Commit e39fdee1 authored by Wey-Yi Guy's avatar Wey-Yi Guy Committed by John W. Linville

iwlwifi: put all the isr related function under ops

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: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 81baf6ec
...@@ -11,14 +11,14 @@ CFLAGS_iwl-devtrace.o := -I$(src) ...@@ -11,14 +11,14 @@ CFLAGS_iwl-devtrace.o := -I$(src)
# AGN # AGN
obj-$(CONFIG_IWLAGN) += iwlagn.o 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-ucode.o iwl-agn-tx.o
iwlagn-objs += iwl-agn-lib.o iwl-agn-rx.o iwl-agn-calib.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-objs += iwl-agn-tt.o iwl-agn-sta.o iwl-agn-eeprom.o
iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-agn-debugfs.o iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-agn-debugfs.o
iwlagn-$(CONFIG_IWL4965) += iwl-4965.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-5000.o
iwlagn-$(CONFIG_IWL5000) += iwl-6000.o iwlagn-$(CONFIG_IWL5000) += iwl-6000.o
iwlagn-$(CONFIG_IWL5000) += iwl-1000.o iwlagn-$(CONFIG_IWL5000) += iwl-1000.o
......
...@@ -211,7 +211,13 @@ static struct iwl_lib_ops iwl1000_lib = { ...@@ -211,7 +211,13 @@ static struct iwl_lib_ops iwl1000_lib = {
.calib_version = iwlagn_eeprom_calib_version, .calib_version = iwlagn_eeprom_calib_version,
.query_addr = iwlagn_eeprom_query_addr, .query_addr = iwlagn_eeprom_query_addr,
}, },
.isr_ops = {
.isr = iwl_isr_ict, .isr = iwl_isr_ict,
.free = iwl_free_isr_ict,
.alloc = iwl_alloc_isr_ict,
.reset = iwl_reset_ict,
.disable = iwl_disable_ict,
},
.temp_ops = { .temp_ops = {
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}, },
......
...@@ -2727,7 +2727,9 @@ static struct iwl_lib_ops iwl3945_lib = { ...@@ -2727,7 +2727,9 @@ static struct iwl_lib_ops iwl3945_lib = {
}, },
.send_tx_power = iwl3945_send_tx_power, .send_tx_power = iwl3945_send_tx_power,
.is_valid_rtc_data_addr = iwl3945_hw_valid_rtc_data_addr, .is_valid_rtc_data_addr = iwl3945_hw_valid_rtc_data_addr,
.isr_ops = {
.isr = iwl_isr_legacy, .isr = iwl_isr_legacy,
},
.recover_from_tx_stall = iwl_bg_monitor_recover, .recover_from_tx_stall = iwl_bg_monitor_recover,
.check_plcp_health = iwl3945_good_plcp_health, .check_plcp_health = iwl3945_good_plcp_health,
......
...@@ -2561,7 +2561,9 @@ static struct iwl_lib_ops iwl4965_lib = { ...@@ -2561,7 +2561,9 @@ static struct iwl_lib_ops iwl4965_lib = {
}, },
.send_tx_power = iwl4965_send_tx_power, .send_tx_power = iwl4965_send_tx_power,
.update_chain_flags = iwl_update_chain_flags, .update_chain_flags = iwl_update_chain_flags,
.isr_ops = {
.isr = iwl_isr_legacy, .isr = iwl_isr_legacy,
},
.temp_ops = { .temp_ops = {
.temperature = iwl4965_temperature_calib, .temperature = iwl4965_temperature_calib,
}, },
......
...@@ -385,7 +385,13 @@ static struct iwl_lib_ops iwl5000_lib = { ...@@ -385,7 +385,13 @@ static struct iwl_lib_ops iwl5000_lib = {
.calib_version = iwlagn_eeprom_calib_version, .calib_version = iwlagn_eeprom_calib_version,
.query_addr = iwlagn_eeprom_query_addr, .query_addr = iwlagn_eeprom_query_addr,
}, },
.isr_ops = {
.isr = iwl_isr_ict, .isr = iwl_isr_ict,
.free = iwl_free_isr_ict,
.alloc = iwl_alloc_isr_ict,
.reset = iwl_reset_ict,
.disable = iwl_disable_ict,
},
.temp_ops = { .temp_ops = {
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}, },
...@@ -449,7 +455,13 @@ static struct iwl_lib_ops iwl5150_lib = { ...@@ -449,7 +455,13 @@ static struct iwl_lib_ops iwl5150_lib = {
.calib_version = iwlagn_eeprom_calib_version, .calib_version = iwlagn_eeprom_calib_version,
.query_addr = iwlagn_eeprom_query_addr, .query_addr = iwlagn_eeprom_query_addr,
}, },
.isr_ops = {
.isr = iwl_isr_ict, .isr = iwl_isr_ict,
.free = iwl_free_isr_ict,
.alloc = iwl_alloc_isr_ict,
.reset = iwl_reset_ict,
.disable = iwl_disable_ict,
},
.temp_ops = { .temp_ops = {
.temperature = iwl5150_temperature, .temperature = iwl5150_temperature,
}, },
......
...@@ -322,7 +322,13 @@ static struct iwl_lib_ops iwl6000_lib = { ...@@ -322,7 +322,13 @@ static struct iwl_lib_ops iwl6000_lib = {
.query_addr = iwlagn_eeprom_query_addr, .query_addr = iwlagn_eeprom_query_addr,
.update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower, .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
}, },
.isr_ops = {
.isr = iwl_isr_ict, .isr = iwl_isr_ict,
.free = iwl_free_isr_ict,
.alloc = iwl_alloc_isr_ict,
.reset = iwl_reset_ict,
.disable = iwl_disable_ict,
},
.temp_ops = { .temp_ops = {
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}, },
...@@ -389,7 +395,13 @@ static struct iwl_lib_ops iwl6000g2b_lib = { ...@@ -389,7 +395,13 @@ static struct iwl_lib_ops iwl6000g2b_lib = {
.query_addr = iwlagn_eeprom_query_addr, .query_addr = iwlagn_eeprom_query_addr,
.update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower, .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
}, },
.isr_ops = {
.isr = iwl_isr_ict, .isr = iwl_isr_ict,
.free = iwl_free_isr_ict,
.alloc = iwl_alloc_isr_ict,
.reset = iwl_reset_ict,
.disable = iwl_disable_ict,
},
.temp_ops = { .temp_ops = {
.temperature = iwlagn_temperature, .temperature = iwlagn_temperature,
}, },
......
...@@ -2815,7 +2815,8 @@ static void __iwl_down(struct iwl_priv *priv) ...@@ -2815,7 +2815,8 @@ static void __iwl_down(struct iwl_priv *priv)
STATUS_EXIT_PENDING; STATUS_EXIT_PENDING;
/* device going down, Stop using ICT table */ /* 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_txq_ctx_stop(priv);
iwlagn_rxq_stop(priv); iwlagn_rxq_stop(priv);
...@@ -3038,7 +3039,8 @@ static void iwl_bg_alive_start(struct work_struct *data) ...@@ -3038,7 +3039,8 @@ static void iwl_bg_alive_start(struct work_struct *data)
return; return;
/* enable dram interrupt */ /* 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); mutex_lock(&priv->mutex);
iwl_alive_start(priv); iwl_alive_start(priv);
...@@ -4172,8 +4174,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -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); pci_enable_msi(priv->pci_dev);
iwl_alloc_isr_ict(priv); if (priv->cfg->ops->lib->isr_ops.alloc)
err = request_irq(priv->pci_dev->irq, priv->cfg->ops->lib->isr, 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); IRQF_SHARED, DRV_NAME, priv);
if (err) { if (err) {
IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); 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) ...@@ -4220,7 +4224,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
destroy_workqueue(priv->workqueue); destroy_workqueue(priv->workqueue);
priv->workqueue = NULL; priv->workqueue = NULL;
free_irq(priv->pci_dev->irq, priv); 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: out_disable_msi:
pci_disable_msi(priv->pci_dev); pci_disable_msi(priv->pci_dev);
iwl_uninit_drv(priv); iwl_uninit_drv(priv);
...@@ -4315,7 +4320,8 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) ...@@ -4315,7 +4320,8 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
iwl_uninit_drv(priv); 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); dev_kfree_skb(priv->beacon_skb);
......
...@@ -120,6 +120,14 @@ struct iwl_apm_ops { ...@@ -120,6 +120,14 @@ struct iwl_apm_ops {
void (*config)(struct iwl_priv *priv); 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 { struct iwl_debugfs_ops {
ssize_t (*rx_stats_read)(struct file *file, char __user *user_buf, ssize_t (*rx_stats_read)(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos); size_t count, loff_t *ppos);
...@@ -193,7 +201,9 @@ struct iwl_lib_ops { ...@@ -193,7 +201,9 @@ struct iwl_lib_ops {
/* power */ /* power */
int (*send_tx_power) (struct iwl_priv *priv); int (*send_tx_power) (struct iwl_priv *priv);
void (*update_chain_flags)(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) */ /* eeprom operations (as defined in iwl-eeprom.h) */
struct iwl_eeprom_ops eeprom_ops; struct iwl_eeprom_ops eeprom_ops;
......
...@@ -4120,7 +4120,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e ...@@ -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); 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); IRQF_SHARED, DRV_NAME, priv);
if (err) { if (err) {
IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment