Skip to contentSkip to conversation

usb: gadget: net2280: Fix NULL pointer dereference

PATCH In review Ricardo Ribalda Delgado 4 participants 7 messages May 15, 2014 – May 19, 2014 USB

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/2 usb: gadget: net2280: Fix NULL pointer dereference

When DEBUG is enabled driver->driver.name is accessed, but driver can be NULL

[  174.411689] BUG: unable to handle kernel NULL pointer dereference at 0000000000000040
[  174.429043] RIP: 0010:[<ffffffffa0131ca3>]  [<ffffffffa0131ca3>] net2280_stop+0xa3/0x100 [net2280]
[  174.457910] Call Trace:
[  174.459503]  [<ffffffffa00dd92a>] usb_gadget_remove_driver+0x5a/0xb0 [udc_core]
[  174.462693]  [<ffffffffa00ddd84>] usb_del_gadget_udc+0xb4/0x110 [udc_core]
[  174.464316]  [<ffffffffa012e2bf>] net2280_remove+0x2f/0x1c0 [net2280]

---
v4: Replace if with terniary operator

 drivers/usb/gadget/net2280.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/net2280.c +3 -1
index 43e5e2f..300b3a7 100644
@@ -1972,7 +1972,9 @@ static int net2280_stop(struct usb_gadget *_gadget,
 	device_remove_file (&dev->pdev->dev, &dev_attr_function);
 	device_remove_file (&dev->pdev->dev, &dev_attr_queues);
 
-	DEBUG (dev, "unregistered driver '%s'\n", driver->driver.name);
+	DEBUG(dev, "unregistered driver '%s'\n",
+			driver ? driver->driver.name : "");
+
 	return 0;
 }
 
Signature · 1 line
2.0.0.rc0
#1 lore raw

PATCH v4 2/2 usb: gadget: net2280: Add support for PLX USB338X

This patch adds support for the PLX USB3380 and USB3382.

This driver is based on the driver from the manufacturer.

Since USB338X is register compatible with NET2280, I thought that it would be better to include this hardware into net2280 driver.

Manufacturer's driver only supported the USB33X, did not follow the Kernel Style and contain some trivial errors. This patch has tried to address this issues.

This patch has only been tested on USB338x hardware, but the merge has been done trying to not affect the behaviour of NET2280.

---
v4: -Fix bug with usb_ep_set_maxpacket_limit

v3: -Fix Double parenthesis
-Comments by Joe Perches
- declare ep_bit as global const
- logical continuations at end of line
- fix multiline comment

v2:
-use usb_ep_set_maxpacket_limit
-usb338x: Fix support for high speed

 drivers/usb/gadget/Kconfig   |   10 +-
 drivers/usb/gadget/net2280.c | 1115 ++++++++++++++++++++++++++++++++++++++----
 drivers/usb/gadget/net2280.h |   97 +++-
 include/linux/usb/usb338x.h  |  199 ++++++++
 4 files changed, 1330 insertions(+), 91 deletions(-)
 create mode 100644 include/linux/usb/usb338x.h
drivers/usb/gadget/Kconfig +9 -1
index 3557c7e..831af8f 100644
@@ -415,7 +415,7 @@ config USB_NET2272_DMA
 	  If unsure, say "N" here.  The driver works fine in PIO mode.
 
 config USB_NET2280
-	tristate "NetChip 228x"
+	tristate "NetChip 228x / PLX USB338x"
 	depends on PCI
 	help
 	   NetChip 2280 / 2282 is a PCI based USB peripheral controller which
@@ -425,6 +425,14 @@ config USB_NET2280
 	   (for control transfers) and several endpoints with dedicated
 	   functions.
 
+	   PLX 3380 / 3382 is a PCIe based USB peripheral controller which
+	   supports full, high speed USB 2.0 and super speed USB 3.0
+	   data transfers.
+
+	   It has eight configurable endpoints, as well as endpoint zero
+	   (for control transfers) and several endpoints with dedicated
+	   functions.
+
 	   Say "y" to link the driver statically, or "m" to build a
 	   dynamically linked module called "net2280" and force all
 	   gadget drivers to also be dynamically linked.
