diff options
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r-- | include/linux/usb.h | 156 |
1 files changed, 124 insertions, 32 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index d2bd0c8e0154..0da15b0b02be 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/fs.h> /* for struct file_operations */ | 19 | #include <linux/fs.h> /* for struct file_operations */ |
20 | #include <linux/completion.h> /* for struct completion */ | 20 | #include <linux/completion.h> /* for struct completion */ |
21 | #include <linux/sched.h> /* for current && schedule_timeout */ | 21 | #include <linux/sched.h> /* for current && schedule_timeout */ |
22 | #include <linux/mutex.h> /* for struct mutex */ | ||
22 | 23 | ||
23 | struct usb_device; | 24 | struct usb_device; |
24 | struct usb_driver; | 25 | struct usb_driver; |
@@ -102,8 +103,13 @@ enum usb_interface_condition { | |||
102 | * number from the USB core by calling usb_register_dev(). | 103 | * number from the USB core by calling usb_register_dev(). |
103 | * @condition: binding state of the interface: not bound, binding | 104 | * @condition: binding state of the interface: not bound, binding |
104 | * (in probe()), bound to a driver, or unbinding (in disconnect()) | 105 | * (in probe()), bound to a driver, or unbinding (in disconnect()) |
106 | * @is_active: flag set when the interface is bound and not suspended. | ||
107 | * @needs_remote_wakeup: flag set when the driver requires remote-wakeup | ||
108 | * capability during autosuspend. | ||
105 | * @dev: driver model's view of this device | 109 | * @dev: driver model's view of this device |
106 | * @class_dev: driver model's class view of this device. | 110 | * @class_dev: driver model's class view of this device. |
111 | * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not | ||
112 | * allowed unless the counter is 0. | ||
107 | * | 113 | * |
108 | * USB device drivers attach to interfaces on a physical device. Each | 114 | * USB device drivers attach to interfaces on a physical device. Each |
109 | * interface encapsulates a single high level function, such as feeding | 115 | * interface encapsulates a single high level function, such as feeding |
@@ -142,8 +148,12 @@ struct usb_interface { | |||
142 | int minor; /* minor number this interface is | 148 | int minor; /* minor number this interface is |
143 | * bound to */ | 149 | * bound to */ |
144 | enum usb_interface_condition condition; /* state of binding */ | 150 | enum usb_interface_condition condition; /* state of binding */ |
151 | unsigned is_active:1; /* the interface is not suspended */ | ||
152 | unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ | ||
153 | |||
145 | struct device dev; /* interface specific device info */ | 154 | struct device dev; /* interface specific device info */ |
146 | struct class_device *class_dev; | 155 | struct class_device *class_dev; |
156 | int pm_usage_cnt; /* usage counter for autosuspend */ | ||
147 | }; | 157 | }; |
148 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) | 158 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) |
149 | #define interface_to_usbdev(intf) \ | 159 | #define interface_to_usbdev(intf) \ |
@@ -254,8 +264,6 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, | |||
254 | 264 | ||
255 | /* ----------------------------------------------------------------------- */ | 265 | /* ----------------------------------------------------------------------- */ |
256 | 266 | ||
257 | struct usb_operations; | ||
258 | |||
259 | /* USB device number allocation bitmap */ | 267 | /* USB device number allocation bitmap */ |
260 | struct usb_devmap { | 268 | struct usb_devmap { |
261 | unsigned long devicemap[128 / (8*sizeof(unsigned long))]; | 269 | unsigned long devicemap[128 / (8*sizeof(unsigned long))]; |
@@ -268,6 +276,7 @@ struct usb_bus { | |||
268 | struct device *controller; /* host/master side hardware */ | 276 | struct device *controller; /* host/master side hardware */ |
269 | int busnum; /* Bus number (in order of reg) */ | 277 | int busnum; /* Bus number (in order of reg) */ |
270 | char *bus_name; /* stable id (PCI slot_name etc) */ | 278 | char *bus_name; /* stable id (PCI slot_name etc) */ |
279 | u8 uses_dma; /* Does the host controller use DMA? */ | ||
271 | u8 otg_port; /* 0, or number of OTG/HNP port */ | 280 | u8 otg_port; /* 0, or number of OTG/HNP port */ |
272 | unsigned is_b_host:1; /* true during some HNP roleswitches */ | 281 | unsigned is_b_host:1; /* true during some HNP roleswitches */ |
273 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ | 282 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ |
@@ -276,10 +285,8 @@ struct usb_bus { | |||
276 | * round-robin allocation */ | 285 | * round-robin allocation */ |
277 | 286 | ||
278 | struct usb_devmap devmap; /* device address allocation map */ | 287 | struct usb_devmap devmap; /* device address allocation map */ |
279 | struct usb_operations *op; /* Operations (specific to the HC) */ | ||
280 | struct usb_device *root_hub; /* Root hub */ | 288 | struct usb_device *root_hub; /* Root hub */ |
281 | struct list_head bus_list; /* list of busses */ | 289 | struct list_head bus_list; /* list of busses */ |
282 | void *hcpriv; /* Host Controller private data */ | ||
283 | 290 | ||
284 | int bandwidth_allocated; /* on this bus: how much of the time | 291 | int bandwidth_allocated; /* on this bus: how much of the time |
285 | * reserved for periodic (intr/iso) | 292 | * reserved for periodic (intr/iso) |
@@ -294,8 +301,6 @@ struct usb_bus { | |||
294 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ | 301 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ |
295 | 302 | ||
296 | struct class_device *class_dev; /* class device for this bus */ | 303 | struct class_device *class_dev; /* class device for this bus */ |
297 | struct kref kref; /* reference counting for this bus */ | ||
298 | void (*release)(struct usb_bus *bus); | ||
299 | 304 | ||
300 | #if defined(CONFIG_USB_MON) | 305 | #if defined(CONFIG_USB_MON) |
301 | struct mon_bus *mon_bus; /* non-null when associated */ | 306 | struct mon_bus *mon_bus; /* non-null when associated */ |
@@ -350,6 +355,7 @@ struct usb_device { | |||
350 | 355 | ||
351 | unsigned short bus_mA; /* Current available from the bus */ | 356 | unsigned short bus_mA; /* Current available from the bus */ |
352 | u8 portnum; /* Parent port number (origin 1) */ | 357 | u8 portnum; /* Parent port number (origin 1) */ |
358 | u8 level; /* Number of USB hub ancestors */ | ||
353 | 359 | ||
354 | int have_langid; /* whether string_langid is valid */ | 360 | int have_langid; /* whether string_langid is valid */ |
355 | int string_langid; /* language ID for strings */ | 361 | int string_langid; /* language ID for strings */ |
@@ -373,6 +379,15 @@ struct usb_device { | |||
373 | 379 | ||
374 | int maxchild; /* Number of ports if hub */ | 380 | int maxchild; /* Number of ports if hub */ |
375 | struct usb_device *children[USB_MAXCHILDREN]; | 381 | struct usb_device *children[USB_MAXCHILDREN]; |
382 | |||
383 | #ifdef CONFIG_PM | ||
384 | struct work_struct autosuspend; /* for delayed autosuspends */ | ||
385 | struct mutex pm_mutex; /* protects PM operations */ | ||
386 | int pm_usage_cnt; /* usage counter for autosuspend */ | ||
387 | |||
388 | unsigned auto_pm:1; /* autosuspend/resume in progress */ | ||
389 | unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ | ||
390 | #endif | ||
376 | }; | 391 | }; |
377 | #define to_usb_device(d) container_of(d, struct usb_device, dev) | 392 | #define to_usb_device(d) container_of(d, struct usb_device, dev) |
378 | 393 | ||
@@ -384,7 +399,7 @@ extern void usb_put_dev(struct usb_device *dev); | |||
384 | #define usb_unlock_device(udev) up(&(udev)->dev.sem) | 399 | #define usb_unlock_device(udev) up(&(udev)->dev.sem) |
385 | #define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) | 400 | #define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) |
386 | extern int usb_lock_device_for_reset(struct usb_device *udev, | 401 | extern int usb_lock_device_for_reset(struct usb_device *udev, |
387 | struct usb_interface *iface); | 402 | const struct usb_interface *iface); |
388 | 403 | ||
389 | /* USB port reset for device reinitialization */ | 404 | /* USB port reset for device reinitialization */ |
390 | extern int usb_reset_device(struct usb_device *dev); | 405 | extern int usb_reset_device(struct usb_device *dev); |
@@ -393,6 +408,17 @@ extern int usb_reset_composite_device(struct usb_device *dev, | |||
393 | 408 | ||
394 | extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); | 409 | extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); |
395 | 410 | ||
411 | /* USB autosuspend and autoresume */ | ||
412 | #ifdef CONFIG_USB_SUSPEND | ||
413 | extern int usb_autopm_get_interface(struct usb_interface *intf); | ||
414 | extern void usb_autopm_put_interface(struct usb_interface *intf); | ||
415 | |||
416 | #else | ||
417 | #define usb_autopm_get_interface(intf) 0 | ||
418 | #define usb_autopm_put_interface(intf) do {} while (0) | ||
419 | #endif | ||
420 | |||
421 | |||
396 | /*-------------------------------------------------------------------------*/ | 422 | /*-------------------------------------------------------------------------*/ |
397 | 423 | ||
398 | /* for drivers using iso endpoints */ | 424 | /* for drivers using iso endpoints */ |
@@ -423,10 +449,10 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface, | |||
423 | 449 | ||
424 | extern struct usb_interface *usb_find_interface(struct usb_driver *drv, | 450 | extern struct usb_interface *usb_find_interface(struct usb_driver *drv, |
425 | int minor); | 451 | int minor); |
426 | extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, | 452 | extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev, |
427 | unsigned ifnum); | 453 | unsigned ifnum); |
428 | extern struct usb_host_interface *usb_altnum_to_altsetting( | 454 | extern struct usb_host_interface *usb_altnum_to_altsetting( |
429 | struct usb_interface *intf, unsigned int altnum); | 455 | const struct usb_interface *intf, unsigned int altnum); |
430 | 456 | ||
431 | 457 | ||
432 | /** | 458 | /** |
@@ -464,6 +490,20 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, | |||
464 | 490 | ||
465 | /*-------------------------------------------------------------------------*/ | 491 | /*-------------------------------------------------------------------------*/ |
466 | 492 | ||
493 | extern int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd); | ||
494 | extern int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd); | ||
495 | extern int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd); | ||
496 | extern int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd); | ||
497 | extern int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd); | ||
498 | extern int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd); | ||
499 | extern int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd); | ||
500 | extern int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd); | ||
501 | extern int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd); | ||
502 | extern int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd); | ||
503 | extern int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd); | ||
504 | |||
505 | /*-------------------------------------------------------------------------*/ | ||
506 | |||
467 | #define USB_DEVICE_ID_MATCH_DEVICE \ | 507 | #define USB_DEVICE_ID_MATCH_DEVICE \ |
468 | (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) | 508 | (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) |
469 | #define USB_DEVICE_ID_MATCH_DEV_RANGE \ | 509 | #define USB_DEVICE_ID_MATCH_DEV_RANGE \ |
@@ -540,7 +580,17 @@ struct usb_dynids { | |||
540 | }; | 580 | }; |
541 | 581 | ||
542 | /** | 582 | /** |
543 | * struct usb_driver - identifies USB driver to usbcore | 583 | * struct usbdrv_wrap - wrapper for driver-model structure |
584 | * @driver: The driver-model core driver structure. | ||
585 | * @for_devices: Non-zero for device drivers, 0 for interface drivers. | ||
586 | */ | ||
587 | struct usbdrv_wrap { | ||
588 | struct device_driver driver; | ||
589 | int for_devices; | ||
590 | }; | ||
591 | |||
592 | /** | ||
593 | * struct usb_driver - identifies USB interface driver to usbcore | ||
544 | * @name: The driver name should be unique among USB drivers, | 594 | * @name: The driver name should be unique among USB drivers, |
545 | * and should normally be the same as the module name. | 595 | * and should normally be the same as the module name. |
546 | * @probe: Called to see if the driver is willing to manage a particular | 596 | * @probe: Called to see if the driver is willing to manage a particular |
@@ -567,12 +617,14 @@ struct usb_dynids { | |||
567 | * or your driver's probe function will never get called. | 617 | * or your driver's probe function will never get called. |
568 | * @dynids: used internally to hold the list of dynamically added device | 618 | * @dynids: used internally to hold the list of dynamically added device |
569 | * ids for this driver. | 619 | * ids for this driver. |
570 | * @driver: the driver model core driver structure. | 620 | * @drvwrap: Driver-model core structure wrapper. |
571 | * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be | 621 | * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be |
572 | * added to this driver by preventing the sysfs file from being created. | 622 | * added to this driver by preventing the sysfs file from being created. |
623 | * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend | ||
624 | * for interfaces bound to this driver. | ||
573 | * | 625 | * |
574 | * USB drivers must provide a name, probe() and disconnect() methods, | 626 | * USB interface drivers must provide a name, probe() and disconnect() |
575 | * and an id_table. Other driver fields are optional. | 627 | * methods, and an id_table. Other driver fields are optional. |
576 | * | 628 | * |
577 | * The id_table is used in hotplugging. It holds a set of descriptors, | 629 | * The id_table is used in hotplugging. It holds a set of descriptors, |
578 | * and specialized data may be associated with each entry. That table | 630 | * and specialized data may be associated with each entry. That table |
@@ -606,10 +658,44 @@ struct usb_driver { | |||
606 | const struct usb_device_id *id_table; | 658 | const struct usb_device_id *id_table; |
607 | 659 | ||
608 | struct usb_dynids dynids; | 660 | struct usb_dynids dynids; |
609 | struct device_driver driver; | 661 | struct usbdrv_wrap drvwrap; |
610 | unsigned int no_dynamic_id:1; | 662 | unsigned int no_dynamic_id:1; |
663 | unsigned int supports_autosuspend:1; | ||
611 | }; | 664 | }; |
612 | #define to_usb_driver(d) container_of(d, struct usb_driver, driver) | 665 | #define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver) |
666 | |||
667 | /** | ||
668 | * struct usb_device_driver - identifies USB device driver to usbcore | ||
669 | * @name: The driver name should be unique among USB drivers, | ||
670 | * and should normally be the same as the module name. | ||
671 | * @probe: Called to see if the driver is willing to manage a particular | ||
672 | * device. If it is, probe returns zero and uses dev_set_drvdata() | ||
673 | * to associate driver-specific data with the device. If unwilling | ||
674 | * to manage the device, return a negative errno value. | ||
675 | * @disconnect: Called when the device is no longer accessible, usually | ||
676 | * because it has been (or is being) disconnected or the driver's | ||
677 | * module is being unloaded. | ||
678 | * @suspend: Called when the device is going to be suspended by the system. | ||
679 | * @resume: Called when the device is being resumed by the system. | ||
680 | * @drvwrap: Driver-model core structure wrapper. | ||
681 | * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend | ||
682 | * for devices bound to this driver. | ||
683 | * | ||
684 | * USB drivers must provide all the fields listed above except drvwrap. | ||
685 | */ | ||
686 | struct usb_device_driver { | ||
687 | const char *name; | ||
688 | |||
689 | int (*probe) (struct usb_device *udev); | ||
690 | void (*disconnect) (struct usb_device *udev); | ||
691 | |||
692 | int (*suspend) (struct usb_device *udev, pm_message_t message); | ||
693 | int (*resume) (struct usb_device *udev); | ||
694 | struct usbdrv_wrap drvwrap; | ||
695 | unsigned int supports_autosuspend:1; | ||
696 | }; | ||
697 | #define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \ | ||
698 | drvwrap.driver) | ||
613 | 699 | ||
614 | extern struct bus_type usb_bus_type; | 700 | extern struct bus_type usb_bus_type; |
615 | 701 | ||
@@ -633,13 +719,17 @@ struct usb_class_driver { | |||
633 | * use these in module_init()/module_exit() | 719 | * use these in module_init()/module_exit() |
634 | * and don't forget MODULE_DEVICE_TABLE(usb, ...) | 720 | * and don't forget MODULE_DEVICE_TABLE(usb, ...) |
635 | */ | 721 | */ |
636 | int usb_register_driver(struct usb_driver *, struct module *); | 722 | extern int usb_register_driver(struct usb_driver *, struct module *); |
637 | static inline int usb_register(struct usb_driver *driver) | 723 | static inline int usb_register(struct usb_driver *driver) |
638 | { | 724 | { |
639 | return usb_register_driver(driver, THIS_MODULE); | 725 | return usb_register_driver(driver, THIS_MODULE); |
640 | } | 726 | } |
641 | extern void usb_deregister(struct usb_driver *); | 727 | extern void usb_deregister(struct usb_driver *); |
642 | 728 | ||
729 | extern int usb_register_device_driver(struct usb_device_driver *, | ||
730 | struct module *); | ||
731 | extern void usb_deregister_device_driver(struct usb_device_driver *); | ||
732 | |||
643 | extern int usb_register_dev(struct usb_interface *intf, | 733 | extern int usb_register_dev(struct usb_interface *intf, |
644 | struct usb_class_driver *class_driver); | 734 | struct usb_class_driver *class_driver); |
645 | extern void usb_deregister_dev(struct usb_interface *intf, | 735 | extern void usb_deregister_dev(struct usb_interface *intf, |
@@ -885,7 +975,7 @@ struct urb | |||
885 | * @setup_packet: pointer to the setup_packet buffer | 975 | * @setup_packet: pointer to the setup_packet buffer |
886 | * @transfer_buffer: pointer to the transfer buffer | 976 | * @transfer_buffer: pointer to the transfer buffer |
887 | * @buffer_length: length of the transfer buffer | 977 | * @buffer_length: length of the transfer buffer |
888 | * @complete: pointer to the usb_complete_t function | 978 | * @complete_fn: pointer to the usb_complete_t function |
889 | * @context: what to set the urb context to. | 979 | * @context: what to set the urb context to. |
890 | * | 980 | * |
891 | * Initializes a control urb with the proper information needed to submit | 981 | * Initializes a control urb with the proper information needed to submit |
@@ -897,7 +987,7 @@ static inline void usb_fill_control_urb (struct urb *urb, | |||
897 | unsigned char *setup_packet, | 987 | unsigned char *setup_packet, |
898 | void *transfer_buffer, | 988 | void *transfer_buffer, |
899 | int buffer_length, | 989 | int buffer_length, |
900 | usb_complete_t complete, | 990 | usb_complete_t complete_fn, |
901 | void *context) | 991 | void *context) |
902 | { | 992 | { |
903 | spin_lock_init(&urb->lock); | 993 | spin_lock_init(&urb->lock); |
@@ -906,7 +996,7 @@ static inline void usb_fill_control_urb (struct urb *urb, | |||
906 | urb->setup_packet = setup_packet; | 996 | urb->setup_packet = setup_packet; |
907 | urb->transfer_buffer = transfer_buffer; | 997 | urb->transfer_buffer = transfer_buffer; |
908 | urb->transfer_buffer_length = buffer_length; | 998 | urb->transfer_buffer_length = buffer_length; |
909 | urb->complete = complete; | 999 | urb->complete = complete_fn; |
910 | urb->context = context; | 1000 | urb->context = context; |
911 | } | 1001 | } |
912 | 1002 | ||
@@ -917,7 +1007,7 @@ static inline void usb_fill_control_urb (struct urb *urb, | |||
917 | * @pipe: the endpoint pipe | 1007 | * @pipe: the endpoint pipe |
918 | * @transfer_buffer: pointer to the transfer buffer | 1008 | * @transfer_buffer: pointer to the transfer buffer |
919 | * @buffer_length: length of the transfer buffer | 1009 | * @buffer_length: length of the transfer buffer |
920 | * @complete: pointer to the usb_complete_t function | 1010 | * @complete_fn: pointer to the usb_complete_t function |
921 | * @context: what to set the urb context to. | 1011 | * @context: what to set the urb context to. |
922 | * | 1012 | * |
923 | * Initializes a bulk urb with the proper information needed to submit it | 1013 | * Initializes a bulk urb with the proper information needed to submit it |
@@ -928,7 +1018,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb, | |||
928 | unsigned int pipe, | 1018 | unsigned int pipe, |
929 | void *transfer_buffer, | 1019 | void *transfer_buffer, |
930 | int buffer_length, | 1020 | int buffer_length, |
931 | usb_complete_t complete, | 1021 | usb_complete_t complete_fn, |
932 | void *context) | 1022 | void *context) |
933 | { | 1023 | { |
934 | spin_lock_init(&urb->lock); | 1024 | spin_lock_init(&urb->lock); |
@@ -936,7 +1026,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb, | |||
936 | urb->pipe = pipe; | 1026 | urb->pipe = pipe; |
937 | urb->transfer_buffer = transfer_buffer; | 1027 | urb->transfer_buffer = transfer_buffer; |
938 | urb->transfer_buffer_length = buffer_length; | 1028 | urb->transfer_buffer_length = buffer_length; |
939 | urb->complete = complete; | 1029 | urb->complete = complete_fn; |
940 | urb->context = context; | 1030 | urb->context = context; |
941 | } | 1031 | } |
942 | 1032 | ||
@@ -947,7 +1037,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb, | |||
947 | * @pipe: the endpoint pipe | 1037 | * @pipe: the endpoint pipe |
948 | * @transfer_buffer: pointer to the transfer buffer | 1038 | * @transfer_buffer: pointer to the transfer buffer |
949 | * @buffer_length: length of the transfer buffer | 1039 | * @buffer_length: length of the transfer buffer |
950 | * @complete: pointer to the usb_complete_t function | 1040 | * @complete_fn: pointer to the usb_complete_t function |
951 | * @context: what to set the urb context to. | 1041 | * @context: what to set the urb context to. |
952 | * @interval: what to set the urb interval to, encoded like | 1042 | * @interval: what to set the urb interval to, encoded like |
953 | * the endpoint descriptor's bInterval value. | 1043 | * the endpoint descriptor's bInterval value. |
@@ -963,7 +1053,7 @@ static inline void usb_fill_int_urb (struct urb *urb, | |||
963 | unsigned int pipe, | 1053 | unsigned int pipe, |
964 | void *transfer_buffer, | 1054 | void *transfer_buffer, |
965 | int buffer_length, | 1055 | int buffer_length, |
966 | usb_complete_t complete, | 1056 | usb_complete_t complete_fn, |
967 | void *context, | 1057 | void *context, |
968 | int interval) | 1058 | int interval) |
969 | { | 1059 | { |
@@ -972,7 +1062,7 @@ static inline void usb_fill_int_urb (struct urb *urb, | |||
972 | urb->pipe = pipe; | 1062 | urb->pipe = pipe; |
973 | urb->transfer_buffer = transfer_buffer; | 1063 | urb->transfer_buffer = transfer_buffer; |
974 | urb->transfer_buffer_length = buffer_length; | 1064 | urb->transfer_buffer_length = buffer_length; |
975 | urb->complete = complete; | 1065 | urb->complete = complete_fn; |
976 | urb->context = context; | 1066 | urb->context = context; |
977 | if (dev->speed == USB_SPEED_HIGH) | 1067 | if (dev->speed == USB_SPEED_HIGH) |
978 | urb->interval = 1 << (interval - 1); | 1068 | urb->interval = 1 << (interval - 1); |
@@ -990,7 +1080,6 @@ extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); | |||
990 | extern int usb_unlink_urb(struct urb *urb); | 1080 | extern int usb_unlink_urb(struct urb *urb); |
991 | extern void usb_kill_urb(struct urb *urb); | 1081 | extern void usb_kill_urb(struct urb *urb); |
992 | 1082 | ||
993 | #define HAVE_USB_BUFFERS | ||
994 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, | 1083 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, |
995 | gfp_t mem_flags, dma_addr_t *dma); | 1084 | gfp_t mem_flags, dma_addr_t *dma); |
996 | void usb_buffer_free (struct usb_device *dev, size_t size, | 1085 | void usb_buffer_free (struct usb_device *dev, size_t size, |
@@ -1003,14 +1092,14 @@ void usb_buffer_unmap (struct urb *urb); | |||
1003 | #endif | 1092 | #endif |
1004 | 1093 | ||
1005 | struct scatterlist; | 1094 | struct scatterlist; |
1006 | int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe, | 1095 | int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe, |
1007 | struct scatterlist *sg, int nents); | 1096 | struct scatterlist *sg, int nents); |
1008 | #if 0 | 1097 | #if 0 |
1009 | void usb_buffer_dmasync_sg (struct usb_device *dev, unsigned pipe, | 1098 | void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe, |
1010 | struct scatterlist *sg, int n_hw_ents); | 1099 | struct scatterlist *sg, int n_hw_ents); |
1011 | #endif | 1100 | #endif |
1012 | void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, | 1101 | void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe, |
1013 | struct scatterlist *sg, int n_hw_ents); | 1102 | struct scatterlist *sg, int n_hw_ents); |
1014 | 1103 | ||
1015 | /*-------------------------------------------------------------------* | 1104 | /*-------------------------------------------------------------------* |
1016 | * SYNCHRONOUS CALL SUPPORT * | 1105 | * SYNCHRONOUS CALL SUPPORT * |
@@ -1038,6 +1127,9 @@ extern int usb_clear_halt(struct usb_device *dev, int pipe); | |||
1038 | extern int usb_reset_configuration(struct usb_device *dev); | 1127 | extern int usb_reset_configuration(struct usb_device *dev); |
1039 | extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); | 1128 | extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); |
1040 | 1129 | ||
1130 | /* this request isn't really synchronous, but it belongs with the others */ | ||
1131 | extern int usb_driver_set_configuration(struct usb_device *udev, int config); | ||
1132 | |||
1041 | /* | 1133 | /* |
1042 | * timeouts, in milliseconds, used for sending/receiving control messages | 1134 | * timeouts, in milliseconds, used for sending/receiving control messages |
1043 | * they typically complete within a few frames (msec) after they're issued | 1135 | * they typically complete within a few frames (msec) after they're issued |