diff options
author | Pete Zaitcev <zaitcev@redhat.com> | 2005-10-22 23:15:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-04 16:48:31 -0500 |
commit | a00828e9ac62caed7b830d631914d7748817ccd1 (patch) | |
tree | 2fed4c66762fa4f54945413b4027ff5837ad0633 /drivers/block/ub.c | |
parent | 1c50c317e2e7f15427149cbc216a63366468710e (diff) |
[PATCH] USB: drivers/usb/storage/libusual
This patch adds a shim driver libusual, which routes devices between
usb-storage and ub according to the common table, based on unusual_devs.h.
The help and example syntax is in Kconfig.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/block/ub.c')
-rw-r--r-- | drivers/block/ub.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index bfb23d543ff7..06d741d58a68 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/usb.h> | 31 | #include <linux/usb.h> |
32 | #include <linux/usb_usual.h> | ||
32 | #include <linux/blkdev.h> | 33 | #include <linux/blkdev.h> |
33 | #include <linux/devfs_fs_kernel.h> | 34 | #include <linux/devfs_fs_kernel.h> |
34 | #include <linux/timer.h> | 35 | #include <linux/timer.h> |
@@ -107,16 +108,6 @@ | |||
107 | */ | 108 | */ |
108 | 109 | ||
109 | /* | 110 | /* |
110 | * Definitions which have to be scattered once we understand the layout better. | ||
111 | */ | ||
112 | |||
113 | /* Transport (despite PR in the name) */ | ||
114 | #define US_PR_BULK 0x50 /* bulk only */ | ||
115 | |||
116 | /* Protocol */ | ||
117 | #define US_SC_SCSI 0x06 /* Transparent */ | ||
118 | |||
119 | /* | ||
120 | * This many LUNs per USB device. | 111 | * This many LUNs per USB device. |
121 | * Every one of them takes a host, see UB_MAX_HOSTS. | 112 | * Every one of them takes a host, see UB_MAX_HOSTS. |
122 | */ | 113 | */ |
@@ -422,13 +413,18 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum); | |||
422 | 413 | ||
423 | /* | 414 | /* |
424 | */ | 415 | */ |
416 | #ifdef CONFIG_USB_LIBUSUAL | ||
417 | |||
418 | #define ub_usb_ids storage_usb_ids | ||
419 | #else | ||
420 | |||
425 | static struct usb_device_id ub_usb_ids[] = { | 421 | static struct usb_device_id ub_usb_ids[] = { |
426 | // { USB_DEVICE_VER(0x0781, 0x0002, 0x0009, 0x0009) }, /* SDDR-31 */ | ||
427 | { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) }, | 422 | { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) }, |
428 | { } | 423 | { } |
429 | }; | 424 | }; |
430 | 425 | ||
431 | MODULE_DEVICE_TABLE(usb, ub_usb_ids); | 426 | MODULE_DEVICE_TABLE(usb, ub_usb_ids); |
427 | #endif /* CONFIG_USB_LIBUSUAL */ | ||
432 | 428 | ||
433 | /* | 429 | /* |
434 | * Find me a way to identify "next free minor" for add_disk(), | 430 | * Find me a way to identify "next free minor" for add_disk(), |
@@ -2172,6 +2168,9 @@ static int ub_probe(struct usb_interface *intf, | |||
2172 | int rc; | 2168 | int rc; |
2173 | int i; | 2169 | int i; |
2174 | 2170 | ||
2171 | if (usb_usual_check_type(dev_id, USB_US_TYPE_UB)) | ||
2172 | return -ENXIO; | ||
2173 | |||
2175 | rc = -ENOMEM; | 2174 | rc = -ENOMEM; |
2176 | if ((sc = kmalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL) | 2175 | if ((sc = kmalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL) |
2177 | goto err_core; | 2176 | goto err_core; |
@@ -2479,6 +2478,7 @@ static int __init ub_init(void) | |||
2479 | if ((rc = usb_register(&ub_driver)) != 0) | 2478 | if ((rc = usb_register(&ub_driver)) != 0) |
2480 | goto err_register; | 2479 | goto err_register; |
2481 | 2480 | ||
2481 | usb_usual_set_present(USB_US_TYPE_UB); | ||
2482 | return 0; | 2482 | return 0; |
2483 | 2483 | ||
2484 | err_register: | 2484 | err_register: |
@@ -2494,6 +2494,7 @@ static void __exit ub_exit(void) | |||
2494 | 2494 | ||
2495 | devfs_remove(DEVFS_NAME); | 2495 | devfs_remove(DEVFS_NAME); |
2496 | unregister_blkdev(UB_MAJOR, DRV_NAME); | 2496 | unregister_blkdev(UB_MAJOR, DRV_NAME); |
2497 | usb_usual_clear_present(USB_US_TYPE_UB); | ||
2497 | } | 2498 | } |
2498 | 2499 | ||
2499 | module_init(ub_init); | 2500 | module_init(ub_init); |