diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2009-02-12 14:47:54 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:20:34 -0400 |
commit | 32d5493eb83a217c3b1eba4b98cd6d19864f71a8 (patch) | |
tree | 13f1ee0b36639b15932602000971531fbeba06d0 /drivers/usb/storage/isd200.c | |
parent | 0ff71883b2d60136430458413c135d545c69b0c4 (diff) |
usb-storage: make isd200 a separate module
This patch (as1208) converts usb-storage's isd200 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/isd200.c')
-rw-r--r-- | drivers/usb/storage/isd200.c | 94 |
1 files changed, 91 insertions, 3 deletions
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 383abf2516a5..df943008538c 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c | |||
@@ -44,6 +44,7 @@ | |||
44 | 44 | ||
45 | #include <linux/jiffies.h> | 45 | #include <linux/jiffies.h> |
46 | #include <linux/errno.h> | 46 | #include <linux/errno.h> |
47 | #include <linux/module.h> | ||
47 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
48 | #include <linux/hdreg.h> | 49 | #include <linux/hdreg.h> |
49 | #include <linux/scatterlist.h> | 50 | #include <linux/scatterlist.h> |
@@ -57,7 +58,50 @@ | |||
57 | #include "protocol.h" | 58 | #include "protocol.h" |
58 | #include "debug.h" | 59 | #include "debug.h" |
59 | #include "scsiglue.h" | 60 | #include "scsiglue.h" |
60 | #include "isd200.h" | 61 | |
62 | |||
63 | static int isd200_Initialization(struct us_data *us); | ||
64 | |||
65 | |||
66 | /* | ||
67 | * The table of devices | ||
68 | */ | ||
69 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ | ||
70 | vendorName, productName, useProtocol, useTransport, \ | ||
71 | initFunction, flags) \ | ||
72 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | ||
73 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | ||
74 | |||
75 | struct usb_device_id isd200_usb_ids[] = { | ||
76 | # include "unusual_isd200.h" | ||
77 | { } /* Terminating entry */ | ||
78 | }; | ||
79 | MODULE_DEVICE_TABLE(usb, isd200_usb_ids); | ||
80 | |||
81 | #undef UNUSUAL_DEV | ||
82 | #undef USUAL_DEV | ||
83 | |||
84 | /* | ||
85 | * The flags table | ||
86 | */ | ||
87 | #define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \ | ||
88 | vendor_name, product_name, use_protocol, use_transport, \ | ||
89 | init_function, Flags) \ | ||
90 | { \ | ||
91 | .vendorName = vendor_name, \ | ||
92 | .productName = product_name, \ | ||
93 | .useProtocol = use_protocol, \ | ||
94 | .useTransport = use_transport, \ | ||
95 | .initFunction = init_function, \ | ||
96 | } | ||
97 | |||
98 | static struct us_unusual_dev isd200_unusual_dev_list[] = { | ||
99 | # include "unusual_isd200.h" | ||
100 | { } /* Terminating entry */ | ||
101 | }; | ||
102 | |||
103 | #undef UNUSUAL_DEV | ||
104 | #undef USUAL_DEV | ||
61 | 105 | ||
62 | 106 | ||
63 | /* Timeout defines (in Seconds) */ | 107 | /* Timeout defines (in Seconds) */ |
@@ -1518,7 +1562,7 @@ static int isd200_init_info(struct us_data *us) | |||
1518 | * Initialization for the ISD200 | 1562 | * Initialization for the ISD200 |
1519 | */ | 1563 | */ |
1520 | 1564 | ||
1521 | int isd200_Initialization(struct us_data *us) | 1565 | static int isd200_Initialization(struct us_data *us) |
1522 | { | 1566 | { |
1523 | US_DEBUGP("ISD200 Initialization...\n"); | 1567 | US_DEBUGP("ISD200 Initialization...\n"); |
1524 | 1568 | ||
@@ -1549,7 +1593,7 @@ int isd200_Initialization(struct us_data *us) | |||
1549 | * | 1593 | * |
1550 | */ | 1594 | */ |
1551 | 1595 | ||
1552 | void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us) | 1596 | static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us) |
1553 | { | 1597 | { |
1554 | int sendToTransport = 1, orig_bufflen; | 1598 | int sendToTransport = 1, orig_bufflen; |
1555 | union ata_cdb ataCdb; | 1599 | union ata_cdb ataCdb; |
@@ -1570,3 +1614,47 @@ void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us) | |||
1570 | 1614 | ||
1571 | isd200_srb_set_bufflen(srb, orig_bufflen); | 1615 | isd200_srb_set_bufflen(srb, orig_bufflen); |
1572 | } | 1616 | } |
1617 | |||
1618 | static int isd200_probe(struct usb_interface *intf, | ||
1619 | const struct usb_device_id *id) | ||
1620 | { | ||
1621 | struct us_data *us; | ||
1622 | int result; | ||
1623 | |||
1624 | result = usb_stor_probe1(&us, intf, id, | ||
1625 | (id - isd200_usb_ids) + isd200_unusual_dev_list); | ||
1626 | if (result) | ||
1627 | return result; | ||
1628 | |||
1629 | us->protocol_name = "ISD200 ATA/ATAPI"; | ||
1630 | us->proto_handler = isd200_ata_command; | ||
1631 | |||
1632 | result = usb_stor_probe2(us); | ||
1633 | return result; | ||
1634 | } | ||
1635 | |||
1636 | static struct usb_driver isd200_driver = { | ||
1637 | .name = "ums-isd200", | ||
1638 | .probe = isd200_probe, | ||
1639 | .disconnect = usb_stor_disconnect, | ||
1640 | .suspend = usb_stor_suspend, | ||
1641 | .resume = usb_stor_resume, | ||
1642 | .reset_resume = usb_stor_reset_resume, | ||
1643 | .pre_reset = usb_stor_pre_reset, | ||
1644 | .post_reset = usb_stor_post_reset, | ||
1645 | .id_table = isd200_usb_ids, | ||
1646 | .soft_unbind = 1, | ||
1647 | }; | ||
1648 | |||
1649 | static int __init isd200_init(void) | ||
1650 | { | ||
1651 | return usb_register(&isd200_driver); | ||
1652 | } | ||
1653 | |||
1654 | static void __exit isd200_exit(void) | ||
1655 | { | ||
1656 | usb_deregister(&isd200_driver); | ||
1657 | } | ||
1658 | |||
1659 | module_init(isd200_init); | ||
1660 | module_exit(isd200_exit); | ||