diff options
author | Will Newton <will.newton@imgtec.com> | 2008-08-12 10:39:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-10-17 17:41:05 -0400 |
commit | 7483cff8a3ea4c31a677a6ac1a4eb3d78adcb9cc (patch) | |
tree | 62bf2de9cde28cf0c040b7995fa583285a5a3931 /drivers/usb/gadget/fsl_usb2_udc.c | |
parent | f6e4411fe7df19493e3a2fbc2543f718f75671f6 (diff) |
fsl_usb2_udc: Fix some sparse warnings and remove redundant code.
Fix some sparse "integer used as NULL pointer" warnings.
Remove some unnecessary volatiles and static initialization.
Remove some unused struct members and reorder to improve packing.
Remove a few unneeded includes.
Signed-off-by: Will Newton <will.newton@gmail.com>
Acked-by: Li Yang <leoli@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/fsl_usb2_udc.c')
-rw-r--r-- | drivers/usb/gadget/fsl_usb2_udc.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c index 3b96aac27af9..d242e7eb5a54 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.c +++ b/drivers/usb/gadget/fsl_usb2_udc.c | |||
@@ -23,11 +23,8 @@ | |||
23 | #include <linux/ioport.h> | 23 | #include <linux/ioport.h> |
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include <linux/delay.h> | ||
27 | #include <linux/sched.h> | ||
28 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
29 | #include <linux/init.h> | 27 | #include <linux/init.h> |
30 | #include <linux/timer.h> | ||
31 | #include <linux/list.h> | 28 | #include <linux/list.h> |
32 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
33 | #include <linux/proc_fs.h> | 30 | #include <linux/proc_fs.h> |
@@ -44,11 +41,9 @@ | |||
44 | 41 | ||
45 | #include <asm/byteorder.h> | 42 | #include <asm/byteorder.h> |
46 | #include <asm/io.h> | 43 | #include <asm/io.h> |
47 | #include <asm/irq.h> | ||
48 | #include <asm/system.h> | 44 | #include <asm/system.h> |
49 | #include <asm/unaligned.h> | 45 | #include <asm/unaligned.h> |
50 | #include <asm/dma.h> | 46 | #include <asm/dma.h> |
51 | #include <asm/cacheflush.h> | ||
52 | 47 | ||
53 | #include "fsl_usb2_udc.h" | 48 | #include "fsl_usb2_udc.h" |
54 | 49 | ||
@@ -61,8 +56,8 @@ | |||
61 | static const char driver_name[] = "fsl-usb2-udc"; | 56 | static const char driver_name[] = "fsl-usb2-udc"; |
62 | static const char driver_desc[] = DRIVER_DESC; | 57 | static const char driver_desc[] = DRIVER_DESC; |
63 | 58 | ||
64 | volatile static struct usb_dr_device *dr_regs = NULL; | 59 | static struct usb_dr_device *dr_regs; |
65 | volatile static struct usb_sys_interface *usb_sys_regs = NULL; | 60 | static struct usb_sys_interface *usb_sys_regs; |
66 | 61 | ||
67 | /* it is initialized in probe() */ | 62 | /* it is initialized in probe() */ |
68 | static struct fsl_udc *udc_controller = NULL; | 63 | static struct fsl_udc *udc_controller = NULL; |
@@ -560,7 +555,7 @@ static int fsl_ep_disable(struct usb_ep *_ep) | |||
560 | /* nuke all pending requests (does flush) */ | 555 | /* nuke all pending requests (does flush) */ |
561 | nuke(ep, -ESHUTDOWN); | 556 | nuke(ep, -ESHUTDOWN); |
562 | 557 | ||
563 | ep->desc = 0; | 558 | ep->desc = NULL; |
564 | ep->stopped = 1; | 559 | ep->stopped = 1; |
565 | spin_unlock_irqrestore(&udc->lock, flags); | 560 | spin_unlock_irqrestore(&udc->lock, flags); |
566 | 561 | ||
@@ -1565,9 +1560,6 @@ static void port_change_irq(struct fsl_udc *udc) | |||
1565 | { | 1560 | { |
1566 | u32 speed; | 1561 | u32 speed; |
1567 | 1562 | ||
1568 | if (udc->bus_reset) | ||
1569 | udc->bus_reset = 0; | ||
1570 | |||
1571 | /* Bus resetting is finished */ | 1563 | /* Bus resetting is finished */ |
1572 | if (!(fsl_readl(&dr_regs->portsc1) & PORTSCX_PORT_RESET)) { | 1564 | if (!(fsl_readl(&dr_regs->portsc1) & PORTSCX_PORT_RESET)) { |
1573 | /* Get the speed */ | 1565 | /* Get the speed */ |
@@ -1675,8 +1667,6 @@ static void reset_irq(struct fsl_udc *udc) | |||
1675 | 1667 | ||
1676 | if (fsl_readl(&dr_regs->portsc1) & PORTSCX_PORT_RESET) { | 1668 | if (fsl_readl(&dr_regs->portsc1) & PORTSCX_PORT_RESET) { |
1677 | VDBG("Bus reset"); | 1669 | VDBG("Bus reset"); |
1678 | /* Bus is reseting */ | ||
1679 | udc->bus_reset = 1; | ||
1680 | /* Reset all the queues, include XD, dTD, EP queue | 1670 | /* Reset all the queues, include XD, dTD, EP queue |
1681 | * head and TR Queue */ | 1671 | * head and TR Queue */ |
1682 | reset_queues(udc); | 1672 | reset_queues(udc); |
@@ -1796,7 +1786,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) | |||
1796 | /* lock is needed but whether should use this lock or another */ | 1786 | /* lock is needed but whether should use this lock or another */ |
1797 | spin_lock_irqsave(&udc_controller->lock, flags); | 1787 | spin_lock_irqsave(&udc_controller->lock, flags); |
1798 | 1788 | ||
1799 | driver->driver.bus = 0; | 1789 | driver->driver.bus = NULL; |
1800 | /* hook up the driver */ | 1790 | /* hook up the driver */ |
1801 | udc_controller->driver = driver; | 1791 | udc_controller->driver = driver; |
1802 | udc_controller->gadget.dev.driver = &driver->driver; | 1792 | udc_controller->gadget.dev.driver = &driver->driver; |
@@ -1806,8 +1796,8 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) | |||
1806 | retval = driver->bind(&udc_controller->gadget); | 1796 | retval = driver->bind(&udc_controller->gadget); |
1807 | if (retval) { | 1797 | if (retval) { |
1808 | VDBG("bind to %s --> %d", driver->driver.name, retval); | 1798 | VDBG("bind to %s --> %d", driver->driver.name, retval); |
1809 | udc_controller->gadget.dev.driver = 0; | 1799 | udc_controller->gadget.dev.driver = NULL; |
1810 | udc_controller->driver = 0; | 1800 | udc_controller->driver = NULL; |
1811 | goto out; | 1801 | goto out; |
1812 | } | 1802 | } |
1813 | 1803 | ||
@@ -1839,7 +1829,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
1839 | return -EINVAL; | 1829 | return -EINVAL; |
1840 | 1830 | ||
1841 | if (udc_controller->transceiver) | 1831 | if (udc_controller->transceiver) |
1842 | (void)otg_set_peripheral(udc_controller->transceiver, 0); | 1832 | otg_set_peripheral(udc_controller->transceiver, NULL); |
1843 | 1833 | ||
1844 | /* stop DR, disable intr */ | 1834 | /* stop DR, disable intr */ |
1845 | dr_controller_stop(udc_controller); | 1835 | dr_controller_stop(udc_controller); |
@@ -1860,8 +1850,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
1860 | 1850 | ||
1861 | /* unbind gadget and unhook driver. */ | 1851 | /* unbind gadget and unhook driver. */ |
1862 | driver->unbind(&udc_controller->gadget); | 1852 | driver->unbind(&udc_controller->gadget); |
1863 | udc_controller->gadget.dev.driver = 0; | 1853 | udc_controller->gadget.dev.driver = NULL; |
1864 | udc_controller->driver = 0; | 1854 | udc_controller->driver = NULL; |
1865 | 1855 | ||
1866 | printk("unregistered gadget driver '%s'\r\n", driver->driver.name); | 1856 | printk("unregistered gadget driver '%s'\r\n", driver->driver.name); |
1867 | return 0; | 1857 | return 0; |