diff options
| author | Greg Kroah-Hartman <greg@kroah.com> | 2004-05-11 20:06:23 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <greg@kroah.com> | 2004-05-11 20:06:23 -0700 |
| commit | f5510e199d75aa007d25f4d6d663e206249bddd1 (patch) | |
| tree | feef71e999badc0ffb52f910fdcafed3f52d605a /include/linux | |
| parent | 141baf80514374935d084c12f2f1e426e9cea5a0 (diff) | |
| parent | 7e0cb221855e45fdeb1b3f433fefb211a205434c (diff) | |
Merge kroah.com:/home/greg/linux/BK/bleed-2.6
into kroah.com:/home/greg/linux/BK/usb-2.6
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/usb.h | 46 | ||||
| -rw-r--r-- | include/linux/usbdevice_fs.h | 1 |
2 files changed, 41 insertions, 6 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 608e3a297340..21bec41ea6c9 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -14,6 +14,7 @@ #include <linux/delay.h> /* for mdelay() */ #include <linux/interrupt.h> /* for in_interrupt() */ #include <linux/list.h> /* for struct list_head */ +#include <linux/kref.h> /* for struct kref */ #include <linux/device.h> /* for struct device */ #include <linux/fs.h> /* for struct file_operations */ #include <linux/completion.h> /* for struct completion */ @@ -147,11 +148,42 @@ void usb_put_intf(struct usb_interface *intf); #define USB_MAXINTERFACES 32 /** + * struct usb_interface_cache - long-term representation of a device interface + * @num_altsetting: number of altsettings defined. + * @ref: reference counter. + * @altsetting: variable-length array of interface structures, one for + * each alternate setting that may be selected. Each one includes a + * set of endpoint configurations. They will be in no particular order. + * + * These structures persist for the lifetime of a usb_device, unlike + * struct usb_interface (which persists only as long as its configuration + * is installed). The altsetting arrays can be accessed through these + * structures at any time, permitting comparison of configurations and + * providing support for the /proc/bus/usb/devices pseudo-file. + */ +struct usb_interface_cache { + unsigned num_altsetting; /* number of alternate settings */ + struct kref ref; /* reference counter */ + + /* variable-length array of alternate settings for this interface, + * stored in no particular order */ + struct usb_host_interface altsetting[0]; +}; +#define ref_to_usb_interface_cache(r) \ + container_of(r, struct usb_interface_cache, ref) +#define altsetting_to_usb_interface_cache(a) \ + container_of(a, struct usb_interface_cache, altsetting[0]) + +/** * struct usb_host_config - representation of a device's configuration * @desc: the device's configuration descriptor. - * @interface: array of usb_interface structures, one for each interface - * in the configuration. The number of interfaces is stored in - * desc.bNumInterfaces. + * @interface: array of pointers to usb_interface structures, one for each + * interface in the configuration. The number of interfaces is stored + * in desc.bNumInterfaces. These pointers are valid only while the + * the configuration is active. + * @intf_cache: array of pointers to usb_interface_cache structures, one + * for each interface in the configuration. These structures exist + * for the entire life of the device. * @extra: pointer to buffer containing all extra descriptors associated * with this configuration (those preceding the first interface * descriptor). @@ -185,6 +217,10 @@ struct usb_host_config { * stored in no particular order */ struct usb_interface *interface[USB_MAXINTERFACES]; + /* Interface information available even when this is not the + * active configuration */ + struct usb_interface_cache *intf_cache[USB_MAXINTERFACES]; + unsigned char *extra; /* Extra descriptors */ int extralen; }; @@ -676,7 +712,7 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *); * URB_NO_SETUP_DMA_MAP indicate which buffers have already been mapped. * URB_NO_SETUP_DMA_MAP is ignored for non-control URBs. * - * Interrupt UBS must provide an interval, saying how often (in milliseconds + * Interrupt URBs must provide an interval, saying how often (in milliseconds * or, for highspeed devices, 125 microsecond units) * to poll for transfers. After the URB has been submitted, the interval * field reflects how the transfer was actually scheduled. @@ -731,8 +767,8 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *); struct urb { /* private, usb core and host controller only fields in the urb */ + struct kref kref; /* reference count of the URB */ spinlock_t lock; /* lock for the URB */ - atomic_t count; /* reference count of the URB */ void *hcpriv; /* private data for host controller */ struct list_head urb_list; /* list pointer to all active urbs */ int bandwidth; /* bandwidth for INT/ISO request */ diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index 129927386cac..4235d9f352f2 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h @@ -154,7 +154,6 @@ struct usbdevfs_hub_portinfo { struct dev_state { struct list_head list; /* state list */ - struct rw_semaphore devsem; /* protects modifications to dev (dev == NULL indicating disconnect) */ struct usb_device *dev; struct file *file; spinlock_t lock; /* protects the async urb lists */ |
