Message ID | 20241206111337.726244-4-claudiu.beznea.uj@bp.renesas.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | iio: adc: rzg2l_adc: Add support for RZ/G3S | expand |
On Fri, 6 Dec 2024 13:13:25 +0200 Claudiu <claudiu.beznea@tuxon.dev> wrote: > From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > Starting with commit d872bed85036 ("reset: Add devres helpers to request > pre-deasserted reset controls"), devres helpers are available to simplify > the process of requesting pre-deasserted reset controls. Update the > rzg2l_adc driver to utilize these helpers, reducing complexity in this > way. > > Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > --- > > Changes in v2: > - rebased on top of patch 2/15 from this version > - used "failed to get/deassert" failure messages > > drivers/iio/adc/rzg2l_adc.c | 37 ++++++------------------------------- > 1 file changed, 6 insertions(+), 31 deletions(-) > > diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c > index 8a804f81c04b..c0c13e99aa92 100644 > --- a/drivers/iio/adc/rzg2l_adc.c > +++ b/drivers/iio/adc/rzg2l_adc.c > @@ -411,11 +411,6 @@ static void rzg2l_adc_pm_runtime_set_suspended(void *data) > pm_runtime_set_suspended(dev->parent); > } > > -static void rzg2l_adc_reset_assert(void *data) > -{ > - reset_control_assert(data); > -} > - > static int rzg2l_adc_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > @@ -448,34 +443,14 @@ static int rzg2l_adc_probe(struct platform_device *pdev) > if (IS_ERR(adc->adclk)) > return dev_err_probe(dev, PTR_ERR(adc->adclk), "Failed to get adclk"); > > - adc->adrstn = devm_reset_control_get_exclusive(dev, "adrst-n"); > + adc->adrstn = devm_reset_control_get_exclusive_deasserted(dev, "adrst-n"); > if (IS_ERR(adc->adrstn)) > - return dev_err_probe(dev, PTR_ERR(adc->adrstn), "failed to get adrstn\n"); > - > - adc->presetn = devm_reset_control_get_exclusive(dev, "presetn"); > - if (IS_ERR(adc->presetn)) > - return dev_err_probe(dev, PTR_ERR(adc->presetn), "failed to get presetn\n"); > - > - ret = reset_control_deassert(adc->adrstn); > - if (ret) > - return dev_err_probe(&pdev->dev, ret, "failed to deassert adrstn pin, %d\n", ret); > - > - ret = devm_add_action_or_reset(&pdev->dev, > - rzg2l_adc_reset_assert, adc->adrstn); > - if (ret) { Huh. Missed this in previous. These brackets shouldn't be there. > - return dev_err_probe(&pdev->dev, ret, > - "failed to register adrstn assert devm action, %d\n", ret); > - } > + return dev_err_probe(dev, PTR_ERR(adc->adrstn), "failed to get/deassert adrst-n\n"); > > - ret = reset_control_deassert(adc->presetn); > - if (ret) > - return dev_err_probe(&pdev->dev, ret, "failed to deassert presetn pin, %d\n", ret); > - > - ret = devm_add_action_or_reset(&pdev->dev, > - rzg2l_adc_reset_assert, adc->presetn); > - if (ret) { > - return dev_err_probe(&pdev->dev, ret, > - "failed to register presetn assert devm action, %d\n", ret); > + adc->presetn = devm_reset_control_get_exclusive_deasserted(dev, "presetn"); > + if (IS_ERR(adc->presetn)) { Adding bracket here both makes limited sense and messes up the diff. I dropped them. Jonathan > + return dev_err_probe(dev, PTR_ERR(adc->presetn), > + "failed to get/deassert presetn\n"); > } > > ret = rzg2l_adc_hw_init(adc);
On Fri, Dec 6, 2024 at 11:14 AM Claudiu <claudiu.beznea@tuxon.dev> wrote: > > From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > Starting with commit d872bed85036 ("reset: Add devres helpers to request > pre-deasserted reset controls"), devres helpers are available to simplify > the process of requesting pre-deasserted reset controls. Update the > rzg2l_adc driver to utilize these helpers, reducing complexity in this > way. > > Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > --- > > Changes in v2: > - rebased on top of patch 2/15 from this version > - used "failed to get/deassert" failure messages > > drivers/iio/adc/rzg2l_adc.c | 37 ++++++------------------------------- > 1 file changed, 6 insertions(+), 31 deletions(-) > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Cheers, Prabhakar > diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c > index 8a804f81c04b..c0c13e99aa92 100644 > --- a/drivers/iio/adc/rzg2l_adc.c > +++ b/drivers/iio/adc/rzg2l_adc.c > @@ -411,11 +411,6 @@ static void rzg2l_adc_pm_runtime_set_suspended(void *data) > pm_runtime_set_suspended(dev->parent); > } > > -static void rzg2l_adc_reset_assert(void *data) > -{ > - reset_control_assert(data); > -} > - > static int rzg2l_adc_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > @@ -448,34 +443,14 @@ static int rzg2l_adc_probe(struct platform_device *pdev) > if (IS_ERR(adc->adclk)) > return dev_err_probe(dev, PTR_ERR(adc->adclk), "Failed to get adclk"); > > - adc->adrstn = devm_reset_control_get_exclusive(dev, "adrst-n"); > + adc->adrstn = devm_reset_control_get_exclusive_deasserted(dev, "adrst-n"); > if (IS_ERR(adc->adrstn)) > - return dev_err_probe(dev, PTR_ERR(adc->adrstn), "failed to get adrstn\n"); > - > - adc->presetn = devm_reset_control_get_exclusive(dev, "presetn"); > - if (IS_ERR(adc->presetn)) > - return dev_err_probe(dev, PTR_ERR(adc->presetn), "failed to get presetn\n"); > - > - ret = reset_control_deassert(adc->adrstn); > - if (ret) > - return dev_err_probe(&pdev->dev, ret, "failed to deassert adrstn pin, %d\n", ret); > - > - ret = devm_add_action_or_reset(&pdev->dev, > - rzg2l_adc_reset_assert, adc->adrstn); > - if (ret) { > - return dev_err_probe(&pdev->dev, ret, > - "failed to register adrstn assert devm action, %d\n", ret); > - } > + return dev_err_probe(dev, PTR_ERR(adc->adrstn), "failed to get/deassert adrst-n\n"); > > - ret = reset_control_deassert(adc->presetn); > - if (ret) > - return dev_err_probe(&pdev->dev, ret, "failed to deassert presetn pin, %d\n", ret); > - > - ret = devm_add_action_or_reset(&pdev->dev, > - rzg2l_adc_reset_assert, adc->presetn); > - if (ret) { > - return dev_err_probe(&pdev->dev, ret, > - "failed to register presetn assert devm action, %d\n", ret); > + adc->presetn = devm_reset_control_get_exclusive_deasserted(dev, "presetn"); > + if (IS_ERR(adc->presetn)) { > + return dev_err_probe(dev, PTR_ERR(adc->presetn), > + "failed to get/deassert presetn\n"); > } > > ret = rzg2l_adc_hw_init(adc); > -- > 2.39.2 > >
diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c index 8a804f81c04b..c0c13e99aa92 100644 --- a/drivers/iio/adc/rzg2l_adc.c +++ b/drivers/iio/adc/rzg2l_adc.c @@ -411,11 +411,6 @@ static void rzg2l_adc_pm_runtime_set_suspended(void *data) pm_runtime_set_suspended(dev->parent); } -static void rzg2l_adc_reset_assert(void *data) -{ - reset_control_assert(data); -} - static int rzg2l_adc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -448,34 +443,14 @@ static int rzg2l_adc_probe(struct platform_device *pdev) if (IS_ERR(adc->adclk)) return dev_err_probe(dev, PTR_ERR(adc->adclk), "Failed to get adclk"); - adc->adrstn = devm_reset_control_get_exclusive(dev, "adrst-n"); + adc->adrstn = devm_reset_control_get_exclusive_deasserted(dev, "adrst-n"); if (IS_ERR(adc->adrstn)) - return dev_err_probe(dev, PTR_ERR(adc->adrstn), "failed to get adrstn\n"); - - adc->presetn = devm_reset_control_get_exclusive(dev, "presetn"); - if (IS_ERR(adc->presetn)) - return dev_err_probe(dev, PTR_ERR(adc->presetn), "failed to get presetn\n"); - - ret = reset_control_deassert(adc->adrstn); - if (ret) - return dev_err_probe(&pdev->dev, ret, "failed to deassert adrstn pin, %d\n", ret); - - ret = devm_add_action_or_reset(&pdev->dev, - rzg2l_adc_reset_assert, adc->adrstn); - if (ret) { - return dev_err_probe(&pdev->dev, ret, - "failed to register adrstn assert devm action, %d\n", ret); - } + return dev_err_probe(dev, PTR_ERR(adc->adrstn), "failed to get/deassert adrst-n\n"); - ret = reset_control_deassert(adc->presetn); - if (ret) - return dev_err_probe(&pdev->dev, ret, "failed to deassert presetn pin, %d\n", ret); - - ret = devm_add_action_or_reset(&pdev->dev, - rzg2l_adc_reset_assert, adc->presetn); - if (ret) { - return dev_err_probe(&pdev->dev, ret, - "failed to register presetn assert devm action, %d\n", ret); + adc->presetn = devm_reset_control_get_exclusive_deasserted(dev, "presetn"); + if (IS_ERR(adc->presetn)) { + return dev_err_probe(dev, PTR_ERR(adc->presetn), + "failed to get/deassert presetn\n"); } ret = rzg2l_adc_hw_init(adc);