Commit 41dceed51f0e6105ca2bf45c3835a7cd9eaa077b

Authored by Greg Kroah-Hartman
1 parent 969ab2ee9d

USB: fix codingstyle issues in include/linux/usb/

Fixes a number of coding style issues in the USB public header files.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Showing 11 changed files with 220 additions and 205 deletions Side-by-side Diff

include/linux/usb/audio.h
... ... @@ -27,13 +27,13 @@
27 27  
28 28 /* 4.3.2 Class-Specific AC Interface Descriptor */
29 29 struct usb_ac_header_descriptor {
30   - __u8 bLength; // 8+n
31   - __u8 bDescriptorType; // USB_DT_CS_INTERFACE
32   - __u8 bDescriptorSubtype; // USB_MS_HEADER
33   - __le16 bcdADC; // 0x0100
34   - __le16 wTotalLength; // includes Unit and Terminal desc.
35   - __u8 bInCollection; // n
36   - __u8 baInterfaceNr[]; // [n]
  30 + __u8 bLength; /* 8+n */
  31 + __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
  32 + __u8 bDescriptorSubtype; /* USB_MS_HEADER */
  33 + __le16 bcdADC; /* 0x0100 */
  34 + __le16 wTotalLength; /* includes Unit and Terminal desc. */
  35 + __u8 bInCollection; /* n */
  36 + __u8 baInterfaceNr[]; /* [n] */
37 37 } __attribute__ ((packed));
38 38  
39 39 #define USB_DT_AC_HEADER_SIZE(n) (8+(n))
include/linux/usb/cdc.h
... ... @@ -29,16 +29,16 @@
29 29 * Class-Specific descriptors ... there are a couple dozen of them
30 30 */
31 31  
32   -#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */
33   -#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */
34   -#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */
35   -#define USB_CDC_UNION_TYPE 0x06 /* union_desc */
  32 +#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */
  33 +#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */
  34 +#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */
  35 +#define USB_CDC_UNION_TYPE 0x06 /* union_desc */
36 36 #define USB_CDC_COUNTRY_TYPE 0x07
37   -#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */
38   -#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */
  37 +#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */
  38 +#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */
39 39 #define USB_CDC_WHCM_TYPE 0x11
40   -#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */
41   -#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */
  40 +#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */
  41 +#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */
42 42 #define USB_CDC_DMM_TYPE 0x14
43 43 #define USB_CDC_OBEX_TYPE 0x15
44 44  
include/linux/usb/gadget.h
... ... @@ -70,9 +70,10 @@
70 70 *
71 71 * Bulk endpoints can use any size buffers, and can also be used for interrupt
72 72 * transfers. interrupt-only endpoints can be much less functional.
  73 + *
  74 + * NOTE: this is analagous to 'struct urb' on the host side, except that
  75 + * it's thinner and promotes more pre-allocation.
73 76 */
74   - // NOTE this is analagous to 'struct urb' on the host side,
75   - // except that it's thinner and promotes more pre-allocation.
76 77  
77 78 struct usb_request {
78 79 void *buf;
79 80  
... ... @@ -168,10 +169,10 @@
168 169 *
169 170 * returns zero, or a negative error code.
170 171 */
171   -static inline int
172   -usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc)
  172 +static inline int usb_ep_enable(struct usb_ep *ep,
  173 + const struct usb_endpoint_descriptor *desc)
173 174 {
174   - return ep->ops->enable (ep, desc);
  175 + return ep->ops->enable(ep, desc);
175 176 }
176 177  
177 178 /**
178 179  
... ... @@ -186,10 +187,9 @@
186 187 *
187 188 * returns zero, or a negative error code.
188 189 */
189   -static inline int
190   -usb_ep_disable (struct usb_ep *ep)
  190 +static inline int usb_ep_disable(struct usb_ep *ep)
191 191 {
192   - return ep->ops->disable (ep);
  192 + return ep->ops->disable(ep);
193 193 }
194 194  
195 195 /**
196 196  
... ... @@ -206,10 +206,10 @@
206 206 *
207 207 * Returns the request, or null if one could not be allocated.
208 208 */
209   -static inline struct usb_request *
210   -usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags)
  209 +static inline struct usb_request *usb_ep_alloc_request(struct usb_ep *ep,
  210 + gfp_t gfp_flags)
211 211 {
212   - return ep->ops->alloc_request (ep, gfp_flags);
  212 + return ep->ops->alloc_request(ep, gfp_flags);
213 213 }
214 214  
215 215 /**
216 216  
... ... @@ -221,10 +221,10 @@
221 221 * Caller guarantees the request is not queued, and that it will
222 222 * no longer be requeued (or otherwise used).
223 223 */
224   -static inline void
225   -usb_ep_free_request (struct usb_ep *ep, struct usb_request *req)
  224 +static inline void usb_ep_free_request(struct usb_ep *ep,
  225 + struct usb_request *req)
226 226 {
227   - ep->ops->free_request (ep, req);
  227 + ep->ops->free_request(ep, req);
228 228 }
229 229  
230 230 /**
231 231  
... ... @@ -281,10 +281,10 @@
281 281 * report errors; errors will also be
282 282 * reported when the usb peripheral is disconnected.
283 283 */
284   -static inline int
285   -usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags)
  284 +static inline int usb_ep_queue(struct usb_ep *ep,
  285 + struct usb_request *req, gfp_t gfp_flags)
