diff options
Diffstat (limited to 'drivers/usb/storage/sddr55.c')
-rw-r--r-- | drivers/usb/storage/sddr55.c | 92 |
1 files changed, 89 insertions, 3 deletions
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c index 5a0106ba256c..e97716f8eb02 100644 --- a/drivers/usb/storage/sddr55.c +++ b/drivers/usb/storage/sddr55.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/jiffies.h> | 25 | #include <linux/jiffies.h> |
26 | #include <linux/errno.h> | 26 | #include <linux/errno.h> |
27 | #include <linux/module.h> | ||
27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
28 | 29 | ||
29 | #include <scsi/scsi.h> | 30 | #include <scsi/scsi.h> |
@@ -33,7 +34,45 @@ | |||
33 | #include "transport.h" | 34 | #include "transport.h" |
34 | #include "protocol.h" | 35 | #include "protocol.h" |
35 | #include "debug.h" | 36 | #include "debug.h" |
36 | #include "sddr55.h" | 37 | |
38 | |||
39 | /* | ||
40 | * The table of devices | ||
41 | */ | ||
42 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ | ||
43 | vendorName, productName, useProtocol, useTransport, \ | ||
44 | initFunction, flags) \ | ||
45 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | ||
46 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | ||
47 | |||
48 | struct usb_device_id sddr55_usb_ids[] = { | ||
49 | # include "unusual_sddr55.h" | ||
50 | { } /* Terminating entry */ | ||
51 | }; | ||
52 | MODULE_DEVICE_TABLE(usb, sddr55_usb_ids); | ||
53 | |||
54 | #undef UNUSUAL_DEV | ||
55 | |||
56 | /* | ||
57 | * The flags table | ||
58 | */ | ||
59 | #define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \ | ||
60 | vendor_name, product_name, use_protocol, use_transport, \ | ||
61 | init_function, Flags) \ | ||
62 | { \ | ||
63 | .vendorName = vendor_name, \ | ||
64 | .productName = product_name, \ | ||
65 | .useProtocol = use_protocol, \ | ||
66 | .useTransport = use_transport, \ | ||
67 | .initFunction = init_function, \ | ||
68 | } | ||
69 | |||
70 | static struct us_unusual_dev sddr55_unusual_dev_list[] = { | ||
71 | # include "unusual_sddr55.h" | ||
72 | { } /* Terminating entry */ | ||
73 | }; | ||
74 | |||
75 | #undef UNUSUAL_DEV | ||
37 | 76 | ||
38 | 77 | ||
39 | #define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) ) | 78 | #define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) ) |
@@ -513,7 +552,8 @@ static int sddr55_read_deviceID(struct us_data *us, | |||
513 | } | 552 | } |
514 | 553 | ||
515 | 554 | ||
516 | int sddr55_reset(struct us_data *us) { | 555 | static int sddr55_reset(struct us_data *us) |
556 | { | ||
517 | return 0; | 557 | return 0; |
518 | } | 558 | } |
519 | 559 | ||
@@ -734,7 +774,7 @@ static void sddr55_card_info_destructor(void *extra) { | |||
734 | /* | 774 | /* |
735 | * Transport for the Sandisk SDDR-55 | 775 | * Transport for the Sandisk SDDR-55 |
736 | */ | 776 | */ |
737 | int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) | 777 | static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) |
738 | { | 778 | { |
739 | int result; | 779 | int result; |
740 | static unsigned char inquiry_response[8] = { | 780 | static unsigned char inquiry_response[8] = { |
@@ -931,3 +971,49 @@ int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
931 | return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer? | 971 | return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer? |
932 | } | 972 | } |
933 | 973 | ||
974 | |||
975 | static int sddr55_probe(struct usb_interface *intf, | ||
976 | const struct usb_device_id *id) | ||
977 | { | ||
978 | struct us_data *us; | ||
979 | int result; | ||
980 | |||
981 | result = usb_stor_probe1(&us, intf, id, | ||
982 | (id - sddr55_usb_ids) + sddr55_unusual_dev_list); | ||
983 | if (result) | ||
984 | return result; | ||
985 | |||
986 | us->transport_name = "SDDR55"; | ||
987 | us->transport = sddr55_transport; | ||
988 | us->transport_reset = sddr55_reset; | ||
989 | us->max_lun = 0; | ||
990 | |||
991 | result = usb_stor_probe2(us); | ||
992 | return result; | ||
993 | } | ||
994 | |||
995 | static struct usb_driver sddr55_driver = { | ||
996 | .name = "ums-sddr55", | ||
997 | .probe = sddr55_probe, | ||
998 | .disconnect = usb_stor_disconnect, | ||
999 | .suspend = usb_stor_suspend, | ||
1000 | .resume = usb_stor_resume, | ||
1001 | .reset_resume = usb_stor_reset_resume, | ||
1002 | .pre_reset = usb_stor_pre_reset, | ||
1003 | .post_reset = usb_stor_post_reset, | ||
1004 | .id_table = sddr55_usb_ids, | ||
1005 | .soft_unbind = 1, | ||
1006 | }; | ||
1007 | |||
1008 | static int __init sddr55_init(void) | ||
1009 | { | ||
1010 | return usb_register(&sddr55_driver); | ||
1011 | } | ||
1012 | |||
1013 | static void __exit sddr55_exit(void) | ||
1014 | { | ||
1015 | usb_deregister(&sddr55_driver); | ||
1016 | } | ||
1017 | |||
1018 | module_init(sddr55_init); | ||
1019 | module_exit(sddr55_exit); | ||