diff options
| author | Greg Kroah-Hartman <greg@kroah.com> | 2002-09-30 03:18:52 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <greg@kroah.com> | 2002-09-30 03:18:52 -0700 |
| commit | 1a008d0eb9af65207aeb266a240c9a9f17c86b53 (patch) | |
| tree | 661806eb2211b910985f2fd01aced94331a1edd1 /include/linux | |
| parent | 2fbc109cd56f8e8669bc31fd0dd98a4fae3d0be6 (diff) | |
| parent | 5c1c6931e2653506c837e961041b90b7fb9fd1bf (diff) | |
Merge kroah.com:/home/greg/linux/BK/bleeding_edge-2.5
into kroah.com:/home/greg/linux/BK/gregkh-2.5
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/usb.h | 77 | ||||
| -rw-r--r-- | include/linux/usbdevice_fs.h | 2 |
2 files changed, 64 insertions, 15 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 5d323aa0d36e..5dbc3cb115f7 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -84,6 +84,7 @@ #include <linux/list.h> /* for struct list_head */ #include <linux/device.h> /* for struct device */ #include <linux/fs.h> /* for struct file_operations */ +#include <linux/completion.h> /* for struct completion */ static __inline__ void wait_ms(unsigned int ms) @@ -452,9 +453,9 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size) * User mode code can read these tables to choose which modules to load. * Declare the table as a MODULE_DEVICE_TABLE. * - * The third probe() parameter will point to a matching entry from this - * table. (Null value reserved.) Use the driver_data field for each - * match to hold information tied to that match: device quirks, etc. + * A probe() parameter will point to a matching entry from this table. + * Use the driver_info field for each match to hold information tied + * to that match: device quirks, etc. * * Terminate the driver's table with an all-zeroes entry. * Use the flag values to control which fields are compared. @@ -604,17 +605,14 @@ struct usb_device_id { * @name: The driver name should be unique among USB drivers, * and should normally be the same as the module name. * @probe: Called to see if the driver is willing to manage a particular - * interface on a device. The probe routine returns a handle that - * will later be provided to disconnect(), or a null pointer to - * indicate that the driver will not handle the interface. - * The handle is normally a pointer to driver-specific data. - * If the probe() routine needs to access the interface - * structure itself, use usb_ifnum_to_if() to make sure it's using - * the right one. + * interface on a device. If it is, probe returns zero and uses + * dev_set_drvdata() to associate driver-specific data with the + * interface. It may also use usb_set_interface() to specify the + * appropriate altsetting. If unwilling to manage the interface, + * return a negative errno value. * @disconnect: Called when the interface is no longer accessible, usually - * because its device has been (or is being) disconnected. The - * handle passed is what was returned by probe(), or was provided - * to usb_driver_claim_interface(). + * because its device has been (or is being) disconnected or the + * driver module is being unloaded. * @ioctl: Used for drivers that want to talk to userspace through * the "usbfs" filesystem. This lets devices provide ways to * expose information to user space regardless of where they @@ -648,7 +646,7 @@ struct usb_driver { void (*disconnect) (struct usb_interface *intf); - int (*ioctl) (struct usb_device *dev, unsigned int code, void *buf); + int (*ioctl) (struct usb_interface *intf, unsigned int code, void *buf); const struct usb_device_id *id_table; @@ -1074,6 +1072,57 @@ extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); #define USB_CTRL_SET_TIMEOUT 3 + +/** + * struct usb_sg_request - support for scatter/gather I/O + * @status: zero indicates success, else negative errno + * @bytes: counts bytes transferred. + * + * These requests are initialized using usb_sg_init(), and then are used + * as request handles passed to usb_sg_wait() or usb_sg_cancel(). Most + * members of the request object aren't for driver access. + * + * The status and bytecount values are valid only after usb_sg_wait() + * returns. If the status is zero, then the bytecount matches the total + * from the request. + * + * After an error completion, drivers may need to clear a halt condition + * on the endpoint. + */ +struct usb_sg_request { + int status; + size_t bytes; + + // members not documented above are private to usbcore, + // and are not provided for driver access! + spinlock_t lock; + + struct usb_device *dev; + int pipe; + struct scatterlist *sg; + int nents; + + int entries; + struct urb **urbs; + + int count; + struct completion complete; +}; + +int usb_sg_init ( + struct usb_sg_request *io, + struct usb_device *dev, + unsigned pipe, + unsigned period, + struct scatterlist *sg, + int nents, + size_t length, + int mem_flags +); +void usb_sg_cancel (struct usb_sg_request *io); +void usb_sg_wait (struct usb_sg_request *io); + + /* -------------------------------------------------------------------------- */ /* diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index de18e956f47b..84653713900c 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h @@ -108,7 +108,7 @@ struct usbdevfs_urb { struct usbdevfs_iso_packet_desc iso_frame_desc[0]; }; -/* ioctls for talking to drivers in the usbcore module: */ +/* ioctls for talking directly to drivers */ struct usbdevfs_ioctl { int ifno; /* interface 0..N ; negative numbers reserved */ int ioctl_code; /* MUST encode size + direction of data so the |
