Re: [PATCH v2 01/12] i2c: allow setting the parent device and OF node through the adapter struct

From: Andreas Kemnade

Date: Mon Mar 02 2026 - 11:21:37 EST


On Mon, 2 Mar 2026 16:42:58 +0100
Bartosz Golaszewski <brgl@xxxxxxxxxx> wrote:

> On Mon, Mar 2, 2026 at 4:11 PM Andreas Kemnade <andreas@xxxxxxxxxxxx> wrote:
> >
> > On Mon, 2 Mar 2026 12:38:27 +0200
> > Kalle Niemi <kaleposti@xxxxxxxxx> wrote:
> >
> > > On 3/2/26 10:55, Bartosz Golaszewski wrote:
> > > > On Mon, Mar 2, 2026 at 8:47 AM Kalle Niemi <kaleposti@xxxxxxxxx> wrote:
> > > >> On 2/23/26 11:05, Bartosz Golaszewski wrote:
> > > >>> In order to stop i2c bus drivers from dereferencing the struct device
> > > >>> embedded in struct i2c_adapter, let's allow configuring the parent
> > > >>> device and OF-node of the adapter directly through dedicated fields.
> > > >>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
> > > >>> ---
> > > >> Hello,
> > > >> Automated driver test system bisected this commit to be the first bad
> > > >> commit, linux-next next-20260227 was tested. Failed tests include driver
> > > >> tests for ROHM PMIC and accelerometers, which are connected to
> > > >> BeagleBone Black.
> > > >> The failed driver tests all fail to first i2cget and the tests stop
> > > >> there: "Could not open file '/dev/i2c-2' or 'dev/i2c/2': No such file or
> > > >> directory".
> > > > Wolfram: well, now it would actually be useful to know which commit
> > > > exactly is the culprit so maybe splitting the changes is not a bad
> > > > idea after all.
> > > > Kalle: which i2c bus driver fails here? Any errors in kernel log?
> > > > Bart
> > >
> > > Hello Bart,
> > >
> > > i2c-1 and i2c-2 are failing. I am not seeing any i2c errors in kernel log. I got two failures without the dmesg available (this is bugged test sequence, and not a kernel crash), but those got the same stdout message "Could not open file ...." as all others.
> > >
> > Probably I am using the same host driver
> >
> > tested on OMAP3 DM3730, result: i2c drivers get bound to their devices,
> > no obvious trouble. But controllers are registered with high indexes.
> >
> > localhost:~# i2cdetect -l
> > i2c-3 i2c OMAP I2C adapter I2C adapter
> > i2c-4 i2c OMAP I2C adapter I2C adapter
> > i2c-5 i2c OMAP I2C adapter I2C adapter
> > localhost:~# uname -a
> > Linux localhost 7.0.0-rc1-next-20260227 #27 SMP Mon Mar 2 11:56:27 CET 2026 armv7l Linux
> >
> > Regards,
> > Andreas
>
> Hi! Does the change I posted earlier in this thread help?
>
It does *not* as written earlier.

Just for comparison, with the offending patch reverted, it
looks like this:

localhost:~# i2cdetect -l
i2c-0 i2c OMAP I2C adapter I2C adapter
i2c-1 i2c OMAP I2C adapter I2C adapter
i2c-2 i2c OMAP I2C adapter I2C adapter


So as long only kernel drivers are used and matched via devicetree compatible
nothing seems to care about the change of bus numbers.

Regards,
Andreas