Commit 08321c06 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Wey-Yi Guy

iwlagn: add a get_irq method to iwl_bus_ops and use it

In order to remove a few more dereference to priv->pdev that will be killed
[Asoon, there is now a method to get the IRQ number.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 85aed7c4
...@@ -3610,10 +3610,11 @@ int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops, ...@@ -3610,10 +3610,11 @@ int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops,
********************/ ********************/
iwl_alloc_isr_ict(priv); iwl_alloc_isr_ict(priv);
err = request_irq(priv->pci_dev->irq, iwl_isr_ict, err = request_irq(priv->bus.ops->get_irq(&priv->bus), iwl_isr_ict,
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->bus.ops->get_irq(&priv->bus));
goto out_uninit_drv; goto out_uninit_drv;
} }
...@@ -3650,7 +3651,7 @@ int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops, ...@@ -3650,7 +3651,7 @@ int iwl_probe(void *bus_specific, struct iwl_bus_ops *bus_ops,
out_destroy_workqueue: out_destroy_workqueue:
destroy_workqueue(priv->workqueue); destroy_workqueue(priv->workqueue);
priv->workqueue = NULL; priv->workqueue = NULL;
free_irq(priv->pci_dev->irq, priv); free_irq(priv->bus.ops->get_irq(&priv->bus), priv);
iwl_free_isr_ict(priv); iwl_free_isr_ict(priv);
out_uninit_drv: out_uninit_drv:
iwl_uninit_drv(priv); iwl_uninit_drv(priv);
...@@ -3722,7 +3723,7 @@ void __devexit iwl_remove(struct iwl_priv * priv) ...@@ -3722,7 +3723,7 @@ void __devexit iwl_remove(struct iwl_priv * priv)
priv->workqueue = NULL; priv->workqueue = NULL;
iwl_free_traffic_mem(priv); iwl_free_traffic_mem(priv);
free_irq(priv->pci_dev->irq, priv); free_irq(priv->bus.ops->get_irq(&priv->bus), priv);
priv->bus.ops->set_drv_data(&priv->bus, NULL); priv->bus.ops->set_drv_data(&priv->bus, NULL);
iwl_uninit_drv(priv); iwl_uninit_drv(priv);
......
...@@ -125,7 +125,7 @@ irqreturn_t iwl_isr_ict(int irq, void *data); ...@@ -125,7 +125,7 @@ irqreturn_t iwl_isr_ict(int irq, void *data);
static inline void iwl_synchronize_irq(struct iwl_priv *priv) static inline void iwl_synchronize_irq(struct iwl_priv *priv)
{ {
/* wait to make sure we flush pending tasklet*/ /* wait to make sure we flush pending tasklet*/
synchronize_irq(priv->pci_dev->irq); synchronize_irq(priv->bus.ops->get_irq(&priv->bus));
tasklet_kill(&priv->irq_tasklet); tasklet_kill(&priv->irq_tasklet);
} }
......
...@@ -1198,6 +1198,7 @@ struct iwl_bus; ...@@ -1198,6 +1198,7 @@ struct iwl_bus;
* @apm_config: will be called during the config of the APM configuration * @apm_config: will be called during the config of the APM configuration
* @set_drv_data: set the priv pointer to the bus layer * @set_drv_data: set the priv pointer to the bus layer
* @get_dev: returns the device struct * @get_dev: returns the device struct
* @get_irq: returns the irq number
* @get_hw_id: prints the hw_id in the provided buffer * @get_hw_id: prints the hw_id in the provided buffer
* @write8: write a byte to register at offset ofs * @write8: write a byte to register at offset ofs
* @write32: write a dword to register at offset ofs * @write32: write a dword to register at offset ofs
...@@ -1208,6 +1209,7 @@ struct iwl_bus_ops { ...@@ -1208,6 +1209,7 @@ struct iwl_bus_ops {
void (*apm_config)(struct iwl_bus *bus); void (*apm_config)(struct iwl_bus *bus);
void (*set_drv_data)(struct iwl_bus *bus, void *priv); void (*set_drv_data)(struct iwl_bus *bus, void *priv);
struct device *(*get_dev)(const struct iwl_bus *bus); struct device *(*get_dev)(const struct iwl_bus *bus);
unsigned int (*get_irq)(const struct iwl_bus *bus);
void (*get_hw_id)(struct iwl_bus *bus, char buf[], int buf_len); void (*get_hw_id)(struct iwl_bus *bus, char buf[], int buf_len);
void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val); void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val);
void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val); void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val);
......
...@@ -141,6 +141,11 @@ static struct device *iwl_pci_get_dev(const struct iwl_bus *bus) ...@@ -141,6 +141,11 @@ static struct device *iwl_pci_get_dev(const struct iwl_bus *bus)
return &(IWL_BUS_GET_PCI_DEV(bus)->dev); return &(IWL_BUS_GET_PCI_DEV(bus)->dev);
} }
static unsigned int iwl_pci_get_irq(const struct iwl_bus *bus)
{
return IWL_BUS_GET_PCI_DEV(bus)->irq;
}
static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[], static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[],
int buf_len) int buf_len)
{ {
...@@ -171,6 +176,7 @@ static struct iwl_bus_ops pci_ops = { ...@@ -171,6 +176,7 @@ static struct iwl_bus_ops pci_ops = {
.apm_config = iwl_pci_apm_config, .apm_config = iwl_pci_apm_config,
.set_drv_data = iwl_pci_set_drv_data, .set_drv_data = iwl_pci_set_drv_data,
.get_dev = iwl_pci_get_dev, .get_dev = iwl_pci_get_dev,
.get_irq = iwl_pci_get_irq,
.get_hw_id = iwl_pci_get_hw_id, .get_hw_id = iwl_pci_get_hw_id,
.write8 = iwl_pci_write8, .write8 = iwl_pci_write8,
.write32 = iwl_pci_write32, .write32 = iwl_pci_write32,
......
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