drivers/usb/gadget/net2280.c +1030 -85

1,503 lines not on this page · raw message

drivers/usb/gadget/net2280.h +92 -5

173 lines not on this page · raw message

include/linux/usb/usb338x.h new file +199 -0

199 lines not on this page · raw message

Signature · 1 line
2.0.0.rc0
#2 lore raw

Re: [PATCH 2/2 v4] usb: gadget: net2280: Add support for PLX USB338X

Quoted 7 lines · Ricardo Ribalda Delgado

This patch adds support for the PLX USB3380 and USB3382.

This driver is based on the driver from the manufacturer.

Since USB338X is register compatible with NET2280, I thought that it would be better to include this hardware into net2280 driver.

Quoted 8 lines

Manufacturer's driver only supported the USB33X, did not follow the Kernel Style and contain some trivial errors. This patch has tried to address this issues.

This patch has only been tested on USB338x hardware, but the merge has been done trying to not affect the behaviour of NET2280.

anybody with net2280, please give me a Tested-by so I'm sure there are no regressions caused by this patch. One question though, is it worth to use the legacy mode just to get register compatibility ? What are the drawbacks of using legacy mode ? Is any feature missing when we use legacy mode ?

cheers

Signature · 1 line
balbi
#3 lore raw

Re: [PATCH 2/2 v4] usb: gadget: net2280: Add support for PLX USB338X

Quoted 18 lines · Felipe Balbi
Quoted 7 lines · Ricardo Ribalda Delgado

This patch adds support for the PLX USB3380 and USB3382.

This driver is based on the driver from the manufacturer.

Since USB338X is register compatible with NET2280, I thought that it would be better to include this hardware into net2280 driver.

Quoted 8 lines

Manufacturer's driver only supported the USB33X, did not follow the Kernel Style and contain some trivial errors. This patch has tried to address this issues.

This patch has only been tested on USB338x hardware, but the merge has been done trying to not affect the behaviour of NET2280.

Quoted 7 lines

anybody with net2280, please give me a Tested-by so I'm sure there are no regressions caused by this patch. One question though, is it worth to use the legacy mode just to get register compatibility ? What are the drawbacks of using legacy mode ? Is any feature missing when we use legacy mode ?

cheers

This patch is a merge of the full driver from plx with the net2280 driver. It should support enhanced and legacy mode. The mode is selected with a pull up/down on a pin.

I have tested it with a usb3880 EV board in USB 3.0 and 2.0

According to the doc. The chip in legacy mode should be a almost 100% compatible with the old driver. But of course no superspeed is available with the unmodified net2280 driver. Also there are some erratas that needs to be addressed.

"
As the successor of the gold standard NET 2280, PCI to USB 2.0 Peripheral Controller, the USB 3380 can be used with existing NET 2280 software with no or minimal change."

On enhanced mode there are more endpoints and some other improvements.

Regards

PS sorry for the double post. The first one was in HTML thanks to gmail app :P

Quoted 3 lines

--
balbi

Tested-by
#4 lore raw

Re: [PATCH 2/2 v4] usb: gadget: net2280: Add support for PLX USB338X

In reply to Felipe Balbi
Quoted 15 lines · Felipe Balbi
Quoted 14 lines · Ricardo Ribalda Delgado

This patch adds support for the PLX USB3380 and USB3382.

This driver is based on the driver from the manufacturer.

Since USB338X is register compatible with NET2280, I thought that it would be better to include this hardware into net2280 driver.

Manufacturer's driver only supported the USB33X, did not follow the Kernel Style and contain some trivial errors. This patch has tried to address this issues.

This patch has only been tested on USB338x hardware, but the merge has been done trying to not affect the behaviour of NET2280.

Quoted 7 lines
Quoted 1 line

anybody with net2280, please give me a Tested-by so I'm sure there are no regressions caused by this patch. One question though, is it worth to use the legacy mode just to get register compatibility ? What are the drawbacks of using legacy mode ? Is any feature missing when we use legacy mode ?

I tried it out with my net2280 card. There didn't appear to be any problems under light testing.

