Re: [PATCH v6 1/5] i2c: core: add managed function for adding i2c adapters
From: Wolfram Sang
Date: Tue Apr 06 2021 - 16:16:25 EST
On Wed, Mar 31, 2021 at 09:36:26PM +0800, Yicong Yang wrote:
> Some I2C controller drivers will only unregister the I2C
> adapter in their .remove() callback, which can be done
> by simply using a managed variant to add the I2C adapter.
>
> So add the managed functions for adding the I2C adapter.
Yes, I think we can do this. We just need to pay attention that people
make sure interrupts are disabled and/or freed when the adapter gets
removed. But this is also true for the current situation. I.e. removing
the adapter manually in remove() and then relying on devm_ to free the
interrupt is a bit dangerous.
> + return devm_add_action_or_reset(dev, devm_i2c_del_adapter, adapter);
Cool, I didn't know this function.
Attachment:
signature.asc
Description: PGP signature