aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/ibmtr_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/ibmtr_cs.c')
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 961294983354..90da35d1f4a5 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -116,8 +116,6 @@ static dev_info_t dev_info = "ibmtr_cs";
116static dev_link_t *ibmtr_attach(void); 116static dev_link_t *ibmtr_attach(void);
117static void ibmtr_detach(struct pcmcia_device *p_dev); 117static void ibmtr_detach(struct pcmcia_device *p_dev);
118 118
119static dev_link_t *dev_list;
120
121/*====================================================================*/ 119/*====================================================================*/
122 120
123typedef struct ibmtr_dev_t { 121typedef struct ibmtr_dev_t {
@@ -186,8 +184,7 @@ static dev_link_t *ibmtr_attach(void)
186 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 184 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
187 185
188 /* Register with Card Services */ 186 /* Register with Card Services */
189 link->next = dev_list; 187 link->next = NULL;
190 dev_list = link;
191 client_reg.dev_info = &dev_info; 188 client_reg.dev_info = &dev_info;
192 client_reg.Version = 0x0210; 189 client_reg.Version = 0x0210;
193 client_reg.event_callback_args.client_data = link; 190 client_reg.event_callback_args.client_data = link;
@@ -219,19 +216,10 @@ static void ibmtr_detach(struct pcmcia_device *p_dev)
219{ 216{
220 dev_link_t *link = dev_to_instance(p_dev); 217 dev_link_t *link = dev_to_instance(p_dev);
221 struct ibmtr_dev_t *info = link->priv; 218 struct ibmtr_dev_t *info = link->priv;
222 dev_link_t **linkp; 219 struct net_device *dev = info->dev;
223 struct net_device *dev;
224 220
225 DEBUG(0, "ibmtr_detach(0x%p)\n", link); 221 DEBUG(0, "ibmtr_detach(0x%p)\n", link);
226 222
227 /* Locate device structure */
228 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
229 if (*linkp == link) break;
230 if (*linkp == NULL)
231 return;
232
233 dev = info->dev;
234
235 if (link->dev) 223 if (link->dev)
236 unregister_netdev(dev); 224 unregister_netdev(dev);
237 225
@@ -242,10 +230,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev)
242 if (link->state & DEV_CONFIG) 230 if (link->state & DEV_CONFIG)
243 ibmtr_release(link); 231 ibmtr_release(link);
244 232
245 /* Unlink device structure, free bits */
246 *linkp = link->next;
247 free_netdev(dev); 233 free_netdev(dev);
248 kfree(info); 234 kfree(info);
249} /* ibmtr_detach */ 235} /* ibmtr_detach */
250 236
251/*====================================================================== 237/*======================================================================
@@ -530,7 +516,6 @@ static int __init init_ibmtr_cs(void)
530static void __exit exit_ibmtr_cs(void) 516static void __exit exit_ibmtr_cs(void)
531{ 517{
532 pcmcia_unregister_driver(&ibmtr_cs_driver); 518 pcmcia_unregister_driver(&ibmtr_cs_driver);
533 BUG_ON(dev_list != NULL);
534} 519}
535 520
536module_init(init_ibmtr_cs); 521module_init(init_ibmtr_cs);