Skip to contentSkip to conversation

usb: dwc3: gadget: fix mask and shift order in DWC3_DCFG_NUMP()

PATCH In review Dan Carpenter 3 participants 3 messages May 3, 2016

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

PATCH 1/1 usb: dwc3: gadget: fix mask and shift order in DWC3_DCFG_NUMP()

In the original DWC3_DCFG_NUMP() was always zero. It looks like the intent was to shift first and then do the mask.

Fixes 2a58f9c12bb3 ('usb: dwc3: gadget: disable automatic calculation of ACK TP NUMP')
drivers/usb/dwc3/core.h +1 -1
index 186a886..7ddf944 100644
@@ -277,7 +277,7 @@
 #define DWC3_DCFG_FULLSPEED1	(3 << 0)
 
 #define DWC3_DCFG_NUMP_SHIFT	17
-#define DWC3_DCFG_NUMP(n)	(((n) & 0x1f) >> DWC3_DCFG_NUMP_SHIFT)
+#define DWC3_DCFG_NUMP(n)	(((n) >> DWC3_DCFG_NUMP_SHIFT) & 0x1f)
 #define DWC3_DCFG_NUMP_MASK	(0x1f << DWC3_DCFG_NUMP_SHIFT)
 #define DWC3_DCFG_LPM_CAP	(1 << 22)
 
#1 lore raw

Hi,

Quoted 5 lines · Dan Carpenter

In the original DWC3_DCFG_NUMP() was always zero. It looks like the intent was to shift first and then do the mask.

Fixes 2a58f9c12bb3 ('usb: dwc3: gadget: disable automatic calculation of ACK TP NUMP')

Thanks for this fix, I completely missed it :-) Greg, if you want to take this as a patch, that's fine by me. Otherwise I can queue it for -rc1. In any case, S-o-B below:

Quoted 17 lines
drivers/usb/dwc3/core.h +1 -2
index 186a886..7ddf944 100644
@@ -277,7 +277,7 @@
 #define DWC3_DCFG_FULLSPEED1	(3 << 0)
 
 #define DWC3_DCFG_NUMP_SHIFT	17
-#define DWC3_DCFG_NUMP(n)	(((n) & 0x1f) >> DWC3_DCFG_NUMP_SHIFT)
+#define DWC3_DCFG_NUMP(n)	(((n) >> DWC3_DCFG_NUMP_SHIFT) & 0x1f)
 #define DWC3_DCFG_NUMP_MASK	(0x1f << DWC3_DCFG_NUMP_SHIFT)
 #define DWC3_DCFG_LPM_CAP	(1 << 22)
 
--

To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
balbi
#2 lore raw
Quoted 7 lines · Felipe Balbi

Hi,

Quoted 3 lines · Dan Carpenter

In the original DWC3_DCFG_NUMP() was always zero. It looks like the intent was to shift first and then do the mask.

Quoted 8 lines
Quoted 2 lines
Fixes 2a58f9c12bb3 ('usb: dwc3: gadget: disable automatic calculation of ACK TP NUMP')

Thanks for this fix, I completely missed it :-) Greg, if you want to take this as a patch, that's fine by me. Otherwise I can queue it for -rc1. In any case, S-o-B below:

I'll take it, thanks.

greg k-h