[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <707e5ff3-c38a-c0fe-e6b9-1e054cc46606@metafoo.de>
Date: Mon, 15 Mar 2021 06:55:53 +0100
From: Lars-Peter Clausen <lars@...afoo.de>
To: Mugilraj Dhavachelvan <dmugil2000@...il.com>,
ardeleanalex@...il.com, Jonathan Cameron <jic23@...nel.org>,
Hartmut Knaack <knaack.h@....de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] iio:dac:max517.c: Use devm_iio_device_register()
On 3/14/21 6:57 PM, Mugilraj Dhavachelvan wrote:
> Use devm_iio_device_register() to avoid remove function and
> drop explicit call to iio_device_unregister().
>
> Signed-off-by: Mugilraj Dhavachelvan <dmugil2000@...il.com>
>
> changes v1->v2:
> -As sugested by Alexandru removed i2c_set_clientdata() because the stored
> data will be never used.
Hi,
This looks good!
Reviewed-by: Lars-Peter Clausen <lars@...afoo.de>
One thing process wise. I know it is tempting to send version 2 as a
reply to version 1, but this way it is also easy for the messages to get
lost in longer threads. At least for the IIO mailinglist we have decided
that it is best to send new versions of a patch series as their own
threads so that they stand own and get noticed.
- Lars
> ---
> drivers/iio/dac/max517.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c
> index 7e01838ef4d0..00f0062a0298 100644
> --- a/drivers/iio/dac/max517.c
> +++ b/drivers/iio/dac/max517.c
> @@ -153,7 +153,6 @@ static int max517_probe(struct i2c_client *client,
> if (!indio_dev)
> return -ENOMEM;
> data = iio_priv(indio_dev);
> - i2c_set_clientdata(client, indio_dev);
> data->client = client;
>
> /* establish that the iio_dev is a child of the i2c device */
> @@ -189,13 +188,7 @@ static int max517_probe(struct i2c_client *client,
> data->vref_mv[chan] = platform_data->vref_mv[chan];
> }
>
> - return iio_device_register(indio_dev);
> -}
> -
> -static int max517_remove(struct i2c_client *client)
> -{
> - iio_device_unregister(i2c_get_clientdata(client));
> - return 0;
> + return devm_iio_device_register(&client->dev, indio_dev);
> }
>
> static const struct i2c_device_id max517_id[] = {
> @@ -214,7 +207,6 @@ static struct i2c_driver max517_driver = {
> .pm = &max517_pm_ops,
> },
> .probe = max517_probe,
> - .remove = max517_remove,
> .id_table = max517_id,
> };
> module_i2c_driver(max517_driver);
Powered by blists - more mailing lists