aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:25:35 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:20 -0500
commitb463581154f3f3eecda27cae60df813fefcd84d3 (patch)
tree5e5b0f7a32b0727b64e52b9b2649897e6c841074 /drivers/scsi/pcmcia
parentf3990715589d378a2d3aa9b8accd78bb4a2378b7 (diff)
[PATCH] pcmcia: remove dev_list from drivers
The linked list of devices managed by each PCMCIA driver is, in very most cases, unused. Therefore, remove it from many drivers. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi/pcmcia')
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c30
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c19
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c16
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c14
4 files changed, 11 insertions, 68 deletions
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index 5842c938fff..538fedb9792 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -87,8 +87,6 @@ static dev_link_t *fdomain_attach(void);
87static void fdomain_detach(struct pcmcia_device *p_dev); 87static void fdomain_detach(struct pcmcia_device *p_dev);
88 88
89 89
90static dev_link_t *dev_list = NULL;
91
92static dev_info_t dev_info = "fdomain_cs"; 90static dev_info_t dev_info = "fdomain_cs";
93 91
94static dev_link_t *fdomain_attach(void) 92static dev_link_t *fdomain_attach(void)
@@ -116,8 +114,7 @@ static dev_link_t *fdomain_attach(void)
116 link->conf.Present = PRESENT_OPTION; 114 link->conf.Present = PRESENT_OPTION;
117 115
118 /* Register with Card Services */ 116 /* Register with Card Services */
119 link->next = dev_list; 117 link->next = NULL;
120 dev_list = link;
121 client_reg.dev_info = &dev_info; 118 client_reg.dev_info = &dev_info;
122 client_reg.Version = 0x0210; 119 client_reg.Version = 0x0210;
123 client_reg.event_callback_args.client_data = link; 120 client_reg.event_callback_args.client_data = link;
@@ -135,24 +132,14 @@ static dev_link_t *fdomain_attach(void)
135 132
136static void fdomain_detach(struct pcmcia_device *p_dev) 133static void fdomain_detach(struct pcmcia_device *p_dev)
137{ 134{
138 dev_link_t *link = dev_to_instance(p_dev); 135 dev_link_t *link = dev_to_instance(p_dev);
139 dev_link_t **linkp;
140 136
141 DEBUG(0, "fdomain_detach(0x%p)\n", link); 137 DEBUG(0, "fdomain_detach(0x%p)\n", link);
142 138
143 /* Locate device structure */ 139 if (link->state & DEV_CONFIG)
144 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 140 fdomain_release(link);
145 if (*linkp == link) break; 141
146 if (*linkp == NULL) 142 kfree(link->priv);
147 return;
148
149 if (link->state & DEV_CONFIG)
150 fdomain_release(link);
151
152 /* Unlink device structure, free bits */
153 *linkp = link->next;
154 kfree(link->priv);
155
156} /* fdomain_detach */ 143} /* fdomain_detach */
157 144
158/*====================================================================*/ 145/*====================================================================*/
@@ -324,7 +311,6 @@ static int __init init_fdomain_cs(void)
324static void __exit exit_fdomain_cs(void) 311static void __exit exit_fdomain_cs(void)
325{ 312{
326 pcmcia_unregister_driver(&fdomain_cs_driver); 313 pcmcia_unregister_driver(&fdomain_cs_driver);
327 BUG_ON(dev_list != NULL);
328} 314}
329 315
330module_init(init_fdomain_cs); 316module_init(init_fdomain_cs);
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index e40a8c22aa9..e48e9fb3c58 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -104,7 +104,6 @@ static struct scsi_host_template nsp_driver_template = {
104#endif 104#endif
105}; 105};
106 106
107static dev_link_t *dev_list = NULL;
108static dev_info_t dev_info = {"nsp_cs"}; 107static dev_info_t dev_info = {"nsp_cs"};
109 108
110static nsp_hw_data nsp_data_base; /* attach <-> detect glue */ 109static nsp_hw_data nsp_data_base; /* attach <-> detect glue */
@@ -1638,8 +1637,7 @@ static dev_link_t *nsp_cs_attach(void)
1638 1637
1639 1638
1640 /* Register with Card Services */ 1639 /* Register with Card Services */
1641 link->next = dev_list; 1640 link->next = NULL;
1642 dev_list = link;
1643 client_reg.dev_info = &dev_info; 1641 client_reg.dev_info = &dev_info;
1644 client_reg.Version = 0x0210; 1642 client_reg.Version = 0x0210;
1645 client_reg.event_callback_args.client_data = link; 1643 client_reg.event_callback_args.client_data = link;
@@ -1665,30 +1663,16 @@ static dev_link_t *nsp_cs_attach(void)
1665static void nsp_cs_detach(struct pcmcia_device *p_dev) 1663static void nsp_cs_detach(struct pcmcia_device *p_dev)
1666{ 1664{
1667 dev_link_t *link = dev_to_instance(p_dev); 1665 dev_link_t *link = dev_to_instance(p_dev);
1668 dev_link_t **linkp;
1669 1666
1670 nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); 1667 nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link);
1671 1668
1672 /* Locate device structure */
1673 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) {
1674 if (*linkp == link) {
1675 break;
1676 }
1677 }
1678 if (*linkp == NULL) {
1679 return;
1680 }
1681
1682 if (link->state & DEV_CONFIG) { 1669 if (link->state & DEV_CONFIG) {
1683 ((scsi_info_t *)link->priv)->stop = 1; 1670 ((scsi_info_t *)link->priv)->stop = 1;
1684 nsp_cs_release(link); 1671 nsp_cs_release(link);
1685 } 1672 }
1686 1673
1687 /* Unlink device structure, free bits */
1688 *linkp = link->next;
1689 kfree(link->priv); 1674 kfree(link->priv);
1690 link->priv = NULL; 1675 link->priv = NULL;
1691
1692} /* nsp_cs_detach */ 1676} /* nsp_cs_detach */
1693 1677
1694 1678
@@ -2168,7 +2152,6 @@ static void __exit nsp_cs_exit(void)
2168 2152
2169#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,68)) 2153#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,68))
2170 pcmcia_unregister_driver(&nsp_driver); 2154 pcmcia_unregister_driver(&nsp_driver);
2171 BUG_ON(dev_list != NULL);
2172#else 2155#else
2173 unregister_pcmcia_driver(&dev_info); 2156 unregister_pcmcia_driver(&dev_info);
2174 /* XXX: this really needs to move into generic code.. */ 2157 /* XXX: this really needs to move into generic code.. */
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index 8351dc234ff..e10281a6e5f 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -104,8 +104,6 @@ static dev_link_t *qlogic_attach(void);
104static void qlogic_detach(struct pcmcia_device *p_dev); 104static void qlogic_detach(struct pcmcia_device *p_dev);
105 105
106 106
107static dev_link_t *dev_list = NULL;
108
109static dev_info_t dev_info = "qlogic_cs"; 107static dev_info_t dev_info = "qlogic_cs";
110 108
111static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host, 109static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host,
@@ -190,8 +188,7 @@ static dev_link_t *qlogic_attach(void)
190 link->conf.Present = PRESENT_OPTION; 188 link->conf.Present = PRESENT_OPTION;
191 189
192 /* Register with Card Services */ 190 /* Register with Card Services */
193 link->next = dev_list; 191 link->next = NULL;
194 dev_list = link;
195 client_reg.dev_info = &dev_info; 192 client_reg.dev_info = &dev_info;
196 client_reg.Version = 0x0210; 193 client_reg.Version = 0x0210;
197 client_reg.event_callback_args.client_data = link; 194 client_reg.event_callback_args.client_data = link;
@@ -210,22 +207,12 @@ static dev_link_t *qlogic_attach(void)
210static void qlogic_detach(struct pcmcia_device *p_dev) 207static void qlogic_detach(struct pcmcia_device *p_dev)
211{ 208{
212 dev_link_t *link = dev_to_instance(p_dev); 209 dev_link_t *link = dev_to_instance(p_dev);
213 dev_link_t **linkp;
214 210
215 DEBUG(0, "qlogic_detach(0x%p)\n", link); 211 DEBUG(0, "qlogic_detach(0x%p)\n", link);
216 212
217 /* Locate device structure */
218 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
219 if (*linkp == link)
220 break;
221 if (*linkp == NULL)
222 return;
223
224 if (link->state & DEV_CONFIG) 213 if (link->state & DEV_CONFIG)
225 qlogic_release(link); 214 qlogic_release(link);
226 215
227 /* Unlink device structure, free bits */
228 *linkp = link->next;
229 kfree(link->priv); 216 kfree(link->priv);
230 217
231} /* qlogic_detach */ 218} /* qlogic_detach */
@@ -439,7 +426,6 @@ static int __init init_qlogic_cs(void)
439static void __exit exit_qlogic_cs(void) 426static void __exit exit_qlogic_cs(void)
440{ 427{
441 pcmcia_unregister_driver(&qlogic_cs_driver); 428 pcmcia_unregister_driver(&qlogic_cs_driver);
442 BUG_ON(dev_list != NULL);
443} 429}
444 430
445MODULE_AUTHOR("Tom Zerucha, Michael Griffith"); 431MODULE_AUTHOR("Tom Zerucha, Michael Griffith");
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index a0f8e2691f9..87d50b33475 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -232,7 +232,6 @@ enum Phase {
232* Global (within this module) variables other than 232* Global (within this module) variables other than
233* sym53c500_driver_template (the scsi_host_template). 233* sym53c500_driver_template (the scsi_host_template).
234*/ 234*/
235static dev_link_t *dev_list;
236static dev_info_t dev_info = "sym53c500_cs"; 235static dev_info_t dev_info = "sym53c500_cs";
237 236
238/* ================================================================== */ 237/* ================================================================== */
@@ -930,22 +929,12 @@ static void
930SYM53C500_detach(struct pcmcia_device *p_dev) 929SYM53C500_detach(struct pcmcia_device *p_dev)
931{ 930{
932 dev_link_t *link = dev_to_instance(p_dev); 931 dev_link_t *link = dev_to_instance(p_dev);
933 dev_link_t **linkp;
934 932
935 DEBUG(0, "SYM53C500_detach(0x%p)\n", link); 933 DEBUG(0, "SYM53C500_detach(0x%p)\n", link);
936 934
937 /* Locate device structure */
938 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
939 if (*linkp == link)
940 break;
941 if (*linkp == NULL)
942 return;
943
944 if (link->state & DEV_CONFIG) 935 if (link->state & DEV_CONFIG)
945 SYM53C500_release(link); 936 SYM53C500_release(link);
946 937
947 /* Unlink device structure, free bits. */
948 *linkp = link->next;
949 kfree(link->priv); 938 kfree(link->priv);
950 link->priv = NULL; 939 link->priv = NULL;
951} /* SYM53C500_detach */ 940} /* SYM53C500_detach */
@@ -978,8 +967,7 @@ SYM53C500_attach(void)
978 link->conf.Present = PRESENT_OPTION; 967 link->conf.Present = PRESENT_OPTION;
979 968
980 /* Register with Card Services */ 969 /* Register with Card Services */
981 link->next = dev_list; 970 link->next = NULL;
982 dev_list = link;
983 client_reg.dev_info = &dev_info; 971 client_reg.dev_info = &dev_info;
984 client_reg.Version = 0x0210; 972 client_reg.Version = 0x0210;
985 client_reg.event_callback_args.client_data = link; 973 client_reg.event_callback_args.client_data = link;