286 286 {
287   - return ep->ops->queue (ep, req, gfp_flags);
  287 + return ep->ops->queue(ep, req, gfp_flags);
288 288 }
289 289  
290 290 /**
291 291  
... ... @@ -301,9 +301,9 @@
301 301 * restrictions prevent drivers from supporting configuration changes,
302 302 * even to configuration zero (a "chapter 9" requirement).
303 303 */
304   -static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req)
  304 +static inline int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
305 305 {
306   - return ep->ops->dequeue (ep, req);
  306 + return ep->ops->dequeue(ep, req);
307 307 }
308 308  
309 309 /**
310 310  
... ... @@ -327,10 +327,9 @@
327 327 * transfer requests are still queued, or if the controller hardware
328 328 * (usually a FIFO) still holds bytes that the host hasn't collected.
329 329 */
330   -static inline int
331   -usb_ep_set_halt (struct usb_ep *ep)
  330 +static inline int usb_ep_set_halt(struct usb_ep *ep)
332 331 {
333   - return ep->ops->set_halt (ep, 1);
  332 + return ep->ops->set_halt(ep, 1);
334 333 }
335 334  
336 335 /**
337 336  
... ... @@ -346,10 +345,9 @@
346 345 * Note that some hardware can't support this request (like pxa2xx_udc),
347 346 * and accordingly can't correctly implement interface altsettings.
348 347 */
349   -static inline int
350   -usb_ep_clear_halt (struct usb_ep *ep)
  348 +static inline int usb_ep_clear_halt(struct usb_ep *ep)
351 349 {
352   - return ep->ops->set_halt (ep, 0);
  350 + return ep->ops->set_halt(ep, 0);
353 351 }
354 352  
355 353 /**
356 354  
... ... @@ -367,11 +365,10 @@
367 365 * errno if the endpoint doesn't use a FIFO or doesn't support such
368 366 * precise handling.
369 367 */
370   -static inline int
371   -usb_ep_fifo_status (struct usb_ep *ep)
  368 +static inline int usb_ep_fifo_status(struct usb_ep *ep)
372 369 {
373 370 if (ep->ops->fifo_status)
374   - return ep->ops->fifo_status (ep);
  371 + return ep->ops->fifo_status(ep);
375 372 else
376 373 return -EOPNOTSUPP;
377 374 }
378 375  
... ... @@ -385,11 +382,10 @@
385 382 * must never be used except when endpoint is not being used for any
386 383 * protocol translation.
387 384 */
388   -static inline void
389   -usb_ep_fifo_flush (struct usb_ep *ep)
  385 +static inline void usb_ep_fifo_flush(struct usb_ep *ep)
390 386 {
391 387 if (ep->ops->fifo_flush)
392   - ep->ops->fifo_flush (ep);
  388 + ep->ops->fifo_flush(ep);
393 389 }
394 390  
395 391  
... ... @@ -469,10 +465,10 @@
469 465 struct device dev;
470 466 };
471 467  
472   -static inline void set_gadget_data (struct usb_gadget *gadget, void *data)
473   - { dev_set_drvdata (&gadget->dev, data); }
474   -static inline void *get_gadget_data (struct usb_gadget *gadget)
475   - { return dev_get_drvdata (&gadget->dev); }
  468 +static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
  469 + { dev_set_drvdata(&gadget->dev, data); }
  470 +static inline void *get_gadget_data(struct usb_gadget *gadget)
  471 + { return dev_get_drvdata(&gadget->dev); }
476 472  
477 473 /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
478 474 #define gadget_for_each_ep(tmp,gadget) \
... ... @@ -511,7 +507,6 @@
511 507 #endif
512 508 }
513 509  
514   -
515 510 /**
516 511 * usb_gadget_frame_number - returns the current frame number
517 512 * @gadget: controller that reports the frame number
518 513  
... ... @@ -519,9 +514,9 @@
519 514 * Returns the usb frame number, normally eleven bits from a SOF packet,
520 515 * or negative errno if this device doesn't support this capability.
521 516 */
522   -static inline int usb_gadget_frame_number (struct usb_gadget *gadget)
  517 +static inline int usb_gadget_frame_number(struct usb_gadget *gadget)
523 518 {
524   - return gadget->ops->get_frame (gadget);
  519 + return gadget->ops->get_frame(gadget);
525 520 }
526 521  
527 522 /**
528 523  
... ... @@ -537,11 +532,11 @@
537 532 * even if OTG isn't otherwise in use. OTG devices may also start
538 533 * remote wakeup even when hosts don't explicitly enable it.
539 534 */
540   -static inline int usb_gadget_wakeup (struct usb_gadget *gadget)
  535 +static inline int usb_gadget_wakeup(struct usb_gadget *gadget)
541 536 {
542 537 if (!gadget->ops->wakeup)
543 538 return -EOPNOTSUPP;
544   - return gadget->ops->wakeup (gadget);
  539 + return gadget->ops->wakeup(gadget);
545 540 }
546 541  
547 542 /**
548 543  
... ... @@ -553,12 +548,11 @@
553 548 *
554 549 * returns zero on success, else negative errno.
555 550 */
556   -static inline int
557   -usb_gadget_set_selfpowered (struct usb_gadget *gadget)
  551 +static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget)
