aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/freecom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/storage/freecom.c')
-rw-r--r--drivers/usb/storage/freecom.c99
1 files changed, 94 insertions, 5 deletions
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
index 73ac7262239e..54cc94277acb 100644
--- a/drivers/usb/storage/freecom.c
+++ b/drivers/usb/storage/freecom.c
@@ -26,6 +26,7 @@
26 * (http://www.freecom.de/) 26 * (http://www.freecom.de/)
27 */ 27 */
28 28
29#include <linux/module.h>
29#include <scsi/scsi.h> 30#include <scsi/scsi.h>
30#include <scsi/scsi_cmnd.h> 31#include <scsi/scsi_cmnd.h>
31 32
@@ -33,7 +34,10 @@
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 "freecom.h" 37
38MODULE_DESCRIPTION("Driver for Freecom USB/IDE adaptor");
39MODULE_AUTHOR("David Brown <usb-storage@davidb.org>");
40MODULE_LICENSE("GPL");
37 41
38#ifdef CONFIG_USB_STORAGE_DEBUG 42#ifdef CONFIG_USB_STORAGE_DEBUG
39static void pdump (void *, int); 43static void pdump (void *, int);
@@ -103,6 +107,47 @@ struct freecom_status {
103#define FCM_PACKET_LENGTH 64 107#define FCM_PACKET_LENGTH 64
104#define FCM_STATUS_PACKET_LENGTH 4 108#define FCM_STATUS_PACKET_LENGTH 4
105 109
110static int init_freecom(struct us_data *us);
111
112
113/*
114 * The table of devices
115 */
116#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
117 vendorName, productName, useProtocol, useTransport, \
118 initFunction, flags) \
119{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
120 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
121
122struct usb_device_id freecom_usb_ids[] = {
123# include "unusual_freecom.h"
124 { } /* Terminating entry */
125};
126MODULE_DEVICE_TABLE(usb, freecom_usb_ids);
127
128#undef UNUSUAL_DEV
129
130/*
131 * The flags table
132 */
133#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
134 vendor_name, product_name, use_protocol, use_transport, \
135 init_function, Flags) \
136{ \
137 .vendorName = vendor_name, \
138 .productName = product_name, \
139 .useProtocol = use_protocol, \
140 .useTransport = use_transport, \
141 .initFunction = init_function, \
142}
143
144static struct us_unusual_dev freecom_unusual_dev_list[] = {
145# include "unusual_freecom.h"
146 { } /* Terminating entry */
147};
148
149#undef UNUSUAL_DEV
150
106static int 151static int
107freecom_readdata (struct scsi_cmnd *srb, struct us_data *us, 152freecom_readdata (struct scsi_cmnd *srb, struct us_data *us,
108 unsigned int ipipe, unsigned int opipe, int count) 153 unsigned int ipipe, unsigned int opipe, int count)
@@ -173,7 +218,7 @@ freecom_writedata (struct scsi_cmnd *srb, struct us_data *us,
173 * Transport for the Freecom USB/IDE adaptor. 218 * Transport for the Freecom USB/IDE adaptor.
174 * 219 *
175 */ 220 */
176int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) 221static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
177{ 222{
178 struct freecom_cb_wrap *fcb; 223 struct freecom_cb_wrap *fcb;
179 struct freecom_status *fst; 224 struct freecom_status *fst;
@@ -377,8 +422,7 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
377 return USB_STOR_TRANSPORT_GOOD; 422 return USB_STOR_TRANSPORT_GOOD;
378} 423}
379 424
380int 425static int init_freecom(struct us_data *us)
381freecom_init (struct us_data *us)
382{ 426{
383 int result; 427 int result;
384 char *buffer = us->iobuf; 428 char *buffer = us->iobuf;
@@ -417,7 +461,7 @@ freecom_init (struct us_data *us)
417 return USB_STOR_TRANSPORT_GOOD; 461 return USB_STOR_TRANSPORT_GOOD;
418} 462}
419 463
420int usb_stor_freecom_reset(struct us_data *us) 464static int usb_stor_freecom_reset(struct us_data *us)
421{ 465{
422 printk (KERN_CRIT "freecom reset called\n"); 466 printk (KERN_CRIT "freecom reset called\n");
423 467
@@ -479,3 +523,48 @@ static void pdump (void *ibuffer, int length)
479} 523}
480#endif 524#endif
481 525
526static int freecom_probe(struct usb_interface *intf,
527 const struct usb_device_id *id)
528{
529 struct us_data *us;
530 int result;
531
532 result = usb_stor_probe1(&us, intf, id,
533 (id - freecom_usb_ids) + freecom_unusual_dev_list);
534 if (result)
535 return result;
536
537 us->transport_name = "Freecom";
538 us->transport = freecom_transport;
539 us->transport_reset = usb_stor_freecom_reset;
540 us->max_lun = 0;
541
542 result = usb_stor_probe2(us);
543 return result;
544}
545
546static struct usb_driver freecom_driver = {
547 .name = "ums-freecom",
548 .probe = freecom_probe,
549 .disconnect = usb_stor_disconnect,
550 .suspend = usb_stor_suspend,
551 .resume = usb_stor_resume,
552 .reset_resume = usb_stor_reset_resume,
553 .pre_reset = usb_stor_pre_reset,
554 .post_reset = usb_stor_post_reset,
555 .id_table = freecom_usb_ids,
556 .soft_unbind = 1,
557};
558
559static int __init freecom_init(void)
560{
561 return usb_register(&freecom_driver);
562}
563
564static void __exit freecom_exit(void)
565{
566 usb_deregister(&freecom_driver);
567}
568
569module_init(freecom_init);
570module_exit(freecom_exit);