* [PATCH v2 0/5] usb: xhci: fix of some code/comment
@ 2022-02-17 1:22 Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 1/5] usb: host: xhci: use ffs() in xhci_mem_init() Linyu Yuan
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Linyu Yuan @ 2022-02-17 1:22 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman; +Cc: linux-usb, Jack Pham, Linyu Yuan
Only samll change, no description here.
v2: fix checkpatch warning on patch#1,
thanks to Sergei Shtylyov and Greg Kroah-Hartman
Linyu Yuan (5):
usb: host: xhci: use ffs() in xhci_mem_init()
usb: host: xhci: fix a comment typo in xhci_mem_init()
usb: host: xhci: update hci_version operation in xhci_gen_setup()
usb: host: xhci: add blank line in xhci_halt()
usb: host: xhci: remove init to some ret/retval
drivers/usb/host/xhci-mem.c | 8 ++------
drivers/usb/host/xhci.c | 14 ++++++++------
2 files changed, 10 insertions(+), 12 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/5] usb: host: xhci: use ffs() in xhci_mem_init()
2022-02-17 1:22 [PATCH v2 0/5] usb: xhci: fix of some code/comment Linyu Yuan
@ 2022-02-17 1:22 ` Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 2/5] usb: host: xhci: fix a comment typo " Linyu Yuan
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Linyu Yuan @ 2022-02-17 1:22 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman; +Cc: linux-usb, Jack Pham, Linyu Yuan
The for loop to find page size bit can be replaced with ffs().
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
v2: move assignment out of if condition
drivers/usb/host/xhci-mem.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 0e31206..ad681e2 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -2395,11 +2395,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
page_size = readl(&xhci->op_regs->page_size);
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Supported page size register = 0x%x", page_size);
- for (i = 0; i < 16; i++) {
- if ((0x1 & page_size) != 0)
- break;
- page_size = page_size >> 1;
- }
+ i = ffs(page_size);
if (i < 16)
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Supported page size of %iK", (1 << (i+12)) / 1024);
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/5] usb: host: xhci: fix a comment typo in xhci_mem_init()
2022-02-17 1:22 [PATCH v2 0/5] usb: xhci: fix of some code/comment Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 1/5] usb: host: xhci: use ffs() in xhci_mem_init() Linyu Yuan
@ 2022-02-17 1:22 ` Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 3/5] usb: host: xhci: update hci_version operation in xhci_gen_setup() Linyu Yuan
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Linyu Yuan @ 2022-02-17 1:22 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman; +Cc: linux-usb, Jack Pham, Linyu Yuan
It should be Device Context, not doorbell.
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
v2: no change
drivers/usb/host/xhci-mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index ad681e2..c3a8611 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -2421,7 +2421,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
writel(val, &xhci->op_regs->config_reg);
/*
- * xHCI section 5.4.6 - doorbell array must be
+ * xHCI section 5.4.6 - Device Context array must be
* "physically contiguous and 64-byte (cache line) aligned".
*/
xhci->dcbaa = dma_alloc_coherent(dev, sizeof(*xhci->dcbaa), &dma,
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/5] usb: host: xhci: update hci_version operation in xhci_gen_setup()
2022-02-17 1:22 [PATCH v2 0/5] usb: xhci: fix of some code/comment Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 1/5] usb: host: xhci: use ffs() in xhci_mem_init() Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 2/5] usb: host: xhci: fix a comment typo " Linyu Yuan
@ 2022-02-17 1:22 ` Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 4/5] usb: host: xhci: add blank line in xhci_halt() Linyu Yuan
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Linyu Yuan @ 2022-02-17 1:22 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman; +Cc: linux-usb, Jack Pham, Linyu Yuan
There is no need to store temperary value in hcc_params.
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
v2: no change
drivers/usb/host/xhci.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index dc357ca..857a9c6 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -5280,8 +5280,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
xhci->hcs_params1 = readl(&xhci->cap_regs->hcs_params1);
xhci->hcs_params2 = readl(&xhci->cap_regs->hcs_params2);
xhci->hcs_params3 = readl(&xhci->cap_regs->hcs_params3);
- xhci->hcc_params = readl(&xhci->cap_regs->hc_capbase);
- xhci->hci_version = HC_VERSION(xhci->hcc_params);
+ xhci->hci_version = HC_VERSION(readl(&xhci->cap_regs->hc_capbase));
xhci->hcc_params = readl(&xhci->cap_regs->hcc_params);
if (xhci->hci_version > 0x100)
xhci->hcc_params2 = readl(&xhci->cap_regs->hcc_params2);
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/5] usb: host: xhci: add blank line in xhci_halt()
2022-02-17 1:22 [PATCH v2 0/5] usb: xhci: fix of some code/comment Linyu Yuan
` (2 preceding siblings ...)
2022-02-17 1:22 ` [PATCH v2 3/5] usb: host: xhci: update hci_version operation in xhci_gen_setup() Linyu Yuan
@ 2022-02-17 1:22 ` Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 5/5] usb: host: xhci: remove init to some ret/retval Linyu Yuan
2022-03-02 15:06 ` [PATCH v2 0/5] usb: xhci: fix of some code/comment Mathias Nyman
5 siblings, 0 replies; 7+ messages in thread
From: Linyu Yuan @ 2022-02-17 1:22 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman; +Cc: linux-usb, Jack Pham, Linyu Yuan
It is more readable to add blank lines.
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
v2: no change
drivers/usb/host/xhci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 857a9c6..8b6f1a7 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -110,6 +110,7 @@ void xhci_quiesce(struct xhci_hcd *xhci)
int xhci_halt(struct xhci_hcd *xhci)
{
int ret;
+
xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Halt the HC");
xhci_quiesce(xhci);
@@ -119,8 +120,10 @@ int xhci_halt(struct xhci_hcd *xhci)
xhci_warn(xhci, "Host halt failed, %d\n", ret);
return ret;
}
+
xhci->xhc_state |= XHCI_STATE_HALTED;
xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
+
return ret;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 5/5] usb: host: xhci: remove init to some ret/retval
2022-02-17 1:22 [PATCH v2 0/5] usb: xhci: fix of some code/comment Linyu Yuan
` (3 preceding siblings ...)
2022-02-17 1:22 ` [PATCH v2 4/5] usb: host: xhci: add blank line in xhci_halt() Linyu Yuan
@ 2022-02-17 1:22 ` Linyu Yuan
2022-03-02 15:06 ` [PATCH v2 0/5] usb: xhci: fix of some code/comment Mathias Nyman
5 siblings, 0 replies; 7+ messages in thread
From: Linyu Yuan @ 2022-02-17 1:22 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman; +Cc: linux-usb, Jack Pham, Linyu Yuan
The ret/retval will be set when it used, no need to init at definition.
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
v2: no change
drivers/usb/host/xhci.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 8b6f1a7..b37735e 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -327,7 +327,7 @@ static int xhci_setup_msi(struct xhci_hcd *xhci)
*/
static int xhci_setup_msix(struct xhci_hcd *xhci)
{
- int i, ret = 0;
+ int i, ret;
struct usb_hcd *hcd = xhci_to_hcd(xhci);
struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
@@ -581,7 +581,7 @@ static int xhci_all_ports_seen_u0(struct xhci_hcd *xhci)
static int xhci_init(struct usb_hcd *hcd)
{
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
- int retval = 0;
+ int retval;
xhci_dbg_trace(xhci, trace_xhci_dbg_init, "xhci_init");
spin_lock_init(&xhci->lock);
@@ -3971,7 +3971,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id)
struct xhci_command *command;
unsigned long flags;
u32 state;
- int ret = 0;
+ int ret;
command = xhci_alloc_command(xhci, true, GFP_KERNEL);
if (!command)
@@ -4007,7 +4007,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id)
xhci_free_command(xhci, command);
- return ret;
+ return 0;
}
/*
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/5] usb: xhci: fix of some code/comment
2022-02-17 1:22 [PATCH v2 0/5] usb: xhci: fix of some code/comment Linyu Yuan
` (4 preceding siblings ...)
2022-02-17 1:22 ` [PATCH v2 5/5] usb: host: xhci: remove init to some ret/retval Linyu Yuan
@ 2022-03-02 15:06 ` Mathias Nyman
5 siblings, 0 replies; 7+ messages in thread
From: Mathias Nyman @ 2022-03-02 15:06 UTC (permalink / raw)
To: Linyu Yuan, Mathias Nyman, Greg Kroah-Hartman; +Cc: linux-usb, Jack Pham
On 17.2.2022 3.22, Linyu Yuan wrote:
> Only samll change, no description here.
>
> v2: fix checkpatch warning on patch#1,
> thanks to Sergei Shtylyov and Greg Kroah-Hartman
>
> Linyu Yuan (5):
> usb: host: xhci: use ffs() in xhci_mem_init()
> usb: host: xhci: fix a comment typo in xhci_mem_init()
> usb: host: xhci: update hci_version operation in xhci_gen_setup()
> usb: host: xhci: add blank line in xhci_halt()
> usb: host: xhci: remove init to some ret/retval
>
> drivers/usb/host/xhci-mem.c | 8 ++------
> drivers/usb/host/xhci.c | 14 ++++++++------
> 2 files changed, 10 insertions(+), 12 deletions(-)
>
Thanks, adding these
-Mathias
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-03-02 15:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 1:22 [PATCH v2 0/5] usb: xhci: fix of some code/comment Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 1/5] usb: host: xhci: use ffs() in xhci_mem_init() Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 2/5] usb: host: xhci: fix a comment typo " Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 3/5] usb: host: xhci: update hci_version operation in xhci_gen_setup() Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 4/5] usb: host: xhci: add blank line in xhci_halt() Linyu Yuan
2022-02-17 1:22 ` [PATCH v2 5/5] usb: host: xhci: remove init to some ret/retval Linyu Yuan
2022-03-02 15:06 ` [PATCH v2 0/5] usb: xhci: fix of some code/comment Mathias Nyman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.