aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/fdomain_stub.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/pcmcia/fdomain_stub.c')
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index 5842c938fff5..538fedb97924 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);