Re: [PATCH v2 2/4] i2c/busses/i2c-icy: Add LTC2990 present on 2019 board revision

From: Max Staudt
Date: Tue Aug 13 2019 - 05:49:13 EST


On 08/13/2019 09:03 AM, Geert Uytterhoeven wrote:
> Hi Max,
>
> On Tue, Aug 13, 2019 at 1:53 AM Max Staudt <max@xxxxxxxxx> wrote:
>> Since the 2019 a1k.org community re-print of these PCBs sports an
>> LTC2990 hwmon chip as an example use case, let this driver autoprobe
>> for that as well. If it is present, modprobing ltc2990 is sufficient.
>>
>> Signed-off-by: Max Staudt <max@xxxxxxxxx>
>
> Thanks for your patch!
>
>> --- a/drivers/i2c/busses/i2c-icy.c
>> +++ b/drivers/i2c/busses/i2c-icy.c
>> @@ -160,6 +180,8 @@ static void icy_remove(struct zorro_dev *z)
>> {
>> struct icy_i2c *i2c = dev_get_drvdata(&z->dev);
>>
>> + i2c_unregister_device(i2c->client_ltc2990);
>
> Is this needed?
> In my understanding, i2c_del_adapter() below takes care of that.
It seems to do that in i2c_del_adapter():

device_for_each_child(&adap->dev, NULL, __unregister_dummy);


However, I'm not sure I'm supposed to do that. I went by Documentation/i2c/instantiating-devices, which in "Method 2" says:

The driver which instantiated the I2C device is responsible for destroying
it on cleanup. This is done by calling i2c_unregister_device() on the
pointer that was earlier returned by i2c_new_device() or
i2c_new_probed_device().


So, what is preferred and why?


Thanks!

Max