diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2008-06-11 21:46:53 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-14 12:18:04 -0400 |
commit | 4e39317df0f9e48919130574238319f9a445e6e3 (patch) | |
tree | 7983603d7798c10f18372de514ab9b2a773d1f8b /drivers/net/wireless/iwlwifi/iwl4965-base.c | |
parent | 16e727e866d739d7f02790c794410f6d9f1d720b (diff) |
iwlwifi: clean up in setup/cancel deferred work
This patch makes some clean up in setup/cancel_deferred_work.
iwl_setup_deferred_work does the work that is common to 4965
and 5000, then it calls to HW specific handlers.
This patch also removes uneeded work_struct from iwl_priv.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index a8dfdcbb8b43..0acd42bd43c5 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -1647,6 +1647,26 @@ static void iwl4965_bg_beacon_update(struct work_struct *work) | |||
1647 | iwl4965_send_beacon_cmd(priv); | 1647 | iwl4965_send_beacon_cmd(priv); |
1648 | } | 1648 | } |
1649 | 1649 | ||
1650 | /** | ||
1651 | * iwl4965_bg_statistics_periodic - Timer callback to queue statistics | ||
1652 | * | ||
1653 | * This callback is provided in order to send a statistics request. | ||
1654 | * | ||
1655 | * This timer function is continually reset to execute within | ||
1656 | * REG_RECALIB_PERIOD seconds since the last STATISTICS_NOTIFICATION | ||
1657 | * was received. We need to ensure we receive the statistics in order | ||
1658 | * to update the temperature used for calibrating the TXPOWER. | ||
1659 | */ | ||
1660 | static void iwl4965_bg_statistics_periodic(unsigned long data) | ||
1661 | { | ||
1662 | struct iwl_priv *priv = (struct iwl_priv *)data; | ||
1663 | |||
1664 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
1665 | return; | ||
1666 | |||
1667 | iwl_send_statistics_request(priv, CMD_ASYNC); | ||
1668 | } | ||
1669 | |||
1650 | static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, | 1670 | static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, |
1651 | struct iwl_rx_mem_buffer *rxb) | 1671 | struct iwl_rx_mem_buffer *rxb) |
1652 | { | 1672 | { |
@@ -2887,7 +2907,7 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
2887 | queue_work(priv->workqueue, &priv->restart); | 2907 | queue_work(priv->workqueue, &priv->restart); |
2888 | } | 2908 | } |
2889 | 2909 | ||
2890 | static void iwl4965_cancel_deferred_work(struct iwl_priv *priv); | 2910 | static void iwl_cancel_deferred_work(struct iwl_priv *priv); |
2891 | 2911 | ||
2892 | static void __iwl4965_down(struct iwl_priv *priv) | 2912 | static void __iwl4965_down(struct iwl_priv *priv) |
2893 | { | 2913 | { |
@@ -2991,7 +3011,7 @@ static void iwl4965_down(struct iwl_priv *priv) | |||
2991 | __iwl4965_down(priv); | 3011 | __iwl4965_down(priv); |
2992 | mutex_unlock(&priv->mutex); | 3012 | mutex_unlock(&priv->mutex); |
2993 | 3013 | ||
2994 | iwl4965_cancel_deferred_work(priv); | 3014 | iwl_cancel_deferred_work(priv); |
2995 | } | 3015 | } |
2996 | 3016 | ||
2997 | #define MAX_HW_RESTARTS 5 | 3017 | #define MAX_HW_RESTARTS 5 |
@@ -5022,7 +5042,7 @@ static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); | |||
5022 | * | 5042 | * |
5023 | *****************************************************************************/ | 5043 | *****************************************************************************/ |
5024 | 5044 | ||
5025 | static void iwl4965_setup_deferred_work(struct iwl_priv *priv) | 5045 | static void iwl_setup_deferred_work(struct iwl_priv *priv) |
5026 | { | 5046 | { |
5027 | priv->workqueue = create_workqueue(DRV_NAME); | 5047 | priv->workqueue = create_workqueue(DRV_NAME); |
5028 | 5048 | ||
@@ -5043,21 +5063,28 @@ static void iwl4965_setup_deferred_work(struct iwl_priv *priv) | |||
5043 | INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); | 5063 | INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); |
5044 | INIT_DELAYED_WORK(&priv->scan_check, iwl4965_bg_scan_check); | 5064 | INIT_DELAYED_WORK(&priv->scan_check, iwl4965_bg_scan_check); |
5045 | 5065 | ||
5046 | iwl4965_hw_setup_deferred_work(priv); | 5066 | if (priv->cfg->ops->lib->setup_deferred_work) |
5067 | priv->cfg->ops->lib->setup_deferred_work(priv); | ||
5068 | |||
5069 | init_timer(&priv->statistics_periodic); | ||
5070 | priv->statistics_periodic.data = (unsigned long)priv; | ||
5071 | priv->statistics_periodic.function = iwl4965_bg_statistics_periodic; | ||
5047 | 5072 | ||
5048 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) | 5073 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) |
5049 | iwl4965_irq_tasklet, (unsigned long)priv); | 5074 | iwl4965_irq_tasklet, (unsigned long)priv); |
5050 | } | 5075 | } |
5051 | 5076 | ||
5052 | static void iwl4965_cancel_deferred_work(struct iwl_priv *priv) | 5077 | static void iwl_cancel_deferred_work(struct iwl_priv *priv) |
5053 | { | 5078 | { |
5054 | iwl4965_hw_cancel_deferred_work(priv); | 5079 | if (priv->cfg->ops->lib->cancel_deferred_work) |
5080 | priv->cfg->ops->lib->cancel_deferred_work(priv); | ||
5055 | 5081 | ||
5056 | cancel_delayed_work_sync(&priv->init_alive_start); | 5082 | cancel_delayed_work_sync(&priv->init_alive_start); |
5057 | cancel_delayed_work(&priv->scan_check); | 5083 | cancel_delayed_work(&priv->scan_check); |
5058 | cancel_delayed_work(&priv->alive_start); | 5084 | cancel_delayed_work(&priv->alive_start); |
5059 | cancel_delayed_work(&priv->post_associate); | 5085 | cancel_delayed_work(&priv->post_associate); |
5060 | cancel_work_sync(&priv->beacon_update); | 5086 | cancel_work_sync(&priv->beacon_update); |
5087 | del_timer_sync(&priv->statistics_periodic); | ||
5061 | } | 5088 | } |
5062 | 5089 | ||
5063 | static struct attribute *iwl4965_sysfs_entries[] = { | 5090 | static struct attribute *iwl4965_sysfs_entries[] = { |
@@ -5269,7 +5296,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
5269 | } | 5296 | } |
5270 | 5297 | ||
5271 | 5298 | ||
5272 | iwl4965_setup_deferred_work(priv); | 5299 | iwl_setup_deferred_work(priv); |
5273 | iwl4965_setup_rx_handlers(priv); | 5300 | iwl4965_setup_rx_handlers(priv); |
5274 | 5301 | ||
5275 | /******************** | 5302 | /******************** |