aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorWill Newton <will.newton@imgtec.com>2008-08-12 10:39:09 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-17 17:41:05 -0400
commit7483cff8a3ea4c31a677a6ac1a4eb3d78adcb9cc (patch)
tree62bf2de9cde28cf0c040b7995fa583285a5a3931 /drivers/usb/gadget
parentf6e4411fe7df19493e3a2fbc2543f718f75671f6 (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')
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.c28
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.h21
2 files changed, 11 insertions, 38 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 @@
61static const char driver_name[] = "fsl-usb2-udc"; 56static const char driver_name[] = "fsl-usb2-udc";
62static const char driver_desc[] = DRIVER_DESC; 57static const char driver_desc[] = DRIVER_DESC;
63 58
64volatile static struct usb_dr_device *dr_regs = NULL; 59static struct usb_dr_device *dr_regs;
65volatile static struct usb_sys_interface *usb_sys_regs = NULL; 60static struct usb_sys_interface *usb_sys_regs;
66 61
67/* it is initialized in probe() */ 62/* it is initialized in probe() */
68static struct fsl_udc *udc_controller = NULL; 63static 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;
diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h
index 6131752a38bc..e63ef12645f5 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.h
+++ b/drivers/usb/gadget/fsl_usb2_udc.h
@@ -424,16 +424,6 @@ struct ep_td_struct {
424/* Controller dma boundary */ 424/* Controller dma boundary */
425#define UDC_DMA_BOUNDARY 0x1000 425#define UDC_DMA_BOUNDARY 0x1000
426 426
427/* -----------------------------------------------------------------------*/
428/* ##### enum data
429*/
430typedef enum {
431 e_ULPI,
432 e_UTMI_8BIT,
433 e_UTMI_16BIT,
434 e_SERIAL
435} e_PhyInterface;
436
437/*-------------------------------------------------------------------------*/ 427/*-------------------------------------------------------------------------*/
438 428
439/* ### driver private data 429/* ### driver private data
@@ -469,9 +459,9 @@ struct fsl_ep {
469#define EP_DIR_OUT 0 459#define EP_DIR_OUT 0
470 460
471struct fsl_udc { 461struct fsl_udc {
472
473 struct usb_gadget gadget; 462 struct usb_gadget gadget;
474 struct usb_gadget_driver *driver; 463 struct usb_gadget_driver *driver;
464 struct completion *done; /* to make sure release() is done */
475 struct fsl_ep *eps; 465 struct fsl_ep *eps;
476 unsigned int max_ep; 466 unsigned int max_ep;
477 unsigned int irq; 467 unsigned int irq;
@@ -492,20 +482,13 @@ struct fsl_udc {
492 size_t ep_qh_size; /* size after alignment adjustment*/ 482 size_t ep_qh_size; /* size after alignment adjustment*/
493 dma_addr_t ep_qh_dma; /* dma address of QH */ 483 dma_addr_t ep_qh_dma; /* dma address of QH */
494 484
495 u32 max_pipes; /* Device max pipes */ 485 u32 max_pipes; /* Device max pipes */
496 u32 max_use_endpts; /* Max endpointes to be used */
497 u32 bus_reset; /* Device is bus reseting */
498 u32 resume_state; /* USB state to resume */ 486 u32 resume_state; /* USB state to resume */
499 u32 usb_state; /* USB current state */ 487 u32 usb_state; /* USB current state */
500 u32 usb_next_state; /* USB next state */
501 u32 ep0_state; /* Endpoint zero state */ 488 u32 ep0_state; /* Endpoint zero state */
502 u32 ep0_dir; /* Endpoint zero direction: can be 489 u32 ep0_dir; /* Endpoint zero direction: can be
503 USB_DIR_IN or USB_DIR_OUT */ 490 USB_DIR_IN or USB_DIR_OUT */
504 u32 usb_sof_count; /* SOF count */
505 u32 errors; /* USB ERRORs count */
506 u8 device_address; /* Device USB address */ 491 u8 device_address; /* Device USB address */
507
508 struct completion *done; /* to make sure release() is done */
509}; 492};
510 493
511/*-------------------------------------------------------------------------*/ 494/*-------------------------------------------------------------------------*/