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>

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