#5 lore raw

Re: [PATCH 2/2 v4] usb: gadget: net2280: Add support for PLX USB338X

In reply to Ricardo Ribalda Delgado
Quoted 1 line · Ricardo Ribalda Delgado

This patch adds support for the PLX USB3380 and USB3382.

A few more trivial notes, all can be addressed as follow-on patches or perhaps even ignored altogether.

drivers/usb/gadget/net2280.c

Quoted 1 line
drivers/usb/gadget/net2280.c +0 -0

[]

drivers/usb/gadget/net2280.c static const char *const ep_name [] = { · line 100

Quoted 5 lines
drivers/usb/gadget/net2280.c +1 -0
@@ -90,11 +97,12 @@ static const char *const ep_name [] = {
  */
 static bool use_dma = 1;
 static bool use_dma_chaining = 0;
+static bool use_msi = 1;

Nicer to use true/false instead of 1/0

[]

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 175

Quoted 5 lines
drivers/usb/gadget/net2280.c +1 -0
@@ -161,11 +172,20 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
 	if ((desc->bEndpointAddress & 0x0f) == EP_DONTUSE)
 		return -EDOM;
 
+	if (dev->pdev->vendor == 0x10b5) {

There are several tests of vendor that could use #define constants instead of magic numbers

Also, perhaps these parts will be used by other vendors and might have to be expanded.

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 186

Quoted 5 lines
drivers/usb/gadget/net2280.c +1 -1
 	/* sanity check ep-e/ep-f since their fifos are small */
 	max = usb_endpoint_maxp (desc) & 0x1fff;
-	if (ep->num > 4 && max > 64)
+	if (ep->num > 4 && max > 64 && (dev->pdev->vendor == 0x17cc))
 		return -ERANGE;

Maybe too specific to one vendor ID?

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 180

Quoted 1 line
drivers/usb/gadget/net2280.c +1 -0
+

Superfluous blank line

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 200

Quoted 7 lines
drivers/usb/gadget/net2280.c +2 -1
@@ -176,7 +196,8 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
 	ep->out_overflow = 0;
 
 	/* set speed-dependent max packet; may kick in high bandwidth */
-	set_idx_reg (dev->regs, REG_EP_MAXPKT (dev, ep->num), max);
+	set_idx_reg(dev->regs, (dev->enhanced_mode) ? ep_enhanced[ep->num]
+					: REG_EP_MAXPKT(dev, ep->num), max);

Maybe a static inline/macro helper function for this?

	dev->enhanced_mode ? ep_enhanced[ep->num] : REG_EP_MAXPKT(dev, ep->num)

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)

Quoted 1 line
drivers/usb/gadget/net2280.c +0 -0
@@ -226,11 +267,13 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)

[]

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 275

Quoted 5 lines
drivers/usb/gadget/net2280.c +2 -1
 	/* enable irqs */
 	if (!ep->dma) {				/* pio, per-packet */
-		tmp = (1 << ep->num) | readl (&dev->regs->pciirqenb0);
+		tmp = (dev->pdev->vendor == 0x17cc)?(1 << ep->num)
+						   : (1 << ep_bit[ep->num]);

And another static inline/macro helper for this?

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 298

Quoted 8 lines
drivers/usb/gadget/net2280.c +2 -2
@@ -251,8 +294,10 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
 			tmp = (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE);
 			writel (tmp, &ep->regs->ep_irqenb);
 
-			tmp = (1 << ep->num) | readl (&dev->regs->pciirqenb0);
-			writel (tmp, &dev->regs->pciirqenb0);
+			tmp = (dev->pdev->vendor == 0x17cc)?(1 << ep->num)
+						: (1 << ep_bit[ep->num]);

This one is used twice and should use at least the same formatting.

[]

drivers/usb/gadget/net2280.c static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep)

Quoted 1 line
drivers/usb/gadget/net2280.c +0 -0
@@ -361,6 +407,55 @@ static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep)

[]

drivers/usb/gadget/net2280.c static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep) · line 457

