From: jic23@kernel.org (Jonathan Cameron)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/15] iio: adc: stm32: use devm_of_platform_populate()
Date: Mon, 29 May 2017 17:00:18 +0100 [thread overview]
Message-ID: <20170529170018.3fb2e8aa@kernel.org> (raw)
In-Reply-To: <1496072763-31209-2-git-send-email-benjamin.gaignard@linaro.org>
On Mon, 29 May 2017 17:45:49 +0200
Benjamin Gaignard <benjamin.gaignard@linaro.org> wrote:
> Use devm_of_platform_populate() instead of of_platform_populate and
> of_platform_depopulate to simplify driver code
>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
My gut feeling is to dislike this particular instance.
It's changing the order of removal of elements to not
be a reverse of the order of them being set up. That
takes it from obviously correct to something where some thought
is required. For the trivial saving in lines of code I'm
unconvinced it is a worthwhile change..
Mind you, this particular driver isn't balancing the
probe and remove order anyway (the regulator stuff)
so I guess it's not making it much worse...
Jonathan
>
> CC: Jonathan Cameron <jic23@kernel.org>
> CC: Hartmut Knaack <knaack.h@gmx.de>
> CC: Lars-Peter Clausen <lars@metafoo.de>
> CC: Alexandre Torgue <alexandre.torgue@st.com>
> CC: Fabrice Gasnier <fabrice.gasnier@st.com>
> CC: linux-iio at vger.kernel.org
> CC: linux-arm-kernel at lists.infradead.org
> CC: linux-kernel at vger.kernel.org
> ---
> drivers/iio/adc/stm32-adc-core.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c
> index 22b7c93..46e41dc5 100644
> --- a/drivers/iio/adc/stm32-adc-core.c
> +++ b/drivers/iio/adc/stm32-adc-core.c
> @@ -186,7 +186,6 @@ static void stm32_adc_irq_remove(struct platform_device *pdev,
> static int stm32_adc_probe(struct platform_device *pdev)
> {
> struct stm32_adc_priv *priv;
> - struct device_node *np = pdev->dev.of_node;
> struct resource *res;
> int ret;
>
> @@ -249,7 +248,7 @@ static int stm32_adc_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, &priv->common);
>
> - ret = of_platform_populate(np, NULL, NULL, &pdev->dev);
> + ret = devm_of_platform_populate(&pdev->dev);
> if (ret < 0) {
> dev_err(&pdev->dev, "failed to populate DT children\n");
> goto err_irq_remove;
> @@ -274,7 +273,6 @@ static int stm32_adc_remove(struct platform_device *pdev)
> struct stm32_adc_common *common = platform_get_drvdata(pdev);
> struct stm32_adc_priv *priv = to_stm32_adc_priv(common);
>
> - of_platform_depopulate(&pdev->dev);
> stm32_adc_irq_remove(pdev, priv);
> clk_disable_unprepare(priv->aclk);
> regulator_disable(priv->vref);
next prev parent reply other threads:[~2017-05-29 16:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-29 15:45 [PATCH 00/15] make more driver use devm_of_platform_populate() Benjamin Gaignard
2017-05-29 15:45 ` [PATCH 01/15] iio: adc: stm32: " Benjamin Gaignard
2017-05-29 16:00 ` Jonathan Cameron [this message]
2017-05-29 16:03 ` Fabrice Gasnier
2017-05-29 15:45 ` [PATCH 02/15] iio: dac: " Benjamin Gaignard
2017-05-29 16:10 ` Fabrice Gasnier
2017-05-29 15:45 ` [PATCH 05/15] mfd: stm32-timers: use devm_of_platform_populate Benjamin Gaignard
2017-05-30 9:29 ` Lee Jones
2017-05-29 15:45 ` [PATCH 08/15] mfd: exynos: use devm_of_platform_populate() Benjamin Gaignard
2017-05-30 9:31 ` Lee Jones
2017-05-29 15:46 ` [PATCH 14/15] sound: stm32: " Benjamin Gaignard
2017-05-30 9:03 ` Olivier MOYSAN
2017-05-29 15:46 ` [PATCH 15/15] media: exynos4-is: " Benjamin Gaignard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170529170018.3fb2e8aa@kernel.org \
--to=jic23@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).