iio: adc: sun20i-gpadc: Use devm_reset_control_get_exclusive_deasserted() in sun20i_gpadc_probe()
Subsystems (3)
PATCH 1/1 iio: adc: sun20i-gpadc: Use devm_reset_control_get_exclusive_deasserted() in sun20i_gpadc_probe()
From: Markus Elfring <[email protected]>
Date: Sat, 14 Nov 2026 17:55:16 +0100
Use devm_reset_control_get_exclusive_deasserted() to replace the explicit reset acquisition, deassertion, and cleanup action registered with devm_add_action_or_reset().
Simplify reset handling and remove the custom reset assertion callback while preserving reset assertion during cleanup.
The source code was transformed by using the Coccinelle software.
--- drivers/iio/adc/sun20i-gpadc-iio.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)
drivers/iio/adc/sun20i-gpadc-iio.c +3 -17
@@ -157,13 +157,6 @@ static const struct iio_info sun20i_gpadc_iio_info = { .fwnode_xlate = sun20i_gpadc_fwnode_xlate, }; -static void sun20i_gpadc_reset_assert (void *data) -{ -struct reset_control *rst = data; - -reset_control_assert (rst); -} -static const struct iio_chan_spec sun20i_gpadc_chan_template = { .type =IIO_VOLTAGE , .indexed =1 ,
@@ -225,17 +218,10 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)if (ret ==0 )return dev_err_probe (dev, -ENODEV ,"needs at least one clocks\n" ); - rst =devm_reset_control_get_exclusive (dev,NULL ); + rst =devm_reset_control_get_exclusive_deasserted (dev,NULL );if (IS_ERR (rst)) -return dev_err_probe (dev,PTR_ERR (rst),"failed to get reset control\n" ); - - ret =reset_control_deassert (rst); -if (ret) -return dev_err_probe (dev, ret,"failed to deassert reset\n" ); - - ret =devm_add_action_or_reset (dev, sun20i_gpadc_reset_assert, rst); -if (ret) -return ret; +return dev_err_probe (dev,PTR_ERR (rst), +"failed to get and deassert reset\n" ); irq =platform_get_irq (pdev,0 );if (irq <0 )
Signature · 1 line
2.56.0
Dne sobota, 14. november 2026 ob 18:08:10 Srednjeevropski standardni čas je Markus Elfring napisal(a):
Quoted 9 lines
From: Markus Elfring <[email protected]>
Date: Sat, 14 Nov 2026 17:55:16 +0100Use
devm_reset_control_get_exclusive_deasserted()to replace the explicit reset acquisition, deassertion, and cleanup action registered withdevm_add_action_or_reset().
Simplify reset handling and remove the custom reset assertion callback while preserving reset assertion during cleanup.
Quoted 3 lines
The source code was transformed by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
Best regards,
Jernej
Quoted 44 lines
--- drivers/iio/adc/sun20i-gpadc-iio.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)drivers/iio/adc/sun20i-gpadc-iio.c +3
-17@@ -157,13 +157,6 @@ static const struct iio_info sun20i_gpadc_iio_info = { .fwnode_xlate = sun20i_gpadc_fwnode_xlate, }; -static void sun20i_gpadc_reset_assert (void *data) -{ -struct reset_control *rst = data; - -reset_control_assert (rst); -} -static const struct iio_chan_spec sun20i_gpadc_chan_template = { .type =IIO_VOLTAGE , .indexed =1 ,@@ -225,17 +218,10 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)if (ret ==0 )return dev_err_probe (dev, -ENODEV ,"needs at least one clocks\n" ); - rst =devm_reset_control_get_exclusive (dev,NULL ); + rst =devm_reset_control_get_exclusive_deasserted (dev,NULL );if (IS_ERR (rst)) -return dev_err_probe (dev,PTR_ERR (rst),"failed to get reset control\n" ); - - ret =reset_control_deassert (rst); -if (ret) -return dev_err_probe (dev, ret,"failed to deassert reset\n" ); - - ret =devm_add_action_or_reset (dev, sun20i_gpadc_reset_assert, rst); -if (ret) -return ret; +return dev_err_probe (dev,PTR_ERR (rst), +"failed to get and deassert reset\n" ); irq =platform_get_irq (pdev,0 );if (irq <0 )
Jonathan Cameron
maintainerQuoted 10 lines · On Sat, 14 Nov 2026 18:19:12 +0100 Jernej Škrabec <[email protected]>…
Dne sobota, 14. november 2026 ob 18:08:10 Srednjeevropski standardni čas je Markus Elfring napisal(a):
Quoted 9 lines
From: Markus Elfring <[email protected]>
Date: Sat, 14 Nov 2026 17:55:16 +0100Use
devm_reset_control_get_exclusive_deasserted()to replace the explicit reset acquisition, deassertion, and cleanup action registered withdevm_add_action_or_reset().
Simplify reset handling and remove the custom reset assertion callback while preserving reset assertion during cleanup.
Quoted 6 lines
Quoted 3 lines
The source code was transformed by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>Acked-by Jernej Skrabec <[email protected]>
Like for like swap as far as I can tell, so applied to the testing branch of iio.git
Thanks,
Jonathan
Quoted 51 lines
Best regards,
JernejQuoted 44 lines
--- drivers/iio/adc/sun20i-gpadc-iio.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)drivers/iio/adc/sun20i-gpadc-iio.c +3
-17@@ -157,13 +157,6 @@ static const struct iio_info sun20i_gpadc_iio_info = { .fwnode_xlate = sun20i_gpadc_fwnode_xlate, }; -static void sun20i_gpadc_reset_assert (void *data) -{ -struct reset_control *rst = data; - -reset_control_assert (rst); -} -static const struct iio_chan_spec sun20i_gpadc_chan_template = { .type =IIO_VOLTAGE , .indexed =1 ,@@ -225,17 +218,10 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)if (ret ==0 )return dev_err_probe (dev, -ENODEV ,"needs at least one clocks\n" ); - rst =devm_reset_control_get_exclusive (dev,NULL ); + rst =devm_reset_control_get_exclusive_deasserted (dev,NULL );if (IS_ERR (rst)) -return dev_err_probe (dev,PTR_ERR (rst),"failed to get reset control\n" ); - - ret =reset_control_deassert (rst); -if (ret) -return dev_err_probe (dev, ret,"failed to deassert reset\n" ); - - ret =devm_add_action_or_reset (dev, sun20i_gpadc_reset_assert, rst); -if (ret) -return ret; +return dev_err_probe (dev,PTR_ERR (rst), +"failed to get and deassert reset\n" ); irq =platform_get_irq (pdev,0 );if (irq <0 )