558 552 {
559 553 if (!gadget->ops->set_selfpowered)
560 554 return -EOPNOTSUPP;
561   - return gadget->ops->set_selfpowered (gadget, 1);
  555 + return gadget->ops->set_selfpowered(gadget, 1);
562 556 }
563 557  
564 558 /**
565 559  
... ... @@ -571,12 +565,11 @@
571 565 *
572 566 * returns zero on success, else negative errno.
573 567 */
574   -static inline int
575   -usb_gadget_clear_selfpowered (struct usb_gadget *gadget)
  568 +static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
576 569 {
577 570 if (!gadget->ops->set_selfpowered)
578 571 return -EOPNOTSUPP;
579   - return gadget->ops->set_selfpowered (gadget, 0);
  572 + return gadget->ops->set_selfpowered(gadget, 0);
580 573 }
581 574  
582 575 /**
583 576  
... ... @@ -591,12 +584,11 @@
591 584 *
592 585 * Returns zero on success, else negative errno.
593 586 */
594   -static inline int
595   -usb_gadget_vbus_connect(struct usb_gadget *gadget)
  587 +static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget)
596 588 {
597 589 if (!gadget->ops->vbus_session)
598 590 return -EOPNOTSUPP;
599   - return gadget->ops->vbus_session (gadget, 1);
  591 + return gadget->ops->vbus_session(gadget, 1);
600 592 }
601 593  
602 594 /**
603 595  
... ... @@ -611,12 +603,11 @@
611 603 *
612 604 * Returns zero on success, else negative errno.
613 605 */
614   -static inline int
615   -usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
  606 +static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
616 607 {
617 608 if (!gadget->ops->vbus_draw)
618 609 return -EOPNOTSUPP;
619   - return gadget->ops->vbus_draw (gadget, mA);
  610 + return gadget->ops->vbus_draw(gadget, mA);
620 611 }
621 612  
622 613 /**
623 614  
... ... @@ -629,12 +620,11 @@
629 620 *
630 621 * Returns zero on success, else negative errno.
631 622 */
632   -static inline int
633   -usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
  623 +static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
634 624 {
635 625 if (!gadget->ops->vbus_session)
636 626 return -EOPNOTSUPP;
637   - return gadget->ops->vbus_session (gadget, 0);
  627 + return gadget->ops->vbus_session(gadget, 0);
638 628 }
639 629  
640 630 /**
641 631  
... ... @@ -648,12 +638,11 @@
648 638 *
649 639 * Returns zero on success, else negative errno.
650 640 */
651   -static inline int
652   -usb_gadget_connect (struct usb_gadget *gadget)
  641 +static inline int usb_gadget_connect(struct usb_gadget *gadget)
653 642 {
654 643 if (!gadget->ops->pullup)
655 644 return -EOPNOTSUPP;
656   - return gadget->ops->pullup (gadget, 1);
  645 + return gadget->ops->pullup(gadget, 1);
657 646 }
658 647  
659 648 /**
660 649  
661 650  
... ... @@ -671,16 +660,14 @@
671 660 *
672 661 * Returns zero on success, else negative errno.
673 662 */
674   -static inline int
675   -usb_gadget_disconnect (struct usb_gadget *gadget)
  663 +static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
676 664 {
677 665 if (!gadget->ops->pullup)
678 666 return -EOPNOTSUPP;
679   - return gadget->ops->pullup (gadget, 0);
  667 + return gadget->ops->pullup(gadget, 0);
680 668 }
681 669  
682 670  
683   -
684 671 /*-------------------------------------------------------------------------*/
685 672  
686 673 /**
... ... @@ -764,7 +751,7 @@
764 751 void (*suspend)(struct usb_gadget *);
765 752 void (*resume)(struct usb_gadget *);
766 753  
767   - // FIXME support safe rmmod
  754 + /* FIXME support safe rmmod */
768 755 struct device_driver driver;
769 756 };
770 757  
... ... @@ -790,7 +777,7 @@
790 777 * the bind() functions will be in init sections.
791 778 * This function must be called in a context that can sleep.
792 779 */
793   -int usb_gadget_register_driver (struct usb_gadget_driver *driver);
  780 +int usb_gadget_register_driver(struct usb_gadget_driver *driver);
794 781  
795 782 /**
796 783 * usb_gadget_unregister_driver - unregister a gadget driver
... ... @@ -805,7 +792,7 @@
805 792 * will in in exit sections, so may not be linked in some kernels.
806 793 * This function must be called in a context that can sleep.
807 794 */
808   -int usb_gadget_unregister_driver (struct usb_gadget_driver *driver);
  795 +int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
809 796  
810 797 /*-------------------------------------------------------------------------*/
811 798  
... ... @@ -838,7 +825,7 @@
838 825 };
839 826  
840 827 /* put descriptor for string with that id into buf (buflen >= 256) */
841   -int usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf);
  828 +int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf);
842 829  
843 830 /*-------------------------------------------------------------------------*/
844 831  
845 832  
... ... @@ -856,10 +843,10 @@
856 843  
857 844 /* utility wrapping a simple endpoint selection policy */
858 845  
859   -extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *,
  846 +extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
860 847 struct usb_endpoint_descriptor *) __devinit;
861 848  
862   -extern void usb_ep_autoconfig_reset (struct usb_gadget *) __devinit;
  849 +extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit;
