X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=include%2Flinux%2Fusb.h;h=e34e5e3dce529bff49f09e1565471d7d9c657c85;hb=0500abf52109d09bf60d740dec2e41d6cf265688;hp=748d04385256dc1063249bd282267b55834bb6e7;hpb=dad2ad82c5f058367df79de022bd12d36afcd065;p=linux-2.6-omap-h63xx.git diff --git a/include/linux/usb.h b/include/linux/usb.h index 748d0438525..e34e5e3dce5 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -47,6 +47,7 @@ struct usb_driver; * @urb_list: urbs queued to this endpoint; maintained by usbcore * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) * with one or more transfer descriptors (TDs) per urb + * @kobj: kobject for sysfs info * @extra: descriptors following this endpoint in the configuration * @extralen: how many bytes of "extra" are valid * @@ -224,7 +225,7 @@ struct usb_interface_cache { * Device drivers should not attempt to activate configurations. The choice * of which configuration to install is a policy decision based on such * considerations as available power, functionality provided, and the user's - * desires (expressed through hotplug scripts). However, drivers can call + * desires (expressed through userspace tools). However, drivers can call * usb_reset_configuration() to reinitialize the current configuration and * all its interfaces. */ @@ -328,8 +329,6 @@ struct usb_device { struct usb_tt *tt; /* low/full speed dev, highspeed hub */ int ttport; /* device port on that tt hub */ - struct semaphore serialize; - unsigned int toggle[2]; /* one bit for each endpoint * ([0] = IN, [1] = OUT) */ @@ -348,6 +347,9 @@ struct usb_device { char **rawdescriptors; /* Raw descriptors for each config */ + unsigned short bus_mA; /* Current available from the bus */ + u8 portnum; /* Parent port number (origin 1) */ + int have_langid; /* whether string_langid is valid */ int string_langid; /* language ID for strings */ @@ -376,11 +378,12 @@ struct usb_device { extern struct usb_device *usb_get_dev(struct usb_device *dev); extern void usb_put_dev(struct usb_device *dev); -extern void usb_lock_device(struct usb_device *udev); -extern int usb_trylock_device(struct usb_device *udev); +/* USB device locking */ +#define usb_lock_device(udev) down(&(udev)->dev.sem) +#define usb_unlock_device(udev) up(&(udev)->dev.sem) +#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) extern int usb_lock_device_for_reset(struct usb_device *udev, struct usb_interface *iface); -extern void usb_unlock_device(struct usb_device *udev); /* USB port reset for device reinitialization */ extern int usb_reset_device(struct usb_device *dev); @@ -528,10 +531,13 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, /* ----------------------------------------------------------------------- */ +struct usb_dynids { + spinlock_t lock; + struct list_head list; +}; + /** * struct usb_driver - identifies USB driver to usbcore - * @owner: Pointer to the module owner of this driver; initialize - * it using THIS_MODULE. * @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 @@ -552,7 +558,11 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, * @id_table: USB drivers use ID table to support hotplugging. * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set * or your driver's probe function will never get called. + * @dynids: used internally to hold the list of dynamically added device + * ids for this driver. * @driver: the driver model core driver structure. + * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be + * added to this driver by preventing the sysfs file from being created. * * USB drivers must provide a name, probe() and disconnect() methods, * and an id_table. Other driver fields are optional. @@ -570,8 +580,6 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, * them as necessary, and blocking until the unlinks complete). */ struct usb_driver { - struct module *owner; - const char *name; int (*probe) (struct usb_interface *intf, @@ -587,7 +595,9 @@ struct usb_driver { const struct usb_device_id *id_table; + struct usb_dynids dynids; struct device_driver driver; + unsigned int no_dynamic_id:1; }; #define to_usb_driver(d) container_of(d, struct usb_driver, driver) @@ -605,7 +615,7 @@ extern struct bus_type usb_bus_type; */ struct usb_class_driver { char *name; - struct file_operations *fops; + const struct file_operations *fops; int minor_base; }; @@ -613,7 +623,11 @@ struct usb_class_driver { * use these in module_init()/module_exit() * and don't forget MODULE_DEVICE_TABLE(usb, ...) */ -extern int usb_register(struct usb_driver *); +int usb_register_driver(struct usb_driver *, struct module *); +static inline int usb_register(struct usb_driver *driver) +{ + return usb_register_driver(driver, THIS_MODULE); +} extern void usb_deregister(struct usb_driver *); extern int usb_register_dev(struct usb_interface *intf, @@ -819,7 +833,7 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *); */ struct urb { - /* private, usb core and host controller only fields in the 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 */ void *hcpriv; /* private data for host controller */ @@ -827,7 +841,7 @@ struct urb atomic_t use_count; /* concurrent submissions counter */ u8 reject; /* submissions will fail */ - /* public, documented fields in the urb that can be used by drivers */ + /* public: documented fields in the urb that can be used by drivers */ struct list_head urb_list; /* list head for use by the urb's * current owner */ struct usb_device *dev; /* (in) pointer to associated device */ @@ -1004,8 +1018,6 @@ extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype, unsigned char descindex, void *buf, int size); extern int usb_get_status(struct usb_device *dev, int type, int target, void *data); -extern int usb_get_string(struct usb_device *dev, - unsigned short langid, unsigned char index, void *buf, int size); extern int usb_string(struct usb_device *dev, int index, char *buf, size_t size); @@ -1045,7 +1057,7 @@ struct usb_sg_request { size_t bytes; /* - * members below are private to usbcore, + * members below are private: to usbcore, * and are not provided for driver access! */ spinlock_t lock;