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]
Date:   Fri, 3 Sep 2021 16:22:15 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Alexandru Ardelean <aardelean@...iqon.com>
Cc:     linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-doc@...r.kernel.org, jic23@...nel.org, hdegoede@...hat.com,
        wens@...e.org
Subject: Re: [PATCH 2/5] iio: adc: intel_mrfld_adc: convert probe to full
 device-managed

On Fri, Sep 03, 2021 at 10:29:14AM +0300, Alexandru Ardelean wrote:
> The only call in the remove hook is the iio_map_array_unregister() call.
> Since we have a devm_iio_map_array_register() function now, we can use that
> and remove the remove hook entirely.
> The IIO device was registered with the devm_iio_device_register() prior to
> this change.
> 
> Also, the platform_set_drvdata() can be removed now, since it was used only
> in the remove hook.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

> Signed-off-by: Alexandru Ardelean <aardelean@...iqon.com>
> ---
>  drivers/iio/adc/intel_mrfld_adc.c | 24 ++----------------------
>  1 file changed, 2 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/iio/adc/intel_mrfld_adc.c b/drivers/iio/adc/intel_mrfld_adc.c
> index 75394350eb4c..616de0c3a049 100644
> --- a/drivers/iio/adc/intel_mrfld_adc.c
> +++ b/drivers/iio/adc/intel_mrfld_adc.c
> @@ -205,8 +205,6 @@ static int mrfld_adc_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> -	platform_set_drvdata(pdev, indio_dev);
> -
>  	indio_dev->name = pdev->name;
>  
>  	indio_dev->channels = mrfld_adc_channels;
> @@ -214,28 +212,11 @@ static int mrfld_adc_probe(struct platform_device *pdev)
>  	indio_dev->info = &mrfld_adc_iio_info;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  
> -	ret = iio_map_array_register(indio_dev, iio_maps);
> +	ret = devm_iio_map_array_register(dev, indio_dev, iio_maps);
>  	if (ret)
>  		return ret;
>  
> -	ret = devm_iio_device_register(dev, indio_dev);
> -	if (ret < 0)
> -		goto err_array_unregister;
> -
> -	return 0;
> -
> -err_array_unregister:
> -	iio_map_array_unregister(indio_dev);
> -	return ret;
> -}
> -
> -static int mrfld_adc_remove(struct platform_device *pdev)
> -{
> -	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> -
> -	iio_map_array_unregister(indio_dev);
> -
> -	return 0;
> +	return devm_iio_device_register(dev, indio_dev);
>  }
>  
>  static const struct platform_device_id mrfld_adc_id_table[] = {
> @@ -249,7 +230,6 @@ static struct platform_driver mrfld_adc_driver = {
>  		.name = "mrfld_bcove_adc",
>  	},
>  	.probe = mrfld_adc_probe,
> -	.remove = mrfld_adc_remove,
>  	.id_table = mrfld_adc_id_table,
>  };
>  module_platform_driver(mrfld_adc_driver);
> -- 
> 2.31.1
> 

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