diff options
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r-- | include/linux/usb.h | 165 |
1 files changed, 128 insertions, 37 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 8dead32e7eb..190cc1b78fe 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; |
@@ -48,7 +49,7 @@ struct ep_device; | |||
48 | * @urb_list: urbs queued to this endpoint; maintained by usbcore | 49 | * @urb_list: urbs queued to this endpoint; maintained by usbcore |
49 | * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) | 50 | * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) |
50 | * with one or more transfer descriptors (TDs) per urb | 51 | * with one or more transfer descriptors (TDs) per urb |
51 | * @kobj: kobject for sysfs info | 52 | * @ep_dev: ep_device for sysfs info |
52 | * @extra: descriptors following this endpoint in the configuration | 53 | * @extra: descriptors following this endpoint in the configuration |
53 | * @extralen: how many bytes of "extra" are valid | 54 | * @extralen: how many bytes of "extra" are valid |
54 | * | 55 | * |
@@ -102,9 +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 | * @usb_dev: if an interface is bound to the USB major, this will point | 110 | * @class_dev: driver model's class view of this device. |
107 | * to the sysfs representation for that device. | 111 | * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not |
112 | * allowed unless the counter is 0. | ||
108 | * | 113 | * |
109 | * USB device drivers attach to interfaces on a physical device. Each | 114 | * USB device drivers attach to interfaces on a physical device. Each |
110 | * interface encapsulates a single high level function, such as feeding | 115 | * interface encapsulates a single high level function, such as feeding |
@@ -143,8 +148,12 @@ struct usb_interface { | |||
143 | int minor; /* minor number this interface is | 148 | int minor; /* minor number this interface is |
144 | * bound to */ | 149 | * bound to */ |
145 | 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 | |||
146 | struct device dev; /* interface specific device info */ | 154 | struct device dev; /* interface specific device info */ |
147 | struct device *usb_dev; /* pointer to the usb class's device, if any */ | 155 | struct class_device *class_dev; |
156 | int pm_usage_cnt; /* usage counter for autosuspend */ | ||
148 | }; | 157 | }; |
149 | #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) |
150 | #define interface_to_usbdev(intf) \ | 159 | #define interface_to_usbdev(intf) \ |
@@ -255,8 +264,6 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, | |||
255 | 264 | ||
256 | /* ----------------------------------------------------------------------- */ | 265 | /* ----------------------------------------------------------------------- */ |
257 | 266 | ||
258 | struct usb_operations; | ||
259 | |||
260 | /* USB device number allocation bitmap */ | 267 | /* USB device number allocation bitmap */ |
261 | struct usb_devmap { | 268 | struct usb_devmap { |
262 | unsigned long devicemap[128 / (8*sizeof(unsigned long))]; | 269 | unsigned long devicemap[128 / (8*sizeof(unsigned long))]; |
@@ -269,6 +276,7 @@ struct usb_bus { | |||
269 | struct device *controller; /* host/master side hardware */ | 276 | struct device *controller; /* host/master side hardware */ |
270 | int busnum; /* Bus number (in order of reg) */ | 277 | int busnum; /* Bus number (in order of reg) */ |
271 | 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? */ | ||
272 | u8 otg_port; /* 0, or number of OTG/HNP port */ | 280 | u8 otg_port; /* 0, or number of OTG/HNP port */ |
273 | unsigned is_b_host:1; /* true during some HNP roleswitches */ | 281 | unsigned is_b_host:1; /* true during some HNP roleswitches */ |
274 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ | 282 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ |
@@ -277,10 +285,8 @@ struct usb_bus { | |||
277 | * round-robin allocation */ | 285 | * round-robin allocation */ |
278 | 286 | ||
279 | struct usb_devmap devmap; /* device address allocation map */ | 287 | struct usb_devmap devmap; /* device address allocation map */ |
280 | struct usb_operations *op; /* Operations (specific to the HC) */ | ||
281 | struct usb_device *root_hub; /* Root hub */ | 288 | struct usb_device *root_hub; /* Root hub */ |
282 | struct list_head bus_list; /* list of busses */ | 289 | struct list_head bus_list; /* list of busses */ |
283 | void *hcpriv; /* Host Controller private data */ | ||
284 | 290 | ||
285 | int bandwidth_allocated; /* on this bus: how much of the time | 291 | int bandwidth_allocated; /* on this bus: how much of the time |
286 | * reserved for periodic (intr/iso) | 292 | * reserved for periodic (intr/iso) |
@@ -295,8 +301,6 @@ struct usb_bus { | |||
295 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ | 301 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ |
296 | 302 | ||
297 | struct class_device *class_dev; /* class device for this bus */ | 303 | struct class_device *class_dev; /* class device for this bus */ |
298 | struct kref kref; /* reference counting for this bus */ | ||
299 | void (*release)(struct usb_bus *bus); | ||
300 | 304 | ||
301 | #if defined(CONFIG_USB_MON) | 305 | #if defined(CONFIG_USB_MON) |
302 | struct mon_bus *mon_bus; /* non-null when associated */ | 306 | struct mon_bus *mon_bus; /* non-null when associated */ |
@@ -351,6 +355,7 @@ struct usb_device { | |||
351 | 355 | ||
352 | unsigned short bus_mA; /* Current available from the bus */ | 356 | unsigned short bus_mA; /* Current available from the bus */ |
353 | u8 portnum; /* Parent port number (origin 1) */ | 357 | u8 portnum; /* Parent port number (origin 1) */ |
358 | u8 level; /* Number of USB hub ancestors */ | ||
354 | 359 | ||
355 | int have_langid; /* whether string_langid is valid */ | 360 | int have_langid; /* whether string_langid is valid */ |
356 | int string_langid; /* language ID for strings */ | 361 | int string_langid; /* language ID for strings */ |
@@ -361,7 +366,7 @@ struct usb_device { | |||
361 | char *serial; /* iSerialNumber string, if present */ | 366 | char *serial; /* iSerialNumber string, if present */ |
362 | 367 | ||
363 | struct list_head filelist; | 368 | struct list_head filelist; |
364 | struct device *usbfs_dev; | 369 | struct class_device *class_dev; |
365 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ | 370 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ |
366 | 371 | ||
367 | /* | 372 | /* |
@@ -374,6 +379,15 @@ struct usb_device { | |||
374 | 379 | ||
375 | int maxchild; /* Number of ports if hub */ | 380 | int maxchild; /* Number of ports if hub */ |
376 | struct usb_device *children[USB_MAXCHILDREN]; | 381 | struct usb_device *children[USB_MAXCHILDREN]; |
382 | |||
383 | int pm_usage_cnt; /* usage counter for autosuspend */ | ||
384 | #ifdef CONFIG_PM | ||
385 | struct work_struct autosuspend; /* for delayed autosuspends */ | ||
386 | struct mutex pm_mutex; /* protects PM operations */ | ||
387 | |||
388 | unsigned auto_pm:1; /* autosuspend/resume in progress */ | ||
389 | unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ | ||
390 | #endif | ||
377 | }; | 391 | }; |
378 | #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) |
379 | 393 | ||
@@ -385,7 +399,7 @@ extern void usb_put_dev(struct usb_device *dev); | |||
385 | #define usb_unlock_device(udev) up(&(udev)->dev.sem) | 399 | #define usb_unlock_device(udev) up(&(udev)->dev.sem) |
386 | #define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) | 400 | #define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) |
387 | extern int usb_lock_device_for_reset(struct usb_device *udev, | 401 | extern int usb_lock_device_for_reset(struct usb_device *udev, |
388 | struct usb_interface *iface); | 402 | const struct usb_interface *iface); |
389 | 403 | ||
390 | /* USB port reset for device reinitialization */ | 404 | /* USB port reset for device reinitialization */ |
391 | extern int usb_reset_device(struct usb_device *dev); | 405 | extern int usb_reset_device(struct usb_device *dev); |
@@ -394,6 +408,17 @@ extern int usb_reset_composite_device(struct usb_device *dev, | |||
394 | 408 | ||
395 | 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); |
396 | 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 | |||
397 | /*-------------------------------------------------------------------------*/ | 422 | /*-------------------------------------------------------------------------*/ |
398 | 423 | ||
399 | /* for drivers using iso endpoints */ | 424 | /* for drivers using iso endpoints */ |
@@ -424,10 +449,10 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface, | |||
424 | 449 | ||
425 | extern struct usb_interface *usb_find_interface(struct usb_driver *drv, | 450 | extern struct usb_interface *usb_find_interface(struct usb_driver *drv, |
426 | int minor); | 451 | int minor); |
427 | 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, |
428 | unsigned ifnum); | 453 | unsigned ifnum); |
429 | extern struct usb_host_interface *usb_altnum_to_altsetting( | 454 | extern struct usb_host_interface *usb_altnum_to_altsetting( |
430 | struct usb_interface *intf, unsigned int altnum); | 455 | const struct usb_interface *intf, unsigned int altnum); |
431 | 456 | ||
432 | 457 | ||
433 | /** | 458 | /** |
@@ -465,6 +490,20 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, | |||
465 | 490 | ||
466 | /*-------------------------------------------------------------------------*/ | 491 | /*-------------------------------------------------------------------------*/ |
467 | 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 | |||
468 | #define USB_DEVICE_ID_MATCH_DEVICE \ | 507 | #define USB_DEVICE_ID_MATCH_DEVICE \ |
469 | (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) | 508 | (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) |
470 | #define USB_DEVICE_ID_MATCH_DEV_RANGE \ | 509 | #define USB_DEVICE_ID_MATCH_DEV_RANGE \ |
@@ -541,7 +580,17 @@ struct usb_dynids { | |||
541 | }; | 580 | }; |
542 | 581 | ||
543 | /** | 582 | /** |
544 | * 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 | ||
545 | * @name: The driver name should be unique among USB drivers, | 594 | * @name: The driver name should be unique among USB drivers, |
546 | * and should normally be the same as the module name. | 595 | * and should normally be the same as the module name. |
547 | * @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 |
@@ -568,12 +617,14 @@ struct usb_dynids { | |||
568 | * or your driver's probe function will never get called. | 617 | * or your driver's probe function will never get called. |
569 | * @dynids: used internally to hold the list of dynamically added device | 618 | * @dynids: used internally to hold the list of dynamically added device |
570 | * ids for this driver. | 619 | * ids for this driver. |
571 | * @driver: the driver model core driver structure. | 620 | * @drvwrap: Driver-model core structure wrapper. |
572 | * @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 |
573 | * 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. | ||
574 | * | 625 | * |
575 | * USB drivers must provide a name, probe() and disconnect() methods, | 626 | * USB interface drivers must provide a name, probe() and disconnect() |
576 | * and an id_table. Other driver fields are optional. | 627 | * methods, and an id_table. Other driver fields are optional. |
577 | * | 628 | * |
578 | * 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, |
579 | * and specialized data may be associated with each entry. That table | 630 | * and specialized data may be associated with each entry. That table |
@@ -607,10 +658,44 @@ struct usb_driver { | |||
607 | const struct usb_device_id *id_table; | 658 | const struct usb_device_id *id_table; |
608 | 659 | ||
609 | struct usb_dynids dynids; | 660 | struct usb_dynids dynids; |
610 | struct device_driver driver; | 661 | struct usbdrv_wrap drvwrap; |
611 | unsigned int no_dynamic_id:1; | 662 | unsigned int no_dynamic_id:1; |
663 | unsigned int supports_autosuspend:1; | ||
612 | }; | 664 | }; |
613 | #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) | ||
614 | 699 | ||
615 | extern struct bus_type usb_bus_type; | 700 | extern struct bus_type usb_bus_type; |
616 | 701 | ||
@@ -634,13 +719,17 @@ struct usb_class_driver { | |||
634 | * use these in module_init()/module_exit() | 719 | * use these in module_init()/module_exit() |
635 | * and don't forget MODULE_DEVICE_TABLE(usb, ...) | 720 | * and don't forget MODULE_DEVICE_TABLE(usb, ...) |
636 | */ | 721 | */ |
637 | int usb_register_driver(struct usb_driver *, struct module *); | 722 | extern int usb_register_driver(struct usb_driver *, struct module *); |
638 | static inline int usb_register(struct usb_driver *driver) | 723 | static inline int usb_register(struct usb_driver *driver) |
639 | { | 724 | { |
640 | return usb_register_driver(driver, THIS_MODULE); | 725 | return usb_register_driver(driver, THIS_MODULE); |
641 | } | 726 | } |
642 | extern void usb_deregister(struct usb_driver *); | 727 | extern void usb_deregister(struct usb_driver *); |
643 | 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 | |||
644 | extern int usb_register_dev(struct usb_interface *intf, | 733 | extern int usb_register_dev(struct usb_interface *intf, |
645 | struct usb_class_driver *class_driver); | 734 | struct usb_class_driver *class_driver); |
646 | extern void usb_deregister_dev(struct usb_interface *intf, | 735 | extern void usb_deregister_dev(struct usb_interface *intf, |
@@ -886,7 +975,7 @@ struct urb | |||
886 | * @setup_packet: pointer to the setup_packet buffer | 975 | * @setup_packet: pointer to the setup_packet buffer |
887 | * @transfer_buffer: pointer to the transfer buffer | 976 | * @transfer_buffer: pointer to the transfer buffer |
888 | * @buffer_length: length of the transfer buffer | 977 | * @buffer_length: length of the transfer buffer |
889 | * @complete: pointer to the usb_complete_t function | 978 | * @complete_fn: pointer to the usb_complete_t function |
890 | * @context: what to set the urb context to. | 979 | * @context: what to set the urb context to. |
891 | * | 980 | * |
892 | * Initializes a control urb with the proper information needed to submit | 981 | * Initializes a control urb with the proper information needed to submit |
@@ -898,7 +987,7 @@ static inline void usb_fill_control_urb (struct urb *urb, | |||
898 | unsigned char *setup_packet, | 987 | unsigned char *setup_packet, |
899 | void *transfer_buffer, | 988 | void *transfer_buffer, |
900 | int buffer_length, | 989 | int buffer_length, |
901 | usb_complete_t complete, | 990 | usb_complete_t complete_fn, |
902 | void *context) | 991 | void *context) |
903 | { | 992 | { |
904 | spin_lock_init(&urb->lock); | 993 | spin_lock_init(&urb->lock); |
@@ -907,7 +996,7 @@ static inline void usb_fill_control_urb (struct urb *urb, | |||
907 | urb->setup_packet = setup_packet; | 996 | urb->setup_packet = setup_packet; |
908 | urb->transfer_buffer = transfer_buffer; | 997 | urb->transfer_buffer = transfer_buffer; |
909 | urb->transfer_buffer_length = buffer_length; | 998 | urb->transfer_buffer_length = buffer_length; |
910 | urb->complete = complete; | 999 | urb->complete = complete_fn; |
911 | urb->context = context; | 1000 | urb->context = context; |
912 | } | 1001 | } |
913 | 1002 | ||
@@ -918,7 +1007,7 @@ static inline void usb_fill_control_urb (struct urb *urb, | |||
918 | * @pipe: the endpoint pipe | 1007 | * @pipe: the endpoint pipe |
919 | * @transfer_buffer: pointer to the transfer buffer | 1008 | * @transfer_buffer: pointer to the transfer buffer |
920 | * @buffer_length: length of the transfer buffer | 1009 | * @buffer_length: length of the transfer buffer |
921 | * @complete: pointer to the usb_complete_t function | 1010 | * @complete_fn: pointer to the usb_complete_t function |
922 | * @context: what to set the urb context to. | 1011 | * @context: what to set the urb context to. |
923 | * | 1012 | * |
924 | * 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 |
@@ -929,7 +1018,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb, | |||
929 | unsigned int pipe, | 1018 | unsigned int pipe, |
930 | void *transfer_buffer, | 1019 | void *transfer_buffer, |
931 | int buffer_length, | 1020 | int buffer_length, |
932 | usb_complete_t complete, | 1021 | usb_complete_t complete_fn, |
933 | void *context) | 1022 | void *context) |
934 | { | 1023 | { |
935 | spin_lock_init(&urb->lock); | 1024 | spin_lock_init(&urb->lock); |
@@ -937,7 +1026,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb, | |||
937 | urb->pipe = pipe; | 1026 | urb->pipe = pipe; |
938 | urb->transfer_buffer = transfer_buffer; | 1027 | urb->transfer_buffer = transfer_buffer; |
939 | urb->transfer_buffer_length = buffer_length; | 1028 | urb->transfer_buffer_length = buffer_length; |
940 | urb->complete = complete; | 1029 | urb->complete = complete_fn; |
941 | urb->context = context; | 1030 | urb->context = context; |
942 | } | 1031 | } |
943 | 1032 | ||
@@ -948,7 +1037,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb, | |||
948 | * @pipe: the endpoint pipe | 1037 | * @pipe: the endpoint pipe |
949 | * @transfer_buffer: pointer to the transfer buffer | 1038 | * @transfer_buffer: pointer to the transfer buffer |
950 | * @buffer_length: length of the transfer buffer | 1039 | * @buffer_length: length of the transfer buffer |
951 | * @complete: pointer to the usb_complete_t function | 1040 | * @complete_fn: pointer to the usb_complete_t function |
952 | * @context: what to set the urb context to. | 1041 | * @context: what to set the urb context to. |
953 | * @interval: what to set the urb interval to, encoded like | 1042 | * @interval: what to set the urb interval to, encoded like |
954 | * the endpoint descriptor's bInterval value. | 1043 | * the endpoint descriptor's bInterval value. |
@@ -964,7 +1053,7 @@ static inline void usb_fill_int_urb (struct urb *urb, | |||
964 | unsigned int pipe, | 1053 | unsigned int pipe, |
965 | void *transfer_buffer, | 1054 | void *transfer_buffer, |
966 | int buffer_length, | 1055 | int buffer_length, |
967 | usb_complete_t complete, | 1056 | usb_complete_t complete_fn, |
968 | void *context, | 1057 | void *context, |
969 | int interval) | 1058 | int interval) |
970 | { | 1059 | { |
@@ -973,7 +1062,7 @@ static inline void usb_fill_int_urb (struct urb *urb, | |||
973 | urb->pipe = pipe; | 1062 | urb->pipe = pipe; |
974 | urb->transfer_buffer = transfer_buffer; | 1063 | urb->transfer_buffer = transfer_buffer; |
975 | urb->transfer_buffer_length = buffer_length; | 1064 | urb->transfer_buffer_length = buffer_length; |
976 | urb->complete = complete; | 1065 | urb->complete = complete_fn; |
977 | urb->context = context; | 1066 | urb->context = context; |
978 | if (dev->speed == USB_SPEED_HIGH) | 1067 | if (dev->speed == USB_SPEED_HIGH) |
979 | urb->interval = 1 << (interval - 1); | 1068 | urb->interval = 1 << (interval - 1); |
@@ -991,7 +1080,6 @@ extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); | |||
991 | extern int usb_unlink_urb(struct urb *urb); | 1080 | extern int usb_unlink_urb(struct urb *urb); |
992 | extern void usb_kill_urb(struct urb *urb); | 1081 | extern void usb_kill_urb(struct urb *urb); |
993 | 1082 | ||
994 | #define HAVE_USB_BUFFERS | ||
995 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, | 1083 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, |
996 | gfp_t mem_flags, dma_addr_t *dma); | 1084 | gfp_t mem_flags, dma_addr_t *dma); |
997 | void usb_buffer_free (struct usb_device *dev, size_t size, | 1085 | void usb_buffer_free (struct usb_device *dev, size_t size, |
@@ -1004,14 +1092,14 @@ void usb_buffer_unmap (struct urb *urb); | |||
1004 | #endif | 1092 | #endif |
1005 | 1093 | ||
1006 | struct scatterlist; | 1094 | struct scatterlist; |
1007 | int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe, | 1095 | int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe, |
1008 | struct scatterlist *sg, int nents); | 1096 | struct scatterlist *sg, int nents); |
1009 | #if 0 | 1097 | #if 0 |
1010 | void usb_buffer_dmasync_sg (struct usb_device *dev, unsigned pipe, | 1098 | void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe, |
1011 | struct scatterlist *sg, int n_hw_ents); | 1099 | struct scatterlist *sg, int n_hw_ents); |
1012 | #endif | 1100 | #endif |
1013 | void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, | 1101 | void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe, |
1014 | struct scatterlist *sg, int n_hw_ents); | 1102 | struct scatterlist *sg, int n_hw_ents); |
1015 | 1103 | ||
1016 | /*-------------------------------------------------------------------* | 1104 | /*-------------------------------------------------------------------* |
1017 | * SYNCHRONOUS CALL SUPPORT * | 1105 | * SYNCHRONOUS CALL SUPPORT * |
@@ -1039,6 +1127,9 @@ extern int usb_clear_halt(struct usb_device *dev, int pipe); | |||
1039 | extern int usb_reset_configuration(struct usb_device *dev); | 1127 | extern int usb_reset_configuration(struct usb_device *dev); |
1040 | 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); |
1041 | 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 | |||
1042 | /* | 1133 | /* |
1043 | * timeouts, in milliseconds, used for sending/receiving control messages | 1134 | * timeouts, in milliseconds, used for sending/receiving control messages |
1044 | * 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 |