aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap/hostap_cs.c
diff options
context:
space:
mode:
authorJouni Malinen <jkmaline@cc.hut.fi>2005-10-02 20:18:58 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-03 22:00:08 -0400
commitbab76198b3111bd0328be3c1fa208237eb12f86e (patch)
tree11f1e2ec911c48a1e74563979457e8d299e414e5 /drivers/net/wireless/hostap/hostap_cs.c
parent2759c8d536efe3b853867f345627d89fb64c37af (diff)
[PATCH] hostap: Remove hw specific dev_open/close handlers
Host AP driver used hardware model specific dev_open/close handlers that were called on dev_open/close if the hardware driver had registered the handler. These were only used for hostap_cs and only for tracking whether any of the netdevs were UP. This information is already available from local->num_dev_open, so there is not need for the special open/close handler. Let's get rid of these handlers. In addition to cleaning up the code, this fixes a module refcounting issue for hostap_cs where ejecting the card while any of the netdevs were open did not decrement refcount properly. Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_cs.c')
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c45
1 files changed, 10 insertions, 35 deletions
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index faa83badf0a1..23bcc51b7131 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
495static 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
503static 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
525static struct prism2_helper_functions prism2_pccard_funcs = 495static 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};
@@ -883,6 +851,13 @@ static int prism2_event(event_t event, int priority,
883{ 851{
884 dev_link_t *link = args->client_data; 852 dev_link_t *link = args->client_data;
885 struct net_device *dev = (struct net_device *) link->priv; 853 struct net_device *dev = (struct net_device *) link->priv;
854 int dev_open = 0;
855
856 if (link->state & DEV_CONFIG) {
857 struct hostap_interface *iface = netdev_priv(dev);
858 if (iface && iface->local)
859 dev_open = iface->local->num_dev_open > 0;
860 }
886 861
887 switch (event) { 862 switch (event) {
888 case CS_EVENT_CARD_INSERTION: 863 case CS_EVENT_CARD_INSERTION:
@@ -911,7 +886,7 @@ static int prism2_event(event_t event, int priority,
911 case CS_EVENT_RESET_PHYSICAL: 886 case CS_EVENT_RESET_PHYSICAL:
912 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_RESET_PHYSICAL\n", dev_info); 887 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_RESET_PHYSICAL\n", dev_info);
913 if (link->state & DEV_CONFIG) { 888 if (link->state & DEV_CONFIG) {
914 if (link->open) { 889 if (dev_open) {
915 netif_stop_queue(dev); 890 netif_stop_queue(dev);
916 netif_device_detach(dev); 891 netif_device_detach(dev);
917 } 892 }
@@ -931,8 +906,8 @@ static int prism2_event(event_t event, int priority,
931 pcmcia_request_configuration(link->handle, 906 pcmcia_request_configuration(link->handle,
932 &link->conf); 907 &link->conf);
933 prism2_hw_shutdown(dev, 1); 908 prism2_hw_shutdown(dev, 1);
934 prism2_hw_config(dev, link->open ? 0 : 1); 909 prism2_hw_config(dev, dev_open ? 0 : 1);
935 if (link->open) { 910 if (dev_open) {
936 netif_device_attach(dev); 911 netif_device_attach(dev);
937 netif_start_queue(dev); 912 netif_start_queue(dev);
938 } 913 }