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

No logical code changes were made, but checkpatch.pl is much happier now.

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

+113 -91
+113 -91
include/linux/usb.h
··· 162 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 163 164 struct device dev; /* interface specific device info */ 165 - struct device *usb_dev; /* pointer to the usb class's device, if any */ 166 int pm_usage_cnt; /* usage counter for autosuspend */ 167 }; 168 #define to_usb_interface(d) container_of(d, struct usb_interface, dev) 169 #define interface_to_usbdev(intf) \ 170 container_of(intf->dev.parent, struct usb_device, dev) 171 172 - static inline void *usb_get_intfdata (struct usb_interface *intf) 173 { 174 - return dev_get_drvdata (&intf->dev); 175 } 176 177 - static inline void usb_set_intfdata (struct usb_interface *intf, void *data) 178 { 179 dev_set_drvdata(&intf->dev, data); 180 } ··· 275 276 int __usb_get_extra_descriptor(char *buffer, unsigned size, 277 unsigned char type, void **ptr); 278 - #define usb_get_extra_descriptor(ifpoint,type,ptr)\ 279 - __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\ 280 - type,(void**)ptr) 281 282 /* ----------------------------------------------------------------------- */ 283 ··· 389 unsigned can_submit:1; /* URBs may be submitted */ 390 unsigned discon_suspended:1; /* Disconnected while suspended */ 391 unsigned have_langid:1; /* whether string_langid is valid */ 392 - unsigned authorized:1; /* Policy has determined we can use it */ 393 unsigned wusb:1; /* Device is Wireless USB */ 394 int string_langid; /* language ID for strings */ 395 ··· 418 419 int pm_usage_cnt; /* usage counter for autosuspend */ 420 u32 quirks; /* quirks of the whole device */ 421 - atomic_t urbnum; /* number of URBs submitted for the whole device */ 422 423 unsigned long active_duration; /* total time device is not suspended */ 424 ··· 503 /*-------------------------------------------------------------------------*/ 504 505 /* for drivers using iso endpoints */ 506 - extern int usb_get_current_frame_number (struct usb_device *usb_dev); 507 508 /* used these for multi-interface device registration */ 509 extern int usb_driver_claim_interface(struct usb_driver *driver, 510 - struct usb_interface *iface, void* priv); 511 512 /** 513 * usb_interface_claimed - returns true iff an interface is claimed ··· 519 * may need to explicitly claim that lock. 520 * 521 */ 522 - static inline int usb_interface_claimed(struct usb_interface *iface) { 523 return (iface->dev.driver != NULL); 524 } 525 ··· 563 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are 564 * high speed, and a different one if they are full or low speed. 565 */ 566 - static inline int usb_make_path (struct usb_device *dev, char *buf, 567 - size_t size) 568 { 569 int actual; 570 - actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, 571 - dev->devpath); 572 return (actual >= (int)size) ? -1 : actual; 573 } 574 ··· 613 * 614 * Returns true if the endpoint is of type OUT, otherwise it returns false. 615 */ 616 - static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd) 617 { 618 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); 619 } ··· 625 * 626 * Returns true if the endpoint is of type bulk, otherwise it returns false. 627 */ 628 - static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd) 629 { 630 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 631 USB_ENDPOINT_XFER_BULK); ··· 638 * 639 * Returns true if the endpoint is of type control, otherwise it returns false. 640 */ 641 - static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor *epd) 642 { 643 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 644 USB_ENDPOINT_XFER_CONTROL); ··· 652 * Returns true if the endpoint is of type interrupt, otherwise it returns 653 * false. 654 */ 655 - static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd) 656 { 657 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 658 USB_ENDPOINT_XFER_INT); ··· 666 * Returns true if the endpoint is of type isochronous, otherwise it returns 667 * false. 668 */ 669 - static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd) 670 { 671 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 672 USB_ENDPOINT_XFER_ISOC); ··· 680 * Returns true if the endpoint has bulk transfer type and IN direction, 681 * otherwise it returns false. 682 */ 683 - static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd) 684 { 685 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); 686 } ··· 693 * Returns true if the endpoint has bulk transfer type and OUT direction, 694 * otherwise it returns false. 695 */ 696 - static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd) 697 { 698 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); 699 } ··· 706 * Returns true if the endpoint has interrupt transfer type and IN direction, 707 * otherwise it returns false. 708 */ 709 - static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd) 710 { 711 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); 712 } ··· 719 * Returns true if the endpoint has interrupt transfer type and OUT direction, 720 * otherwise it returns false. 721 */ 722 - static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd) 723 { 724 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); 725 } ··· 732 * Returns true if the endpoint has isochronous transfer type and IN direction, 733 * otherwise it returns false. 734 */ 735 - static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd) 736 { 737 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); 738 } ··· 745 * Returns true if the endpoint has isochronous transfer type and OUT direction, 746 * otherwise it returns false. 747 */ 748 - static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd) 749 { 750 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); 751 } ··· 777 * specific device. 778 */ 779 #define USB_DEVICE(vend,prod) \ 780 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \ 781 - .idProduct = (prod) 782 /** 783 * USB_DEVICE_VER - macro used to describe a specific usb device with a 784 * version range ··· 791 * This macro is used to create a struct usb_device_id that matches a 792 * specific device, with a version range. 793 */ 794 - #define USB_DEVICE_VER(vend,prod,lo,hi) \ 795 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \ 796 - .idVendor = (vend), .idProduct = (prod), \ 797 - .bcdDevice_lo = (lo), .bcdDevice_hi = (hi) 798 799 /** 800 * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb ··· 808 * This macro is used to create a struct usb_device_id that matches a 809 * specific interface protocol of devices. 810 */ 811 - #define USB_DEVICE_INTERFACE_PROTOCOL(vend,prod,pr) \ 812 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ 813 .idVendor = (vend), \ 814 .idProduct = (prod), \ 815 .bInterfaceProtocol = (pr) ··· 824 * This macro is used to create a struct usb_device_id that matches a 825 * specific class of devices. 826 */ 827 - #define USB_DEVICE_INFO(cl,sc,pr) \ 828 - .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), \ 829 - .bDeviceSubClass = (sc), .bDeviceProtocol = (pr) 830 831 /** 832 - * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces 833 * @cl: bInterfaceClass value 834 * @sc: bInterfaceSubClass value 835 * @pr: bInterfaceProtocol value ··· 839 * This macro is used to create a struct usb_device_id that matches a 840 * specific class of interfaces. 841 */ 842 - #define USB_INTERFACE_INFO(cl,sc,pr) \ 843 - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \ 844 - .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) 845 846 /** 847 * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device ··· 860 * This is especially useful when explicitly matching devices that have 861 * vendor specific bDeviceClass values, but standards-compliant interfaces. 862 */ 863 - #define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \ 864 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ 865 | USB_DEVICE_ID_MATCH_DEVICE, \ 866 - .idVendor = (vend), .idProduct = (prod), \ 867 .bInterfaceClass = (cl), \ 868 - .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) 869 870 /* ----------------------------------------------------------------------- */ 871 ··· 1145 * transferred. It will normally be the same as requested, unless 1146 * either an error was reported or a short read was performed. 1147 * The URB_SHORT_NOT_OK transfer flag may be used to make such 1148 - * short reads be reported as errors. 1149 * @setup_packet: Only used for control transfers, this points to eight bytes 1150 * of setup data. Control transfers always start by sending this data 1151 * to the device. Then transfer_buffer is read or written, if needed. ··· 1164 * @complete: Completion handler. This URB is passed as the parameter to the 1165 * completion function. The completion function may then do what 1166 * it likes with the URB, including resubmitting or freeing it. 1167 - * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to 1168 * collect the transfer status for each buffer. 1169 * 1170 * This structure identifies USB transfer requests. URBs must be allocated by ··· 1268 * when the urb is owned by the hcd, that is, since the call to 1269 * usb_submit_urb() till the entry into the completion routine. 1270 */ 1271 - struct urb 1272 - { 1273 /* private: usb core and host controller only fields in the urb */ 1274 struct kref kref; /* reference count of the URB */ 1275 void *hcpriv; /* private data for host controller */ ··· 1279 /* public: documented fields in the urb that can be used by drivers */ 1280 struct list_head urb_list; /* list head for use by the urb's 1281 * current owner */ 1282 - struct list_head anchor_list; /* the URB may be anchored by the driver */ 1283 struct usb_anchor *anchor; 1284 struct usb_device *dev; /* (in) pointer to associated device */ 1285 - struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */ 1286 unsigned int pipe; /* (in) pipe information */ 1287 int status; /* (return) non-ISO status */ 1288 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ ··· 1319 * Initializes a control urb with the proper information needed to submit 1320 * it to a device. 1321 */ 1322 - static inline void usb_fill_control_urb (struct urb *urb, 1323 - struct usb_device *dev, 1324 - unsigned int pipe, 1325 - unsigned char *setup_packet, 1326 - void *transfer_buffer, 1327 - int buffer_length, 1328 - usb_complete_t complete_fn, 1329 - void *context) 1330 { 1331 urb->dev = dev; 1332 urb->pipe = pipe; ··· 1350 * Initializes a bulk urb with the proper information needed to submit it 1351 * to a device. 1352 */ 1353 - static inline void usb_fill_bulk_urb (struct urb *urb, 1354 - struct usb_device *dev, 1355 - unsigned int pipe, 1356 - void *transfer_buffer, 1357 - int buffer_length, 1358 - usb_complete_t complete_fn, 1359 - void *context) 1360 { 1361 urb->dev = dev; 1362 urb->pipe = pipe; ··· 1384 * the endpoint interval, and express polling intervals in microframes 1385 * (eight per millisecond) rather than in frames (one per millisecond). 1386 */ 1387 - static inline void usb_fill_int_urb (struct urb *urb, 1388 - struct usb_device *dev, 1389 - unsigned int pipe, 1390 - void *transfer_buffer, 1391 - int buffer_length, 1392 - usb_complete_t complete_fn, 1393 - void *context, 1394 - int interval) 1395 { 1396 urb->dev = dev; 1397 urb->pipe = pipe; ··· 1444 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; 1445 } 1446 1447 - void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1448 gfp_t mem_flags, dma_addr_t *dma); 1449 - void usb_buffer_free (struct usb_device *dev, size_t size, 1450 void *addr, dma_addr_t dma); 1451 1452 #if 0 1453 - struct urb *usb_buffer_map (struct urb *urb); 1454 - void usb_buffer_dmasync (struct urb *urb); 1455 - void usb_buffer_unmap (struct urb *urb); 1456 #endif 1457 1458 struct scatterlist; ··· 1524 int status; 1525 size_t bytes; 1526 1527 - /* 1528 * members below are private: to usbcore, 1529 * and are not provided for driver access! 1530 */ ··· 1542 struct completion complete; 1543 }; 1544 1545 - int usb_sg_init ( 1546 struct usb_sg_request *io, 1547 struct usb_device *dev, 1548 - unsigned pipe, 1549 unsigned period, 1550 struct scatterlist *sg, 1551 int nents, 1552 size_t length, 1553 gfp_t mem_flags 1554 ); 1555 - void usb_sg_cancel (struct usb_sg_request *io); 1556 - void usb_sg_wait (struct usb_sg_request *io); 1557 1558 1559 /* ----------------------------------------------------------------------- */ ··· 1610 1611 /* Create various pipes... */ 1612 #define usb_sndctrlpipe(dev,endpoint) \ 1613 - ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint)) 1614 #define usb_rcvctrlpipe(dev,endpoint) \ 1615 - ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1616 #define usb_sndisocpipe(dev,endpoint) \ 1617 - ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint)) 1618 #define usb_rcvisocpipe(dev,endpoint) \ 1619 - ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1620 #define usb_sndbulkpipe(dev,endpoint) \ 1621 - ((PIPE_BULK << 30) | __create_pipe(dev,endpoint)) 1622 #define usb_rcvbulkpipe(dev,endpoint) \ 1623 - ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1624 #define usb_sndintpipe(dev,endpoint) \ 1625 - ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint)) 1626 #define usb_rcvintpipe(dev,endpoint) \ 1627 - ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1628 1629 /*-------------------------------------------------------------------------*/ 1630
··· 162 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 163 164 struct device dev; /* interface specific device info */ 165 + struct device *usb_dev; 166 int pm_usage_cnt; /* usage counter for autosuspend */ 167 }; 168 #define to_usb_interface(d) container_of(d, struct usb_interface, dev) 169 #define interface_to_usbdev(intf) \ 170 container_of(intf->dev.parent, struct usb_device, dev) 171 172 + static inline void *usb_get_intfdata(struct usb_interface *intf) 173 { 174 + return dev_get_drvdata(&intf->dev); 175 } 176 177 + static inline void usb_set_intfdata(struct usb_interface *intf, void *data) 178 { 179 dev_set_drvdata(&intf->dev, data); 180 } ··· 275 276 int __usb_get_extra_descriptor(char *buffer, unsigned size, 277 unsigned char type, void **ptr); 278 + #define usb_get_extra_descriptor(ifpoint, type, ptr) \ 279 + __usb_get_extra_descriptor((ifpoint)->extra, \ 280 + (ifpoint)->extralen, \ 281 + type, (void **)ptr) 282 283 /* ----------------------------------------------------------------------- */ 284 ··· 388 unsigned can_submit:1; /* URBs may be submitted */ 389 unsigned discon_suspended:1; /* Disconnected while suspended */ 390 unsigned have_langid:1; /* whether string_langid is valid */ 391 + unsigned authorized:1; /* Policy has said we can use it */ 392 unsigned wusb:1; /* Device is Wireless USB */ 393 int string_langid; /* language ID for strings */ 394 ··· 417 418 int pm_usage_cnt; /* usage counter for autosuspend */ 419 u32 quirks; /* quirks of the whole device */ 420 + atomic_t urbnum; /* number of URBs submitted for 421 + the whole device */ 422 423 unsigned long active_duration; /* total time device is not suspended */ 424 ··· 501 /*-------------------------------------------------------------------------*/ 502 503 /* for drivers using iso endpoints */ 504 + extern int usb_get_current_frame_number(struct usb_device *usb_dev); 505 506 /* used these for multi-interface device registration */ 507 extern int usb_driver_claim_interface(struct usb_driver *driver, 508 + struct usb_interface *iface, void *priv); 509 510 /** 511 * usb_interface_claimed - returns true iff an interface is claimed ··· 517 * may need to explicitly claim that lock. 518 * 519 */ 520 + static inline int usb_interface_claimed(struct usb_interface *iface) 521 + { 522 return (iface->dev.driver != NULL); 523 } 524 ··· 560 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are 561 * high speed, and a different one if they are full or low speed. 562 */ 563 + static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size) 564 { 565 int actual; 566 + actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name, 567 + dev->devpath); 568 return (actual >= (int)size) ? -1 : actual; 569 } 570 ··· 611 * 612 * Returns true if the endpoint is of type OUT, otherwise it returns false. 613 */ 614 + static inline int usb_endpoint_dir_out( 615 + const struct usb_endpoint_descriptor *epd) 616 { 617 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); 618 } ··· 622 * 623 * Returns true if the endpoint is of type bulk, otherwise it returns false. 624 */ 625 + static inline int usb_endpoint_xfer_bulk( 626 + const struct usb_endpoint_descriptor *epd) 627 { 628 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 629 USB_ENDPOINT_XFER_BULK); ··· 634 * 635 * Returns true if the endpoint is of type control, otherwise it returns false. 636 */ 637 + static inline int usb_endpoint_xfer_control( 638 + const struct usb_endpoint_descriptor *epd) 639 { 640 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 641 USB_ENDPOINT_XFER_CONTROL); ··· 647 * Returns true if the endpoint is of type interrupt, otherwise it returns 648 * false. 649 */ 650 + static inline int usb_endpoint_xfer_int( 651 + const struct usb_endpoint_descriptor *epd) 652 { 653 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 654 USB_ENDPOINT_XFER_INT); ··· 660 * Returns true if the endpoint is of type isochronous, otherwise it returns 661 * false. 662 */ 663 + static inline int usb_endpoint_xfer_isoc( 664 + const struct usb_endpoint_descriptor *epd) 665 { 666 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 667 USB_ENDPOINT_XFER_ISOC); ··· 673 * Returns true if the endpoint has bulk transfer type and IN direction, 674 * otherwise it returns false. 675 */ 676 + static inline int usb_endpoint_is_bulk_in( 677 + const struct usb_endpoint_descriptor *epd) 678 { 679 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); 680 } ··· 685 * Returns true if the endpoint has bulk transfer type and OUT direction, 686 * otherwise it returns false. 687 */ 688 + static inline int usb_endpoint_is_bulk_out( 689 + const struct usb_endpoint_descriptor *epd) 690 { 691 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); 692 } ··· 697 * Returns true if the endpoint has interrupt transfer type and IN direction, 698 * otherwise it returns false. 699 */ 700 + static inline int usb_endpoint_is_int_in( 701 + const struct usb_endpoint_descriptor *epd) 702 { 703 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); 704 } ··· 709 * Returns true if the endpoint has interrupt transfer type and OUT direction, 710 * otherwise it returns false. 711 */ 712 + static inline int usb_endpoint_is_int_out( 713 + const struct usb_endpoint_descriptor *epd) 714 { 715 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); 716 } ··· 721 * Returns true if the endpoint has isochronous transfer type and IN direction, 722 * otherwise it returns false. 723 */ 724 + static inline int usb_endpoint_is_isoc_in( 725 + const struct usb_endpoint_descriptor *epd) 726 { 727 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); 728 } ··· 733 * Returns true if the endpoint has isochronous transfer type and OUT direction, 734 * otherwise it returns false. 735 */ 736 + static inline int usb_endpoint_is_isoc_out( 737 + const struct usb_endpoint_descriptor *epd) 738 { 739 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); 740 } ··· 764 * specific device. 765 */ 766 #define USB_DEVICE(vend,prod) \ 767 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ 768 + .idVendor = (vend), \ 769 + .idProduct = (prod) 770 /** 771 * USB_DEVICE_VER - macro used to describe a specific usb device with a 772 * version range ··· 777 * This macro is used to create a struct usb_device_id that matches a 778 * specific device, with a version range. 779 */ 780 + #define USB_DEVICE_VER(vend, prod, lo, hi) \ 781 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \ 782 + .idVendor = (vend), \ 783 + .idProduct = (prod), \ 784 + .bcdDevice_lo = (lo), \ 785 + .bcdDevice_hi = (hi) 786 787 /** 788 * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb ··· 792 * This macro is used to create a struct usb_device_id that matches a 793 * specific interface protocol of devices. 794 */ 795 + #define USB_DEVICE_INTERFACE_PROTOCOL(vend, prod, pr) \ 796 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ 797 + USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ 798 .idVendor = (vend), \ 799 .idProduct = (prod), \ 800 .bInterfaceProtocol = (pr) ··· 807 * This macro is used to create a struct usb_device_id that matches a 808 * specific class of devices. 809 */ 810 + #define USB_DEVICE_INFO(cl, sc, pr) \ 811 + .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, \ 812 + .bDeviceClass = (cl), \ 813 + .bDeviceSubClass = (sc), \ 814 + .bDeviceProtocol = (pr) 815 816 /** 817 + * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces 818 * @cl: bInterfaceClass value 819 * @sc: bInterfaceSubClass value 820 * @pr: bInterfaceProtocol value ··· 820 * This macro is used to create a struct usb_device_id that matches a 821 * specific class of interfaces. 822 */ 823 + #define USB_INTERFACE_INFO(cl, sc, pr) \ 824 + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \ 825 + .bInterfaceClass = (cl), \ 826 + .bInterfaceSubClass = (sc), \ 827 + .bInterfaceProtocol = (pr) 828 829 /** 830 * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device ··· 839 * This is especially useful when explicitly matching devices that have 840 * vendor specific bDeviceClass values, but standards-compliant interfaces. 841 */ 842 + #define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \ 843 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ 844 | USB_DEVICE_ID_MATCH_DEVICE, \ 845 + .idVendor = (vend), \ 846 + .idProduct = (prod), \ 847 .bInterfaceClass = (cl), \ 848 + .bInterfaceSubClass = (sc), \ 849 + .bInterfaceProtocol = (pr) 850 851 /* ----------------------------------------------------------------------- */ 852 ··· 1122 * transferred. It will normally be the same as requested, unless 1123 * either an error was reported or a short read was performed. 1124 * The URB_SHORT_NOT_OK transfer flag may be used to make such 1125 + * short reads be reported as errors. 1126 * @setup_packet: Only used for control transfers, this points to eight bytes 1127 * of setup data. Control transfers always start by sending this data 1128 * to the device. Then transfer_buffer is read or written, if needed. ··· 1141 * @complete: Completion handler. This URB is passed as the parameter to the 1142 * completion function. The completion function may then do what 1143 * it likes with the URB, including resubmitting or freeing it. 1144 + * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to 1145 * collect the transfer status for each buffer. 1146 * 1147 * This structure identifies USB transfer requests. URBs must be allocated by ··· 1245 * when the urb is owned by the hcd, that is, since the call to 1246 * usb_submit_urb() till the entry into the completion routine. 1247 */ 1248 + struct urb { 1249 /* private: usb core and host controller only fields in the urb */ 1250 struct kref kref; /* reference count of the URB */ 1251 void *hcpriv; /* private data for host controller */ ··· 1257 /* public: documented fields in the urb that can be used by drivers */ 1258 struct list_head urb_list; /* list head for use by the urb's 1259 * current owner */ 1260 + struct list_head anchor_list; /* the URB may be anchored */ 1261 struct usb_anchor *anchor; 1262 struct usb_device *dev; /* (in) pointer to associated device */ 1263 + struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ 1264 unsigned int pipe; /* (in) pipe information */ 1265 int status; /* (return) non-ISO status */ 1266 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ ··· 1297 * Initializes a control urb with the proper information needed to submit 1298 * it to a device. 1299 */ 1300 + static inline void usb_fill_control_urb(struct urb *urb, 1301 + struct usb_device *dev, 1302 + unsigned int pipe, 1303 + unsigned char *setup_packet, 1304 + void *transfer_buffer, 1305 + int buffer_length, 1306 + usb_complete_t complete_fn, 1307 + void *context) 1308 { 1309 urb->dev = dev; 1310 urb->pipe = pipe; ··· 1328 * Initializes a bulk urb with the proper information needed to submit it 1329 * to a device. 1330 */ 1331 + static inline void usb_fill_bulk_urb(struct urb *urb, 1332 + struct usb_device *dev, 1333 + unsigned int pipe, 1334 + void *transfer_buffer, 1335 + int buffer_length, 1336 + usb_complete_t complete_fn, 1337 + void *context) 1338 { 1339 urb->dev = dev; 1340 urb->pipe = pipe; ··· 1362 * the endpoint interval, and express polling intervals in microframes 1363 * (eight per millisecond) rather than in frames (one per millisecond). 1364 */ 1365 + static inline void usb_fill_int_urb(struct urb *urb, 1366 + struct usb_device *dev, 1367 + unsigned int pipe, 1368 + void *transfer_buffer, 1369 + int buffer_length, 1370 + usb_complete_t complete_fn, 1371 + void *context, 1372 + int interval) 1373 { 1374 urb->dev = dev; 1375 urb->pipe = pipe; ··· 1422 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; 1423 } 1424 1425 + void *usb_buffer_alloc(struct usb_device *dev, size_t size, 1426 gfp_t mem_flags, dma_addr_t *dma); 1427 + void usb_buffer_free(struct usb_device *dev, size_t size, 1428 void *addr, dma_addr_t dma); 1429 1430 #if 0 1431 + struct urb *usb_buffer_map(struct urb *urb); 1432 + void usb_buffer_dmasync(struct urb *urb); 1433 + void usb_buffer_unmap(struct urb *urb); 1434 #endif 1435 1436 struct scatterlist; ··· 1502 int status; 1503 size_t bytes; 1504 1505 + /* 1506 * members below are private: to usbcore, 1507 * and are not provided for driver access! 1508 */ ··· 1520 struct completion complete; 1521 }; 1522 1523 + int usb_sg_init( 1524 struct usb_sg_request *io, 1525 struct usb_device *dev, 1526 + unsigned pipe, 1527 unsigned period, 1528 struct scatterlist *sg, 1529 int nents, 1530 size_t length, 1531 gfp_t mem_flags 1532 ); 1533 + void usb_sg_cancel(struct usb_sg_request *io); 1534 + void usb_sg_wait(struct usb_sg_request *io); 1535 1536 1537 /* ----------------------------------------------------------------------- */ ··· 1588 1589 /* Create various pipes... */ 1590 #define usb_sndctrlpipe(dev,endpoint) \ 1591 + ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint)) 1592 #define usb_rcvctrlpipe(dev,endpoint) \ 1593 + ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1594 #define usb_sndisocpipe(dev,endpoint) \ 1595 + ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint)) 1596 #define usb_rcvisocpipe(dev,endpoint) \ 1597 + ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1598 #define usb_sndbulkpipe(dev,endpoint) \ 1599 + ((PIPE_BULK << 30) | __create_pipe(dev, endpoint)) 1600 #define usb_rcvbulkpipe(dev,endpoint) \ 1601 + ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1602 #define usb_sndintpipe(dev,endpoint) \ 1603 + ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint)) 1604 #define usb_rcvintpipe(dev,endpoint) \ 1605 + ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1606 1607 /*-------------------------------------------------------------------------*/ 1608