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: <12cabd69-fcb4-2e01-3a48-c4327e839d3a@gmail.com>
Date:   Sun, 14 Mar 2021 19:01:57 +0530
From:   Mugilraj D <dmugil2000@...il.com>
To:     Alexandru Ardelean <ardeleanalex@...il.com>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        linux-iio <linux-iio@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio:dac:max517: Use devm_iio_device_register()



On 14/03/21 4:37 pm, Alexandru Ardelean wrote:
> On Sun, Mar 14, 2021 at 11:34 AM Mugilraj Dhavachelvan
> <dmugil2000@...il.com> 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>
>> ---
>>  drivers/iio/dac/max517.c | 9 +--------
>>  1 file changed, 1 insertion(+), 8 deletions(-)
>>
>> diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c
>> index 7e01838ef4d0..5f72f126162d 100644
>> --- a/drivers/iio/dac/max517.c
>> +++ b/drivers/iio/dac/max517.c
>> @@ -189,13 +189,7 @@ static int max517_probe(struct i2c_client *client,
>>                         data->vref_mv[chan] = platform_data->vref_mv[chan];
>>         }
>>
>> -       return iio_device_register(indio_dev);
>> -}
>> -
> 
> In this case you can also remove the line with
>      i2c_set_clientdata(client, indio_dev);
> 
> A lot of times, when functions like i2c_get_clientdata() get removed,
> the i2c_set_clientdata() function becomes useless.
> i.e. it stores some data that will never be used in the lifetime of the driver.
> 
> It isn't always the case that you can do that; so, some care must be
> taken to avoid special cases.
> But in this case, you can remove the i2c_set_clientdata() call.
> 
Ack, I'll send that in a while. I should send with [V2] tag right.
> 
>> -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 +208,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);
>> --
>> 2.25.1
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