* [PATCH v2] iio: adc: Modernize single regulator call
@ 2025-05-14 18:52 Gabriel Souza Araujo
2025-05-15 17:17 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Gabriel Souza Araujo @ 2025-05-14 18:52 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, Gabriel Souza Araujo, Cesar Bispo
Replace a single instance of legacy regulator with devm_regulator_get_enable().
This change improves code clarity and aligns with modern kernel APIs.
Signed-off-by: Gabriel Souza Araujo <gabrielfsouza.araujo@gmail.com>
Co-developed-by: Cesar Bispo <cesar.bispo@ime.usp.br>
Signed-off-by: Cesar Bispo <cesar.bispo@ime.usp.br>
---
The first version [1] did not compile due to incorrect use of pointers and improper
parameterization of the devm_regulator_get_enable() function.
These issues have been fixed, and the code now compiles successfully.
[1] https://lore.kernel.org/linux-iio/20250429160526.5934-1-cesar.bispo@ime.usp.br/
drivers/iio/adc/qcom-pm8xxx-xoadc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
index 226285992..8b2e798d0 100644
--- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
+++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
@@ -923,7 +923,7 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
pm8xxx_eoc_irq, NULL, 0, variant->name, indio_dev);
if (ret) {
dev_err(dev, "unable to request IRQ\n");
- goto out_disable_vref;
+ return ret;
}
indio_dev->name = variant->name;
@@ -934,7 +934,7 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
ret = iio_device_register(indio_dev);
if (ret)
- goto out_disable_vref;
+ return ret;
ret = pm8xxx_calibrate_device(adc);
if (ret)
@@ -946,8 +946,6 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
out_unreg_device:
iio_device_unregister(indio_dev);
-out_disable_vref:
- regulator_disable(adc->vref);
return ret;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2] iio: adc: Modernize single regulator call
2025-05-14 18:52 [PATCH v2] iio: adc: Modernize single regulator call Gabriel Souza Araujo
@ 2025-05-15 17:17 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2025-05-15 17:17 UTC (permalink / raw)
To: Gabriel Souza Araujo; +Cc: linux-iio, Cesar Bispo
On Wed, 14 May 2025 15:52:20 -0300
Gabriel Souza Araujo <gabrielfsouza.araujo@gmail.com> wrote:
> Replace a single instance of legacy regulator with devm_regulator_get_enable().
> This change improves code clarity and aligns with modern kernel APIs.
This description does not match the patch.
>
> Signed-off-by: Gabriel Souza Araujo <gabrielfsouza.araujo@gmail.com>
> Co-developed-by: Cesar Bispo <cesar.bispo@ime.usp.br>
> Signed-off-by: Cesar Bispo <cesar.bispo@ime.usp.br>
> ---
> The first version [1] did not compile due to incorrect use of pointers and improper
> parameterization of the devm_regulator_get_enable() function.
> These issues have been fixed, and the code now compiles successfully.
>
> [1] https://lore.kernel.org/linux-iio/20250429160526.5934-1-cesar.bispo@ime.usp.br/
>
> drivers/iio/adc/qcom-pm8xxx-xoadc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> index 226285992..8b2e798d0 100644
> --- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> +++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> @@ -923,7 +923,7 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
> pm8xxx_eoc_irq, NULL, 0, variant->name, indio_dev);
> if (ret) {
> dev_err(dev, "unable to request IRQ\n");
> - goto out_disable_vref;
> + return ret;
> }
>
> indio_dev->name = variant->name;
> @@ -934,7 +934,7 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
>
> ret = iio_device_register(indio_dev);
> if (ret)
> - goto out_disable_vref;
> + return ret;
>
> ret = pm8xxx_calibrate_device(adc);
> if (ret)
> @@ -946,8 +946,6 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
>
> out_unreg_device:
> iio_device_unregister(indio_dev);
> -out_disable_vref:
> - regulator_disable(adc->vref);
>
> return ret;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-15 17:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-14 18:52 [PATCH v2] iio: adc: Modernize single regulator call Gabriel Souza Araujo
2025-05-15 17:17 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox