diff mbox series

[RESEND,v2,04/11] usb: xhci: convert to HCS_MAX_PORTS()

Message ID 20200902061343.3185-4-linux@fw-web.de
State Superseded
Delegated to: Marek Vasut
Headers show
Series [RESEND,v2,01/11] usb: xhci: add a member hci_version in xhci_ctrl struct | expand

Commit Message

Frank Wunderlich Sept. 2, 2020, 6:13 a.m. UTC
From: Chunfeng Yun <chunfeng.yun@mediatek.com>

Use HCS_MAX_PORTS(p) instead of
((p & HCS_MAX_PORTS_MASK) >> HCS_MAX_PORTS_SHIFT)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci.c | 3 +--
 include/usb/xhci.h      | 2 --
 2 files changed, 1 insertion(+), 4 deletions(-)

Comments

Bin Meng Sept. 4, 2020, 6:54 a.m. UTC | #1
On Wed, Sep 2, 2020 at 2:15 PM Frank Wunderlich <linux@fw-web.de> wrote:
>
> From: Chunfeng Yun <chunfeng.yun@mediatek.com>
>
> Use HCS_MAX_PORTS(p) instead of
> ((p & HCS_MAX_PORTS_MASK) >> HCS_MAX_PORTS_SHIFT)
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>  drivers/usb/host/xhci.c | 3 +--
>  include/usb/xhci.h      | 2 --
>  2 files changed, 1 insertion(+), 4 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 51edeb22c1..5f3a0fba4b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1257,8 +1257,7 @@  static int xhci_lowlevel_init(struct xhci_ctrl *ctrl)
 		return -ENOMEM;
 
 	reg = xhci_readl(&hccr->cr_hcsparams1);
-	descriptor.hub.bNbrPorts = ((reg & HCS_MAX_PORTS_MASK) >>
-						HCS_MAX_PORTS_SHIFT);
+	descriptor.hub.bNbrPorts = HCS_MAX_PORTS(reg);
 	printf("Register %x NbrPorts %d\n", reg, descriptor.hub.bNbrPorts);
 
 	/* Port Indicators */
diff --git a/include/usb/xhci.h b/include/usb/xhci.h
index 3de46cd95e..cf4c0208b2 100644
--- a/include/usb/xhci.h
+++ b/include/usb/xhci.h
@@ -101,8 +101,6 @@  struct xhci_hccr {
 /* bits 8:18, Max Interrupters */
 #define HCS_MAX_INTRS(p)	(((p) >> 8) & 0x7ff)
 /* bits 24:31, Max Ports - max value is 0x7F = 127 ports */
-#define HCS_MAX_PORTS_SHIFT	24
-#define HCS_MAX_PORTS_MASK	(0xff << HCS_MAX_PORTS_SHIFT)
 #define HCS_MAX_PORTS(p)	(((p) >> 24) & 0xff)
 
 /* HCSPARAMS2 - hcs_params2 - bitmasks */