Commit 7483cff8 authored by Will Newton's avatar Will Newton Committed by Greg Kroah-Hartman

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: default avatarWill Newton <will.newton@gmail.com>
Acked-by: default avatarLi Yang <leoli@freescale.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f6e4411f
...@@ -23,11 +23,8 @@ ...@@ -23,11 +23,8 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/timer.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
...@@ -44,11 +41,9 @@ ...@@ -44,11 +41,9 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/cacheflush.h>
#include "fsl_usb2_udc.h" #include "fsl_usb2_udc.h"
...@@ -61,8 +56,8 @@ ...@@ -61,8 +56,8 @@
static const char driver_name[] = "fsl-usb2-udc"; static const char driver_name[] = "fsl-usb2-udc";
static const char driver_desc[] = DRIVER_DESC; static const char driver_desc[] = DRIVER_DESC;
volatile static struct usb_dr_device *dr_regs = NULL; static struct usb_dr_device *dr_regs;
volatile static struct usb_sys_interface *usb_sys_regs = NULL; static struct usb_sys_interface *usb_sys_regs;
/* it is initialized in probe() */ /* it is initialized in probe() */
static struct fsl_udc *udc_controller = NULL; static struct fsl_udc *udc_controller = NULL;
...@@ -560,7 +555,7 @@ static int fsl_ep_disable(struct usb_ep *_ep) ...@@ -560,7 +555,7 @@ static int fsl_ep_disable(struct usb_ep *_ep)
/* nuke all pending requests (does flush) */ /* nuke all pending requests (does flush) */
nuke(ep, -ESHUTDOWN); nuke(ep, -ESHUTDOWN);
ep->desc = 0; ep->desc = NULL;
ep->stopped = 1; ep->stopped = 1;
spin_unlock_irqrestore(&udc->lock, flags); spin_unlock_irqrestore(&udc->lock, flags);
...@@ -1565,9 +1560,6 @@ static void port_change_irq(struct fsl_udc *udc) ...@@ -1565,9 +1560,6 @@ static void port_change_irq(struct fsl_udc *udc)
{ {
u32 speed; u32 speed;
if (udc->bus_reset)
udc->bus_reset = 0;
/* Bus resetting is finished */ /* Bus resetting is finished */
if (!(fsl_readl(&dr_regs->portsc1) & PORTSCX_PORT_RESET)) { if (!(fsl_readl(&dr_regs->portsc1) & PORTSCX_PORT_RESET)) {
/* Get the speed */ /* Get the speed */
...@@ -1675,8 +1667,6 @@ static void reset_irq(struct fsl_udc *udc) ...@@ -1675,8 +1667,6 @@ static void reset_irq(struct fsl_udc *udc)
if (fsl_readl(&dr_regs->portsc1) & PORTSCX_PORT_RESET) { if (fsl_readl(&dr_regs->portsc1) & PORTSCX_PORT_RESET) {
VDBG("Bus reset"); VDBG("Bus reset");
/* Bus is reseting */
udc->bus_reset = 1;
/* Reset all the queues, include XD, dTD, EP queue /* Reset all the queues, include XD, dTD, EP queue
* head and TR Queue */ * head and TR Queue */
reset_queues(udc); reset_queues(udc);
...@@ -1796,7 +1786,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) ...@@ -1796,7 +1786,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
/* lock is needed but whether should use this lock or another */ /* lock is needed but whether should use this lock or another */
spin_lock_irqsave(&udc_controller->lock, flags); spin_lock_irqsave(&udc_controller->lock, flags);
driver->driver.bus = 0; driver->driver.bus = NULL;
/* hook up the driver */ /* hook up the driver */
udc_controller->driver = driver; udc_controller->driver = driver;
udc_controller->gadget.dev.driver = &driver->driver; udc_controller->gadget.dev.driver = &driver->driver;
...@@ -1806,8 +1796,8 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) ...@@ -1806,8 +1796,8 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
retval = driver->bind(&udc_controller->gadget); retval = driver->bind(&udc_controller->gadget);
if (retval) { if (retval) {
VDBG("bind to %s --> %d", driver->driver.name, retval); VDBG("bind to %s --> %d", driver->driver.name, retval);
udc_controller->gadget.dev.driver = 0; udc_controller->gadget.dev.driver = NULL;
udc_controller->driver = 0; udc_controller->driver = NULL;
goto out; goto out;
} }
...@@ -1839,7 +1829,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) ...@@ -1839,7 +1829,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
return -EINVAL; return -EINVAL;
if (udc_controller->transceiver) if (udc_controller->transceiver)
(void)otg_set_peripheral(udc_controller->transceiver, 0); otg_set_peripheral(udc_controller->transceiver, NULL);
/* stop DR, disable intr */ /* stop DR, disable intr */
dr_controller_stop(udc_controller); dr_controller_stop(udc_controller);
...@@ -1860,8 +1850,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) ...@@ -1860,8 +1850,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
/* unbind gadget and unhook driver. */ /* unbind gadget and unhook driver. */
driver->unbind(&udc_controller->gadget); driver->unbind(&udc_controller->gadget);
udc_controller->gadget.dev.driver = 0; udc_controller->gadget.dev.driver = NULL;
udc_controller->driver = 0; udc_controller->driver = NULL;
printk("unregistered gadget driver '%s'\r\n", driver->driver.name); printk("unregistered gadget driver '%s'\r\n", driver->driver.name);
return 0; return 0;
......
...@@ -424,16 +424,6 @@ struct ep_td_struct { ...@@ -424,16 +424,6 @@ struct ep_td_struct {
/* Controller dma boundary */ /* Controller dma boundary */
#define UDC_DMA_BOUNDARY 0x1000 #define UDC_DMA_BOUNDARY 0x1000
/* -----------------------------------------------------------------------*/
/* ##### enum data
*/
typedef enum {
e_ULPI,
e_UTMI_8BIT,
e_UTMI_16BIT,
e_SERIAL
} e_PhyInterface;
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* ### driver private data /* ### driver private data
...@@ -469,9 +459,9 @@ struct fsl_ep { ...@@ -469,9 +459,9 @@ struct fsl_ep {
#define EP_DIR_OUT 0 #define EP_DIR_OUT 0
struct fsl_udc { struct fsl_udc {
struct usb_gadget gadget; struct usb_gadget gadget;
struct usb_gadget_driver *driver; struct usb_gadget_driver *driver;
struct completion *done; /* to make sure release() is done */
struct fsl_ep *eps; struct fsl_ep *eps;
unsigned int max_ep; unsigned int max_ep;
unsigned int irq; unsigned int irq;
...@@ -492,20 +482,13 @@ struct fsl_udc { ...@@ -492,20 +482,13 @@ struct fsl_udc {
size_t ep_qh_size; /* size after alignment adjustment*/ size_t ep_qh_size; /* size after alignment adjustment*/
dma_addr_t ep_qh_dma; /* dma address of QH */ dma_addr_t ep_qh_dma; /* dma address of QH */
u32 max_pipes; /* Device max pipes */ u32 max_pipes; /* Device max pipes */
u32 max_use_endpts; /* Max endpointes to be used */
u32 bus_reset; /* Device is bus reseting */
u32 resume_state; /* USB state to resume */ u32 resume_state; /* USB state to resume */
u32 usb_state; /* USB current state */ u32 usb_state; /* USB current state */
u32 usb_next_state; /* USB next state */
u32 ep0_state; /* Endpoint zero state */ u32 ep0_state; /* Endpoint zero state */
u32 ep0_dir; /* Endpoint zero direction: can be u32 ep0_dir; /* Endpoint zero direction: can be
USB_DIR_IN or USB_DIR_OUT */ USB_DIR_IN or USB_DIR_OUT */
u32 usb_sof_count; /* SOF count */
u32 errors; /* USB ERRORs count */
u8 device_address; /* Device USB address */ u8 device_address; /* Device USB address */
struct completion *done; /* to make sure release() is done */
}; };
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment