aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-07-01 20:55:50 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-12 19:34:43 -0400
commit2d70c99b9340fa6c834fa6e32209e153f35a3e20 (patch)
treecbd098df25e1af57abdfee9aecd9be88a6571b44 /drivers/usb/gadget
parent70790f6339a868e2a0d643f44899418f64a95943 (diff)
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: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/goku_udc.c36
-rw-r--r--drivers/usb/gadget/goku_udc.h10
2 files changed, 23 insertions, 23 deletions
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index dfadb643597b..d6c5f1150ae7 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -20,7 +20,6 @@
20 * - DMA works with ep1 (OUT transfers) and ep2 (IN transfers). 20 * - DMA works with ep1 (OUT transfers) and ep2 (IN transfers).
21 */ 21 */
22 22
23#undef DEBUG
24// #define VERBOSE /* extra debug messages (success too) */ 23// #define VERBOSE /* extra debug messages (success too) */
25// #define USB_TRACE /* packet-level success messages */ 24// #define USB_TRACE /* packet-level success messages */
26 25
@@ -440,7 +439,7 @@ top:
440 /* use ep1/ep2 double-buffering for OUT */ 439 /* use ep1/ep2 double-buffering for OUT */
441 if (!(size & PACKET_ACTIVE)) 440 if (!(size & PACKET_ACTIVE))
442 size = readl(&regs->EPxSizeLB[ep->num]); 441 size = readl(&regs->EPxSizeLB[ep->num]);
443 if (!(size & PACKET_ACTIVE)) // "can't happen" 442 if (!(size & PACKET_ACTIVE)) /* "can't happen" */
444 break; 443 break;
445 size &= DATASIZE; /* EPxSizeH == 0 */ 444 size &= DATASIZE; /* EPxSizeH == 0 */
446 445
@@ -1092,17 +1091,17 @@ udc_proc_read(char *buffer, char **start, off_t off, int count,
1092 is_usb_connected 1091 is_usb_connected
1093 ? ((tmp & PW_PULLUP) ? "full speed" : "powered") 1092 ? ((tmp & PW_PULLUP) ? "full speed" : "powered")
1094 : "disconnected", 1093 : "disconnected",
1095 ({char *tmp; 1094 ({char *state;
1096 switch(dev->ep0state){ 1095 switch(dev->ep0state){
1097 case EP0_DISCONNECT: tmp = "ep0_disconnect"; break; 1096 case EP0_DISCONNECT: state = "ep0_disconnect"; break;
1098 case EP0_IDLE: tmp = "ep0_idle"; break; 1097 case EP0_IDLE: state = "ep0_idle"; break;
1099 case EP0_IN: tmp = "ep0_in"; break; 1098 case EP0_IN: state = "ep0_in"; break;
1100 case EP0_OUT: tmp = "ep0_out"; break; 1099 case EP0_OUT: state = "ep0_out"; break;
1101 case EP0_STATUS: tmp = "ep0_status"; break; 1100 case EP0_STATUS: state = "ep0_status"; break;
1102 case EP0_STALL: tmp = "ep0_stall"; break; 1101 case EP0_STALL: state = "ep0_stall"; break;
1103 case EP0_SUSPEND: tmp = "ep0_suspend"; break; 1102 case EP0_SUSPEND: state = "ep0_suspend"; break;
1104 default: tmp = "ep0_?"; break; 1103 default: state = "ep0_?"; break;
1105 } tmp; }) 1104 } state; })
1106 ); 1105 );
1107 size -= t; 1106 size -= t;
1108 next += t; 1107 next += t;
@@ -1147,7 +1146,6 @@ udc_proc_read(char *buffer, char **start, off_t off, int count,
1147 for (i = 0; i < 4; i++) { 1146 for (i = 0; i < 4; i++) {
1148 struct goku_ep *ep = &dev->ep [i]; 1147 struct goku_ep *ep = &dev->ep [i];
1149 struct goku_request *req; 1148 struct goku_request *req;
1150 int t;
1151 1149
1152 if (i && !ep->desc) 1150 if (i && !ep->desc)
1153 continue; 1151 continue;
@@ -1235,7 +1233,7 @@ done:
1235static void udc_reinit (struct goku_udc *dev) 1233static void udc_reinit (struct goku_udc *dev)
1236{ 1234{
1237 static char *names [] = { "ep0", "ep1-bulk", "ep2-bulk", "ep3-bulk" }; 1235 static char *names [] = { "ep0", "ep1-bulk", "ep2-bulk", "ep3-bulk" };
1238 1236
1239 unsigned i; 1237 unsigned i;
1240 1238
1241 INIT_LIST_HEAD (&dev->gadget.ep_list); 1239 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 1846
1849 /* done */ 1847 /* done */
1850 the_controller = dev; 1848 the_controller = dev;
1851 device_register(&dev->gadget.dev); 1849 retval = device_register(&dev->gadget.dev);
1852 1850 if (retval == 0)
1853 return 0; 1851 return 0;
1854 1852
1855done: 1853done:
1856 if (dev) 1854 if (dev)
@@ -1862,8 +1860,8 @@ done:
1862/*-------------------------------------------------------------------------*/ 1860/*-------------------------------------------------------------------------*/
1863 1861
1864static struct pci_device_id pci_ids [] = { { 1862static struct pci_device_id pci_ids [] = { {
1865 .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), 1863 .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe),
1866 .class_mask = ~0, 1864 .class_mask = ~0,
1867 .vendor = 0x102f, /* Toshiba */ 1865 .vendor = 0x102f, /* Toshiba */
1868 .device = 0x0107, /* this UDC */ 1866 .device = 0x0107, /* this UDC */
1869 .subvendor = PCI_ANY_ID, 1867 .subvendor = PCI_ANY_ID,
diff --git a/drivers/usb/gadget/goku_udc.h b/drivers/usb/gadget/goku_udc.h
index ea8c8e58cabf..bc4eb1e0b507 100644
--- a/drivers/usb/gadget/goku_udc.h
+++ b/drivers/usb/gadget/goku_udc.h
@@ -41,8 +41,10 @@ struct goku_udc_regs {
41#define INT_SYSERROR 0x40000 41#define INT_SYSERROR 0x40000
42#define INT_PWRDETECT 0x80000 42#define INT_PWRDETECT 0x80000
43 43
44#define INT_DEVWIDE (INT_PWRDETECT|INT_SYSERROR/*|INT_ERR*/|INT_USBRESET|INT_SUSPEND) 44#define INT_DEVWIDE \
45#define INT_EP0 (INT_SETUP|INT_ENDPOINT0/*|INT_STATUS*/|INT_STATUSNAK) 45 (INT_PWRDETECT|INT_SYSERROR/*|INT_ERR*/|INT_USBRESET|INT_SUSPEND)
46#define INT_EP0 \
47 (INT_SETUP|INT_ENDPOINT0/*|INT_STATUS*/|INT_STATUSNAK)
46 48
47 u32 dma_master; 49 u32 dma_master;
48#define MST_EOPB_DIS 0x0800 50#define MST_EOPB_DIS 0x0800
@@ -231,7 +233,7 @@ struct goku_request {
231enum ep0state { 233enum ep0state {
232 EP0_DISCONNECT, /* no host */ 234 EP0_DISCONNECT, /* no host */
233 EP0_IDLE, /* between STATUS ack and SETUP report */ 235 EP0_IDLE, /* between STATUS ack and SETUP report */
234 EP0_IN, EP0_OUT, /* data stage */ 236 EP0_IN, EP0_OUT, /* data stage */
235 EP0_STATUS, /* status stage */ 237 EP0_STATUS, /* status stage */
236 EP0_STALL, /* data or status stages */ 238 EP0_STALL, /* data or status stages */
237 EP0_SUSPEND, /* usb suspend */ 239 EP0_SUSPEND, /* usb suspend */
@@ -242,7 +244,7 @@ struct goku_udc {
242 struct usb_gadget gadget; 244 struct usb_gadget gadget;
243 spinlock_t lock; 245 spinlock_t lock;
244 struct goku_ep ep[4]; 246 struct goku_ep ep[4];
245 struct usb_gadget_driver *driver; 247 struct usb_gadget_driver *driver;
246 248
247 enum ep0state ep0state; 249 enum ep0state ep0state;
248 unsigned got_irq:1, 250 unsigned got_irq:1,