diff options
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_cs.c')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 50 |
1 files changed, 13 insertions, 37 deletions
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index faa83badf0a..2643976a667 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -492,42 +492,10 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | |||
492 | } | 492 | } |
493 | 493 | ||
494 | 494 | ||
495 | static int prism2_pccard_dev_open(local_info_t *local) | ||
496 | { | ||
497 | struct hostap_cs_priv *hw_priv = local->hw_priv; | ||
498 | hw_priv->link->open++; | ||
499 | return 0; | ||
500 | } | ||
501 | |||
502 | |||
503 | static int prism2_pccard_dev_close(local_info_t *local) | ||
504 | { | ||
505 | struct hostap_cs_priv *hw_priv; | ||
506 | |||
507 | if (local == NULL || local->hw_priv == NULL) | ||
508 | return 1; | ||
509 | hw_priv = local->hw_priv; | ||
510 | if (hw_priv->link == NULL) | ||
511 | return 1; | ||
512 | |||
513 | if (!hw_priv->link->open) { | ||
514 | printk(KERN_WARNING "%s: prism2_pccard_dev_close(): " | ||
515 | "link not open?!\n", local->dev->name); | ||
516 | return 1; | ||
517 | } | ||
518 | |||
519 | hw_priv->link->open--; | ||
520 | |||
521 | return 0; | ||
522 | } | ||
523 | |||
524 | |||
525 | static struct prism2_helper_functions prism2_pccard_funcs = | 495 | static struct prism2_helper_functions prism2_pccard_funcs = |
526 | { | 496 | { |
527 | .card_present = prism2_pccard_card_present, | 497 | .card_present = prism2_pccard_card_present, |
528 | .cor_sreset = prism2_pccard_cor_sreset, | 498 | .cor_sreset = prism2_pccard_cor_sreset, |
529 | .dev_open = prism2_pccard_dev_open, | ||
530 | .dev_close = prism2_pccard_dev_close, | ||
531 | .genesis_reset = prism2_pccard_genesis_reset, | 499 | .genesis_reset = prism2_pccard_genesis_reset, |
532 | .hw_type = HOSTAP_HW_PCCARD, | 500 | .hw_type = HOSTAP_HW_PCCARD, |
533 | }; | 501 | }; |
@@ -597,13 +565,14 @@ static void prism2_detach(dev_link_t *link) | |||
597 | *linkp = link->next; | 565 | *linkp = link->next; |
598 | /* release net devices */ | 566 | /* release net devices */ |
599 | if (link->priv) { | 567 | if (link->priv) { |
568 | struct hostap_cs_priv *hw_priv; | ||
600 | struct net_device *dev; | 569 | struct net_device *dev; |
601 | struct hostap_interface *iface; | 570 | struct hostap_interface *iface; |
602 | dev = link->priv; | 571 | dev = link->priv; |
603 | iface = netdev_priv(dev); | 572 | iface = netdev_priv(dev); |
604 | kfree(iface->local->hw_priv); | 573 | hw_priv = iface->local->hw_priv; |
605 | iface->local->hw_priv = NULL; | ||
606 | prism2_free_local_data(dev); | 574 | prism2_free_local_data(dev); |
575 | kfree(hw_priv); | ||
607 | } | 576 | } |
608 | kfree(link); | 577 | kfree(link); |
609 | } | 578 | } |
@@ -883,6 +852,13 @@ static int prism2_event(event_t event, int priority, | |||
883 | { | 852 | { |
884 | dev_link_t *link = args->client_data; | 853 | dev_link_t *link = args->client_data; |
885 | struct net_device *dev = (struct net_device *) link->priv; | 854 | struct net_device *dev = (struct net_device *) link->priv; |
855 | int dev_open = 0; | ||
856 | |||
857 | if (link->state & DEV_CONFIG) { | ||
858 | struct hostap_interface *iface = netdev_priv(dev); | ||
859 | if (iface && iface->local) | ||
860 | dev_open = iface->local->num_dev_open > 0; | ||
861 | } | ||
886 | 862 | ||
887 | switch (event) { | 863 | switch (event) { |
888 | case CS_EVENT_CARD_INSERTION: | 864 | case CS_EVENT_CARD_INSERTION: |
@@ -911,7 +887,7 @@ static int prism2_event(event_t event, int priority, | |||
911 | case CS_EVENT_RESET_PHYSICAL: | 887 | case CS_EVENT_RESET_PHYSICAL: |
912 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_RESET_PHYSICAL\n", dev_info); | 888 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_RESET_PHYSICAL\n", dev_info); |
913 | if (link->state & DEV_CONFIG) { | 889 | if (link->state & DEV_CONFIG) { |
914 | if (link->open) { | 890 | if (dev_open) { |
915 | netif_stop_queue(dev); | 891 | netif_stop_queue(dev); |
916 | netif_device_detach(dev); | 892 | netif_device_detach(dev); |
917 | } | 893 | } |
@@ -931,8 +907,8 @@ static int prism2_event(event_t event, int priority, | |||
931 | pcmcia_request_configuration(link->handle, | 907 | pcmcia_request_configuration(link->handle, |
932 | &link->conf); | 908 | &link->conf); |
933 | prism2_hw_shutdown(dev, 1); | 909 | prism2_hw_shutdown(dev, 1); |
934 | prism2_hw_config(dev, link->open ? 0 : 1); | 910 | prism2_hw_config(dev, dev_open ? 0 : 1); |
935 | if (link->open) { | 911 | if (dev_open) { |
936 | netif_device_attach(dev); | 912 | netif_device_attach(dev); |
937 | netif_start_queue(dev); | 913 | netif_start_queue(dev); |
938 | } | 914 | } |