Commit e87e4371 authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: ipa: change ipa_interrupt_config() prototype

Change the return type of ipa_interrupt_config() to be an error
code rather than an IPA interrupt structure pointer, and assign the
the pointer within that function.

Change ipa_interrupt_deconfig() to take the IPA pointer as argument
and have it invalidate the ipa->interrupt pointer.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b78fcd0a
...@@ -236,7 +236,7 @@ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt) ...@@ -236,7 +236,7 @@ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt)
} }
/* Configure the IPA interrupt framework */ /* Configure the IPA interrupt framework */
struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) int ipa_interrupt_config(struct ipa *ipa)
{ {
struct device *dev = &ipa->pdev->dev; struct device *dev = &ipa->pdev->dev;
struct ipa_interrupt *interrupt; struct ipa_interrupt *interrupt;
...@@ -246,15 +246,14 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) ...@@ -246,15 +246,14 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa)
ret = platform_get_irq_byname(ipa->pdev, "ipa"); ret = platform_get_irq_byname(ipa->pdev, "ipa");
if (ret <= 0) { if (ret <= 0) {
dev_err(dev, "DT error %d getting \"ipa\" IRQ property\n", dev_err(dev, "DT error %d getting \"ipa\" IRQ property\n", ret);
ret); return ret ? : -EINVAL;
return ERR_PTR(ret ? : -EINVAL);
} }
irq = ret; irq = ret;
interrupt = kzalloc(sizeof(*interrupt), GFP_KERNEL); interrupt = kzalloc(sizeof(*interrupt), GFP_KERNEL);
if (!interrupt) if (!interrupt)
return ERR_PTR(-ENOMEM); return -ENOMEM;
interrupt->ipa = ipa; interrupt->ipa = ipa;
interrupt->irq = irq; interrupt->irq = irq;
...@@ -271,24 +270,30 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) ...@@ -271,24 +270,30 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa)
ret = dev_pm_set_wake_irq(dev, irq); ret = dev_pm_set_wake_irq(dev, irq);
if (ret) { if (ret) {
dev_err(dev, "error %d registering \"ipa\" IRQ as wakeirq\n", ret); dev_err(dev, "error %d registering \"ipa\" IRQ as wakeirq\n",
ret);
goto err_free_irq; goto err_free_irq;
} }
return interrupt; ipa->interrupt = interrupt;
return 0;
err_free_irq: err_free_irq:
free_irq(interrupt->irq, interrupt); free_irq(interrupt->irq, interrupt);
err_kfree: err_kfree:
kfree(interrupt); kfree(interrupt);
return ERR_PTR(ret); return ret;
} }
/* Inverse of ipa_interrupt_config() */ /* Inverse of ipa_interrupt_config() */
void ipa_interrupt_deconfig(struct ipa_interrupt *interrupt) void ipa_interrupt_deconfig(struct ipa *ipa)
{ {
struct device *dev = &interrupt->ipa->pdev->dev; struct ipa_interrupt *interrupt = ipa->interrupt;
struct device *dev = &ipa->pdev->dev;
ipa->interrupt = NULL;
dev_pm_clear_wake_irq(dev); dev_pm_clear_wake_irq(dev);
free_irq(interrupt->irq, interrupt); free_irq(interrupt->irq, interrupt);
......
...@@ -76,17 +76,17 @@ void ipa_interrupt_irq_enable(struct ipa *ipa); ...@@ -76,17 +76,17 @@ void ipa_interrupt_irq_enable(struct ipa *ipa);
void ipa_interrupt_irq_disable(struct ipa *ipa); void ipa_interrupt_irq_disable(struct ipa *ipa);
/** /**
* ipa_interrupt_config() - Configure the IPA interrupt framework * ipa_interrupt_config() - Configure IPA interrupts
* @ipa: IPA pointer * @ipa: IPA pointer
* *
* Return: Pointer to IPA SMP2P info, or a pointer-coded error * Return: 0 if successful, or a negative error code
*/ */
struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa); int ipa_interrupt_config(struct ipa *ipa);
/** /**
* ipa_interrupt_deconfig() - Inverse of ipa_interrupt_config() * ipa_interrupt_deconfig() - Inverse of ipa_interrupt_config()
* @interrupt: IPA interrupt structure * @ipa: IPA pointer
*/ */
void ipa_interrupt_deconfig(struct ipa_interrupt *interrupt); void ipa_interrupt_deconfig(struct ipa *ipa);
#endif /* _IPA_INTERRUPT_H_ */ #endif /* _IPA_INTERRUPT_H_ */
...@@ -542,12 +542,9 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) ...@@ -542,12 +542,9 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data)
if (ret) if (ret)
goto err_hardware_deconfig; goto err_hardware_deconfig;
ipa->interrupt = ipa_interrupt_config(ipa); ret = ipa_interrupt_config(ipa);
if (IS_ERR(ipa->interrupt)) { if (ret)
ret = PTR_ERR(ipa->interrupt);
ipa->interrupt = NULL;
goto err_mem_deconfig; goto err_mem_deconfig;
}
ipa_uc_config(ipa); ipa_uc_config(ipa);
...@@ -572,8 +569,7 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) ...@@ -572,8 +569,7 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data)
ipa_endpoint_deconfig(ipa); ipa_endpoint_deconfig(ipa);
err_uc_deconfig: err_uc_deconfig:
ipa_uc_deconfig(ipa); ipa_uc_deconfig(ipa);
ipa_interrupt_deconfig(ipa->interrupt); ipa_interrupt_deconfig(ipa);
ipa->interrupt = NULL;
err_mem_deconfig: err_mem_deconfig:
ipa_mem_deconfig(ipa); ipa_mem_deconfig(ipa);
err_hardware_deconfig: err_hardware_deconfig:
...@@ -591,8 +587,7 @@ static void ipa_deconfig(struct ipa *ipa) ...@@ -591,8 +587,7 @@ static void ipa_deconfig(struct ipa *ipa)
ipa_modem_deconfig(ipa); ipa_modem_deconfig(ipa);
ipa_endpoint_deconfig(ipa); ipa_endpoint_deconfig(ipa);
ipa_uc_deconfig(ipa); ipa_uc_deconfig(ipa);
ipa_interrupt_deconfig(ipa->interrupt); ipa_interrupt_deconfig(ipa);
ipa->interrupt = NULL;
ipa_mem_deconfig(ipa); ipa_mem_deconfig(ipa);
ipa_hardware_deconfig(ipa); ipa_hardware_deconfig(ipa);
} }
......
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