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.