863 850  
864 851 #endif /* __KERNEL__ */
865 852  
include/linux/usb/gadgetfs.h
... ... @@ -36,7 +36,7 @@
36 36 GADGETFS_DISCONNECT,
37 37 GADGETFS_SETUP,
38 38 GADGETFS_SUSPEND,
39   - // and likely more !
  39 + /* and likely more ! */
40 40 };
41 41  
42 42 /* NOTE: this structure must stay the same size and layout on
43 43  
44 44  
... ... @@ -44,15 +44,17 @@
44 44 */
45 45 struct usb_gadgetfs_event {
46 46 union {
47   - // NOP, DISCONNECT, SUSPEND: nothing
48   - // ... some hardware can't report disconnection
  47 + /* NOP, DISCONNECT, SUSPEND: nothing
  48 + * ... some hardware can't report disconnection
  49 + */
49 50  
50   - // CONNECT: just the speed
  51 + /* CONNECT: just the speed */
51 52 enum usb_device_speed speed;
52 53  
53   - // SETUP: packet; DATA phase i/o precedes next event
54   - // (setup.bmRequestType & USB_DIR_IN) flags direction
55   - // ... includes SET_CONFIGURATION, SET_INTERFACE
  54 + /* SETUP: packet; DATA phase i/o precedes next event
  55 + *(setup.bmRequestType & USB_DIR_IN) flags direction
  56 + * ... includes SET_CONFIGURATION, SET_INTERFACE
  57 + */
56 58 struct usb_ctrlrequest setup;
57 59 } u;
58 60 enum usb_gadgetfs_event_type type;
59 61  
60 62  
... ... @@ -73,15 +75,15 @@
73 75 * THIS returns how many bytes are "unclaimed" in the endpoint fifo
74 76 * (needed for precise fault handling, when the hardware allows it)
75 77 */
76   -#define GADGETFS_FIFO_STATUS _IO('g',1)
  78 +#define GADGETFS_FIFO_STATUS _IO('g', 1)
77 79  
78 80 /* discards any unclaimed data in the fifo. */
79   -#define GADGETFS_FIFO_FLUSH _IO('g',2)
  81 +#define GADGETFS_FIFO_FLUSH _IO('g', 2)
80 82  
81 83 /* resets endpoint halt+toggle; used to implement set_interface.
82 84 * some hardware (like pxa2xx) can't support this.
83 85 */
84   -#define GADGETFS_CLEAR_HALT _IO('g',3)
  86 +#define GADGETFS_CLEAR_HALT _IO('g', 3)
85 87  
86 88 #endif /* __LINUX_USB_GADGETFS_H */
include/linux/usb/iowarrior.h
... ... @@ -14,14 +14,23 @@
14 14 this information.
15 15 */
16 16 struct iowarrior_info {
17   - __u32 vendor; /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */
18   - __u32 product; /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_XXXXX) */
19   - __u8 serial[9]; /* the serial number of our chip (if a serial-number is not available this is empty string) */
20   - __u32 revision; /* revision number of the chip */
21   - __u32 speed; /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
22   - __u32 power; /* power consumption of the device in mA */
23   - __u32 if_num; /* the number of the endpoint */
24   - __u32 report_size; /* size of the data-packets on this interface */
  17 + /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */
  18 + __u32 vendor;
  19 + /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_X) */
  20 + __u32 product;
  21 + /* the serial number of our chip (if a serial-number is not available
  22 + * this is empty string) */
  23 + __u8 serial[9];
  24 + /* revision number of the chip */
  25 + __u32 revision;
  26 + /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
  27 + __u32 speed;
  28 + /* power consumption of the device in mA */
  29 + __u32 power;
  30 + /* the number of the endpoint */
  31 + __u32 if_num;
  32 + /* size of the data-packets on this interface */
  33 + __u32 report_size;
25 34 };
26 35  
27 36 /*
include/linux/usb/isp116x.h
... ... @@ -25,6 +25,6 @@
25 25 300ns delay between access to ADDR_REG and DATA_REG
26 26 OE, WE MUST NOT be changed during these intervals
27 27 */
28   - void (*delay) (struct device * dev, int delay);
  28 + void (*delay) (struct device *dev, int delay);
