aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2x00/ipw2200.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ipw2x00/ipw2200.c')
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c243
1 files changed, 119 insertions, 124 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index cb2552a6777c..87813c33bdc2 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -894,9 +894,8 @@ static void ipw_led_link_on(struct ipw_priv *priv)
894 894
895 /* If we aren't associated, schedule turning the LED off */ 895 /* If we aren't associated, schedule turning the LED off */
896 if (!(priv->status & STATUS_ASSOCIATED)) 896 if (!(priv->status & STATUS_ASSOCIATED))
897 queue_delayed_work(priv->workqueue, 897 schedule_delayed_work(&priv->led_link_off,
898 &priv->led_link_off, 898 LD_TIME_LINK_ON);
899 LD_TIME_LINK_ON);
900 } 899 }
901 900
902 spin_unlock_irqrestore(&priv->lock, flags); 901 spin_unlock_irqrestore(&priv->lock, flags);
@@ -939,8 +938,8 @@ static void ipw_led_link_off(struct ipw_priv *priv)
939 * turning the LED on (blink while unassociated) */ 938 * turning the LED on (blink while unassociated) */
940 if (!(priv->status & STATUS_RF_KILL_MASK) && 939 if (!(priv->status & STATUS_RF_KILL_MASK) &&
941 !(priv->status & STATUS_ASSOCIATED)) 940 !(priv->status & STATUS_ASSOCIATED))
942 queue_delayed_work(priv->workqueue, &priv->led_link_on, 941 schedule_delayed_work(&priv->led_link_on,
943 LD_TIME_LINK_OFF); 942 LD_TIME_LINK_OFF);
944 943
945 } 944 }
946 945
@@ -980,13 +979,11 @@ static void __ipw_led_activity_on(struct ipw_priv *priv)
980 priv->status |= STATUS_LED_ACT_ON; 979 priv->status |= STATUS_LED_ACT_ON;
981 980
982 cancel_delayed_work(&priv->led_act_off); 981 cancel_delayed_work(&priv->led_act_off);
983 queue_delayed_work(priv->workqueue, &priv->led_act_off, 982 schedule_delayed_work(&priv->led_act_off, LD_TIME_ACT_ON);
984 LD_TIME_ACT_ON);
985 } else { 983 } else {
986 /* Reschedule LED off for full time period */ 984 /* Reschedule LED off for full time period */
987 cancel_delayed_work(&priv->led_act_off); 985 cancel_delayed_work(&priv->led_act_off);
988 queue_delayed_work(priv->workqueue, &priv->led_act_off, 986 schedule_delayed_work(&priv->led_act_off, LD_TIME_ACT_ON);
989 LD_TIME_ACT_ON);
990 } 987 }
991} 988}
992 989
@@ -1184,7 +1181,7 @@ static void ipw_led_shutdown(struct ipw_priv *priv)
1184/* 1181/*
1185 * The following adds a new attribute to the sysfs representation 1182 * The following adds a new attribute to the sysfs representation
1186 * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/) 1183 * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/)
1187 * used for controling the debug level. 1184 * used for controlling the debug level.
1188 * 1185 *
1189 * See the level definitions in ipw for details. 1186 * See the level definitions in ipw for details.
1190 */ 1187 */
@@ -1795,13 +1792,11 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
1795 if (disable_radio) { 1792 if (disable_radio) {
1796 priv->status |= STATUS_RF_KILL_SW; 1793 priv->status |= STATUS_RF_KILL_SW;
1797 1794
1798 if (priv->workqueue) { 1795 cancel_delayed_work(&priv->request_scan);
1799 cancel_delayed_work(&priv->request_scan); 1796 cancel_delayed_work(&priv->request_direct_scan);
1800 cancel_delayed_work(&priv->request_direct_scan); 1797 cancel_delayed_work(&priv->request_passive_scan);
1801 cancel_delayed_work(&priv->request_passive_scan); 1798 cancel_delayed_work(&priv->scan_event);
1802 cancel_delayed_work(&priv->scan_event); 1799 schedule_work(&priv->down);
1803 }
1804 queue_work(priv->workqueue, &priv->down);
1805 } else { 1800 } else {
1806 priv->status &= ~STATUS_RF_KILL_SW; 1801 priv->status &= ~STATUS_RF_KILL_SW;
1807 if (rf_kill_active(priv)) { 1802 if (rf_kill_active(priv)) {
@@ -1809,10 +1804,10 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
1809 "disabled by HW switch\n"); 1804 "disabled by HW switch\n");
1810 /* Make sure the RF_KILL check timer is running */ 1805 /* Make sure the RF_KILL check timer is running */
1811 cancel_delayed_work(&priv->rf_kill); 1806 cancel_delayed_work(&priv->rf_kill);
1812 queue_delayed_work(priv->workqueue, &priv->rf_kill, 1807 schedule_delayed_work(&priv->rf_kill,
1813 round_jiffies_relative(2 * HZ)); 1808 round_jiffies_relative(2 * HZ));
1814 } else 1809 } else
1815 queue_work(priv->workqueue, &priv->up); 1810 schedule_work(&priv->up);
1816 } 1811 }
1817 1812
1818 return 1; 1813 return 1;
@@ -1973,6 +1968,13 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
1973 1968
1974 inta = ipw_read32(priv, IPW_INTA_RW); 1969 inta = ipw_read32(priv, IPW_INTA_RW);
1975 inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); 1970 inta_mask = ipw_read32(priv, IPW_INTA_MASK_R);
1971
1972 if (inta == 0xFFFFFFFF) {
1973 /* Hardware disappeared */
1974 IPW_WARNING("TASKLET INTA == 0xFFFFFFFF\n");
1975 /* Only handle the cached INTA values */
1976 inta = 0;
1977 }
1976 inta &= (IPW_INTA_MASK_ALL & inta_mask); 1978 inta &= (IPW_INTA_MASK_ALL & inta_mask);
1977 1979
1978 /* Add any cached INTA values that need to be handled */ 1980 /* Add any cached INTA values that need to be handled */
@@ -2056,7 +2058,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
2056 cancel_delayed_work(&priv->request_passive_scan); 2058 cancel_delayed_work(&priv->request_passive_scan);
2057 cancel_delayed_work(&priv->scan_event); 2059 cancel_delayed_work(&priv->scan_event);
2058 schedule_work(&priv->link_down); 2060 schedule_work(&priv->link_down);
2059 queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); 2061 schedule_delayed_work(&priv->rf_kill, 2 * HZ);
2060 handled |= IPW_INTA_BIT_RF_KILL_DONE; 2062 handled |= IPW_INTA_BIT_RF_KILL_DONE;
2061 } 2063 }
2062 2064
@@ -2096,7 +2098,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
2096 priv->status &= ~STATUS_HCMD_ACTIVE; 2098 priv->status &= ~STATUS_HCMD_ACTIVE;
2097 wake_up_interruptible(&priv->wait_command_queue); 2099 wake_up_interruptible(&priv->wait_command_queue);
2098 2100
2099 queue_work(priv->workqueue, &priv->adapter_restart); 2101 schedule_work(&priv->adapter_restart);
2100 handled |= IPW_INTA_BIT_FATAL_ERROR; 2102 handled |= IPW_INTA_BIT_FATAL_ERROR;
2101 } 2103 }
2102 2104
@@ -2316,11 +2318,6 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac)
2316 return ipw_send_cmd_pdu(priv, IPW_CMD_ADAPTER_ADDRESS, ETH_ALEN, mac); 2318 return ipw_send_cmd_pdu(priv, IPW_CMD_ADAPTER_ADDRESS, ETH_ALEN, mac);
2317} 2319}
2318 2320
2319/*
2320 * NOTE: This must be executed from our workqueue as it results in udelay
2321 * being called which may corrupt the keyboard if executed on default
2322 * workqueue
2323 */
2324static void ipw_adapter_restart(void *adapter) 2321static void ipw_adapter_restart(void *adapter)
2325{ 2322{
2326 struct ipw_priv *priv = adapter; 2323 struct ipw_priv *priv = adapter;
@@ -2361,13 +2358,13 @@ static void ipw_scan_check(void *data)
2361 IPW_DEBUG_SCAN("Scan completion watchdog resetting " 2358 IPW_DEBUG_SCAN("Scan completion watchdog resetting "
2362 "adapter after (%dms).\n", 2359 "adapter after (%dms).\n",
2363 jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG)); 2360 jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG));
2364 queue_work(priv->workqueue, &priv->adapter_restart); 2361 schedule_work(&priv->adapter_restart);
2365 } else if (priv->status & STATUS_SCANNING) { 2362 } else if (priv->status & STATUS_SCANNING) {
2366 IPW_DEBUG_SCAN("Scan completion watchdog aborting scan " 2363 IPW_DEBUG_SCAN("Scan completion watchdog aborting scan "
2367 "after (%dms).\n", 2364 "after (%dms).\n",
2368 jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG)); 2365 jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG));
2369 ipw_abort_scan(priv); 2366 ipw_abort_scan(priv);
2370 queue_delayed_work(priv->workqueue, &priv->scan_check, HZ); 2367 schedule_delayed_work(&priv->scan_check, HZ);
2371 } 2368 }
2372} 2369}
2373 2370
@@ -3766,7 +3763,7 @@ static int ipw_queue_tx_init(struct ipw_priv *priv,
3766 3763
3767 q->txb = kmalloc(sizeof(q->txb[0]) * count, GFP_KERNEL); 3764 q->txb = kmalloc(sizeof(q->txb[0]) * count, GFP_KERNEL);
3768 if (!q->txb) { 3765 if (!q->txb) {
3769 IPW_ERROR("vmalloc for auxilary BD structures failed\n"); 3766 IPW_ERROR("vmalloc for auxiliary BD structures failed\n");
3770 return -ENOMEM; 3767 return -ENOMEM;
3771 } 3768 }
3772 3769
@@ -3936,7 +3933,7 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet)
3936 3933
3937 if (priv->status & STATUS_ASSOCIATING) { 3934 if (priv->status & STATUS_ASSOCIATING) {
3938 IPW_DEBUG_ASSOC("Disassociating while associating.\n"); 3935 IPW_DEBUG_ASSOC("Disassociating while associating.\n");
3939 queue_work(priv->workqueue, &priv->disassociate); 3936 schedule_work(&priv->disassociate);
3940 return; 3937 return;
3941 } 3938 }
3942 3939
@@ -4353,8 +4350,7 @@ static void ipw_gather_stats(struct ipw_priv *priv)
4353 4350
4354 priv->quality = quality; 4351 priv->quality = quality;
4355 4352
4356 queue_delayed_work(priv->workqueue, &priv->gather_stats, 4353 schedule_delayed_work(&priv->gather_stats, IPW_STATS_INTERVAL);
4357 IPW_STATS_INTERVAL);
4358} 4354}
4359 4355
4360static void ipw_bg_gather_stats(struct work_struct *work) 4356static void ipw_bg_gather_stats(struct work_struct *work)
@@ -4389,10 +4385,10 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv,
4389 IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | 4385 IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF |
4390 IPW_DL_STATE, 4386 IPW_DL_STATE,
4391 "Aborting scan with missed beacon.\n"); 4387 "Aborting scan with missed beacon.\n");
4392 queue_work(priv->workqueue, &priv->abort_scan); 4388 schedule_work(&priv->abort_scan);
4393 } 4389 }
4394 4390
4395 queue_work(priv->workqueue, &priv->disassociate); 4391 schedule_work(&priv->disassociate);
4396 return; 4392 return;
4397 } 4393 }
4398 4394
@@ -4418,8 +4414,7 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv,
4418 if (!(priv->status & STATUS_ROAMING)) { 4414 if (!(priv->status & STATUS_ROAMING)) {
4419 priv->status |= STATUS_ROAMING; 4415 priv->status |= STATUS_ROAMING;
4420 if (!(priv->status & STATUS_SCANNING)) 4416 if (!(priv->status & STATUS_SCANNING))
4421 queue_delayed_work(priv->workqueue, 4417 schedule_delayed_work(&priv->request_scan, 0);
4422 &priv->request_scan, 0);
4423 } 4418 }
4424 return; 4419 return;
4425 } 4420 }
@@ -4432,7 +4427,7 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv,
4432 * channels..) */ 4427 * channels..) */
4433 IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | IPW_DL_STATE, 4428 IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | IPW_DL_STATE,
4434 "Aborting scan with missed beacon.\n"); 4429 "Aborting scan with missed beacon.\n");
4435 queue_work(priv->workqueue, &priv->abort_scan); 4430 schedule_work(&priv->abort_scan);
4436 } 4431 }
4437 4432
4438 IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count); 4433 IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count);
@@ -4455,8 +4450,8 @@ static void handle_scan_event(struct ipw_priv *priv)
4455 /* Only userspace-requested scan completion events go out immediately */ 4450 /* Only userspace-requested scan completion events go out immediately */
4456 if (!priv->user_requested_scan) { 4451 if (!priv->user_requested_scan) {
4457 if (!delayed_work_pending(&priv->scan_event)) 4452 if (!delayed_work_pending(&priv->scan_event))
4458 queue_delayed_work(priv->workqueue, &priv->scan_event, 4453 schedule_delayed_work(&priv->scan_event,
4459 round_jiffies_relative(msecs_to_jiffies(4000))); 4454 round_jiffies_relative(msecs_to_jiffies(4000)));
4460 } else { 4455 } else {
4461 union iwreq_data wrqu; 4456 union iwreq_data wrqu;
4462 4457
@@ -4509,20 +4504,17 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4509 4504
4510 IPW_DEBUG_ASSOC 4505 IPW_DEBUG_ASSOC
4511 ("queueing adhoc check\n"); 4506 ("queueing adhoc check\n");
4512 queue_delayed_work(priv-> 4507 schedule_delayed_work(
4513 workqueue, 4508 &priv->adhoc_check,
4514 &priv-> 4509 le16_to_cpu(priv->
4515 adhoc_check, 4510 assoc_request.
4516 le16_to_cpu(priv-> 4511 beacon_interval));
4517 assoc_request.
4518 beacon_interval));
4519 break; 4512 break;
4520 } 4513 }
4521 4514
4522 priv->status &= ~STATUS_ASSOCIATING; 4515 priv->status &= ~STATUS_ASSOCIATING;
4523 priv->status |= STATUS_ASSOCIATED; 4516 priv->status |= STATUS_ASSOCIATED;
4524 queue_work(priv->workqueue, 4517 schedule_work(&priv->system_config);
4525 &priv->system_config);
4526 4518
4527#ifdef CONFIG_IPW2200_QOS 4519#ifdef CONFIG_IPW2200_QOS
4528#define IPW_GET_PACKET_STYPE(x) WLAN_FC_GET_STYPE( \ 4520#define IPW_GET_PACKET_STYPE(x) WLAN_FC_GET_STYPE( \
@@ -4785,43 +4777,37 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4785#ifdef CONFIG_IPW2200_MONITOR 4777#ifdef CONFIG_IPW2200_MONITOR
4786 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { 4778 if (priv->ieee->iw_mode == IW_MODE_MONITOR) {
4787 priv->status |= STATUS_SCAN_FORCED; 4779 priv->status |= STATUS_SCAN_FORCED;
4788 queue_delayed_work(priv->workqueue, 4780 schedule_delayed_work(&priv->request_scan, 0);
4789 &priv->request_scan, 0);
4790 break; 4781 break;
4791 } 4782 }
4792 priv->status &= ~STATUS_SCAN_FORCED; 4783 priv->status &= ~STATUS_SCAN_FORCED;
4793#endif /* CONFIG_IPW2200_MONITOR */ 4784#endif /* CONFIG_IPW2200_MONITOR */
4794 4785
4795 /* Do queued direct scans first */ 4786 /* Do queued direct scans first */
4796 if (priv->status & STATUS_DIRECT_SCAN_PENDING) { 4787 if (priv->status & STATUS_DIRECT_SCAN_PENDING)
4797 queue_delayed_work(priv->workqueue, 4788 schedule_delayed_work(&priv->request_direct_scan, 0);
4798 &priv->request_direct_scan, 0);
4799 }
4800 4789
4801 if (!(priv->status & (STATUS_ASSOCIATED | 4790 if (!(priv->status & (STATUS_ASSOCIATED |
4802 STATUS_ASSOCIATING | 4791 STATUS_ASSOCIATING |
4803 STATUS_ROAMING | 4792 STATUS_ROAMING |
4804 STATUS_DISASSOCIATING))) 4793 STATUS_DISASSOCIATING)))
4805 queue_work(priv->workqueue, &priv->associate); 4794 schedule_work(&priv->associate);
4806 else if (priv->status & STATUS_ROAMING) { 4795 else if (priv->status & STATUS_ROAMING) {
4807 if (x->status == SCAN_COMPLETED_STATUS_COMPLETE) 4796 if (x->status == SCAN_COMPLETED_STATUS_COMPLETE)
4808 /* If a scan completed and we are in roam mode, then 4797 /* If a scan completed and we are in roam mode, then
4809 * the scan that completed was the one requested as a 4798 * the scan that completed was the one requested as a
4810 * result of entering roam... so, schedule the 4799 * result of entering roam... so, schedule the
4811 * roam work */ 4800 * roam work */
4812 queue_work(priv->workqueue, 4801 schedule_work(&priv->roam);
4813 &priv->roam);
4814 else 4802 else
4815 /* Don't schedule if we aborted the scan */ 4803 /* Don't schedule if we aborted the scan */
4816 priv->status &= ~STATUS_ROAMING; 4804 priv->status &= ~STATUS_ROAMING;
4817 } else if (priv->status & STATUS_SCAN_PENDING) 4805 } else if (priv->status & STATUS_SCAN_PENDING)
4818 queue_delayed_work(priv->workqueue, 4806 schedule_delayed_work(&priv->request_scan, 0);
4819 &priv->request_scan, 0);
4820 else if (priv->config & CFG_BACKGROUND_SCAN 4807 else if (priv->config & CFG_BACKGROUND_SCAN
4821 && priv->status & STATUS_ASSOCIATED) 4808 && priv->status & STATUS_ASSOCIATED)
4822 queue_delayed_work(priv->workqueue, 4809 schedule_delayed_work(&priv->request_scan,
4823 &priv->request_scan, 4810 round_jiffies_relative(HZ));
4824 round_jiffies_relative(HZ));
4825 4811
4826 /* Send an empty event to user space. 4812 /* Send an empty event to user space.
4827 * We don't send the received data on the event because 4813 * We don't send the received data on the event because
@@ -5185,7 +5171,7 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv)
5185 /* If the pre-allocated buffer pool is dropping low, schedule to 5171 /* If the pre-allocated buffer pool is dropping low, schedule to
5186 * refill it */ 5172 * refill it */
5187 if (rxq->free_count <= RX_LOW_WATERMARK) 5173 if (rxq->free_count <= RX_LOW_WATERMARK)
5188 queue_work(priv->workqueue, &priv->rx_replenish); 5174 schedule_work(&priv->rx_replenish);
5189 5175
5190 /* If we've added more space for the firmware to place data, tell it */ 5176 /* If we've added more space for the firmware to place data, tell it */
5191 if (write != rxq->write) 5177 if (write != rxq->write)
@@ -5595,7 +5581,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5595 return 0; 5581 return 0;
5596 } 5582 }
5597 5583
5598 /* Verify privacy compatability */ 5584 /* Verify privacy compatibility */
5599 if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) != 5585 if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) !=
5600 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { 5586 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) {
5601 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " 5587 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
@@ -5822,7 +5808,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5822 return 0; 5808 return 0;
5823 } 5809 }
5824 5810
5825 /* Verify privacy compatability */ 5811 /* Verify privacy compatibility */
5826 if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) != 5812 if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) !=
5827 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { 5813 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) {
5828 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5814 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
@@ -6126,8 +6112,8 @@ static void ipw_adhoc_check(void *data)
6126 return; 6112 return;
6127 } 6113 }
6128 6114
6129 queue_delayed_work(priv->workqueue, &priv->adhoc_check, 6115 schedule_delayed_work(&priv->adhoc_check,
6130 le16_to_cpu(priv->assoc_request.beacon_interval)); 6116 le16_to_cpu(priv->assoc_request.beacon_interval));
6131} 6117}
6132 6118
6133static void ipw_bg_adhoc_check(struct work_struct *work) 6119static void ipw_bg_adhoc_check(struct work_struct *work)
@@ -6516,8 +6502,7 @@ send_request:
6516 } else 6502 } else
6517 priv->status &= ~STATUS_SCAN_PENDING; 6503 priv->status &= ~STATUS_SCAN_PENDING;
6518 6504
6519 queue_delayed_work(priv->workqueue, &priv->scan_check, 6505 schedule_delayed_work(&priv->scan_check, IPW_SCAN_CHECK_WATCHDOG);
6520 IPW_SCAN_CHECK_WATCHDOG);
6521done: 6506done:
6522 mutex_unlock(&priv->mutex); 6507 mutex_unlock(&priv->mutex);
6523 return err; 6508 return err;
@@ -6987,8 +6972,7 @@ static int ipw_qos_handle_probe_response(struct ipw_priv *priv,
6987 !memcmp(network->ssid, 6972 !memcmp(network->ssid,
6988 priv->assoc_network->ssid, 6973 priv->assoc_network->ssid,
6989 network->ssid_len)) { 6974 network->ssid_len)) {
6990 queue_work(priv->workqueue, 6975 schedule_work(&priv->merge_networks);
6991 &priv->merge_networks);
6992 } 6976 }
6993 } 6977 }
6994 6978
@@ -7446,7 +7430,7 @@ static int ipw_associate_network(struct ipw_priv *priv,
7446 priv->assoc_request.capability &= 7430 priv->assoc_request.capability &=
7447 ~cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME); 7431 ~cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME);
7448 7432
7449 IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, " 7433 IPW_DEBUG_ASSOC("%ssociation attempt: '%s', channel %d, "
7450 "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n", 7434 "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n",
7451 roaming ? "Rea" : "A", 7435 roaming ? "Rea" : "A",
7452 print_ssid(ssid, priv->essid, priv->essid_len), 7436 print_ssid(ssid, priv->essid, priv->essid_len),
@@ -7656,7 +7640,7 @@ static int ipw_associate(void *data)
7656 if (priv->status & STATUS_DISASSOCIATING) { 7640 if (priv->status & STATUS_DISASSOCIATING) {
7657 IPW_DEBUG_ASSOC("Not attempting association (in " 7641 IPW_DEBUG_ASSOC("Not attempting association (in "
7658 "disassociating)\n "); 7642 "disassociating)\n ");
7659 queue_work(priv->workqueue, &priv->associate); 7643 schedule_work(&priv->associate);
7660 return 0; 7644 return 0;
7661 } 7645 }
7662 7646
@@ -7724,12 +7708,10 @@ static int ipw_associate(void *data)
7724 7708
7725 if (!(priv->status & STATUS_SCANNING)) { 7709 if (!(priv->status & STATUS_SCANNING)) {
7726 if (!(priv->config & CFG_SPEED_SCAN)) 7710 if (!(priv->config & CFG_SPEED_SCAN))
7727 queue_delayed_work(priv->workqueue, 7711 schedule_delayed_work(&priv->request_scan,
7728 &priv->request_scan, 7712 SCAN_INTERVAL);
7729 SCAN_INTERVAL);
7730 else 7713 else
7731 queue_delayed_work(priv->workqueue, 7714 schedule_delayed_work(&priv->request_scan, 0);
7732 &priv->request_scan, 0);
7733 } 7715 }
7734 7716
7735 return 0; 7717 return 0;
@@ -8202,7 +8184,7 @@ static void ipw_handle_promiscuous_rx(struct ipw_priv *priv,
8202static int is_network_packet(struct ipw_priv *priv, 8184static int is_network_packet(struct ipw_priv *priv,
8203 struct libipw_hdr_4addr *header) 8185 struct libipw_hdr_4addr *header)
8204{ 8186{
8205 /* Filter incoming packets to determine if they are targetted toward 8187 /* Filter incoming packets to determine if they are targeted toward
8206 * this network, discarding packets coming from ourselves */ 8188 * this network, discarding packets coming from ourselves */
8207 switch (priv->ieee->iw_mode) { 8189 switch (priv->ieee->iw_mode) {
8208 case IW_MODE_ADHOC: /* Header: Dest. | Source | BSSID */ 8190 case IW_MODE_ADHOC: /* Header: Dest. | Source | BSSID */
@@ -8358,9 +8340,9 @@ static void ipw_handle_mgmt_packet(struct ipw_priv *priv,
8358} 8340}
8359 8341
8360/* 8342/*
8361 * Main entry function for recieving a packet with 80211 headers. This 8343 * Main entry function for receiving a packet with 80211 headers. This
8362 * should be called when ever the FW has notified us that there is a new 8344 * should be called when ever the FW has notified us that there is a new
8363 * skb in the recieve queue. 8345 * skb in the receive queue.
8364 */ 8346 */
8365static void ipw_rx(struct ipw_priv *priv) 8347static void ipw_rx(struct ipw_priv *priv)
8366{ 8348{
@@ -8701,7 +8683,7 @@ static int ipw_sw_reset(struct ipw_priv *priv, int option)
8701 * functions defined in ipw_main to provide the HW interaction. 8683 * functions defined in ipw_main to provide the HW interaction.
8702 * 8684 *
8703 * The exception to this is the use of the ipw_get_ordinal() 8685 * The exception to this is the use of the ipw_get_ordinal()
8704 * function used to poll the hardware vs. making unecessary calls. 8686 * function used to poll the hardware vs. making unnecessary calls.
8705 * 8687 *
8706 */ 8688 */
8707 8689
@@ -8892,7 +8874,7 @@ static int ipw_wx_set_mode(struct net_device *dev,
8892 8874
8893 priv->ieee->iw_mode = wrqu->mode; 8875 priv->ieee->iw_mode = wrqu->mode;
8894 8876
8895 queue_work(priv->workqueue, &priv->adapter_restart); 8877 schedule_work(&priv->adapter_restart);
8896 mutex_unlock(&priv->mutex); 8878 mutex_unlock(&priv->mutex);
8897 return err; 8879 return err;
8898} 8880}
@@ -9591,7 +9573,7 @@ static int ipw_wx_set_scan(struct net_device *dev,
9591 9573
9592 IPW_DEBUG_WX("Start scan\n"); 9574 IPW_DEBUG_WX("Start scan\n");
9593 9575
9594 queue_delayed_work(priv->workqueue, work, 0); 9576 schedule_delayed_work(work, 0);
9595 9577
9596 return 0; 9578 return 0;
9597} 9579}
@@ -9930,7 +9912,7 @@ static int ipw_wx_set_monitor(struct net_device *dev,
9930#else 9912#else
9931 priv->net_dev->type = ARPHRD_IEEE80211; 9913 priv->net_dev->type = ARPHRD_IEEE80211;
9932#endif 9914#endif
9933 queue_work(priv->workqueue, &priv->adapter_restart); 9915 schedule_work(&priv->adapter_restart);
9934 } 9916 }
9935 9917
9936 ipw_set_channel(priv, parms[1]); 9918 ipw_set_channel(priv, parms[1]);
@@ -9940,7 +9922,7 @@ static int ipw_wx_set_monitor(struct net_device *dev,
9940 return 0; 9922 return 0;
9941 } 9923 }
9942 priv->net_dev->type = ARPHRD_ETHER; 9924 priv->net_dev->type = ARPHRD_ETHER;
9943 queue_work(priv->workqueue, &priv->adapter_restart); 9925 schedule_work(&priv->adapter_restart);
9944 } 9926 }
9945 mutex_unlock(&priv->mutex); 9927 mutex_unlock(&priv->mutex);
9946 return 0; 9928 return 0;
@@ -9954,7 +9936,7 @@ static int ipw_wx_reset(struct net_device *dev,
9954{ 9936{
9955 struct ipw_priv *priv = libipw_priv(dev); 9937 struct ipw_priv *priv = libipw_priv(dev);
9956 IPW_DEBUG_WX("RESET\n"); 9938 IPW_DEBUG_WX("RESET\n");
9957 queue_work(priv->workqueue, &priv->adapter_restart); 9939 schedule_work(&priv->adapter_restart);
9958 return 0; 9940 return 0;
9959} 9941}
9960 9942
@@ -10437,7 +10419,7 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv,
10437 10419
10438 memset(&dummystats, 0, sizeof(dummystats)); 10420 memset(&dummystats, 0, sizeof(dummystats));
10439 10421
10440 /* Filtering of fragment chains is done agains the first fragment */ 10422 /* Filtering of fragment chains is done against the first fragment */
10441 hdr = (void *)txb->fragments[0]->data; 10423 hdr = (void *)txb->fragments[0]->data;
10442 if (libipw_is_management(le16_to_cpu(hdr->frame_control))) { 10424 if (libipw_is_management(le16_to_cpu(hdr->frame_control))) {
10443 if (filter & IPW_PROM_NO_MGMT) 10425 if (filter & IPW_PROM_NO_MGMT)
@@ -10544,7 +10526,7 @@ static int ipw_net_set_mac_address(struct net_device *dev, void *p)
10544 memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); 10526 memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN);
10545 printk(KERN_INFO "%s: Setting MAC to %pM\n", 10527 printk(KERN_INFO "%s: Setting MAC to %pM\n",
10546 priv->net_dev->name, priv->mac_addr); 10528 priv->net_dev->name, priv->mac_addr);
10547 queue_work(priv->workqueue, &priv->adapter_restart); 10529 schedule_work(&priv->adapter_restart);
10548 mutex_unlock(&priv->mutex); 10530 mutex_unlock(&priv->mutex);
10549 return 0; 10531 return 0;
10550} 10532}
@@ -10677,9 +10659,7 @@ static void ipw_rf_kill(void *adapter)
10677 10659
10678 if (rf_kill_active(priv)) { 10660 if (rf_kill_active(priv)) {
10679 IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n"); 10661 IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n");
10680 if (priv->workqueue) 10662 schedule_delayed_work(&priv->rf_kill, 2 * HZ);
10681 queue_delayed_work(priv->workqueue,
10682 &priv->rf_kill, 2 * HZ);
10683 goto exit_unlock; 10663 goto exit_unlock;
10684 } 10664 }
10685 10665
@@ -10690,7 +10670,7 @@ static void ipw_rf_kill(void *adapter)
10690 "device\n"); 10670 "device\n");
10691 10671
10692 /* we can not do an adapter restart while inside an irq lock */ 10672 /* we can not do an adapter restart while inside an irq lock */
10693 queue_work(priv->workqueue, &priv->adapter_restart); 10673 schedule_work(&priv->adapter_restart);
10694 } else 10674 } else
10695 IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " 10675 IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still "
10696 "enabled\n"); 10676 "enabled\n");
@@ -10728,7 +10708,7 @@ static void ipw_link_up(struct ipw_priv *priv)
10728 notify_wx_assoc_event(priv); 10708 notify_wx_assoc_event(priv);
10729 10709
10730 if (priv->config & CFG_BACKGROUND_SCAN) 10710 if (priv->config & CFG_BACKGROUND_SCAN)
10731 queue_delayed_work(priv->workqueue, &priv->request_scan, HZ); 10711 schedule_delayed_work(&priv->request_scan, HZ);
10732} 10712}
10733 10713
10734static void ipw_bg_link_up(struct work_struct *work) 10714static void ipw_bg_link_up(struct work_struct *work)
@@ -10757,7 +10737,7 @@ static void ipw_link_down(struct ipw_priv *priv)
10757 10737
10758 if (!(priv->status & STATUS_EXIT_PENDING)) { 10738 if (!(priv->status & STATUS_EXIT_PENDING)) {
10759 /* Queue up another scan... */ 10739 /* Queue up another scan... */
10760 queue_delayed_work(priv->workqueue, &priv->request_scan, 0); 10740 schedule_delayed_work(&priv->request_scan, 0);
10761 } else 10741 } else
10762 cancel_delayed_work(&priv->scan_event); 10742 cancel_delayed_work(&priv->scan_event);
10763} 10743}
@@ -10775,7 +10755,6 @@ static int __devinit ipw_setup_deferred_work(struct ipw_priv *priv)
10775{ 10755{
10776 int ret = 0; 10756 int ret = 0;
10777 10757
10778 priv->workqueue = create_workqueue(DRV_NAME);
10779 init_waitqueue_head(&priv->wait_command_queue); 10758 init_waitqueue_head(&priv->wait_command_queue);
10780 init_waitqueue_head(&priv->wait_state); 10759 init_waitqueue_head(&priv->wait_state);
10781 10760
@@ -11332,8 +11311,7 @@ static int ipw_up(struct ipw_priv *priv)
11332 IPW_WARNING("Radio Frequency Kill Switch is On:\n" 11311 IPW_WARNING("Radio Frequency Kill Switch is On:\n"
11333 "Kill switch must be turned off for " 11312 "Kill switch must be turned off for "
11334 "wireless networking to work.\n"); 11313 "wireless networking to work.\n");
11335 queue_delayed_work(priv->workqueue, &priv->rf_kill, 11314 schedule_delayed_work(&priv->rf_kill, 2 * HZ);
11336 2 * HZ);
11337 return 0; 11315 return 0;
11338 } 11316 }
11339 11317
@@ -11343,8 +11321,7 @@ static int ipw_up(struct ipw_priv *priv)
11343 11321
11344 /* If configure to try and auto-associate, kick 11322 /* If configure to try and auto-associate, kick
11345 * off a scan. */ 11323 * off a scan. */
11346 queue_delayed_work(priv->workqueue, 11324 schedule_delayed_work(&priv->request_scan, 0);
11347 &priv->request_scan, 0);
11348 11325
11349 return 0; 11326 return 0;
11350 } 11327 }
@@ -11467,9 +11444,13 @@ static int ipw_net_init(struct net_device *dev)
11467 11444
11468 bg_band->band = IEEE80211_BAND_2GHZ; 11445 bg_band->band = IEEE80211_BAND_2GHZ;
11469 bg_band->n_channels = geo->bg_channels; 11446 bg_band->n_channels = geo->bg_channels;
11470 bg_band->channels = 11447 bg_band->channels = kcalloc(geo->bg_channels,
11471 kzalloc(geo->bg_channels * 11448 sizeof(struct ieee80211_channel),
11472 sizeof(struct ieee80211_channel), GFP_KERNEL); 11449 GFP_KERNEL);
11450 if (!bg_band->channels) {
11451 rc = -ENOMEM;
11452 goto out;
11453 }
11473 /* translate geo->bg to bg_band.channels */ 11454 /* translate geo->bg to bg_band.channels */
11474 for (i = 0; i < geo->bg_channels; i++) { 11455 for (i = 0; i < geo->bg_channels; i++) {
11475 bg_band->channels[i].band = IEEE80211_BAND_2GHZ; 11456 bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
@@ -11502,9 +11483,13 @@ static int ipw_net_init(struct net_device *dev)
11502 11483
11503 a_band->band = IEEE80211_BAND_5GHZ; 11484 a_band->band = IEEE80211_BAND_5GHZ;
11504 a_band->n_channels = geo->a_channels; 11485 a_band->n_channels = geo->a_channels;
11505 a_band->channels = 11486 a_band->channels = kcalloc(geo->a_channels,
11506 kzalloc(geo->a_channels * 11487 sizeof(struct ieee80211_channel),
11507 sizeof(struct ieee80211_channel), GFP_KERNEL); 11488 GFP_KERNEL);
11489 if (!a_band->channels) {
11490 rc = -ENOMEM;
11491 goto out;
11492 }
11508 /* translate geo->bg to a_band.channels */ 11493 /* translate geo->bg to a_band.channels */
11509 for (i = 0; i < geo->a_channels; i++) { 11494 for (i = 0; i < geo->a_channels; i++) {
11510 a_band->channels[i].band = IEEE80211_BAND_2GHZ; 11495 a_band->channels[i].band = IEEE80211_BAND_2GHZ;
@@ -11802,7 +11787,7 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev,
11802 err = request_irq(pdev->irq, ipw_isr, IRQF_SHARED, DRV_NAME, priv); 11787 err = request_irq(pdev->irq, ipw_isr, IRQF_SHARED, DRV_NAME, priv);
11803 if (err) { 11788 if (err) {
11804 IPW_ERROR("Error allocating IRQ %d\n", pdev->irq); 11789 IPW_ERROR("Error allocating IRQ %d\n", pdev->irq);
11805 goto out_destroy_workqueue; 11790 goto out_iounmap;
11806 } 11791 }
11807 11792
11808 SET_NETDEV_DEV(net_dev, &pdev->dev); 11793 SET_NETDEV_DEV(net_dev, &pdev->dev);
@@ -11870,9 +11855,6 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev,
11870 sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); 11855 sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group);
11871 out_release_irq: 11856 out_release_irq:
11872 free_irq(pdev->irq, priv); 11857 free_irq(pdev->irq, priv);
11873 out_destroy_workqueue:
11874 destroy_workqueue(priv->workqueue);
11875 priv->workqueue = NULL;
11876 out_iounmap: 11858 out_iounmap:
11877 iounmap(priv->hw_base); 11859 iounmap(priv->hw_base);
11878 out_pci_release_regions: 11860 out_pci_release_regions:
@@ -11915,18 +11897,31 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev)
11915 kfree(priv->cmdlog); 11897 kfree(priv->cmdlog);
11916 priv->cmdlog = NULL; 11898 priv->cmdlog = NULL;
11917 } 11899 }
11918 /* ipw_down will ensure that there is no more pending work 11900
11919 * in the workqueue's, so we can safely remove them now. */ 11901 /* make sure all works are inactive */
11920 cancel_delayed_work(&priv->adhoc_check); 11902 cancel_delayed_work_sync(&priv->adhoc_check);
11921 cancel_delayed_work(&priv->gather_stats); 11903 cancel_work_sync(&priv->associate);
11922 cancel_delayed_work(&priv->request_scan); 11904 cancel_work_sync(&priv->disassociate);
11923 cancel_delayed_work(&priv->request_direct_scan); 11905 cancel_work_sync(&priv->system_config);
11924 cancel_delayed_work(&priv->request_passive_scan); 11906 cancel_work_sync(&priv->rx_replenish);
11925 cancel_delayed_work(&priv->scan_event); 11907 cancel_work_sync(&priv->adapter_restart);
11926 cancel_delayed_work(&priv->rf_kill); 11908 cancel_delayed_work_sync(&priv->rf_kill);
11927 cancel_delayed_work(&priv->scan_check); 11909 cancel_work_sync(&priv->up);
11928 destroy_workqueue(priv->workqueue); 11910 cancel_work_sync(&priv->down);
11929 priv->workqueue = NULL; 11911 cancel_delayed_work_sync(&priv->request_scan);
11912 cancel_delayed_work_sync(&priv->request_direct_scan);
11913 cancel_delayed_work_sync(&priv->request_passive_scan);
11914 cancel_delayed_work_sync(&priv->scan_event);
11915 cancel_delayed_work_sync(&priv->gather_stats);
11916 cancel_work_sync(&priv->abort_scan);
11917 cancel_work_sync(&priv->roam);
11918 cancel_delayed_work_sync(&priv->scan_check);
11919 cancel_work_sync(&priv->link_up);
11920 cancel_work_sync(&priv->link_down);
11921 cancel_delayed_work_sync(&priv->led_link_on);
11922 cancel_delayed_work_sync(&priv->led_link_off);
11923 cancel_delayed_work_sync(&priv->led_act_off);
11924 cancel_work_sync(&priv->merge_networks);
11930 11925
11931 /* Free MAC hash list for ADHOC */ 11926 /* Free MAC hash list for ADHOC */
11932 for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) { 11927 for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) {
@@ -12014,7 +12009,7 @@ static int ipw_pci_resume(struct pci_dev *pdev)
12014 priv->suspend_time = get_seconds() - priv->suspend_at; 12009 priv->suspend_time = get_seconds() - priv->suspend_at;
12015 12010
12016 /* Bring the device back up */ 12011 /* Bring the device back up */
12017 queue_work(priv->workqueue, &priv->up); 12012 schedule_work(&priv->up);
12018 12013
12019 return 0; 12014 return 0;
12020} 12015}