Skip to contentSkip to conversation

USB: ehci_brcm_hub_control: replace wIndex-1 with temp

PATCH In review Haimin Zhang 4 participants 4 messages Nov 5, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 USB: ehci_brcm_hub_control: replace wIndex-1 with temp

In function ehci_brcm_hub_control, like following code, it filters out the case where the upper byte of wIndex is nonzero, so it need be replaced with temp.

```
	if ((typeReq == GetPortStatus) &&
	    (wIndex && wIndex <= ports) &&       // need to be replaced
	    ehci->reset_done[wIndex-1] &&
	    time_after_eq(jiffies, ehci->reset_done[wIndex-1]) &&
	    (ehci_readl(ehci, status_reg) & PORT_RESUME)) {
```
---
 drivers/usb/host/ehci-brcm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-brcm.c +3 -3
index a1e3290e5459..efcfca162126 100644
@@ -73,9 +73,9 @@ static int ehci_brcm_hub_control(
 	 * of RESUME
 	 */
 	if ((typeReq == GetPortStatus) &&
-	    (wIndex && wIndex <= ports) &&
-	    ehci->reset_done[wIndex-1] &&
-	    time_after_eq(jiffies, ehci->reset_done[wIndex-1]) &&
+	    (temp < ports) &&
+	    ehci->reset_done[temp] &&
+	    time_after_eq(jiffies, ehci->reset_done[temp]) &&
 	    (ehci_readl(ehci, status_reg) & PORT_RESUME)) {
 
 		/*
Signature · 1 line
2.30.1 (Apple Git-130)
maintainer
#1 lore raw
Quoted 3 lines · Haimin Zhang

In function ehci_brcm_hub_control, like following code, it filters out the case where the upper byte of wIndex is nonzero, so it need be replaced with temp.

I do not understand this text, can you try to reword it?

And you have trailing whitespace.

And why use `?

Quoted 1 line

```

What is this for? Changelog comments are not in markdown format.

Quoted 2 lines
	if ((typeReq == GetPortStatus) &&
	    (wIndex && wIndex <= ports) &&       // need to be replaced

What does this comment mean?

Quoted 7 lines
	    ehci->reset_done[wIndex-1] &&
	    time_after_eq(jiffies, ehci->reset_done[wIndex-1]) &&
	    (ehci_readl(ehci, status_reg) & PORT_RESUME)) {

```

Again, lines need to be in different order, and your from: line is not correct.

Also, you need an individual email address, not a group email alias for your contributions. We work with individuals, not groups.

Quoted 9 lines
---
 drivers/usb/host/ehci-brcm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-brcm.c +0 -0
index a1e3290e5459..efcfca162126 100644

drivers/usb/host/ehci-brcm.c static int ehci_brcm_hub_control( · line 76

Quoted 7 lines
drivers/usb/host/ehci-brcm.c +1 -3
@@ -73,9 +73,9 @@ static int ehci_brcm_hub_control(
 	 * of RESUME
 	 */
 	if ((typeReq == GetPortStatus) &&
-	    (wIndex && wIndex <= ports) &&
-	    ehci->reset_done[wIndex-1] &&
-	    time_after_eq(jiffies, ehci->reset_done[wIndex-1]) &&
+	    (temp < ports) &&

Where did temp come from?

thanks,

greg k-h

maintainer
#2 lore raw
Quoted 40 lines · Greg KH
Quoted 3 lines · Haimin Zhang

In function ehci_brcm_hub_control, like following code, it filters out the case where the upper byte of wIndex is nonzero, so it need be replaced with temp.

I do not understand this text, can you try to reword it?

And you have trailing whitespace.

And why use `?

Quoted 1 line

```

What is this for? Changelog comments are not in markdown format.

Quoted 2 lines
	if ((typeReq == GetPortStatus) &&
	    (wIndex && wIndex <= ports) &&       // need to be replaced

What does this comment mean?

Quoted 7 lines
	    ehci->reset_done[wIndex-1] &&
	    time_after_eq(jiffies, ehci->reset_done[wIndex-1]) &&
	    (ehci_readl(ehci, status_reg) & PORT_RESUME)) {

```

Again, lines need to be in different order, and your from: line is not correct.

Also, you need an individual email address, not a group email alias for your contributions. We work with individuals, not groups.

Quoted 4 lines
---
 drivers/usb/host/ehci-brcm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 14 lines

drivers/usb/host/ehci-brcm.c static int ehci_brcm_hub_control( · line 76

Quoted 12 lines
drivers/usb/host/ehci-brcm.c +1 -3
index a1e3290e5459..efcfca162126 100644
@@ -73,9 +73,9 @@ static int ehci_brcm_hub_control(
 	 * of RESUME
 	 */
 	if ((typeReq == GetPortStatus) &&
-	    (wIndex && wIndex <= ports) &&
-	    ehci->reset_done[wIndex-1] &&
-	    time_after_eq(jiffies, ehci->reset_done[wIndex-1]) &&
+	    (temp < ports) &&

Where did temp come from?

Also, as long as this piece of code is being changed, it would be a good idea to get rid of all the unnecessary parentheses.

Alan Stern

#3 lore raw
In reply to Greg KH
Quoted 25 lines · Greg KH
Quoted 3 lines · Haimin Zhang

In function ehci_brcm_hub_control, like following code, it filters out the case where the upper byte of wIndex is nonzero, so it need be replaced with temp.

I do not understand this text, can you try to reword it?

And you have trailing whitespace.

And why use `?

Quoted 1 line

```

What is this for? Changelog comments are not in markdown format.

Quoted 2 lines
	if ((typeReq == GetPortStatus) &&
	    (wIndex && wIndex <= ports) &&       // need to be replaced

What does this comment mean?

Quoted 5 lines
	    ehci->reset_done[wIndex-1] &&
	    time_after_eq(jiffies, ehci->reset_done[wIndex-1]) &&
	    (ehci_readl(ehci, status_reg) & PORT_RESUME)) {

```

Quoted 8 lines
Quoted 2 lines

Again, lines need to be in different order, and your from: line is not correct.

Also, you need an individual email address, not a group email alias for your contributions. We work with individuals, not groups.

Also, would you mind copying the people who are remotely involved with this piece of code, like Al? Thank you

Signature · 1 line
Florian