29 29 };
include/linux/usb/midi.h
... ... @@ -47,9 +47,9 @@
47 47 /* 6.1.2.2 MIDI IN Jack Descriptor */
48 48 struct usb_midi_in_jack_descriptor {
49 49 __u8 bLength;
50   - __u8 bDescriptorType; // USB_DT_CS_INTERFACE
51   - __u8 bDescriptorSubtype; // USB_MS_MIDI_IN_JACK
52   - __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
  50 + __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
  51 + __u8 bDescriptorSubtype; /* USB_MS_MIDI_IN_JACK */
  52 + __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */
53 53 __u8 bJackID;
54 54 __u8 iJack;
55 55 } __attribute__ ((packed));
56 56  
... ... @@ -64,12 +64,12 @@
64 64 /* 6.1.2.3 MIDI OUT Jack Descriptor */
65 65 struct usb_midi_out_jack_descriptor {
66 66 __u8 bLength;
67   - __u8 bDescriptorType; // USB_DT_CS_INTERFACE
68   - __u8 bDescriptorSubtype; // USB_MS_MIDI_OUT_JACK
69   - __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
  67 + __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
  68 + __u8 bDescriptorSubtype; /* USB_MS_MIDI_OUT_JACK */
  69 + __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */
70 70 __u8 bJackID;
71   - __u8 bNrInputPins; // p
72   - struct usb_midi_source_pin pins[]; // [p]
  71 + __u8 bNrInputPins; /* p */
  72 + struct usb_midi_source_pin pins[]; /* [p] */
73 73 /*__u8 iJack; -- ommitted due to variable-sized pins[] */
74 74 } __attribute__ ((packed));
75 75  
... ... @@ -90,11 +90,11 @@
90 90  
91 91 /* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */
92 92 struct usb_ms_endpoint_descriptor {
93   - __u8 bLength; // 4+n
94   - __u8 bDescriptorType; // USB_DT_CS_ENDPOINT
95   - __u8 bDescriptorSubtype; // USB_MS_GENERAL
96   - __u8 bNumEmbMIDIJack; // n
97   - __u8 baAssocJackID[]; // [n]
  93 + __u8 bLength; /* 4+n */
  94 + __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
  95 + __u8 bDescriptorSubtype; /* USB_MS_GENERAL */
  96 + __u8 bNumEmbMIDIJack; /* n */
  97 + __u8 baAssocJackID[]; /* [n] */
98 98 } __attribute__ ((packed));
99 99  
100 100 #define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n))
include/linux/usb/net2280.h
... ... @@ -37,7 +37,7 @@
37 37  
38 38 /* main registers, BAR0 + 0x0000 */
39 39 struct net2280_regs {
40   - // offset 0x0000
  40 + /* offset 0x0000 */
41 41 u32 devinit;
42 42 #define LOCAL_CLOCK_FREQUENCY 8
43 43 #define FORCE_PCI_RESET 7
... ... @@ -61,7 +61,7 @@
61 61 #define EEPROM_WRITE_DATA 0
62 62 u32 eeclkfreq;
63 63 u32 _unused0;
64   - // offset 0x0010
  64 + /* offset 0x0010 */
65 65  
66 66 u32 pciirqenb0; /* interrupt PCI master ... */
67 67 #define SETUP_PACKET_INTERRUPT_ENABLE 7
... ... @@ -131,7 +131,7 @@
131 131 #define RESUME_INTERRUPT_ENABLE 1
132 132 #define SOF_INTERRUPT_ENABLE 0
133 133  
134   - // offset 0x0020
  134 + /* offset 0x0020 */
135 135 u32 _unused1;
136 136 u32 usbirqenb1;
137 137 #define USB_INTERRUPT_ENABLE 31
... ... @@ -195,7 +195,7 @@
195 195 #define SUSPEND_REQUEST_CHANGE_INTERRUPT 2
196 196 #define RESUME_INTERRUPT 1
197 197 #define SOF_INTERRUPT 0
198   - // offset 0x0030
  198 + /* offset 0x0030 */
199 199 u32 idxaddr;
200 200 u32 idxdata;
201 201 u32 fifoctl;
... ... @@ -204,7 +204,7 @@
204 204 #define PCI_BASE2_SELECT 2
205 205 #define FIFO_CONFIGURATION_SELECT 0
206 206 u32 _unused2;
207   - // offset 0x0040
  207 + /* offset 0x0040 */
208 208 u32 memaddr;
209 209 #define START 28
210 210 #define DIRECTION 27
... ... @@ -213,7 +213,7 @@
213 213 u32 memdata0;
214 214 u32 memdata1;
215 215 u32 _unused3;
216   - // offset 0x0050
  216 + /* offset 0x0050 */
217 217 u32 gpioctl;
218 218 #define GPIO3_LED_SELECT 12
219 219 #define GPIO3_INTERRUPT_ENABLE 11
... ... @@ -237,7 +237,7 @@
237 237  
238 238 /* usb control, BAR0 + 0x0080 */
239 239 struct net2280_usb_regs {
240   - // offset 0x0080
  240 + /* offset 0x0080 */
241 241 u32 stdrsp;
242 242 #define STALL_UNSUPPORTED_REQUESTS 31
243 243 #define SET_TEST_MODE 16
... ... @@ -275,7 +275,7 @@
275 275 #define PME_WAKEUP_ENABLE 2
276 276 #define DEVICE_REMOTE_WAKEUP_ENABLE 1
277 277 #define SELF_POWERED_STATUS 0
278   - // offset 0x0090
  278 + /* offset 0x0090 */
279 279 u32 usbstat;
280 280 #define HIGH_SPEED 7
281 281 #define FULL_SPEED 6
... ... @@ -291,7 +291,7 @@
291 291 #define TERMINATION_SELECT 0
292 292 u32 setup0123;
293 293 u32 setup4567;
294   - // offset 0x0090
  294 + /* offset 0x0090 */
295 295 u32 _unused0;
296 296 u32 ouraddr;
297 297 #define FORCE_IMMEDIATE 7
... ... @@ -301,7 +301,7 @@
301 301  
302 302 /* pci control, BAR0 + 0x0100 */
303 303 struct net2280_pci_regs {
304   - // offset 0x0100
  304 + /* offset 0x0100 */
305 305 u32 pcimstctl;
306 306 #define PCI_ARBITER_PARK_SELECT 13
307 307 #define PCI_MULTI LEVEL_ARBITER 12
... ... @@ -331,7 +331,7 @@
331 331 * that can be loaded into some of these registers.
332 332 */
333 333 struct net2280_dma_regs { /* [11.7] */
334   - // offset 0x0180, 0x01a0, 0x01c0, 0x01e0,
  334 + /* offset 0x0180, 0x01a0, 0x01c0, 0x01e0, */
335 335 u32 dmactl;
336 336 #define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25
337 337 #define DMA_CLEAR_COUNT_ENABLE 21
... ... @@ -355,7 +355,7 @@
355 355 #define DMA_ABORT 1
356 356 #define DMA_START 0
357 357 u32 _unused0 [2];
358   - // offset 0x0190, 0x01b0, 0x01d0, 0x01f0,
  358 + /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */
359 359 u32 dmacount;
360 360 #define VALID_BIT 31
361 361 #define DMA_DIRECTION 30
362 362  
... ... @@ -371,9 +371,9 @@
371 371 /* dedicated endpoint registers, BAR0 + 0x0200 */
372 372  
373 373 struct net2280_dep_regs { /* [11.8] */
374   - // offset 0x0200, 0x0210, 0x220, 0x230, 0x240
  374 + /* offset 0x0200, 0x0210, 0x220, 0x230, 0x240 */
375 375 u32 dep_cfg;
376   - // offset 0x0204, 0x0214, 0x224, 0x234, 0x244
  376 + /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */
377 377 u32 dep_rsp;
378 378 u32 _unused [2];
379 379 } __attribute__ ((packed));
... ... @@ -383,7 +383,7 @@
383 383 * ep0 reserved for control; E and F have only 64 bytes of fifo
384 384 */
385 385 struct net2280_ep_regs { /* [11.9] */
386   - // offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0
  386 + /* offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 */
387 387 u32 ep_cfg;
388 388 #define ENDPOINT_BYTE_COUNT 16
389 389 #define ENDPOINT_ENABLE 10
... ... @@ -435,7 +435,7 @@
435 435 #define DATA_PACKET_TRANSMITTED_INTERRUPT 2
436 436 #define DATA_OUT_PING_TOKEN_INTERRUPT 1
437 437 #define DATA_IN_TOKEN_INTERRUPT 0
438   - // offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0
  438 + /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */
439 439 u32 ep_avail;
440 440 u32 ep_data;
441 441 u32 _unused0 [2];
include/linux/usb/otg.h
1   -// include/linux/usb/otg.h
  1 +/* USB OTG (On The Go) defines */
2 2  
3 3 /*
4 4 * These APIs may be used between USB controllers. USB device drivers
include/linux/usb/serial.h
... ... @@ -20,7 +20,8 @@
20 20 #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
21 21 #define SERIAL_TTY_MINORS 255 /* loads of devices :) */
22 22  
23   -#define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */
  23 +/* The maximum number of ports one device can grab at once */
  24 +#define MAX_NUM_PORTS 8
24 25  
25 26 /* parity check flag */
26 27 #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
27 28  
28 29  
29 30  
30 31  
31 32  
32 33  
33 34  
... ... @@ -61,29 +62,29 @@
61 62 * ports of a device.
62 63 */
63 64 struct usb_serial_port {
64   - struct usb_serial * serial;
65   - struct tty_struct * tty;
  65 + struct usb_serial *serial;
  66 + struct tty_struct *tty;
66 67 spinlock_t lock;
67 68 struct mutex mutex;
68 69 unsigned char number;
69 70  
70   - unsigned char * interrupt_in_buffer;
71   - struct urb * interrupt_in_urb;
  71 + unsigned char *interrupt_in_buffer;
  72 + struct urb *interrupt_in_urb;
72 73 __u8 interrupt_in_endpointAddress;
73 74  
74   - unsigned char * interrupt_out_buffer;
  75 + unsigned char *interrupt_out_buffer;
75 76 int interrupt_out_size;
76   - struct urb * interrupt_out_urb;
  77 + struct urb *interrupt_out_urb;
77 78 __u8 interrupt_out_endpointAddress;
78 79  
79   - unsigned char * bulk_in_buffer;
  80 + unsigned char *bulk_in_buffer;
80 81 int bulk_in_size;
81   - struct urb * read_urb;
  82 + struct urb *read_urb;
82 83 __u8 bulk_in_endpointAddress;
83 84  
84   - unsigned char * bulk_out_buffer;
  85 + unsigned char *bulk_out_buffer;
85 86 int bulk_out_size;
86   - struct urb * write_urb;
  87 + struct urb *write_urb;
87 88 int write_urb_busy;
88 89 __u8 bulk_out_endpointAddress;
89 90  
90 91  
... ... @@ -98,12 +99,13 @@
98 99 #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
99 100  
100 101 /* get and set the port private data pointer helper functions */
101   -static inline void *usb_get_serial_port_data (struct usb_serial_port *port)
  102 +static inline void *usb_get_serial_port_data(struct usb_serial_port *port)
102 103 {
103 104 return dev_get_drvdata(&port->dev);
104 105 }
105 106  
106   -static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data)
  107 +static inline void usb_set_serial_port_data(struct usb_serial_port *port,
  108 + void *data)
107 109 {
108 110 dev_set_drvdata(&port->dev, data);
109 111 }
... ... @@ -126,9 +128,9 @@
126 128 * usb_set_serial_data() to access this.
127 129 */
128 130 struct usb_serial {
129   - struct usb_device * dev;
130   - struct usb_serial_driver * type;
131   - struct usb_interface * interface;
  131 + struct usb_device *dev;
  132 + struct usb_serial_driver *type;
  133 + struct usb_interface *interface;
132 134 unsigned char disconnected;
133 135 unsigned char minor;
134 136 unsigned char num_ports;
135 137  
136 138  
137 139  
138 140  
... ... @@ -137,30 +139,30 @@
137 139 char num_interrupt_out;
138 140 char num_bulk_in;
139 141 char num_bulk_out;
140   - struct usb_serial_port * port[MAX_NUM_PORTS];
  142 + struct usb_serial_port *port[MAX_NUM_PORTS];
141 143 struct kref kref;
142 144 struct mutex disc_mutex;
143   - void * private;
  145 + void *private;
144 146 };
145 147 #define to_usb_serial(d) container_of(d, struct usb_serial, kref)
146 148  
147 149 #define NUM_DONT_CARE 99
148 150  
149 151 /* get and set the serial private data pointer helper functions */
150   -static inline void *usb_get_serial_data (struct usb_serial *serial)
  152 +static inline void *usb_get_serial_data(struct usb_serial *serial)
151 153 {
152 154 return serial->private;
153 155 }
154 156  
155   -static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
  157 +static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
156 158 {
157 159 serial->private = data;
158 160 }
159 161  
160 162 /**
161 163 * usb_serial_driver - describes a usb serial driver
162   - * @description: pointer to a string that describes this driver. This string used
163   - * in the syslog messages when a device is inserted or removed.
  164 + * @description: pointer to a string that describes this driver. This string
  165 + * used in the syslog messages when a device is inserted or removed.
164 166 * @id_table: pointer to a list of usb_device_id structures that define all
165 167 * of the devices this structure can support.
166 168 * @num_interrupt_in: If a device doesn't have this many interrupt-in
167 169  
168 170  
169 171  
170 172  
171 173  
172 174  
173 175  
174 176  
175 177  
176 178  
177 179  
178 180  
... ... @@ -221,82 +223,91 @@
221 223 struct usb_driver *usb_driver;
222 224 struct usb_dynids dynids;
223 225  
224   - int (*probe) (struct usb_serial *serial, const struct usb_device_id *id);
225   - int (*attach) (struct usb_serial *serial);
  226 + int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
  227 + int (*attach)(struct usb_serial *serial);
226 228 int (*calc_num_ports) (struct usb_serial *serial);
227 229  
228   - void (*shutdown) (struct usb_serial *serial);
  230 + void (*shutdown)(struct usb_serial *serial);
229 231  
230   - int (*port_probe) (struct usb_serial_port *port);
231   - int (*port_remove) (struct usb_serial_port *port);
  232 + int (*port_probe)(struct usb_serial_port *port);
  233 + int (*port_remove)(struct usb_serial_port *port);
232 234  
233   - int (*suspend) (struct usb_serial *serial, pm_message_t message);
234   - int (*resume) (struct usb_serial *serial);
  235 + int (*suspend)(struct usb_serial *serial, pm_message_t message);
  236 + int (*resume)(struct usb_serial *serial);
235 237  
236 238 /* serial function calls */
237   - int (*open) (struct usb_serial_port *port, struct file * filp);
238   - void (*close) (struct usb_serial_port *port, struct file * filp);
239   - int (*write) (struct usb_serial_port *port, const unsigned char *buf, int count);
240   - int (*write_room) (struct usb_serial_port *port);
241   - int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
242   - void (*set_termios) (struct usb_serial_port *port, struct ktermios * old);
243   - void (*break_ctl) (struct usb_serial_port *port, int break_state);
244   - int (*chars_in_buffer) (struct usb_serial_port *port);
245   - void (*throttle) (struct usb_serial_port *port);
246   - void (*unthrottle) (struct usb_serial_port *port);
247   - int (*tiocmget) (struct usb_serial_port *port, struct file *file);
248   - int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear);
  239 + int (*open)(struct usb_serial_port *port, struct file *filp);
  240 + void (*close)(struct usb_serial_port *port, struct file *filp);
  241 + int (*write)(struct usb_serial_port *port, const unsigned char *buf,
  242 + int count);
  243 + int (*write_room)(struct usb_serial_port *port);
  244 + int (*ioctl)(struct usb_serial_port *port, struct file *file,
  245 + unsigned int cmd, unsigned long arg);
  246 + void (*set_termios)(struct usb_serial_port *port, struct ktermios *old);
  247 + void (*break_ctl)(struct usb_serial_port *port, int break_state);
  248 + int (*chars_in_buffer)(struct usb_serial_port *port);
  249 + void (*throttle)(struct usb_serial_port *port);
  250 + void (*unthrottle)(struct usb_serial_port *port);
  251 + int (*tiocmget)(struct usb_serial_port *port, struct file *file);
  252 + int (*tiocmset)(struct usb_serial_port *port, struct file *file,
  253 + unsigned int set, unsigned int clear);
249 254  
250 255 void (*read_int_callback)(struct urb *urb);
251 256 void (*write_int_callback)(struct urb *urb);
252 257 void (*read_bulk_callback)(struct urb *urb);
253 258 void (*write_bulk_callback)(struct urb *urb);
254 259 };
255   -#define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver)
  260 +#define to_usb_serial_driver(d) \
  261 + container_of(d, struct usb_serial_driver, driver)
256 262  
257 263 extern int usb_serial_register(struct usb_serial_driver *driver);
258 264 extern void usb_serial_deregister(struct usb_serial_driver *driver);
259 265 extern void usb_serial_port_softint(struct usb_serial_port *port);
260 266  
261   -extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id);
  267 +extern int usb_serial_probe(struct usb_interface *iface,
  268 + const struct usb_device_id *id);
262 269 extern void usb_serial_disconnect(struct usb_interface *iface);
263 270  
264 271 extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message);
265 272 extern int usb_serial_resume(struct usb_interface *intf);
266 273  
267   -extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest);
268   -extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit);
  274 +extern int ezusb_writememory(struct usb_serial *serial, int address,
  275 + unsigned char *data, int length, __u8 bRequest);
  276 +extern int ezusb_set_reset(struct usb_serial *serial, unsigned char reset_bit);
