aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/airo.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2009-01-24 09:10:42 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 16:01:39 -0500
commitf65b56d67b48eec7ffe174f223e98db58c3bf2b5 (patch)
tree7d90c576a8743bafbc2068786ee522f1df6c00b4 /drivers/net/wireless/airo.c
parentf55d4517ebdd6de627d42a24baefaeb689978087 (diff)
airo: re-arrange WPA capability checks
The capability register has to be read for other (upcoming) stuff, so fold the WPA test function back into _init_airo_card() and move the netdevice registration stuff above it so that the netdevice has a name by the time the card's capabilities are printed out. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/airo.c')
-rw-r--r--drivers/net/wireless/airo.c66
1 files changed, 32 insertions, 34 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index a192c4472e02..a08aadfa09ac 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -2734,28 +2734,6 @@ static void airo_networks_initialize(struct airo_info *ai)
2734 &ai->network_free_list); 2734 &ai->network_free_list);
2735} 2735}
2736 2736
2737static int airo_test_wpa_capable(struct airo_info *ai)
2738{
2739 int status;
2740 CapabilityRid cap_rid;
2741
2742 status = readCapabilityRid(ai, &cap_rid, 1);
2743 if (status != SUCCESS) return 0;
2744
2745 /* Only firmware versions 5.30.17 or better can do WPA */
2746 if (le16_to_cpu(cap_rid.softVer) > 0x530
2747 || (le16_to_cpu(cap_rid.softVer) == 0x530
2748 && le16_to_cpu(cap_rid.softSubVer) >= 17)) {
2749 airo_print_info("", "WPA is supported.");
2750 return 1;
2751 }
2752
2753 /* No WPA support */
2754 airo_print_info("", "WPA unsupported (only firmware versions 5.30.17"
2755 " and greater support WPA. Detected %s)", cap_rid.prodVer);
2756 return 0;
2757}
2758
2759static struct net_device *_init_airo_card( unsigned short irq, int port, 2737static struct net_device *_init_airo_card( unsigned short irq, int port,
2760 int is_pcmcia, struct pci_dev *pci, 2738 int is_pcmcia, struct pci_dev *pci,
2761 struct device *dmdev ) 2739 struct device *dmdev )
@@ -2763,6 +2741,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2763 struct net_device *dev; 2741 struct net_device *dev;
2764 struct airo_info *ai; 2742 struct airo_info *ai;
2765 int i, rc; 2743 int i, rc;
2744 CapabilityRid cap_rid;
2766 2745
2767 /* Create the network device object. */ 2746 /* Create the network device object. */
2768 dev = alloc_netdev(sizeof(*ai), "", ether_setup); 2747 dev = alloc_netdev(sizeof(*ai), "", ether_setup);
@@ -2832,7 +2811,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2832 } 2811 }
2833 2812
2834 if (probe) { 2813 if (probe) {
2835 if ( setup_card( ai, dev->dev_addr, 1 ) != SUCCESS ) { 2814 if (setup_card(ai, dev->dev_addr, 1) != SUCCESS) {
2836 airo_print_err(dev->name, "MAC could not be enabled" ); 2815 airo_print_err(dev->name, "MAC could not be enabled" );
2837 rc = -EIO; 2816 rc = -EIO;
2838 goto err_out_map; 2817 goto err_out_map;
@@ -2842,28 +2821,47 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2842 set_bit(FLAG_FLASHING, &ai->flags); 2821 set_bit(FLAG_FLASHING, &ai->flags);
2843 } 2822 }
2844 2823
2824 strcpy(dev->name, "eth%d");
2825 rc = register_netdev(dev);
2826 if (rc) {
2827 airo_print_err(dev->name, "Couldn't register_netdev");
2828 goto err_out_map;
2829 }
2830 ai->wifidev = init_wifidev(ai, dev);
2831 if (!ai->wifidev)
2832 goto err_out_reg;
2833
2834 rc = readCapabilityRid(ai, &cap_rid, 1);
2835 if (rc != SUCCESS) {
2836 rc = -EIO;
2837 goto err_out_wifi;
2838 }
2839
2840 airo_print_info(dev->name, "Firmware version %x.%x.%02x",
2841 ((le16_to_cpu(cap_rid.softVer) >> 8) & 0xF),
2842 (le16_to_cpu(cap_rid.softVer) & 0xFF),
2843 le16_to_cpu(cap_rid.softSubVer));
2844
2845 /* Test for WPA support */ 2845 /* Test for WPA support */
2846 if (airo_test_wpa_capable(ai)) { 2846 /* Only firmware versions 5.30.17 or better can do WPA */
2847 if (le16_to_cpu(cap_rid.softVer) > 0x530
2848 || (le16_to_cpu(cap_rid.softVer) == 0x530
2849 && le16_to_cpu(cap_rid.softSubVer) >= 17)) {
2850 airo_print_info(ai->dev->name, "WPA supported.");
2851
2847 set_bit(FLAG_WPA_CAPABLE, &ai->flags); 2852 set_bit(FLAG_WPA_CAPABLE, &ai->flags);
2848 ai->bssListFirst = RID_WPA_BSSLISTFIRST; 2853 ai->bssListFirst = RID_WPA_BSSLISTFIRST;
2849 ai->bssListNext = RID_WPA_BSSLISTNEXT; 2854 ai->bssListNext = RID_WPA_BSSLISTNEXT;
2850 ai->bssListRidLen = sizeof(BSSListRid); 2855 ai->bssListRidLen = sizeof(BSSListRid);
2851 } else { 2856 } else {
2857 airo_print_info(ai->dev->name, "WPA unsupported with firmware "
2858 "versions older than 5.30.17.");
2859
2852 ai->bssListFirst = RID_BSSLISTFIRST; 2860 ai->bssListFirst = RID_BSSLISTFIRST;
2853 ai->bssListNext = RID_BSSLISTNEXT; 2861 ai->bssListNext = RID_BSSLISTNEXT;
2854 ai->bssListRidLen = sizeof(BSSListRid) - sizeof(BSSListRidExtra); 2862 ai->bssListRidLen = sizeof(BSSListRid) - sizeof(BSSListRidExtra);
2855 } 2863 }
2856 2864
2857 strcpy(dev->name, "eth%d");
2858 rc = register_netdev(dev);
2859 if (rc) {
2860 airo_print_err(dev->name, "Couldn't register_netdev");
2861 goto err_out_map;
2862 }
2863 ai->wifidev = init_wifidev(ai, dev);
2864 if (!ai->wifidev)
2865 goto err_out_reg;
2866
2867 set_bit(FLAG_REGISTERED,&ai->flags); 2865 set_bit(FLAG_REGISTERED,&ai->flags);
2868 airo_print_info(dev->name, "MAC enabled %pM", dev->dev_addr); 2866 airo_print_info(dev->name, "MAC enabled %pM", dev->dev_addr);
2869 2867