Quoted 8 lines
drivers/usb/gadget/net2280.c +8 -0
+	writel((1 << SHORT_PACKET_OUT_DONE_INTERRUPT) |
+	       (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT) |
+	       (1 << FIFO_OVERFLOW) |
+	       (1 << DATA_PACKET_RECEIVED_INTERRUPT) |
+	       (1 << DATA_PACKET_TRANSMITTED_INTERRUPT) |
+	       (1 << DATA_OUT_PING_TOKEN_INTERRUPT) |
+	       (1 << DATA_IN_TOKEN_INTERRUPT), &ep->regs->ep_stat);
+}

Perhaps these should use the BIT macro

writel((BIT(SHORT_PACKET_OUT_DONE_INTERRUPT) |
BIT(SHORT_PACKET_TRANSFERRED_INTERRUPT) | BIT(FIFO_OVERFLOW) |
etc...

Quoted 1 line

@@ -374,13 +469,17 @@ static int net2280_disable (struct usb_ep *_ep)

drivers/usb/gadget/net2280.c static int net2280_disable (struct usb_ep *_ep) · line 473

Quoted 6 lines
drivers/usb/gadget/net2280.c +2 -1
 	spin_lock_irqsave (&ep->dev->lock, flags);
 	nuke (ep);
-	ep_reset (ep->dev->regs, ep);
+
+	if (ep->dev->pdev->vendor == 0x10b5)

Another vendor ID that could be a #define

drivers/usb/gadget/net2280.c net2280_queue (struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) · line 996

Quoted 8 lines
drivers/usb/gadget/net2280.c +4 -0
@@ -874,8 +990,23 @@ net2280_queue (struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
 
 	/* kickstart this i/o queue? */
 	if (list_empty (&ep->queue) && !ep->stopped) {
+		/* DMA request while EP halted */
+		if (ep->dma &&
+		    (readl(&ep->regs->ep_rsp) & (1 << CLEAR_ENDPOINT_HALT)) &&
+			(dev->pdev->vendor == 0x10b5)) {

here too

drivers/usb/gadget/net2280.c get_ep_by_addr (struct net2280 *dev, u16 wIndex) · line 2725

Quoted 1 line
drivers/usb/gadget/net2280.c +1 -0
+static void defect7374_workaround(struct net2280 *dev, struct usb_ctrlrequest r)

[]

drivers/usb/gadget/net2280.c get_ep_by_addr (struct net2280 *dev, u16 wIndex) · line 2778

Quoted 5 lines
drivers/usb/gadget/net2280.c +5 -0
+	if (ack_wait_timeout >= DEFECT_7374_NUMBEROF_MAX_WAIT_LOOPS) {
+		ERROR(dev, "FAIL: Defect 7374 workaround waited but failed");
+		ERROR(dev, "to detect SS host's data phase ACK.");
+		ERROR(dev, "PL_EP_STATUS_1(23:16):.Expected from 0x11 to 0x16");
+		ERROR(dev, "got 0x%2.2x.\n", state >> STATE);

I'd use just 2 output lines/ERROR calls here.

drivers/usb/gadget/net2280.c get_ep_by_addr (struct net2280 *dev, u16 wIndex) · line 2782

Quoted 4 lines
drivers/usb/gadget/net2280.c +4 -0
+	} else {
+		WARNING(dev, "INFO: Defect 7374 workaround waited about\n");
+		WARNING(dev, "%duSec for Control Read Data Phase ACK\n",
+			DEFECT_7374_PROCESSOR_WAIT_TIME * ack_wait_timeout);

and just 1 here

#6 lore raw

Re: [PATCH 2/2 v4] usb: gadget: net2280: Add support for PLX USB338X

Hello Joe

Thanks again for your comments. Since some the of the issues that you point are also in the other parts of the file I will fix them in a follow up patch for the whole driver.

Quoted 11 lines · Joe Perches
Quoted 1 line · Ricardo Ribalda Delgado

This patch adds support for the PLX USB3380 and USB3382.

A few more trivial notes, all can be addressed as follow-on patches or perhaps even ignored altogether.

drivers/usb/gadget/net2280.c

Quoted 1 line
drivers/usb/gadget/net2280.c +0 -0

[]

Quoted 8 lines

drivers/usb/gadget/net2280.c static const char *const ep_name [] = { · line 100

Quoted 5 lines
drivers/usb/gadget/net2280.c +1 -0
@@ -90,11 +97,12 @@ static const char *const ep_name [] = {
  */
 static bool use_dma = 1;
 static bool use_dma_chaining = 0;
+static bool use_msi = 1;

Nicer to use true/false instead of 1/0

Will fix for the whole file in a new patch

Quoted 11 lines

[]

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 175

Quoted 5 lines
drivers/usb/gadget/net2280.c +1 -0
@@ -161,11 +172,20 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
      if ((desc->bEndpointAddress & 0x0f) == EP_DONTUSE)
              return -EDOM;
 
+     if (dev->pdev->vendor == 0x10b5) {

There are several tests of vendor that could use #define constants instead of magic numbers

Will fix for the whole file in a new patch

Quoted 5 lines

Also, perhaps these parts will be used by other vendors and might have to be expanded.

Quoted 7 lines

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 186

Quoted 5 lines
drivers/usb/gadget/net2280.c +1 -1
      /* sanity check ep-e/ep-f since their fifos are small */
      max = usb_endpoint_maxp (desc) & 0x1fff;
-     if (ep->num > 4 && max > 64)
+     if (ep->num > 4 && max > 64 && (dev->pdev->vendor == 0x17cc))
              return -ERANGE;

Maybe too specific to one vendor ID?

I am using the vendor id to check for net2280 or usb3380. The net2280 needs that test.

Quoted 4 lines

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 180

Quoted 2 lines
drivers/usb/gadget/net2280.c +1 -0
+

Superfluous blank line

Thanks for catching it :).

Quoted 10 lines

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 200

Quoted 8 lines
drivers/usb/gadget/net2280.c +2 -1
@@ -176,7 +196,8 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
      ep->out_overflow = 0;
 
      /* set speed-dependent max packet; may kick in high bandwidth */
-     set_idx_reg (dev->regs, REG_EP_MAXPKT (dev, ep->num), max);
+     set_idx_reg(dev->regs, (dev->enhanced_mode) ? ep_enhanced[ep->num]
+                                     : REG_EP_MAXPKT(dev, ep->num), max);

Maybe a static inline/macro helper function for this?

ok

Quoted 5 lines
        dev->enhanced_mode ? ep_enhanced[ep->num] : REG_EP_MAXPKT(dev, ep->num)

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)

Quoted 1 line
drivers/usb/gadget/net2280.c +0 -0
@@ -226,11 +267,13 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)

[]

Quoted 7 lines

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 275

Quoted 5 lines
drivers/usb/gadget/net2280.c +2 -1
      /* enable irqs */
      if (!ep->dma) {                         /* pio, per-packet */
-             tmp = (1 << ep->num) | readl (&dev->regs->pciirqenb0);
+             tmp = (dev->pdev->vendor == 0x17cc)?(1 << ep->num)
+                                                : (1 << ep_bit[ep->num]);

And another static inline/macro helper for this?

ok

Quoted 26 lines

drivers/usb/gadget/net2280.c net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) · line 298

Quoted 9 lines
drivers/usb/gadget/net2280.c +2 -2
@@ -251,8 +294,10 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
                      tmp = (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE);
                      writel (tmp, &ep->regs->ep_irqenb);
 
-                     tmp = (1 << ep->num) | readl (&dev->regs->pciirqenb0);
-                     writel (tmp, &dev->regs->pciirqenb0);
+                     tmp = (dev->pdev->vendor == 0x17cc)?(1 << ep->num)
+                                             : (1 << ep_bit[ep->num]);

This one is used twice and should use at least the same formatting.

[]

drivers/usb/gadget/net2280.c static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep)

Quoted 1 line
drivers/usb/gadget/net2280.c +0 -0
@@ -361,6 +407,55 @@ static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep)

[]

drivers/usb/gadget/net2280.c static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep) · line 457

Quoted 8 lines
drivers/usb/gadget/net2280.c +8 -0
+     writel((1 << SHORT_PACKET_OUT_DONE_INTERRUPT) |
+            (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT) |
+            (1 << FIFO_OVERFLOW) |
+            (1 << DATA_PACKET_RECEIVED_INTERRUPT) |
+            (1 << DATA_PACKET_TRANSMITTED_INTERRUPT) |
+            (1 << DATA_OUT_PING_TOKEN_INTERRUPT) |
+            (1 << DATA_IN_TOKEN_INTERRUPT), &ep->regs->ep_stat);
+}
Quoted 1 line

Perhaps these should use the BIT macro

Will fix it on a follow up patch.

Quoted 35 lines

writel((BIT(SHORT_PACKET_OUT_DONE_INTERRUPT) |
BIT(SHORT_PACKET_TRANSFERRED_INTERRUPT) | BIT(FIFO_OVERFLOW) |
etc...

Quoted 1 line
(quoted diff) +0 -0
@@ -374,13 +469,17 @@ static int net2280_disable (struct usb_ep *_ep)

drivers/usb/gadget/net2280.c static int net2280_disable (struct usb_ep *_ep) · line 473

Quoted 6 lines
      spin_lock_irqsave (&ep->dev->lock, flags);
      nuke (ep);
drivers/usb/gadget/net2280.c +2 -1
-     ep_reset (ep->dev->regs, ep);
+
+     if (ep->dev->pdev->vendor == 0x10b5)

Another vendor ID that could be a #define

drivers/usb/gadget/net2280.c net2280_queue (struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) · line 996

Quoted 8 lines
drivers/usb/gadget/net2280.c +4 -0
@@ -874,8 +990,23 @@ net2280_queue (struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
 
      /* kickstart this i/o queue? */
      if (list_empty (&ep->queue) && !ep->stopped) {
+             /* DMA request while EP halted */
+             if (ep->dma &&
+                 (readl(&ep->regs->ep_rsp) & (1 << CLEAR_ENDPOINT_HALT)) &&
+                     (dev->pdev->vendor == 0x10b5)) {

here too

drivers/usb/gadget/net2280.c get_ep_by_addr (struct net2280 *dev, u16 wIndex) · line 2725

Quoted 1 line
drivers/usb/gadget/net2280.c +1 -0
+static void defect7374_workaround(struct net2280 *dev, struct usb_ctrlrequest r)

[]

drivers/usb/gadget/net2280.c get_ep_by_addr (struct net2280 *dev, u16 wIndex) · line 2778

Quoted 5 lines
drivers/usb/gadget/net2280.c +5 -0
+     if (ack_wait_timeout >= DEFECT_7374_NUMBEROF_MAX_WAIT_LOOPS) {
+             ERROR(dev, "FAIL: Defect 7374 workaround waited but failed");
+             ERROR(dev, "to detect SS host's data phase ACK.");
+             ERROR(dev, "PL_EP_STATUS_1(23:16):.Expected from 0x11 to 0x16");
+             ERROR(dev, "got 0x%2.2x.\n", state >> STATE);
Quoted 8 lines

I'd use just 2 output lines/ERROR calls here.

drivers/usb/gadget/net2280.c get_ep_by_addr (struct net2280 *dev, u16 wIndex) · line 2782

Quoted 4 lines
drivers/usb/gadget/net2280.c +4 -0
+     } else {
+             WARNING(dev, "INFO: Defect 7374 workaround waited about\n");
+             WARNING(dev, "%duSec for Control Read Data Phase ACK\n",
+                     DEFECT_7374_PROCESSOR_WAIT_TIME * ack_wait_timeout);

and just 1 here

I did split the lines in 4 and 2 because otherwise checkpatch complains:

WARNING: quoted string split across lines
#86: FILE: drivers/usb/gadget/net2280.c:2780:
+ ERROR(dev, "PL_EP_STATUS_1(23:16):.Expected from 0x11 to 0x16"
+ "got 0x%2.2x.\n", state >> STATE);

But if you prefer it that way I have no problem with that.

Quoted 2 lines

Thanks for your comments!

Signature · 1 line
Ricardo Ribalda