269 277  
270 278 /* USB Serial console functions */
271 279 #ifdef CONFIG_USB_SERIAL_CONSOLE
272   -extern void usb_serial_console_init (int debug, int minor);
273   -extern void usb_serial_console_exit (void);
  280 +extern void usb_serial_console_init(int debug, int minor);
  281 +extern void usb_serial_console_exit(void);
274 282 extern void usb_serial_console_disconnect(struct usb_serial *serial);
275 283 #else
276   -static inline void usb_serial_console_init (int debug, int minor) { }
277   -static inline void usb_serial_console_exit (void) { }
  284 +static inline void usb_serial_console_init(int debug, int minor) { }
  285 +static inline void usb_serial_console_exit(void) { }
278 286 static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
279 287 #endif
280 288  
281 289 /* Functions needed by other parts of the usbserial core */
282   -extern struct usb_serial *usb_serial_get_by_index (unsigned int minor);
  290 +extern struct usb_serial *usb_serial_get_by_index(unsigned int minor);
283 291 extern void usb_serial_put(struct usb_serial *serial);
284   -extern int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp);
285   -extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count);
286   -extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp);
287   -extern int usb_serial_generic_resume (struct usb_serial *serial);
288   -extern int usb_serial_generic_write_room (struct usb_serial_port *port);
289   -extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port);
290   -extern void usb_serial_generic_read_bulk_callback (struct urb *urb);
291   -extern void usb_serial_generic_write_bulk_callback (struct urb *urb);
292   -extern void usb_serial_generic_throttle (struct usb_serial_port *port);
293   -extern void usb_serial_generic_unthrottle (struct usb_serial_port *port);
294   -extern void usb_serial_generic_shutdown (struct usb_serial *serial);
295   -extern int usb_serial_generic_register (int debug);
296   -extern void usb_serial_generic_deregister (void);
  292 +extern int usb_serial_generic_open(struct usb_serial_port *port,
  293 + struct file *filp);
  294 +extern int usb_serial_generic_write(struct usb_serial_port *port,
  295 + const unsigned char *buf, int count);
  296 +extern void usb_serial_generic_close(struct usb_serial_port *port,
  297 + struct file *filp);
  298 +extern int usb_serial_generic_resume(struct usb_serial *serial);
  299 +extern int usb_serial_generic_write_room(struct usb_serial_port *port);
  300 +extern int usb_serial_generic_chars_in_buffer(struct usb_serial_port *port);
  301 +extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
  302 +extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
  303 +extern void usb_serial_generic_throttle(struct usb_serial_port *port);
  304 +extern void usb_serial_generic_unthrottle(struct usb_serial_port *port);
  305 +extern void usb_serial_generic_shutdown(struct usb_serial *serial);
  306 +extern int usb_serial_generic_register(int debug);
  307 +extern void usb_serial_generic_deregister(void);
