Re: [PATCH v7 4/6] platform/x86: dell-smo8800: Move instantiation of lis3lv02d i2c_client from i2c-i801 to dell-lis3lv02d

Andy Shevchenko
2024-08-12T17:03:17Z

On Mon, Aug 12, 2024 at 06:00:20PM +0200, Hans de Goede wrote:
> On 8/5/24 10:48 PM, Andy Shevchenko wrote:
> > On Mon, Aug 5, 2024 at 3:38 PM Hans de Goede <hdegoede@redhat.com> wrote:

...

> >> + bus_for_each_dev(&i2c_bus_type, NULL, &adap, find_i801);
> >> + if (!adap)
> >> + return;
> >
> > May i2c_for_each_dev() be used here?
>
> The main difference between i2c_for_each_dev() and
> bus_for_each_dev() is that i2c_for_each_dev() holds
> the i2c core mutex while it is calling the passed
> in callback.
>
> And find_i801() calls i2c_get_adapter() which also
> takes the i2c core mutex, so i2c_for_each_dev()
> cannot be used here since then things deadlock.

+ A comment to prevent "clever" cleanupers from breaking the things?

--
With Best Regards,
Andy Shevchenko