aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/legacy/ide-cs.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index 1fb8976496d9..c83068dd42a0 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -96,7 +96,8 @@ static dev_info_t dev_info = "ide-cs";
96static dev_link_t *ide_attach(void); 96static dev_link_t *ide_attach(void);
97static void ide_detach(struct pcmcia_device *p_dev); 97static void ide_detach(struct pcmcia_device *p_dev);
98 98
99static dev_link_t *dev_list = NULL; 99
100
100 101
101/*====================================================================== 102/*======================================================================
102 103
@@ -130,8 +131,7 @@ static dev_link_t *ide_attach(void)
130 link->conf.IntType = INT_MEMORY_AND_IO; 131 link->conf.IntType = INT_MEMORY_AND_IO;
131 132
132 /* Register with Card Services */ 133 /* Register with Card Services */
133 link->next = dev_list; 134 link->next = NULL;
134 dev_list = link;
135 client_reg.dev_info = &dev_info; 135 client_reg.dev_info = &dev_info;
136 client_reg.Version = 0x0210; 136 client_reg.Version = 0x0210;
137 client_reg.event_callback_args.client_data = link; 137 client_reg.event_callback_args.client_data = link;
@@ -157,23 +157,13 @@ static dev_link_t *ide_attach(void)
157static void ide_detach(struct pcmcia_device *p_dev) 157static void ide_detach(struct pcmcia_device *p_dev)
158{ 158{
159 dev_link_t *link = dev_to_instance(p_dev); 159 dev_link_t *link = dev_to_instance(p_dev);
160 dev_link_t **linkp;
161 160
162 DEBUG(0, "ide_detach(0x%p)\n", link); 161 DEBUG(0, "ide_detach(0x%p)\n", link);
163
164 /* Locate device structure */
165 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
166 if (*linkp == link) break;
167 if (*linkp == NULL)
168 return;
169 162
170 if (link->state & DEV_CONFIG) 163 if (link->state & DEV_CONFIG)
171 ide_release(link); 164 ide_release(link);
172 165
173 /* Unlink, free device structure */
174 *linkp = link->next;
175 kfree(link->priv); 166 kfree(link->priv);
176
177} /* ide_detach */ 167} /* ide_detach */
178 168
179static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle) 169static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle)
@@ -507,7 +497,6 @@ static int __init init_ide_cs(void)
507static void __exit exit_ide_cs(void) 497static void __exit exit_ide_cs(void)
508{ 498{
509 pcmcia_unregister_driver(&ide_cs_driver); 499 pcmcia_unregister_driver(&ide_cs_driver);
510 BUG_ON(dev_list != NULL);
511} 500}
512 501
513late_initcall(init_ide_cs); 502late_initcall(init_ide_cs);