297 308  
298   -extern int usb_serial_bus_register (struct usb_serial_driver *device);
299   -extern void usb_serial_bus_deregister (struct usb_serial_driver *device);
  309 +extern int usb_serial_bus_register(struct usb_serial_driver *device);
  310 +extern void usb_serial_bus_deregister(struct usb_serial_driver *device);
300 311  
301 312 extern struct usb_serial_driver usb_serial_generic_device;
302 313 extern struct bus_type usb_serial_bus_type;
303 314  
304 315  
... ... @@ -310,16 +321,22 @@
310 321 int i;
311 322  
312 323 if (debug) {
313   - dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size);
  324 + dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ",
  325 + function, size);
314 326 for (i = 0; i < size; ++i)
315   - printk ("%.2x ", data[i]);
316   - printk ("\n");
  327 + printk("%.2x ", data[i]);
  328 + printk("\n");
317 329 }
318 330 }
319 331  
320 332 /* Use our own dbg macro */
321 333 #undef dbg
322   -#define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0)
  334 +#define dbg(format, arg...) \
  335 + do { \
  336 + if (debug) \
  337 + printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \
  338 + ## arg); \
  339 + } while (0)
323 340  
324 341  
325 342  
include/linux/usb/sl811.h
... ... @@ -19,8 +19,8 @@
19 19 /* pulse sl811 nRST (probably with a GPIO) */
20 20 void (*reset)(struct device *dev);
21 21  
22   - // some boards need something like these:
23   - // int (*check_overcurrent)(struct device *dev);
24   - // void (*clock_enable)(struct device *dev, int is_on);
  22 + /* some boards need something like these: */
  23 + /* int (*check_overcurrent)(struct device *dev); */
  24 + /* void (*clock_enable)(struct device *dev, int is_on); */
25 25 };