aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/sddr55.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/storage/sddr55.c')
-rw-r--r--drivers/usb/storage/sddr55.c99
1 files changed, 95 insertions, 4 deletions
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
index 0d8df7577899..44dfed7754ed 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,48 @@
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
38MODULE_DESCRIPTION("Driver for SanDisk SDDR-55 SmartMedia reader");
39MODULE_AUTHOR("Simon Munton");
40MODULE_LICENSE("GPL");
41
42/*
43 * The table of devices
44 */
45#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
46 vendorName, productName, useProtocol, useTransport, \
47 initFunction, flags) \
48{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
49 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
50
51struct usb_device_id sddr55_usb_ids[] = {
52# include "unusual_sddr55.h"
53 { } /* Terminating entry */
54};
55MODULE_DEVICE_TABLE(usb, sddr55_usb_ids);
56
57#undef UNUSUAL_DEV
58
59/*
60 * The flags table
61 */
62#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
63 vendor_name, product_name, use_protocol, use_transport, \
64 init_function, Flags) \
65{ \
66 .vendorName = vendor_name, \
67 .productName = product_name, \
68 .useProtocol = use_protocol, \
69 .useTransport = use_transport, \
70 .initFunction = init_function, \
71}
72
73static struct us_unusual_dev sddr55_unusual_dev_list[] = {
74# include "unusual_sddr55.h"
75 { } /* Terminating entry */
76};
77
78#undef UNUSUAL_DEV
37 79
38 80
39#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) ) 81#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
@@ -513,7 +555,8 @@ static int sddr55_read_deviceID(struct us_data *us,
513} 555}
514 556
515 557
516int sddr55_reset(struct us_data *us) { 558static int sddr55_reset(struct us_data *us)
559{
517 return 0; 560 return 0;
518} 561}
519 562
@@ -703,7 +746,9 @@ static int sddr55_read_map(struct us_data *us) {
703 746
704 if (info->lba_to_pba[lba + zone * 1000] != NOT_ALLOCATED && 747 if (info->lba_to_pba[lba + zone * 1000] != NOT_ALLOCATED &&
705 !info->force_read_only) { 748 !info->force_read_only) {
706 printk("sddr55: map inconsistency at LBA %04X\n", lba + zone * 1000); 749 printk(KERN_WARNING
750 "sddr55: map inconsistency at LBA %04X\n",
751 lba + zone * 1000);
707 info->force_read_only = 1; 752 info->force_read_only = 1;
708 } 753 }
709 754
@@ -732,7 +777,7 @@ static void sddr55_card_info_destructor(void *extra) {
732/* 777/*
733 * Transport for the Sandisk SDDR-55 778 * Transport for the Sandisk SDDR-55
734 */ 779 */
735int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) 780static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
736{ 781{
737 int result; 782 int result;
738 static unsigned char inquiry_response[8] = { 783 static unsigned char inquiry_response[8] = {
@@ -929,3 +974,49 @@ int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
929 return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer? 974 return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer?
930} 975}
931 976
977
978static int sddr55_probe(struct usb_interface *intf,
979 const struct usb_device_id *id)
980{
981 struct us_data *us;
982 int result;
983
984 result = usb_stor_probe1(&us, intf, id,
985 (id - sddr55_usb_ids) + sddr55_unusual_dev_list);
986 if (result)
987 return result;
988
989 us->transport_name = "SDDR55";
990 us->transport = sddr55_transport;
991 us->transport_reset = sddr55_reset;
992 us->max_lun = 0;
993
994 result = usb_stor_probe2(us);
995 return result;
996}
997
998static struct usb_driver sddr55_driver = {
999 .name = "ums-sddr55",
1000 .probe = sddr55_probe,
1001 .disconnect = usb_stor_disconnect,
1002 .suspend = usb_stor_suspend,
1003 .resume = usb_stor_resume,
1004 .reset_resume = usb_stor_reset_resume,
1005 .pre_reset = usb_stor_pre_reset,
1006 .post_reset = usb_stor_post_reset,
1007 .id_table = sddr55_usb_ids,
1008 .soft_unbind = 1,
1009};
1010
1011static int __init sddr55_init(void)
1012{
1013 return usb_register(&sddr55_driver);
1014}
1015
1016static void __exit sddr55_exit(void)
1017{
1018 usb_deregister(&sddr55_driver);
1019}
1020
1021module_init(sddr55_init);
1022module_exit(sddr55_exit);