aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap
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
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')
-rw-r--r--drivers/net/wireless/hostap/hostap.c6
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c45
-rw-r--r--drivers/net/wireless/hostap/hostap_pci.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_plx.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_wlan.h2
5 files changed, 10 insertions, 47 deletions
diff --git a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c
index e7f5821b4942..6a96cd9f2685 100644
--- a/drivers/net/wireless/hostap/hostap.c
+++ b/drivers/net/wireless/hostap/hostap.c
@@ -716,9 +716,6 @@ static int prism2_close(struct net_device *dev)
716 hostap_deauth_all_stas(dev, local->ap, 1); 716 hostap_deauth_all_stas(dev, local->ap, 1);
717#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 717#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
718 718
719 if (local->func->dev_close && local->func->dev_close(local))
720 return 0;
721
722 if (dev == local->dev) { 719 if (dev == local->dev) {
723 local->func->hw_shutdown(dev, HOSTAP_HW_ENABLE_CMDCOMPL); 720 local->func->hw_shutdown(dev, HOSTAP_HW_ENABLE_CMDCOMPL);
724 } 721 }
@@ -766,9 +763,6 @@ static int prism2_open(struct net_device *dev)
766 local->hw_downloading) 763 local->hw_downloading)
767 return -ENODEV; 764 return -ENODEV;
768 765
769 if (local->func->dev_open && local->func->dev_open(local))
770 return 1;
771
772 if (!try_module_get(local->hw_module)) 766 if (!try_module_get(local->hw_module))
773 return -ENODEV; 767 return -ENODEV;
774 local->num_dev_open++; 768 local->num_dev_open++;
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 }
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c
index b9254f73fbaf..594cc29c6175 100644
--- a/drivers/net/wireless/hostap/hostap_pci.c
+++ b/drivers/net/wireless/hostap/hostap_pci.c
@@ -277,8 +277,6 @@ static struct prism2_helper_functions prism2_pci_funcs =
277{ 277{
278 .card_present = NULL, 278 .card_present = NULL,
279 .cor_sreset = prism2_pci_cor_sreset, 279 .cor_sreset = prism2_pci_cor_sreset,
280 .dev_open = NULL,
281 .dev_close = NULL,
282 .genesis_reset = prism2_pci_genesis_reset, 280 .genesis_reset = prism2_pci_genesis_reset,
283 .hw_type = HOSTAP_HW_PCI, 281 .hw_type = HOSTAP_HW_PCI,
284}; 282};
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
index 1abebdf48b20..85d3f8a29539 100644
--- a/drivers/net/wireless/hostap/hostap_plx.c
+++ b/drivers/net/wireless/hostap/hostap_plx.c
@@ -328,8 +328,6 @@ static struct prism2_helper_functions prism2_plx_funcs =
328{ 328{
329 .card_present = NULL, 329 .card_present = NULL,
330 .cor_sreset = prism2_plx_cor_sreset, 330 .cor_sreset = prism2_plx_cor_sreset,
331 .dev_open = NULL,
332 .dev_close = NULL,
333 .genesis_reset = prism2_plx_genesis_reset, 331 .genesis_reset = prism2_plx_genesis_reset,
334 .hw_type = HOSTAP_HW_PLX, 332 .hw_type = HOSTAP_HW_PLX,
335}; 333};
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
index cc061e1560d3..cfd801559492 100644
--- a/drivers/net/wireless/hostap/hostap_wlan.h
+++ b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -552,8 +552,6 @@ struct prism2_helper_functions {
552 * (hostap_{cs,plx,pci}.c */ 552 * (hostap_{cs,plx,pci}.c */
553 int (*card_present)(local_info_t *local); 553 int (*card_present)(local_info_t *local);
554 void (*cor_sreset)(local_info_t *local); 554 void (*cor_sreset)(local_info_t *local);
555 int (*dev_open)(local_info_t *local);
556 int (*dev_close)(local_info_t *local);
557 void (*genesis_reset)(local_info_t *local, int hcr); 555 void (*genesis_reset)(local_info_t *local, int hcr);
558 556
559 /* the following functions are from hostap_hw.c, but they may have some 557 /* the following functions are from hostap_hw.c, but they may have some