diff options
author | Pete Zaitcev <zaitcev@redhat.com> | 2005-10-22 20:15:09 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-04 13:48:31 -0800 |
commit | a00828e9ac62caed7b830d631914d7748817ccd1 (patch) | |
tree | 2fed4c66762fa4f54945413b4027ff5837ad0633 /drivers/block/ub.c | |
parent | 1c50c317e2e7f15427149cbc216a63366468710e (diff) | |
download | lwn-a00828e9ac62caed7b830d631914d7748817ccd1.tar.gz lwn-a00828e9ac62caed7b830d631914d7748817ccd1.zip |
[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 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/usb.h> +#include <linux/usb_usual.h> #include <linux/blkdev.h> #include <linux/devfs_fs_kernel.h> #include <linux/timer.h> @@ -107,16 +108,6 @@ */ /* - * Definitions which have to be scattered once we understand the layout better. - */ - -/* Transport (despite PR in the name) */ -#define US_PR_BULK 0x50 /* bulk only */ - -/* Protocol */ -#define US_SC_SCSI 0x06 /* Transparent */ - -/* * This many LUNs per USB device. * Every one of them takes a host, see UB_MAX_HOSTS. */ @@ -422,13 +413,18 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum); /* */ +#ifdef CONFIG_USB_LIBUSUAL + +#define ub_usb_ids storage_usb_ids +#else + static struct usb_device_id ub_usb_ids[] = { - // { USB_DEVICE_VER(0x0781, 0x0002, 0x0009, 0x0009) }, /* SDDR-31 */ { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) }, { } }; MODULE_DEVICE_TABLE(usb, ub_usb_ids); +#endif /* CONFIG_USB_LIBUSUAL */ /* * Find me a way to identify "next free minor" for add_disk(), @@ -2172,6 +2168,9 @@ static int ub_probe(struct usb_interface *intf, int rc; int i; + if (usb_usual_check_type(dev_id, USB_US_TYPE_UB)) + return -ENXIO; + rc = -ENOMEM; if ((sc = kmalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL) goto err_core; @@ -2479,6 +2478,7 @@ static int __init ub_init(void) if ((rc = usb_register(&ub_driver)) != 0) goto err_register; + usb_usual_set_present(USB_US_TYPE_UB); return 0; err_register: @@ -2494,6 +2494,7 @@ static void __exit ub_exit(void) devfs_remove(DEVFS_NAME); unregister_blkdev(UB_MAJOR, DRV_NAME); + usb_usual_clear_present(USB_US_TYPE_UB); } module_init(ub_init); |