iwlwifi: put all the isr related function under ops
authorWey-Yi Guy <wey-yi.w.guy@intel.com>
Wed, 10 Nov 2010 17:56:40 +0000 (09:56 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 15 Nov 2010 18:26:45 +0000 (13:26 -0500)
There were two type of isr supported by iwlwifi devices.
  legacy isr - only used by legacy devices (3945 & 4965)
  ict isr - used by all new generation of iwlwifi devices

Move all the isr related functions into ops, the ict type of isr
supports only needed for newer devices.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/Makefile
drivers/net/wireless/iwlwifi/iwl-1000.c
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl3945-base.c

index b85a9c8ed01e8dc76a58045f419d401411971d0d..01aa2468bd6946a5fc263d468bcbbbffb654a711 100644 (file)
@@ -11,14 +11,14 @@ CFLAGS_iwl-devtrace.o := -I$(src)
 
 # AGN
 obj-$(CONFIG_IWLAGN)   += iwlagn.o
-iwlagn-objs            := iwl-agn.o iwl-agn-rs.o iwl-agn-led.o iwl-agn-ict.o
+iwlagn-objs            := iwl-agn.o iwl-agn-rs.o iwl-agn-led.o
 iwlagn-objs            += iwl-agn-ucode.o iwl-agn-tx.o
 iwlagn-objs            += iwl-agn-lib.o iwl-agn-rx.o iwl-agn-calib.o
 iwlagn-objs            += iwl-agn-tt.o iwl-agn-sta.o iwl-agn-eeprom.o
 iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-agn-debugfs.o
 
 iwlagn-$(CONFIG_IWL4965) += iwl-4965.o
-iwlagn-$(CONFIG_IWL5000) += iwl-agn-rxon.o iwl-agn-hcmd.o
+iwlagn-$(CONFIG_IWL5000) += iwl-agn-rxon.o iwl-agn-hcmd.o iwl-agn-ict.o
 iwlagn-$(CONFIG_IWL5000) += iwl-5000.o
 iwlagn-$(CONFIG_IWL5000) += iwl-6000.o
 iwlagn-$(CONFIG_IWL5000) += iwl-1000.o
index baedea8e4d048af35745e0939ed75b1782504ad3..068f1e1e3297afc4b3ea4ddf98e24ef55992bafc 100644 (file)
@@ -211,7 +211,13 @@ static struct iwl_lib_ops iwl1000_lib = {
                .calib_version  = iwlagn_eeprom_calib_version,
                .query_addr = iwlagn_eeprom_query_addr,
        },
-       .isr = iwl_isr_ict,
+       .isr_ops = {
+               .isr = iwl_isr_ict,
+               .free = iwl_free_isr_ict,
+               .alloc = iwl_alloc_isr_ict,
+               .reset = iwl_reset_ict,
+               .disable = iwl_disable_ict,
+       },
        .temp_ops = {
                .temperature = iwlagn_temperature,
         },
index a97c09992a73b6c04206b1ccf458fdb5cad4c510..1ab171949021d6a72fa84bced74c8209f379ae64 100644 (file)
@@ -2727,7 +2727,9 @@ static struct iwl_lib_ops iwl3945_lib = {
        },
        .send_tx_power  = iwl3945_send_tx_power,
        .is_valid_rtc_data_addr = iwl3945_hw_valid_rtc_data_addr,
-       .isr = iwl_isr_legacy,
+       .isr_ops = {
+               .isr = iwl_isr_legacy,
+       },
        .recover_from_tx_stall = iwl_bg_monitor_recover,
        .check_plcp_health = iwl3945_good_plcp_health,
 
index 6d313c817040cd9b92798e962a19e93cbdcbe228..a6518caa405cf4c47ae8f9bb0af18de67d87429b 100644 (file)
@@ -2561,7 +2561,9 @@ static struct iwl_lib_ops iwl4965_lib = {
        },
        .send_tx_power  = iwl4965_send_tx_power,
        .update_chain_flags = iwl_update_chain_flags,
-       .isr = iwl_isr_legacy,
+       .isr_ops = {
+               .isr = iwl_isr_legacy,
+       },
        .temp_ops = {
                .temperature = iwl4965_temperature_calib,
        },
index e1f412f915ae613d760a84669c7e0c2f1587cfcb..ad43f0fdf91998fc601e14fb615d03784a339a97 100644 (file)
@@ -385,7 +385,13 @@ static struct iwl_lib_ops iwl5000_lib = {
                .calib_version  = iwlagn_eeprom_calib_version,
                .query_addr = iwlagn_eeprom_query_addr,
        },
-       .isr = iwl_isr_ict,
+       .isr_ops = {
+               .isr = iwl_isr_ict,
+               .free = iwl_free_isr_ict,
+               .alloc = iwl_alloc_isr_ict,
+               .reset = iwl_reset_ict,
+               .disable = iwl_disable_ict,
+       },
        .temp_ops = {
                .temperature = iwlagn_temperature,
         },
@@ -449,7 +455,13 @@ static struct iwl_lib_ops iwl5150_lib = {
                .calib_version  = iwlagn_eeprom_calib_version,
                .query_addr = iwlagn_eeprom_query_addr,
        },
-       .isr = iwl_isr_ict,
+       .isr_ops = {
+               .isr = iwl_isr_ict,
+               .free = iwl_free_isr_ict,
+               .alloc = iwl_alloc_isr_ict,
+               .reset = iwl_reset_ict,
+               .disable = iwl_disable_ict,
+       },
        .temp_ops = {
                .temperature = iwl5150_temperature,
         },
index b1816900980c1a092b4f9bb071e17afa95e477a2..21ac2817722e64e9c4d991e6d1780ead5d796648 100644 (file)
@@ -322,7 +322,13 @@ static struct iwl_lib_ops iwl6000_lib = {
                .query_addr = iwlagn_eeprom_query_addr,
                .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
        },
-       .isr = iwl_isr_ict,
+       .isr_ops = {
+               .isr = iwl_isr_ict,
+               .free = iwl_free_isr_ict,
+               .alloc = iwl_alloc_isr_ict,
+               .reset = iwl_reset_ict,
+               .disable = iwl_disable_ict,
+       },
        .temp_ops = {
                .temperature = iwlagn_temperature,
         },
@@ -389,7 +395,13 @@ static struct iwl_lib_ops iwl6000g2b_lib = {
                .query_addr = iwlagn_eeprom_query_addr,
                .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
        },
-       .isr = iwl_isr_ict,
+       .isr_ops = {
+               .isr = iwl_isr_ict,
+               .free = iwl_free_isr_ict,
+               .alloc = iwl_alloc_isr_ict,
+               .reset = iwl_reset_ict,
+               .disable = iwl_disable_ict,
+       },
        .temp_ops = {
                .temperature = iwlagn_temperature,
         },
index 573017474610c3519977b7d97d45f99da53f2f58..007fb20d78ab6c5beab4179713c2a699ea116208 100644 (file)
@@ -2815,7 +2815,8 @@ static void __iwl_down(struct iwl_priv *priv)
                                STATUS_EXIT_PENDING;
 
        /* device going down, Stop using ICT table */
-       iwl_disable_ict(priv);
+       if (priv->cfg->ops->lib->isr_ops.disable)
+               priv->cfg->ops->lib->isr_ops.disable(priv);
 
        iwlagn_txq_ctx_stop(priv);
        iwlagn_rxq_stop(priv);
@@ -3038,7 +3039,8 @@ static void iwl_bg_alive_start(struct work_struct *data)
                return;
 
        /* enable dram interrupt */
-       iwl_reset_ict(priv);
+       if (priv->cfg->ops->lib->isr_ops.reset)
+               priv->cfg->ops->lib->isr_ops.reset(priv);
 
        mutex_lock(&priv->mutex);
        iwl_alive_start(priv);
@@ -4172,8 +4174,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        pci_enable_msi(priv->pci_dev);
 
-       iwl_alloc_isr_ict(priv);
-       err = request_irq(priv->pci_dev->irq, priv->cfg->ops->lib->isr,
+       if (priv->cfg->ops->lib->isr_ops.alloc)
+               priv->cfg->ops->lib->isr_ops.alloc(priv);
+
+       err = request_irq(priv->pci_dev->irq, priv->cfg->ops->lib->isr_ops.isr,
                          IRQF_SHARED, DRV_NAME, priv);
        if (err) {
                IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);
@@ -4220,7 +4224,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        destroy_workqueue(priv->workqueue);
        priv->workqueue = NULL;
        free_irq(priv->pci_dev->irq, priv);
-       iwl_free_isr_ict(priv);
+       if (priv->cfg->ops->lib->isr_ops.free)
+               priv->cfg->ops->lib->isr_ops.free(priv);
  out_disable_msi:
        pci_disable_msi(priv->pci_dev);
        iwl_uninit_drv(priv);
@@ -4315,7 +4320,8 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
 
        iwl_uninit_drv(priv);
 
-       iwl_free_isr_ict(priv);
+       if (priv->cfg->ops->lib->isr_ops.free)
+               priv->cfg->ops->lib->isr_ops.free(priv);
 
        dev_kfree_skb(priv->beacon_skb);
 
index 7505c16db2a205e51528c91bcc9d38342e6a416d..c9723da040fc55a89d4b61c7386ec3c777b1c031 100644 (file)
@@ -120,6 +120,14 @@ struct iwl_apm_ops {
        void (*config)(struct iwl_priv *priv);
 };
 
+struct iwl_isr_ops {
+       irqreturn_t (*isr) (int irq, void *data);
+       void (*free)(struct iwl_priv *priv);
+       int (*alloc)(struct iwl_priv *priv);
+       int (*reset)(struct iwl_priv *priv);
+       void (*disable)(struct iwl_priv *priv);
+};
+
 struct iwl_debugfs_ops {
        ssize_t (*rx_stats_read)(struct file *file, char __user *user_buf,
                                 size_t count, loff_t *ppos);
@@ -193,7 +201,9 @@ struct iwl_lib_ops {
        /* power */
        int (*send_tx_power) (struct iwl_priv *priv);
        void (*update_chain_flags)(struct iwl_priv *priv);
-       irqreturn_t (*isr) (int irq, void *data);
+
+       /* isr */
+       struct iwl_isr_ops isr_ops;
 
        /* eeprom operations (as defined in iwl-eeprom.h) */
        struct iwl_eeprom_ops eeprom_ops;
index 6152a86c19b51ad6417f0fbc3fe2e3d125f35bc7..a55b4623e1c8066e86cc100663a551b89843b4f6 100644 (file)
@@ -4120,7 +4120,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
 
        pci_enable_msi(priv->pci_dev);
 
-       err = request_irq(priv->pci_dev->irq, priv->cfg->ops->lib->isr,
+       err = request_irq(priv->pci_dev->irq, priv->cfg->ops->lib->isr_ops.isr,
                          IRQF_SHARED, DRV_NAME, priv);
        if (err) {
                IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);