Re: [PATCH v2 3/3] i2c: dev: clean up registration

From: Johan Hovold

Date: Tue Nov 10 2026 - 07:51:38 EST


On Tue, Nov 10, 2026 at 12:50:35PM +0100, Wolfram Sang wrote:
> On Thu, Aug 27, 2026 at 12:20:43PM +0200, Johan Hovold wrote:
> > Drop the get_free_i2c_dev() and put_i2c_dev() helpers and do all setup
> > and teardown directly in i2cdev_attach_adapter() and
> > i2cdev_detach_adapter() for consistency and to make the logic clearer.
> >
> > Note that the device list is only used at detach so the i2c-dev can be
> > added after registering the class device.
>
> Can we have the last sentence as a comment in the code, too, please?

Sure.

> > Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
>
> Other than that, I think this patch is an improvement. The logic is more
> explicit. I didn't like 'put_i2c_dev' having a bool parameter, for
> example.
>
> So, only patch 1 needs a bigger update, it seems. Rest is looking good
> to me.

I had rejected that Sashiko finding as being too outlandish for us to
have to worry about. As I just in a reply to Bartosz:

If a malicious actor has physical access to the machine, we have
bigger problems than worrying about them going out of their way
to cause a USB hub worker thread to hang. :)

Limiting the critical section can possibly be done as a follow-up, but
it may not even be worth the effort doing that.

Johan