lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170529170018.3fb2e8aa@kernel.org>
Date:   Mon, 29 May 2017 17:00:18 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Benjamin Gaignard <benjamin.gaignard@...aro.org>
Cc:     Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Alexandre Torgue <alexandre.torgue@...com>,
        Fabrice Gasnier <fabrice.gasnier@...com>,
        linux-iio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/15] iio: adc: stm32: use devm_of_platform_populate()

On Mon, 29 May 2017 17:45:49 +0200
Benjamin Gaignard <benjamin.gaignard@...aro.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@...aro.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@...nel.org>
> CC: Hartmut Knaack <knaack.h@....de>
> CC: Lars-Peter Clausen <lars@...afoo.de>
> CC: Alexandre Torgue <alexandre.torgue@...com>
> CC: Fabrice Gasnier <fabrice.gasnier@...com>
> CC: linux-iio@...r.kernel.org
> CC: linux-arm-kernel@...ts.infradead.org
> CC: linux-kernel@...r.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);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