summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/net2280.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-25 20:40:14 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2007-06-08 16:24:30 -0700
commit01ee7d7032204b383b2fba73021e7acbc776184b (patch)
tree2a5681e94df6ee18287a962394e9e8565e27f5bc /drivers/usb/gadget/net2280.c
parent97cb95d1c4b724bc3bedd16dd022fbd3c2d61283 (diff)
USB: usb gadgets avoid le{16,32}_to_cpup()
It turns out that le16_to_cpup() and le32_to_cpup() aren't always safe to call with pointers into packed structures, since those are inlined functions and GCC may lose the "packed" attribute. So those references can become unaligned kernel accesses, which are evil on some hardware. This patch updates uses of those routines in the gadget stack. The references into packed structures can just use leXX_to_cpu(*x), which in most cases is more natural. Some other uses in RNDIS, mostly in debug code, were wrong in the first place; those use get_unaligned(). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/net2280.c')
-rw-r--r--drivers/usb/gadget/net2280.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index 52779c52b56d..d975ecf18e00 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -2440,9 +2440,9 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat)
tmp = 0;
-#define w_value le16_to_cpup (&u.r.wValue)
-#define w_index le16_to_cpup (&u.r.wIndex)
-#define w_length le16_to_cpup (&u.r.wLength)
+#define w_value le16_to_cpu(u.r.wValue)
+#define w_index le16_to_cpu(u.r.wIndex)
+#define w_length le16_to_cpu(u.r.wLength)
/* ack the irq */
writel (1 << SETUP_PACKET_INTERRUPT, &dev->regs->irqstat0);