aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/freecom.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2009-02-12 14:48:11 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:20:34 -0400
commit0d62939fab3cf28a23ac6934cec599793d3a1d9d (patch)
tree1493af55ad42675eb1be08161c67294ea8692025 /drivers/usb/storage/freecom.c
parent26d6818f19d0ab018f28a20d699511c1efdf508b (diff)
usb-storage: make freecom a separate module
This patch (as1212) converts usb-storage's freecom subdriver into a separate module. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage/freecom.c')
-rw-r--r--drivers/usb/storage/freecom.c95
1 files changed, 90 insertions, 5 deletions
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
index 73ac7262239e..393047b3890d 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,6 @@
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 37
38#ifdef CONFIG_USB_STORAGE_DEBUG 38#ifdef CONFIG_USB_STORAGE_DEBUG
39static void pdump (void *, int); 39static void pdump (void *, int);
@@ -103,6 +103,47 @@ struct freecom_status {
103#define FCM_PACKET_LENGTH 64 103#define FCM_PACKET_LENGTH 64
104#define FCM_STATUS_PACKET_LENGTH 4 104#define FCM_STATUS_PACKET_LENGTH 4
105 105
106static int init_freecom(struct us_data *us);
107
108
109/*
110 * The table of devices
111 */
112#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
113 vendorName, productName, useProtocol, useTransport, \
114 initFunction, flags) \
115{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
116 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
117
118struct usb_device_id freecom_usb_ids[] = {
119# include "unusual_freecom.h"
120 { } /* Terminating entry */
121};
122MODULE_DEVICE_TABLE(usb, freecom_usb_ids);
123
124#undef UNUSUAL_DEV
125
126/*
127 * The flags table
128 */
129#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
130 vendor_name, product_name, use_protocol, use_transport, \
131 init_function, Flags) \
132{ \
133 .vendorName = vendor_name, \
134 .productName = product_name, \
135 .useProtocol = use_protocol, \
136 .useTransport = use_transport, \
137 .initFunction = init_function, \
138}
139
140static struct us_unusual_dev freecom_unusual_dev_list[] = {
141# include "unusual_freecom.h"
142 { } /* Terminating entry */
143};
144
145#undef UNUSUAL_DEV
146
106static int 147static int
107freecom_readdata (struct scsi_cmnd *srb, struct us_data *us, 148freecom_readdata (struct scsi_cmnd *srb, struct us_data *us,
108 unsigned int ipipe, unsigned int opipe, int count) 149 unsigned int ipipe, unsigned int opipe, int count)
@@ -173,7 +214,7 @@ freecom_writedata (struct scsi_cmnd *srb, struct us_data *us,
173 * Transport for the Freecom USB/IDE adaptor. 214 * Transport for the Freecom USB/IDE adaptor.
174 * 215 *
175 */ 216 */
176int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) 217static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
177{ 218{
178 struct freecom_cb_wrap *fcb; 219 struct freecom_cb_wrap *fcb;
179 struct freecom_status *fst; 220 struct freecom_status *fst;
@@ -377,8 +418,7 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
377 return USB_STOR_TRANSPORT_GOOD; 418 return USB_STOR_TRANSPORT_GOOD;
378} 419}
379 420
380int 421static int init_freecom(struct us_data *us)
381freecom_init (struct us_data *us)
382{ 422{
383 int result; 423 int result;
384 char *buffer = us->iobuf; 424 char *buffer = us->iobuf;
@@ -417,7 +457,7 @@ freecom_init (struct us_data *us)
417 return USB_STOR_TRANSPORT_GOOD; 457 return USB_STOR_TRANSPORT_GOOD;
418} 458}
419 459
420int usb_stor_freecom_reset(struct us_data *us) 460static int usb_stor_freecom_reset(struct us_data *us)
421{ 461{
422 printk (KERN_CRIT "freecom reset called\n"); 462 printk (KERN_CRIT "freecom reset called\n");
423 463
@@ -479,3 +519,48 @@ static void pdump (void *ibuffer, int length)
479} 519}
480#endif 520#endif
481 521
522static int freecom_probe(struct usb_interface *intf,
523 const struct usb_device_id *id)
524{
525 struct us_data *us;
526 int result;
527
528 result = usb_stor_probe1(&us, intf, id,
529 (id - freecom_usb_ids) + freecom_unusual_dev_list);
530 if (result)
531 return result;
532
533 us->transport_name = "Freecom";
534 us->transport = freecom_transport;
535 us->transport_reset = usb_stor_freecom_reset;
536 us->max_lun = 0;
537
538 result = usb_stor_probe2(us);
539 return result;
540}
541
542static struct usb_driver freecom_driver = {
543 .name = "ums-freecom",
544 .probe = freecom_probe,
545 .disconnect = usb_stor_disconnect,
546 .suspend = usb_stor_suspend,
547 .resume = usb_stor_resume,
548 .reset_resume = usb_stor_reset_resume,
549 .pre_reset = usb_stor_pre_reset,
550 .post_reset = usb_stor_post_reset,
551 .id_table = freecom_usb_ids,
552 .soft_unbind = 1,
553};
554
555static int __init freecom_init(void)
556{
557 return usb_register(&freecom_driver);
558}
559
560static void __exit freecom_exit(void)
561{
562 usb_deregister(&freecom_driver);
563}
564
565module_init(freecom_init);
566module_exit(freecom_exit);