* [PATCH 0/2] iio: adc: Modernize legacy regulator calls in drivers
@ 2025-04-29 16:05 Cesar Bispo
2025-04-29 16:05 ` [PATCH 1/2] iio: adc: ad7476: modernize single regulator call Cesar Bispo
2025-04-29 16:05 ` [PATCH 2/2] iio: adc: qcom-pm8xxx-xoadc: " Cesar Bispo
0 siblings, 2 replies; 5+ messages in thread
From: Cesar Bispo @ 2025-04-29 16:05 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, Cesar Bispo, GabrIel Ferreira
Replace a single instance of legacy regulator handling in each driver
with devm_regulator_get_enable() or devm_regulator_get_enable_optional().
This change improves code clarity and aligns with modern kernel APIs.
Signed-off-by: Cesar Bispo <cesar.bispo@ime.usp.br>
Co-developed-by: GabrIel Ferreira <gabrielfsouza.araujo@usp.br>
Signed-off-by: GabrIel Ferreira <gabrielfsouza.araujo@usp.br>
Cesar Bispo (2):
iio: adc: ad7476: modernize single regulator call
iio: adc: qcom-pm8xxx-xoadc: modernize single regulator call
drivers/iio/adc/ad7476.c | 6 +++---
drivers/iio/adc/qcom-pm8xxx-xoadc.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] iio: adc: ad7476: modernize single regulator call
2025-04-29 16:05 [PATCH 0/2] iio: adc: Modernize legacy regulator calls in drivers Cesar Bispo
@ 2025-04-29 16:05 ` Cesar Bispo
2025-04-29 17:37 ` Jonathan Cameron
2025-04-29 16:05 ` [PATCH 2/2] iio: adc: qcom-pm8xxx-xoadc: " Cesar Bispo
1 sibling, 1 reply; 5+ messages in thread
From: Cesar Bispo @ 2025-04-29 16:05 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, Cesar Bispo, GabrIel Ferreira
Replace a single instance of legacy regulator handling in each driver
with devm_regulator_get_enable() and devm_regulator_get_enable_optional().
This change improves code clarity and aligns with modern kernel APIs.
Signed-off-by: Cesar Bispo <cesar.bispo@ime.usp.br>
Co-developed-by: GabrIel Ferreira <gabrielfsouza.araujo@usp.br>
Signed-off-by: GabrIel Ferreira <gabrielfsouza.araujo@usp.br>
---
drivers/iio/adc/ad7476.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index 37b0515cf4fc..33155f76230e 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -314,7 +314,7 @@ static int ad7476_probe(struct spi_device *spi)
st->chip_info =
&ad7476_chip_info_tbl[spi_get_device_id(spi)->driver_data];
- reg = devm_regulator_get(&spi->dev, "vcc");
+ reg = devm_regulator_get_enable(&spi->dev, "vcc");
if (IS_ERR(reg))
return PTR_ERR(reg);
@@ -334,11 +334,11 @@ static int ad7476_probe(struct spi_device *spi)
/* If a device has an internal reference vref is optional */
if (st->chip_info->int_vref_uv) {
- reg = devm_regulator_get_optional(&spi->dev, "vref");
+ reg = devm_regulator_get_enable_optional(&spi->dev, "vref");
if (IS_ERR(reg) && (PTR_ERR(reg) != -ENODEV))
return PTR_ERR(reg);
} else {
- reg = devm_regulator_get(&spi->dev, "vref");
+ reg = devm_regulator_get_enable(&spi->dev, "vref");
if (IS_ERR(reg))
return PTR_ERR(reg);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] iio: adc: ad7476: modernize single regulator call
2025-04-29 16:05 ` [PATCH 1/2] iio: adc: ad7476: modernize single regulator call Cesar Bispo
@ 2025-04-29 17:37 ` Jonathan Cameron
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2025-04-29 17:37 UTC (permalink / raw)
To: Cesar Bispo; +Cc: linux-iio, Cesar Bispo, GabrIel Ferreira
On Tue, 29 Apr 2025 13:05:18 -0300
Cesar Bispo <dm.cesaraugusto@gmail.com> wrote:
> Replace a single instance of legacy regulator handling in each driver
> with devm_regulator_get_enable() and devm_regulator_get_enable_optional().
> This change improves code clarity and aligns with modern kernel APIs.
>
> Signed-off-by: Cesar Bispo <cesar.bispo@ime.usp.br>
> Co-developed-by: GabrIel Ferreira <gabrielfsouza.araujo@usp.br>
> Signed-off-by: GabrIel Ferreira <gabrielfsouza.araujo@usp.br>
Take a closer look at the signatures of these functions.
I'm a bit surprised if this builds.
> ---
> drivers/iio/adc/ad7476.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
> index 37b0515cf4fc..33155f76230e 100644
> --- a/drivers/iio/adc/ad7476.c
> +++ b/drivers/iio/adc/ad7476.c
> @@ -314,7 +314,7 @@ static int ad7476_probe(struct spi_device *spi)
> st->chip_info =
> &ad7476_chip_info_tbl[spi_get_device_id(spi)->driver_data];
>
> - reg = devm_regulator_get(&spi->dev, "vcc");
> + reg = devm_regulator_get_enable(&spi->dev, "vcc");
> if (IS_ERR(reg))
> return PTR_ERR(reg);
>
> @@ -334,11 +334,11 @@ static int ad7476_probe(struct spi_device *spi)
>
> /* If a device has an internal reference vref is optional */
> if (st->chip_info->int_vref_uv) {
> - reg = devm_regulator_get_optional(&spi->dev, "vref");
> + reg = devm_regulator_get_enable_optional(&spi->dev, "vref");
> if (IS_ERR(reg) && (PTR_ERR(reg) != -ENODEV))
> return PTR_ERR(reg);
> } else {
> - reg = devm_regulator_get(&spi->dev, "vref");
> + reg = devm_regulator_get_enable(&spi->dev, "vref");
> if (IS_ERR(reg))
> return PTR_ERR(reg);
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] iio: adc: qcom-pm8xxx-xoadc: modernize single regulator call
2025-04-29 16:05 [PATCH 0/2] iio: adc: Modernize legacy regulator calls in drivers Cesar Bispo
2025-04-29 16:05 ` [PATCH 1/2] iio: adc: ad7476: modernize single regulator call Cesar Bispo
@ 2025-04-29 16:05 ` Cesar Bispo
2025-04-29 17:38 ` Jonathan Cameron
1 sibling, 1 reply; 5+ messages in thread
From: Cesar Bispo @ 2025-04-29 16:05 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, Cesar Bispo, GabrIel Ferreira
Replace a single instance of legacy regulator handling in each driver
with devm_regulator_get_enable().
This change improves code clarity and aligns with modern kernel APIs.
Signed-off-by: Cesar Bispo <cesar.bispo@ime.usp.br>
Co-developed-by: GabrIel Ferreira <gabrielfsouza.araujo@usp.br>
Signed-off-by: GabrIel Ferreira <gabrielfsouza.araujo@usp.br>
---
drivers/iio/adc/qcom-pm8xxx-xoadc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
index 31f88cf7f7f1..c99d6acac059 100644
--- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
+++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
@@ -911,7 +911,7 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
adc->map = map;
/* Bring up regulator */
- adc->vref = devm_regulator_get(dev, "xoadc-ref");
+ adc->vref = devm_regulator_get_enable(dev, "xoadc-ref");
if (IS_ERR(adc->vref))
return dev_err_probe(dev, PTR_ERR(adc->vref),
"failed to get XOADC VREF regulator\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] iio: adc: qcom-pm8xxx-xoadc: modernize single regulator call
2025-04-29 16:05 ` [PATCH 2/2] iio: adc: qcom-pm8xxx-xoadc: " Cesar Bispo
@ 2025-04-29 17:38 ` Jonathan Cameron
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2025-04-29 17:38 UTC (permalink / raw)
To: Cesar Bispo; +Cc: linux-iio, Cesar Bispo, GabrIel Ferreira
On Tue, 29 Apr 2025 13:05:19 -0300
Cesar Bispo <dm.cesaraugusto@gmail.com> wrote:
> Replace a single instance of legacy regulator handling in each driver
> with devm_regulator_get_enable().
> This change improves code clarity and aligns with modern kernel APIs.
>
> Signed-off-by: Cesar Bispo <cesar.bispo@ime.usp.br>
> Co-developed-by: GabrIel Ferreira <gabrielfsouza.araujo@usp.br>
> Signed-off-by: GabrIel Ferreira <gabrielfsouza.araujo@usp.br>
As in previous, this should at the very least give a warning...
> ---
> drivers/iio/adc/qcom-pm8xxx-xoadc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> index 31f88cf7f7f1..c99d6acac059 100644
> --- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> +++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> @@ -911,7 +911,7 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
> adc->map = map;
>
> /* Bring up regulator */
> - adc->vref = devm_regulator_get(dev, "xoadc-ref");
> + adc->vref = devm_regulator_get_enable(dev, "xoadc-ref");
This doesn't return a pointer....
> if (IS_ERR(adc->vref))
> return dev_err_probe(dev, PTR_ERR(adc->vref),
> "failed to get XOADC VREF regulator\n");
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-29 17:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 16:05 [PATCH 0/2] iio: adc: Modernize legacy regulator calls in drivers Cesar Bispo
2025-04-29 16:05 ` [PATCH 1/2] iio: adc: ad7476: modernize single regulator call Cesar Bispo
2025-04-29 17:37 ` Jonathan Cameron
2025-04-29 16:05 ` [PATCH 2/2] iio: adc: qcom-pm8xxx-xoadc: " Cesar Bispo
2025-04-29 17:38 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox