Commit 2d70c99b authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

USB: goku_udc trivial cleanups

Minor fixes to goku_udc ... whitespace, let -DDEBUG do its thing,
check the return value of device_register(), sparse tweaks.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 70790f63
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
* - DMA works with ep1 (OUT transfers) and ep2 (IN transfers). * - DMA works with ep1 (OUT transfers) and ep2 (IN transfers).
*/ */
#undef DEBUG
// #define VERBOSE /* extra debug messages (success too) */ // #define VERBOSE /* extra debug messages (success too) */
// #define USB_TRACE /* packet-level success messages */ // #define USB_TRACE /* packet-level success messages */
...@@ -440,7 +439,7 @@ static int read_fifo(struct goku_ep *ep, struct goku_request *req) ...@@ -440,7 +439,7 @@ static int read_fifo(struct goku_ep *ep, struct goku_request *req)
/* use ep1/ep2 double-buffering for OUT */ /* use ep1/ep2 double-buffering for OUT */
if (!(size & PACKET_ACTIVE)) if (!(size & PACKET_ACTIVE))
size = readl(&regs->EPxSizeLB[ep->num]); size = readl(&regs->EPxSizeLB[ep->num]);
if (!(size & PACKET_ACTIVE)) // "can't happen" if (!(size & PACKET_ACTIVE)) /* "can't happen" */
break; break;
size &= DATASIZE; /* EPxSizeH == 0 */ size &= DATASIZE; /* EPxSizeH == 0 */
...@@ -1092,17 +1091,17 @@ udc_proc_read(char *buffer, char **start, off_t off, int count, ...@@ -1092,17 +1091,17 @@ udc_proc_read(char *buffer, char **start, off_t off, int count,
is_usb_connected is_usb_connected
? ((tmp & PW_PULLUP) ? "full speed" : "powered") ? ((tmp & PW_PULLUP) ? "full speed" : "powered")
: "disconnected", : "disconnected",
({char *tmp; ({char *state;
switch(dev->ep0state){ switch(dev->ep0state){
case EP0_DISCONNECT: tmp = "ep0_disconnect"; break; case EP0_DISCONNECT: state = "ep0_disconnect"; break;
case EP0_IDLE: tmp = "ep0_idle"; break; case EP0_IDLE: state = "ep0_idle"; break;
case EP0_IN: tmp = "ep0_in"; break; case EP0_IN: state = "ep0_in"; break;
case EP0_OUT: tmp = "ep0_out"; break; case EP0_OUT: state = "ep0_out"; break;
case EP0_STATUS: tmp = "ep0_status"; break; case EP0_STATUS: state = "ep0_status"; break;
case EP0_STALL: tmp = "ep0_stall"; break; case EP0_STALL: state = "ep0_stall"; break;
case EP0_SUSPEND: tmp = "ep0_suspend"; break; case EP0_SUSPEND: state = "ep0_suspend"; break;
default: tmp = "ep0_?"; break; default: state = "ep0_?"; break;
} tmp; }) } state; })
); );
size -= t; size -= t;
next += t; next += t;
...@@ -1147,7 +1146,6 @@ udc_proc_read(char *buffer, char **start, off_t off, int count, ...@@ -1147,7 +1146,6 @@ udc_proc_read(char *buffer, char **start, off_t off, int count,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
struct goku_ep *ep = &dev->ep [i]; struct goku_ep *ep = &dev->ep [i];
struct goku_request *req; struct goku_request *req;
int t;
if (i && !ep->desc) if (i && !ep->desc)
continue; continue;
...@@ -1235,7 +1233,7 @@ udc_proc_read(char *buffer, char **start, off_t off, int count, ...@@ -1235,7 +1233,7 @@ udc_proc_read(char *buffer, char **start, off_t off, int count,
static void udc_reinit (struct goku_udc *dev) static void udc_reinit (struct goku_udc *dev)
{ {
static char *names [] = { "ep0", "ep1-bulk", "ep2-bulk", "ep3-bulk" }; static char *names [] = { "ep0", "ep1-bulk", "ep2-bulk", "ep3-bulk" };
unsigned i; unsigned i;
INIT_LIST_HEAD (&dev->gadget.ep_list); INIT_LIST_HEAD (&dev->gadget.ep_list);
...@@ -1848,9 +1846,9 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1848,9 +1846,9 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* done */ /* done */
the_controller = dev; the_controller = dev;
device_register(&dev->gadget.dev); retval = device_register(&dev->gadget.dev);
if (retval == 0)
return 0; return 0;
done: done:
if (dev) if (dev)
...@@ -1862,8 +1860,8 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1862,8 +1860,8 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static struct pci_device_id pci_ids [] = { { static struct pci_device_id pci_ids [] = { {
.class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe),
.class_mask = ~0, .class_mask = ~0,
.vendor = 0x102f, /* Toshiba */ .vendor = 0x102f, /* Toshiba */
.device = 0x0107, /* this UDC */ .device = 0x0107, /* this UDC */
.subvendor = PCI_ANY_ID, .subvendor = PCI_ANY_ID,
......
...@@ -41,8 +41,10 @@ struct goku_udc_regs { ...@@ -41,8 +41,10 @@ struct goku_udc_regs {
#define INT_SYSERROR 0x40000 #define INT_SYSERROR 0x40000
#define INT_PWRDETECT 0x80000 #define INT_PWRDETECT 0x80000
#define INT_DEVWIDE (INT_PWRDETECT|INT_SYSERROR/*|INT_ERR*/|INT_USBRESET|INT_SUSPEND) #define INT_DEVWIDE \
#define INT_EP0 (INT_SETUP|INT_ENDPOINT0/*|INT_STATUS*/|INT_STATUSNAK) (INT_PWRDETECT|INT_SYSERROR/*|INT_ERR*/|INT_USBRESET|INT_SUSPEND)
#define INT_EP0 \
(INT_SETUP|INT_ENDPOINT0/*|INT_STATUS*/|INT_STATUSNAK)
u32 dma_master; u32 dma_master;
#define MST_EOPB_DIS 0x0800 #define MST_EOPB_DIS 0x0800
...@@ -231,7 +233,7 @@ struct goku_request { ...@@ -231,7 +233,7 @@ struct goku_request {
enum ep0state { enum ep0state {
EP0_DISCONNECT, /* no host */ EP0_DISCONNECT, /* no host */
EP0_IDLE, /* between STATUS ack and SETUP report */ EP0_IDLE, /* between STATUS ack and SETUP report */
EP0_IN, EP0_OUT, /* data stage */ EP0_IN, EP0_OUT, /* data stage */
EP0_STATUS, /* status stage */ EP0_STATUS, /* status stage */
EP0_STALL, /* data or status stages */ EP0_STALL, /* data or status stages */
EP0_SUSPEND, /* usb suspend */ EP0_SUSPEND, /* usb suspend */
...@@ -242,7 +244,7 @@ struct goku_udc { ...@@ -242,7 +244,7 @@ struct goku_udc {
struct usb_gadget gadget; struct usb_gadget gadget;
spinlock_t lock; spinlock_t lock;
struct goku_ep ep[4]; struct goku_ep ep[4];
struct usb_gadget_driver *driver; struct usb_gadget_driver *driver;
enum ep0state ep0state; enum ep0state ep0state;
unsigned got_irq:1, unsigned got_irq:1,
......
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