diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-17 15:50:23 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-07 18:44:33 -0500 |
commit | 93bacefc4cc0b53e1cb6a336d43847154fdf6886 (patch) | |
tree | 4a82a9d2693d1165c58602a0bf4a8e5c76c541ef /include/linux | |
parent | 495a678fc62e850d15f860d39faee07ba0a8910c (diff) |
USB serial: add dynamic id support to usb-serial core
Thanks to Johannes Hölzl <johannes.hoelzl@gmx.de> for fixing a few
things and getting it all working properly.
This adds support for dynamic usb ids to the usb serial core. The file
"new_id" will show up under the usb serial driver, not the usb driver
associated with the usb-serial driver (yeah, it can be a bit confusing
at first glance...)
This patch also modifies the USB core to allow the usb-serial core to
reuse much of the dynamic id logic.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Johannes Hölzl <johannes.hoelzl@gmx.de>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/usb.h | 12 | ||||
-rw-r--r-- | include/linux/usb/serial.h | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index f3b21636c9df..3cb9285df2d1 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -476,6 +476,8 @@ extern void usb_driver_release_interface(struct usb_driver *driver, | |||
476 | struct usb_interface *iface); | 476 | struct usb_interface *iface); |
477 | const struct usb_device_id *usb_match_id(struct usb_interface *interface, | 477 | const struct usb_device_id *usb_match_id(struct usb_interface *interface, |
478 | const struct usb_device_id *id); | 478 | const struct usb_device_id *id); |
479 | extern int usb_match_one_id(struct usb_interface *interface, | ||
480 | const struct usb_device_id *id); | ||
479 | 481 | ||
480 | extern struct usb_interface *usb_find_interface(struct usb_driver *drv, | 482 | extern struct usb_interface *usb_find_interface(struct usb_driver *drv, |
481 | int minor); | 483 | int minor); |
@@ -724,11 +726,21 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor | |||
724 | 726 | ||
725 | /* ----------------------------------------------------------------------- */ | 727 | /* ----------------------------------------------------------------------- */ |
726 | 728 | ||
729 | /* Stuff for dynamic usb ids */ | ||
727 | struct usb_dynids { | 730 | struct usb_dynids { |
728 | spinlock_t lock; | 731 | spinlock_t lock; |
729 | struct list_head list; | 732 | struct list_head list; |
730 | }; | 733 | }; |
731 | 734 | ||
735 | struct usb_dynid { | ||
736 | struct list_head node; | ||
737 | struct usb_device_id id; | ||
738 | }; | ||
739 | |||
740 | extern ssize_t usb_store_new_id(struct usb_dynids *dynids, | ||
741 | struct device_driver *driver, | ||
742 | const char *buf, size_t count); | ||
743 | |||
732 | /** | 744 | /** |
733 | * struct usbdrv_wrap - wrapper for driver-model structure | 745 | * struct usbdrv_wrap - wrapper for driver-model structure |
734 | * @driver: The driver-model core driver structure. | 746 | * @driver: The driver-model core driver structure. |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 10f99e5f1a97..33dcd8576696 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -179,6 +179,9 @@ static inline void usb_set_serial_data (struct usb_serial *serial, void *data) | |||
179 | * memory structure allocation at this point in time. | 179 | * memory structure allocation at this point in time. |
180 | * @shutdown: pointer to the driver's shutdown function. This will be | 180 | * @shutdown: pointer to the driver's shutdown function. This will be |
181 | * called when the device is removed from the system. | 181 | * called when the device is removed from the system. |
182 | * @usb_driver: pointer to the struct usb_driver that controls this | ||
183 | * device. This is necessary to allow dynamic ids to be added to | ||
184 | * the driver from sysfs. | ||
182 | * | 185 | * |
183 | * This structure is defines a USB Serial driver. It provides all of | 186 | * This structure is defines a USB Serial driver. It provides all of |
184 | * the information that the USB serial core code needs. If the function | 187 | * the information that the USB serial core code needs. If the function |
@@ -202,6 +205,8 @@ struct usb_serial_driver { | |||
202 | 205 | ||
203 | struct list_head driver_list; | 206 | struct list_head driver_list; |
204 | struct device_driver driver; | 207 | struct device_driver driver; |
208 | struct usb_driver *usb_driver; | ||
209 | struct usb_dynids dynids; | ||
205 | 210 | ||
206 | int (*probe) (struct usb_serial *serial, const struct usb_device_id *id); | 211 | int (*probe) (struct usb_serial *serial, const struct usb_device_id *id); |
207 | int (*attach) (struct usb_serial *serial); | 212 | int (*attach) (struct usb_serial *serial); |