diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 15:23:14 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 18:03:10 -0500 |
commit | cc3b4866bee996c922e875b8c8efe9f0d8803aae (patch) | |
tree | 6632837b6986f33566f75ed971cecbdc210e3201 /drivers/net/wireless/orinoco_cs.c | |
parent | 8e9e793d68fcda6cc84c18cedf85ca0f91d801a8 (diff) |
[PATCH] pcmcia: unify detach, REMOVAL_EVENT handlers into one remove callback
Unify the "detach" and REMOVAL_EVENT handlers to one "remove" function.
Old functionality is preserved, for the moment.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/wireless/orinoco_cs.c')
-rw-r--r-- | drivers/net/wireless/orinoco_cs.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 1d66050e3d6a..00679b6c87c1 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -81,7 +81,7 @@ static dev_link_t *dev_list; /* = NULL */ | |||
81 | /********************************************************************/ | 81 | /********************************************************************/ |
82 | 82 | ||
83 | static void orinoco_cs_release(dev_link_t *link); | 83 | static void orinoco_cs_release(dev_link_t *link); |
84 | static void orinoco_cs_detach(dev_link_t *link); | 84 | static void orinoco_cs_detach(struct pcmcia_device *p_dev); |
85 | 85 | ||
86 | /********************************************************************/ | 86 | /********************************************************************/ |
87 | /* Device methods */ | 87 | /* Device methods */ |
@@ -165,7 +165,7 @@ orinoco_cs_attach(void) | |||
165 | ret = pcmcia_register_client(&link->handle, &client_reg); | 165 | ret = pcmcia_register_client(&link->handle, &client_reg); |
166 | if (ret != CS_SUCCESS) { | 166 | if (ret != CS_SUCCESS) { |
167 | cs_error(link->handle, RegisterClient, ret); | 167 | cs_error(link->handle, RegisterClient, ret); |
168 | orinoco_cs_detach(link); | 168 | orinoco_cs_detach(link->handle); |
169 | return NULL; | 169 | return NULL; |
170 | } | 170 | } |
171 | 171 | ||
@@ -178,8 +178,9 @@ orinoco_cs_attach(void) | |||
178 | * are freed. Otherwise, the structures will be freed when the device | 178 | * are freed. Otherwise, the structures will be freed when the device |
179 | * is released. | 179 | * is released. |
180 | */ | 180 | */ |
181 | static void orinoco_cs_detach(dev_link_t *link) | 181 | static void orinoco_cs_detach(struct pcmcia_device *p_dev) |
182 | { | 182 | { |
183 | dev_link_t *link = dev_to_instance(p_dev); | ||
183 | dev_link_t **linkp; | 184 | dev_link_t **linkp; |
184 | struct net_device *dev = link->priv; | 185 | struct net_device *dev = link->priv; |
185 | 186 | ||
@@ -193,10 +194,6 @@ static void orinoco_cs_detach(dev_link_t *link) | |||
193 | if (link->state & DEV_CONFIG) | 194 | if (link->state & DEV_CONFIG) |
194 | orinoco_cs_release(link); | 195 | orinoco_cs_release(link); |
195 | 196 | ||
196 | /* Break the link with Card Services */ | ||
197 | if (link->handle) | ||
198 | pcmcia_deregister_client(link->handle); | ||
199 | |||
200 | /* Unlink device structure, and free it */ | 197 | /* Unlink device structure, and free it */ |
201 | *linkp = link->next; | 198 | *linkp = link->next; |
202 | DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); | 199 | DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); |
@@ -551,30 +548,15 @@ orinoco_cs_event(event_t event, int priority, | |||
551 | event_callback_args_t * args) | 548 | event_callback_args_t * args) |
552 | { | 549 | { |
553 | dev_link_t *link = args->client_data; | 550 | dev_link_t *link = args->client_data; |
554 | struct net_device *dev = link->priv; | ||
555 | struct orinoco_private *priv = netdev_priv(dev); | ||
556 | int err = 0; | ||
557 | 551 | ||
558 | switch (event) { | 552 | switch (event) { |
559 | case CS_EVENT_CARD_REMOVAL: | ||
560 | link->state &= ~DEV_PRESENT; | ||
561 | if (link->state & DEV_CONFIG) { | ||
562 | unsigned long flags; | ||
563 | |||
564 | spin_lock_irqsave(&priv->lock, flags); | ||
565 | netif_device_detach(dev); | ||
566 | priv->hw_unavailable++; | ||
567 | spin_unlock_irqrestore(&priv->lock, flags); | ||
568 | } | ||
569 | break; | ||
570 | |||
571 | case CS_EVENT_CARD_INSERTION: | 553 | case CS_EVENT_CARD_INSERTION: |
572 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 554 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
573 | orinoco_cs_config(link); | 555 | orinoco_cs_config(link); |
574 | break; | 556 | break; |
575 | } | 557 | } |
576 | 558 | ||
577 | return err; | 559 | return 0; |
578 | } /* orinoco_cs_event */ | 560 | } /* orinoco_cs_event */ |
579 | 561 | ||
580 | /********************************************************************/ | 562 | /********************************************************************/ |
@@ -677,7 +659,7 @@ static struct pcmcia_driver orinoco_driver = { | |||
677 | .name = DRIVER_NAME, | 659 | .name = DRIVER_NAME, |
678 | }, | 660 | }, |
679 | .attach = orinoco_cs_attach, | 661 | .attach = orinoco_cs_attach, |
680 | .detach = orinoco_cs_detach, | 662 | .remove = orinoco_cs_detach, |
681 | .event = orinoco_cs_event, | 663 | .event = orinoco_cs_event, |
682 | .id_table = orinoco_cs_ids, | 664 | .id_table = orinoco_cs_ids, |
683 | .suspend = orinoco_cs_suspend, | 665 | .suspend = orinoco_cs_suspend, |