diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/airo.c | 63 |
1 files changed, 27 insertions, 36 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index d96057f4a0de..6a3917b867e0 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -1094,7 +1094,7 @@ static int get_dec_u16( char *buffer, int *start, int limit ); | |||
1094 | static void OUT4500( struct airo_info *, u16 register, u16 value ); | 1094 | static void OUT4500( struct airo_info *, u16 register, u16 value ); |
1095 | static unsigned short IN4500( struct airo_info *, u16 register ); | 1095 | static unsigned short IN4500( struct airo_info *, u16 register ); |
1096 | static u16 setup_card(struct airo_info*, u8 *mac, int lock); | 1096 | static u16 setup_card(struct airo_info*, u8 *mac, int lock); |
1097 | static int enable_MAC( struct airo_info *ai, Resp *rsp, int lock ); | 1097 | static int enable_MAC(struct airo_info *ai, int lock); |
1098 | static void disable_MAC(struct airo_info *ai, int lock); | 1098 | static void disable_MAC(struct airo_info *ai, int lock); |
1099 | static void enable_interrupts(struct airo_info*); | 1099 | static void enable_interrupts(struct airo_info*); |
1100 | static void disable_interrupts(struct airo_info*); | 1100 | static void disable_interrupts(struct airo_info*); |
@@ -1938,7 +1938,6 @@ static void try_auto_wep(struct airo_info *ai) | |||
1938 | 1938 | ||
1939 | static int airo_open(struct net_device *dev) { | 1939 | static int airo_open(struct net_device *dev) { |
1940 | struct airo_info *ai = dev->priv; | 1940 | struct airo_info *ai = dev->priv; |
1941 | Resp rsp; | ||
1942 | int rc = 0; | 1941 | int rc = 0; |
1943 | 1942 | ||
1944 | if (test_bit(FLAG_FLASHING, &ai->flags)) | 1943 | if (test_bit(FLAG_FLASHING, &ai->flags)) |
@@ -1976,7 +1975,7 @@ static int airo_open(struct net_device *dev) { | |||
1976 | 1975 | ||
1977 | try_auto_wep(ai); | 1976 | try_auto_wep(ai); |
1978 | } | 1977 | } |
1979 | enable_MAC(ai, &rsp, 1); | 1978 | enable_MAC(ai, 1); |
1980 | 1979 | ||
1981 | netif_start_queue(dev); | 1980 | netif_start_queue(dev); |
1982 | return 0; | 1981 | return 0; |
@@ -2367,14 +2366,13 @@ static int airo_set_mac_address(struct net_device *dev, void *p) | |||
2367 | { | 2366 | { |
2368 | struct airo_info *ai = dev->priv; | 2367 | struct airo_info *ai = dev->priv; |
2369 | struct sockaddr *addr = p; | 2368 | struct sockaddr *addr = p; |
2370 | Resp rsp; | ||
2371 | 2369 | ||
2372 | readConfigRid(ai, 1); | 2370 | readConfigRid(ai, 1); |
2373 | memcpy (ai->config.macAddr, addr->sa_data, dev->addr_len); | 2371 | memcpy (ai->config.macAddr, addr->sa_data, dev->addr_len); |
2374 | set_bit (FLAG_COMMIT, &ai->flags); | 2372 | set_bit (FLAG_COMMIT, &ai->flags); |
2375 | disable_MAC(ai, 1); | 2373 | disable_MAC(ai, 1); |
2376 | writeConfigRid (ai, 1); | 2374 | writeConfigRid (ai, 1); |
2377 | enable_MAC(ai, &rsp, 1); | 2375 | enable_MAC(ai, 1); |
2378 | memcpy (ai->dev->dev_addr, addr->sa_data, dev->addr_len); | 2376 | memcpy (ai->dev->dev_addr, addr->sa_data, dev->addr_len); |
2379 | if (ai->wifidev) | 2377 | if (ai->wifidev) |
2380 | memcpy (ai->wifidev->dev_addr, addr->sa_data, dev->addr_len); | 2378 | memcpy (ai->wifidev->dev_addr, addr->sa_data, dev->addr_len); |
@@ -3539,9 +3537,11 @@ static u16 IN4500( struct airo_info *ai, u16 reg ) { | |||
3539 | return rc; | 3537 | return rc; |
3540 | } | 3538 | } |
3541 | 3539 | ||
3542 | static int enable_MAC( struct airo_info *ai, Resp *rsp, int lock ) { | 3540 | static int enable_MAC(struct airo_info *ai, int lock) |
3541 | { | ||
3543 | int rc; | 3542 | int rc; |
3544 | Cmd cmd; | 3543 | Cmd cmd; |
3544 | Resp rsp; | ||
3545 | 3545 | ||
3546 | /* FLAG_RADIO_OFF : Radio disabled via /proc or Wireless Extensions | 3546 | /* FLAG_RADIO_OFF : Radio disabled via /proc or Wireless Extensions |
3547 | * FLAG_RADIO_DOWN : Radio disabled via "ifconfig ethX down" | 3547 | * FLAG_RADIO_DOWN : Radio disabled via "ifconfig ethX down" |
@@ -3557,7 +3557,7 @@ static int enable_MAC( struct airo_info *ai, Resp *rsp, int lock ) { | |||
3557 | if (!test_bit(FLAG_ENABLED, &ai->flags)) { | 3557 | if (!test_bit(FLAG_ENABLED, &ai->flags)) { |
3558 | memset(&cmd, 0, sizeof(cmd)); | 3558 | memset(&cmd, 0, sizeof(cmd)); |
3559 | cmd.cmd = MAC_ENABLE; | 3559 | cmd.cmd = MAC_ENABLE; |
3560 | rc = issuecommand(ai, &cmd, rsp); | 3560 | rc = issuecommand(ai, &cmd, &rsp); |
3561 | if (rc == SUCCESS) | 3561 | if (rc == SUCCESS) |
3562 | set_bit(FLAG_ENABLED, &ai->flags); | 3562 | set_bit(FLAG_ENABLED, &ai->flags); |
3563 | } else | 3563 | } else |
@@ -3567,8 +3567,12 @@ static int enable_MAC( struct airo_info *ai, Resp *rsp, int lock ) { | |||
3567 | up(&ai->sem); | 3567 | up(&ai->sem); |
3568 | 3568 | ||
3569 | if (rc) | 3569 | if (rc) |
3570 | airo_print_err(ai->dev->name, "%s: Cannot enable MAC, err=%d", | 3570 | airo_print_err(ai->dev->name, "Cannot enable MAC"); |
3571 | __FUNCTION__, rc); | 3571 | else if ((rsp.status & 0xFF00) != 0) { |
3572 | airo_print_err(ai->dev->name, "Bad MAC enable reason=%x, " | ||
3573 | "rid=%x, offset=%d", rsp.rsp0, rsp.rsp1, rsp.rsp2); | ||
3574 | rc = ERROR; | ||
3575 | } | ||
3572 | return rc; | 3576 | return rc; |
3573 | } | 3577 | } |
3574 | 3578 | ||
@@ -3912,12 +3916,9 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) | |||
3912 | if ( status != SUCCESS ) return ERROR; | 3916 | if ( status != SUCCESS ) return ERROR; |
3913 | } | 3917 | } |
3914 | 3918 | ||
3915 | status = enable_MAC(ai, &rsp, lock); | 3919 | status = enable_MAC(ai, lock); |
3916 | if ( status != SUCCESS || (rsp.status & 0xFF00) != 0) { | 3920 | if (status != SUCCESS) |
3917 | airo_print_err(ai->dev->name, "Bad MAC enable reason = %x, rid = %x," | ||
3918 | " offset = %d", rsp.rsp0, rsp.rsp1, rsp.rsp2 ); | ||
3919 | return ERROR; | 3921 | return ERROR; |
3920 | } | ||
3921 | 3922 | ||
3922 | /* Grab the initial wep key, we gotta save it for auto_wep */ | 3923 | /* Grab the initial wep key, we gotta save it for auto_wep */ |
3923 | rc = readWepKeyRid(ai, &wkr, 1, lock); | 3924 | rc = readWepKeyRid(ai, &wkr, 1, lock); |
@@ -5159,7 +5160,6 @@ static void proc_SSID_on_close( struct inode *inode, struct file *file ) { | |||
5159 | struct net_device *dev = dp->data; | 5160 | struct net_device *dev = dp->data; |
5160 | struct airo_info *ai = dev->priv; | 5161 | struct airo_info *ai = dev->priv; |
5161 | SsidRid SSID_rid; | 5162 | SsidRid SSID_rid; |
5162 | Resp rsp; | ||
5163 | int i; | 5163 | int i; |
5164 | int offset = 0; | 5164 | int offset = 0; |
5165 | 5165 | ||
@@ -5184,7 +5184,7 @@ static void proc_SSID_on_close( struct inode *inode, struct file *file ) { | |||
5184 | SSID_rid.len = sizeof(SSID_rid); | 5184 | SSID_rid.len = sizeof(SSID_rid); |
5185 | disable_MAC(ai, 1); | 5185 | disable_MAC(ai, 1); |
5186 | writeSsidRid(ai, &SSID_rid, 1); | 5186 | writeSsidRid(ai, &SSID_rid, 1); |
5187 | enable_MAC(ai, &rsp, 1); | 5187 | enable_MAC(ai, 1); |
5188 | } | 5188 | } |
5189 | 5189 | ||
5190 | static inline u8 hexVal(char c) { | 5190 | static inline u8 hexVal(char c) { |
@@ -5200,7 +5200,6 @@ static void proc_APList_on_close( struct inode *inode, struct file *file ) { | |||
5200 | struct net_device *dev = dp->data; | 5200 | struct net_device *dev = dp->data; |
5201 | struct airo_info *ai = dev->priv; | 5201 | struct airo_info *ai = dev->priv; |
5202 | APListRid APList_rid; | 5202 | APListRid APList_rid; |
5203 | Resp rsp; | ||
5204 | int i; | 5203 | int i; |
5205 | 5204 | ||
5206 | if ( !data->writelen ) return; | 5205 | if ( !data->writelen ) return; |
@@ -5225,18 +5224,17 @@ static void proc_APList_on_close( struct inode *inode, struct file *file ) { | |||
5225 | } | 5224 | } |
5226 | disable_MAC(ai, 1); | 5225 | disable_MAC(ai, 1); |
5227 | writeAPListRid(ai, &APList_rid, 1); | 5226 | writeAPListRid(ai, &APList_rid, 1); |
5228 | enable_MAC(ai, &rsp, 1); | 5227 | enable_MAC(ai, 1); |
5229 | } | 5228 | } |
5230 | 5229 | ||
5231 | /* This function wraps PC4500_writerid with a MAC disable */ | 5230 | /* This function wraps PC4500_writerid with a MAC disable */ |
5232 | static int do_writerid( struct airo_info *ai, u16 rid, const void *rid_data, | 5231 | static int do_writerid( struct airo_info *ai, u16 rid, const void *rid_data, |
5233 | int len, int dummy ) { | 5232 | int len, int dummy ) { |
5234 | int rc; | 5233 | int rc; |
5235 | Resp rsp; | ||
5236 | 5234 | ||
5237 | disable_MAC(ai, 1); | 5235 | disable_MAC(ai, 1); |
5238 | rc = PC4500_writerid(ai, rid, rid_data, len, 1); | 5236 | rc = PC4500_writerid(ai, rid, rid_data, len, 1); |
5239 | enable_MAC(ai, &rsp, 1); | 5237 | enable_MAC(ai, 1); |
5240 | return rc; | 5238 | return rc; |
5241 | } | 5239 | } |
5242 | 5240 | ||
@@ -5267,7 +5265,6 @@ static int set_wep_key(struct airo_info *ai, u16 index, | |||
5267 | const char *key, u16 keylen, int perm, int lock ) { | 5265 | const char *key, u16 keylen, int perm, int lock ) { |
5268 | static const unsigned char macaddr[ETH_ALEN] = { 0x01, 0, 0, 0, 0, 0 }; | 5266 | static const unsigned char macaddr[ETH_ALEN] = { 0x01, 0, 0, 0, 0, 0 }; |
5269 | WepKeyRid wkr; | 5267 | WepKeyRid wkr; |
5270 | Resp rsp; | ||
5271 | 5268 | ||
5272 | memset(&wkr, 0, sizeof(wkr)); | 5269 | memset(&wkr, 0, sizeof(wkr)); |
5273 | if (keylen == 0) { | 5270 | if (keylen == 0) { |
@@ -5287,7 +5284,7 @@ static int set_wep_key(struct airo_info *ai, u16 index, | |||
5287 | 5284 | ||
5288 | if (perm) disable_MAC(ai, lock); | 5285 | if (perm) disable_MAC(ai, lock); |
5289 | writeWepKeyRid(ai, &wkr, perm, lock); | 5286 | writeWepKeyRid(ai, &wkr, perm, lock); |
5290 | if (perm) enable_MAC(ai, &rsp, lock); | 5287 | if (perm) enable_MAC(ai, lock); |
5291 | return 0; | 5288 | return 0; |
5292 | } | 5289 | } |
5293 | 5290 | ||
@@ -5555,7 +5552,6 @@ static int proc_close( struct inode *inode, struct file *file ) | |||
5555 | changed. */ | 5552 | changed. */ |
5556 | static void timer_func( struct net_device *dev ) { | 5553 | static void timer_func( struct net_device *dev ) { |
5557 | struct airo_info *apriv = dev->priv; | 5554 | struct airo_info *apriv = dev->priv; |
5558 | Resp rsp; | ||
5559 | 5555 | ||
5560 | /* We don't have a link so try changing the authtype */ | 5556 | /* We don't have a link so try changing the authtype */ |
5561 | readConfigRid(apriv, 0); | 5557 | readConfigRid(apriv, 0); |
@@ -5582,7 +5578,7 @@ static void timer_func( struct net_device *dev ) { | |||
5582 | } | 5578 | } |
5583 | set_bit (FLAG_COMMIT, &apriv->flags); | 5579 | set_bit (FLAG_COMMIT, &apriv->flags); |
5584 | writeConfigRid(apriv, 0); | 5580 | writeConfigRid(apriv, 0); |
5585 | enable_MAC(apriv, &rsp, 0); | 5581 | enable_MAC(apriv, 0); |
5586 | up(&apriv->sem); | 5582 | up(&apriv->sem); |
5587 | 5583 | ||
5588 | /* Schedule check to see if the change worked */ | 5584 | /* Schedule check to see if the change worked */ |
@@ -5657,7 +5653,6 @@ static int airo_pci_resume(struct pci_dev *pdev) | |||
5657 | { | 5653 | { |
5658 | struct net_device *dev = pci_get_drvdata(pdev); | 5654 | struct net_device *dev = pci_get_drvdata(pdev); |
5659 | struct airo_info *ai = dev->priv; | 5655 | struct airo_info *ai = dev->priv; |
5660 | Resp rsp; | ||
5661 | pci_power_t prev_state = pdev->current_state; | 5656 | pci_power_t prev_state = pdev->current_state; |
5662 | 5657 | ||
5663 | pci_set_power_state(pdev, PCI_D0); | 5658 | pci_set_power_state(pdev, PCI_D0); |
@@ -5690,7 +5685,7 @@ static int airo_pci_resume(struct pci_dev *pdev) | |||
5690 | ai->APList = NULL; | 5685 | ai->APList = NULL; |
5691 | } | 5686 | } |
5692 | writeConfigRid(ai, 0); | 5687 | writeConfigRid(ai, 0); |
5693 | enable_MAC(ai, &rsp, 0); | 5688 | enable_MAC(ai, 0); |
5694 | ai->power = PMSG_ON; | 5689 | ai->power = PMSG_ON; |
5695 | netif_device_attach(dev); | 5690 | netif_device_attach(dev); |
5696 | netif_wake_queue(dev); | 5691 | netif_wake_queue(dev); |
@@ -5914,7 +5909,6 @@ static int airo_set_essid(struct net_device *dev, | |||
5914 | char *extra) | 5909 | char *extra) |
5915 | { | 5910 | { |
5916 | struct airo_info *local = dev->priv; | 5911 | struct airo_info *local = dev->priv; |
5917 | Resp rsp; | ||
5918 | SsidRid SSID_rid; /* SSIDs */ | 5912 | SsidRid SSID_rid; /* SSIDs */ |
5919 | 5913 | ||
5920 | /* Reload the list of current SSID */ | 5914 | /* Reload the list of current SSID */ |
@@ -5946,7 +5940,7 @@ static int airo_set_essid(struct net_device *dev, | |||
5946 | /* Write it to the card */ | 5940 | /* Write it to the card */ |
5947 | disable_MAC(local, 1); | 5941 | disable_MAC(local, 1); |
5948 | writeSsidRid(local, &SSID_rid, 1); | 5942 | writeSsidRid(local, &SSID_rid, 1); |
5949 | enable_MAC(local, &rsp, 1); | 5943 | enable_MAC(local, 1); |
5950 | 5944 | ||
5951 | return 0; | 5945 | return 0; |
5952 | } | 5946 | } |
@@ -6011,7 +6005,7 @@ static int airo_set_wap(struct net_device *dev, | |||
6011 | memcpy(APList_rid.ap[0], awrq->sa_data, ETH_ALEN); | 6005 | memcpy(APList_rid.ap[0], awrq->sa_data, ETH_ALEN); |
6012 | disable_MAC(local, 1); | 6006 | disable_MAC(local, 1); |
6013 | writeAPListRid(local, &APList_rid, 1); | 6007 | writeAPListRid(local, &APList_rid, 1); |
6014 | enable_MAC(local, &rsp, 1); | 6008 | enable_MAC(local, 1); |
6015 | } | 6009 | } |
6016 | return 0; | 6010 | return 0; |
6017 | } | 6011 | } |
@@ -7465,7 +7459,6 @@ static int airo_config_commit(struct net_device *dev, | |||
7465 | char *extra) /* NULL */ | 7459 | char *extra) /* NULL */ |
7466 | { | 7460 | { |
7467 | struct airo_info *local = dev->priv; | 7461 | struct airo_info *local = dev->priv; |
7468 | Resp rsp; | ||
7469 | 7462 | ||
7470 | if (!test_bit (FLAG_COMMIT, &local->flags)) | 7463 | if (!test_bit (FLAG_COMMIT, &local->flags)) |
7471 | return 0; | 7464 | return 0; |
@@ -7490,7 +7483,7 @@ static int airo_config_commit(struct net_device *dev, | |||
7490 | if (down_interruptible(&local->sem)) | 7483 | if (down_interruptible(&local->sem)) |
7491 | return -ERESTARTSYS; | 7484 | return -ERESTARTSYS; |
7492 | writeConfigRid(local, 0); | 7485 | writeConfigRid(local, 0); |
7493 | enable_MAC(local, &rsp, 0); | 7486 | enable_MAC(local, 0); |
7494 | if (test_bit (FLAG_RESET, &local->flags)) | 7487 | if (test_bit (FLAG_RESET, &local->flags)) |
7495 | airo_set_promisc(local); | 7488 | airo_set_promisc(local); |
7496 | else | 7489 | else |
@@ -7757,7 +7750,6 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) { | |||
7757 | unsigned char *iobuf; | 7750 | unsigned char *iobuf; |
7758 | int len; | 7751 | int len; |
7759 | struct airo_info *ai = dev->priv; | 7752 | struct airo_info *ai = dev->priv; |
7760 | Resp rsp; | ||
7761 | 7753 | ||
7762 | if (test_bit(FLAG_FLASHING, &ai->flags)) | 7754 | if (test_bit(FLAG_FLASHING, &ai->flags)) |
7763 | return -EIO; | 7755 | return -EIO; |
@@ -7769,7 +7761,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) { | |||
7769 | if (test_bit(FLAG_COMMIT, &ai->flags)) { | 7761 | if (test_bit(FLAG_COMMIT, &ai->flags)) { |
7770 | disable_MAC (ai, 1); | 7762 | disable_MAC (ai, 1); |
7771 | writeConfigRid (ai, 1); | 7763 | writeConfigRid (ai, 1); |
7772 | enable_MAC (ai, &rsp, 1); | 7764 | enable_MAC(ai, 1); |
7773 | } | 7765 | } |
7774 | break; | 7766 | break; |
7775 | case AIROGSLIST: ridcode = RID_SSID; break; | 7767 | case AIROGSLIST: ridcode = RID_SSID; break; |
@@ -7826,7 +7818,6 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) { | |||
7826 | struct airo_info *ai = dev->priv; | 7818 | struct airo_info *ai = dev->priv; |
7827 | int ridcode; | 7819 | int ridcode; |
7828 | int enabled; | 7820 | int enabled; |
7829 | Resp rsp; | ||
7830 | static int (* writer)(struct airo_info *, u16 rid, const void *, int, int); | 7821 | static int (* writer)(struct airo_info *, u16 rid, const void *, int, int); |
7831 | unsigned char *iobuf; | 7822 | unsigned char *iobuf; |
7832 | 7823 | ||
@@ -7860,7 +7851,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) { | |||
7860 | * same with MAC off | 7851 | * same with MAC off |
7861 | */ | 7852 | */ |
7862 | case AIROPMACON: | 7853 | case AIROPMACON: |
7863 | if (enable_MAC(ai, &rsp, 1) != 0) | 7854 | if (enable_MAC(ai, 1) != 0) |
7864 | return -EIO; | 7855 | return -EIO; |
7865 | return 0; | 7856 | return 0; |
7866 | 7857 | ||