* [PATCH v2] mfd: ab8500-gpadc: Complain if we fail to enable vtvout LDO
@ 2013-03-09 9:46 Axel Lin
2013-03-13 8:39 ` Samuel Ortiz
2013-03-21 14:55 ` Lee Jones
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2013-03-09 9:46 UTC (permalink / raw)
To: linux-arm-kernel
Since commit c8801a8e
"regulator: core: Mark all get and enable calls as __must_check",
we must check return value of regulator_enable() to silence below build warning.
CC drivers/mfd/ab8500-gpadc.o
drivers/mfd/ab8500-gpadc.c: In function 'ab8500_gpadc_runtime_resume':
drivers/mfd/ab8500-gpadc.c:598:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
drivers/mfd/ab8500-gpadc.c: In function 'ab8500_gpadc_probe':
drivers/mfd/ab8500-gpadc.c:655:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
Also convert to devm_regulator_get(), this fixes a missing regulator_put() call
in ab8500_gpadc_remove().
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
v2:
In the case of goto fail_enable, we should call regulator_put instead of
regulator_disable. However, the regulator_put call is also missed in
ab8500_gpadc_remove(). Thus a simpler fix is to convert regulator_get to
devm_regulator_get.
drivers/mfd/ab8500-gpadc.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c
index b1f3561..5f341a5 100644
--- a/drivers/mfd/ab8500-gpadc.c
+++ b/drivers/mfd/ab8500-gpadc.c
@@ -594,9 +594,12 @@ static int ab8500_gpadc_runtime_suspend(struct device *dev)
static int ab8500_gpadc_runtime_resume(struct device *dev)
{
struct ab8500_gpadc *gpadc = dev_get_drvdata(dev);
+ int ret;
- regulator_enable(gpadc->regu);
- return 0;
+ ret = regulator_enable(gpadc->regu);
+ if (ret)
+ dev_err(dev, "Failed to enable vtvout LDO: %d\n", ret);
+ return ret;
}
static int ab8500_gpadc_runtime_idle(struct device *dev)
@@ -643,7 +646,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
}
/* VTVout LDO used to power up ab8500-GPADC */
- gpadc->regu = regulator_get(&pdev->dev, "vddadc");
+ gpadc->regu = devm_regulator_get(&pdev->dev, "vddadc");
if (IS_ERR(gpadc->regu)) {
ret = PTR_ERR(gpadc->regu);
dev_err(gpadc->dev, "failed to get vtvout LDO\n");
@@ -652,7 +655,11 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, gpadc);
- regulator_enable(gpadc->regu);
+ ret = regulator_enable(gpadc->regu);
+ if (ret) {
+ dev_err(gpadc->dev, "Failed to enable vtvout LDO: %d\n", ret);
+ goto fail_enable;
+ }
pm_runtime_set_autosuspend_delay(gpadc->dev, GPADC_AUDOSUSPEND_DELAY);
pm_runtime_use_autosuspend(gpadc->dev);
@@ -663,6 +670,8 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
list_add_tail(&gpadc->node, &ab8500_gpadc_list);
dev_dbg(gpadc->dev, "probe success\n");
return 0;
+
+fail_enable:
fail_irq:
free_irq(gpadc->irq, gpadc);
fail:
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2] mfd: ab8500-gpadc: Complain if we fail to enable vtvout LDO
2013-03-09 9:46 [PATCH v2] mfd: ab8500-gpadc: Complain if we fail to enable vtvout LDO Axel Lin
@ 2013-03-13 8:39 ` Samuel Ortiz
2013-03-21 14:55 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Samuel Ortiz @ 2013-03-13 8:39 UTC (permalink / raw)
To: linux-arm-kernel
Hi Axel,
On Sat, Mar 09, 2013 at 05:46:45PM +0800, Axel Lin wrote:
> Since commit c8801a8e
> "regulator: core: Mark all get and enable calls as __must_check",
> we must check return value of regulator_enable() to silence below build warning.
>
> CC drivers/mfd/ab8500-gpadc.o
> drivers/mfd/ab8500-gpadc.c: In function 'ab8500_gpadc_runtime_resume':
> drivers/mfd/ab8500-gpadc.c:598:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
> drivers/mfd/ab8500-gpadc.c: In function 'ab8500_gpadc_probe':
> drivers/mfd/ab8500-gpadc.c:655:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
>
> Also convert to devm_regulator_get(), this fixes a missing regulator_put() call
> in ab8500_gpadc_remove().
This is on the edge of a patch split for 2 separate fixes, but I applied it
anyway.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] mfd: ab8500-gpadc: Complain if we fail to enable vtvout LDO
2013-03-09 9:46 [PATCH v2] mfd: ab8500-gpadc: Complain if we fail to enable vtvout LDO Axel Lin
2013-03-13 8:39 ` Samuel Ortiz
@ 2013-03-21 14:55 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2013-03-21 14:55 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, 09 Mar 2013, Axel Lin wrote:
> Since commit c8801a8e
> "regulator: core: Mark all get and enable calls as __must_check",
> we must check return value of regulator_enable() to silence below build warning.
>
> CC drivers/mfd/ab8500-gpadc.o
> drivers/mfd/ab8500-gpadc.c: In function 'ab8500_gpadc_runtime_resume':
> drivers/mfd/ab8500-gpadc.c:598:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
> drivers/mfd/ab8500-gpadc.c: In function 'ab8500_gpadc_probe':
> drivers/mfd/ab8500-gpadc.c:655:18: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result [-Wunused-result]
>
> Also convert to devm_regulator_get(), this fixes a missing regulator_put() call
> in ab8500_gpadc_remove().
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> v2:
> In the case of goto fail_enable, we should call regulator_put instead of
> regulator_disable. However, the regulator_put call is also missed in
> ab8500_gpadc_remove(). Thus a simpler fix is to convert regulator_get to
> devm_regulator_get.
>
> drivers/mfd/ab8500-gpadc.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c
> index b1f3561..5f341a5 100644
> --- a/drivers/mfd/ab8500-gpadc.c
> +++ b/drivers/mfd/ab8500-gpadc.c
> @@ -594,9 +594,12 @@ static int ab8500_gpadc_runtime_suspend(struct device *dev)
> static int ab8500_gpadc_runtime_resume(struct device *dev)
> {
> struct ab8500_gpadc *gpadc = dev_get_drvdata(dev);
> + int ret;
>
> - regulator_enable(gpadc->regu);
> - return 0;
> + ret = regulator_enable(gpadc->regu);
> + if (ret)
> + dev_err(dev, "Failed to enable vtvout LDO: %d\n", ret);
> + return ret;
> }
>
> static int ab8500_gpadc_runtime_idle(struct device *dev)
> @@ -643,7 +646,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
> }
>
> /* VTVout LDO used to power up ab8500-GPADC */
> - gpadc->regu = regulator_get(&pdev->dev, "vddadc");
> + gpadc->regu = devm_regulator_get(&pdev->dev, "vddadc");
> if (IS_ERR(gpadc->regu)) {
> ret = PTR_ERR(gpadc->regu);
> dev_err(gpadc->dev, "failed to get vtvout LDO\n");
> @@ -652,7 +655,11 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, gpadc);
>
> - regulator_enable(gpadc->regu);
> + ret = regulator_enable(gpadc->regu);
> + if (ret) {
> + dev_err(gpadc->dev, "Failed to enable vtvout LDO: %d\n", ret);
> + goto fail_enable;
> + }
>
> pm_runtime_set_autosuspend_delay(gpadc->dev, GPADC_AUDOSUSPEND_DELAY);
> pm_runtime_use_autosuspend(gpadc->dev);
> @@ -663,6 +670,8 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
> list_add_tail(&gpadc->node, &ab8500_gpadc_list);
> dev_dbg(gpadc->dev, "probe success\n");
> return 0;
> +
> +fail_enable:
> fail_irq:
> free_irq(gpadc->irq, gpadc);
> fail:
Actually I think this is the opposite of what we want.
Please see: https://patchwork.kernel.org/patch/2147571/
I can't get hold of Jonas to ask him yet, as he is on parental leave.
--
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-21 14:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-09 9:46 [PATCH v2] mfd: ab8500-gpadc: Complain if we fail to enable vtvout LDO Axel Lin
2013-03-13 8:39 ` Samuel Ortiz
2013-03-21 14:55 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).