diff mbox series

[v2,1/3] usb: xhci-mtk: use bitfield instead of bool

Message ID 20210506063116.41757-1-chunfeng.yun@mediatek.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/3] usb: xhci-mtk: use bitfield instead of bool | expand

Commit Message

Chunfeng Yun (云春峰) May 6, 2021, 6:31 a.m. UTC
Use bitfield instead of bool in struct

Refer to coding-style.rst 17) Using bool:
"If a structure has many true/false values, consider consolidating
them into a bitfield with 1 bit members, or using an appropriate
fixed width type, such as u8."

Due to @has_ippc's default vaule is 0, no need set it again if fail
to get ippc base address

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: add more changelog suggested by Greg
---
 drivers/usb/host/xhci-mtk.c | 2 --
 drivers/usb/host/xhci-mtk.h | 8 ++++----
 2 files changed, 4 insertions(+), 6 deletions(-)

Comments

Greg KH May 6, 2021, 7:37 a.m. UTC | #1
On Thu, May 06, 2021 at 02:31:14PM +0800, Chunfeng Yun wrote:
> Use bitfield instead of bool in struct
> 
> Refer to coding-style.rst 17) Using bool:
> "If a structure has many true/false values, consider consolidating
> them into a bitfield with 1 bit members, or using an appropriate
> fixed width type, such as u8."
> 
> Due to @has_ippc's default vaule is 0, no need set it again if fail
> to get ippc base address

Please split this change out into a separate patch, as it has nothing to
do with the "change to bitfield" change.

thanks,

greg k-h
Sergey Shtylyov May 6, 2021, 8:50 a.m. UTC | #2
Hello!

On 06.05.2021 9:31, Chunfeng Yun wrote:

> Use bitfield instead of bool in struct
> 
> Refer to coding-style.rst 17) Using bool:
> "If a structure has many true/false values, consider consolidating
> them into a bitfield with 1 bit members, or using an appropriate
> fixed width type, such as u8."
> 
> Due to @has_ippc's default vaule is 0, no need set it again if fail

    Value. :-)

> to get ippc base address
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
[...]

MBR, Sergei
Chunfeng Yun (云春峰) May 7, 2021, 1:27 a.m. UTC | #3
On Thu, 2021-05-06 at 09:37 +0200, Greg Kroah-Hartman wrote:
> On Thu, May 06, 2021 at 02:31:14PM +0800, Chunfeng Yun wrote:
> > Use bitfield instead of bool in struct
> > 
> > Refer to coding-style.rst 17) Using bool:
> > "If a structure has many true/false values, consider consolidating
> > them into a bitfield with 1 bit members, or using an appropriate
> > fixed width type, such as u8."
> > 
> > Due to @has_ippc's default vaule is 0, no need set it again if fail
> > to get ippc base address
> 
> Please split this change out into a separate patch, as it has nothing to
> do with the "change to bitfield" change.
Ok, thanks

> 
> thanks,
> 
> greg k-h
Chunfeng Yun (云春峰) May 7, 2021, 1:28 a.m. UTC | #4
On Thu, 2021-05-06 at 11:50 +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 06.05.2021 9:31, Chunfeng Yun wrote:
> 
> > Use bitfield instead of bool in struct
> > 
> > Refer to coding-style.rst 17) Using bool:
> > "If a structure has many true/false values, consider consolidating
> > them into a bitfield with 1 bit members, or using an appropriate
> > fixed width type, such as u8."
> > 
> > Due to @has_ippc's default vaule is 0, no need set it again if fail
> 
>     Value. :-)
Will fix it, thanks
> 
> > to get ippc base address
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> [...]
> 
> MBR, Sergei
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index b2058b3bc834..2548976bcf05 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -495,8 +495,6 @@  static int xhci_mtk_probe(struct platform_device *pdev)
 			goto put_usb2_hcd;
 		}
 		mtk->has_ippc = true;
-	} else {
-		mtk->has_ippc = false;
 	}
 
 	device_init_wakeup(dev, true);
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
index cd3a37bb73e6..94a59b3d178f 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -138,17 +138,17 @@  struct xhci_hcd_mtk {
 	struct mu3h_sch_bw_info *sch_array;
 	struct list_head bw_ep_chk_list;
 	struct mu3c_ippc_regs __iomem *ippc_regs;
-	bool has_ippc;
 	int num_u2_ports;
 	int num_u3_ports;
 	int u3p_dis_msk;
 	struct regulator *vusb33;
 	struct regulator *vbus;
 	struct clk_bulk_data clks[BULK_CLKS_NUM];
-	bool lpm_support;
-	bool u2_lpm_disable;
+	unsigned int has_ippc:1;
+	unsigned int lpm_support:1;
+	unsigned int u2_lpm_disable:1;
 	/* usb remote wakeup */
-	bool uwk_en;
+	unsigned int uwk_en:1;
 	struct regmap *uwk;
 	u32 uwk_reg_base;
 	u32 uwk_vers;