From: Andreas Kemnade <andreas@kemnade.info>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: Kalle Niemi <kaleposti@gmail.com>,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>,
Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>,
Andi Shyti <andi.shyti@kernel.org>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Ray Jui <rjui@broadcom.com>,
Branden Scott <sbranden@broadcom.com>,
bcm-kernel-feedback-list@broadcom.com,
Vignesh R <vigneshr@ti.com>, Aaro Koskinen <aaro.koskinen@iki.fi>,
Janusz Krzysztofik <jmkrzyszt@gmail.com>,
Tony Lindgren <tony@atomide.com>,
Kevin Hilman <khilman@baylibre.com>,
Roger Quadros <rogerq@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>,
Patrice Chotard <patrice.chotard@foss.st.com>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Linus Walleij <linusw@kernel.org>, Frank Li <Frank.Li@nxp.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-omap@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
linux-rpi-kernel@lists.infradead.org,
Matti Vaittinen <mazziesaccount@gmail.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>
Subject: Re: [PATCH v2 01/12] i2c: allow setting the parent device and OF node through the adapter struct
Date: Mon, 2 Mar 2026 16:59:28 +0100 [thread overview]
Message-ID: <20260302165928.0e85b93c@kemnade.info> (raw)
In-Reply-To: <CAMRc=Mc1+GX52A56kBLD0XytvL=E7kpjLDiqNkR=fici4-qUnw@mail.gmail.com>
On Mon, 2 Mar 2026 03:08:24 -0800
Bartosz Golaszewski <brgl@kernel.org> wrote:
> On Mon, 2 Mar 2026 11:38:27 +0100, Kalle Niemi <kaleposti@gmail.com> said:
> > On 3/2/26 10:55, Bartosz Golaszewski wrote:
> >> On Mon, Mar 2, 2026 at 8:47 AM Kalle Niemi <kaleposti@gmail.com> 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@oss.qualcomm.com>
> >>>> ---
> >>> 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.
> >
> > -Kalle
> >
>
> I meant what driver are you using but I suppose it's i2c-omap.
>
> Can you try the following change and let me know if it fixes the issue?
>
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index dd8cec9b04c6..01656f82d2c6 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -1548,6 +1548,11 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
> if (adap->timeout == 0)
> adap->timeout = HZ;
>
> + if (!adap->dev.parent)
> + adap->dev.parent = adap->parent;
> + if (!adap->dev.of_node)
> + adap->dev.of_node = adap->of_node;
> +
> /* register soft irqs for Host Notify */
> res = i2c_setup_host_notify_irq_domain(adap);
> if (res) {
> @@ -1561,11 +1566,6 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
> adap->dev.type = &i2c_adapter_type;
> device_initialize(&adap->dev);
>
> - if (!adap->dev.parent)
> - adap->dev.parent = adap->parent;
> - if (!adap->dev.of_node)
> - adap->dev.of_node = adap->of_node;
> -
> /*
> * This adapter can be used as a parent immediately after device_add(),
> * setup runtime-pm (especially ignore-children) before hand.
>
No changes here. Devices probe, bus indexes are still shifted.
If I take that into account, i2cget still works.
But I think there is no defined order anyways. So if
I would add e.g. usb device provoding i2c busses early than
omap-i2c for some odd reason, things were messed anyways.
On the other hand, just having numbers skipped seems to be odd.
Regards,
Andreas
next prev parent reply other threads:[~2026-03-02 15:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <EDF3FB58-4747-442E-8463-6F1C6E568962@gmail.com>
2026-03-02 11:08 ` [PATCH v2 01/12] i2c: allow setting the parent device and OF node through the adapter struct Bartosz Golaszewski
2026-03-02 15:59 ` Andreas Kemnade [this message]
2026-03-02 16:56 ` Andreas Kemnade
2026-03-02 15:09 ` Andreas Kemnade
2026-03-02 15:42 ` Bartosz Golaszewski
2026-03-02 16:14 ` Andreas Kemnade
2026-02-23 9:05 [PATCH v2 00/12] i2c: configure " Bartosz Golaszewski
2026-02-23 9:05 ` [PATCH v2 01/12] i2c: allow setting the " Bartosz Golaszewski
2026-03-02 7:47 ` Kalle Niemi
2026-03-02 8:55 ` Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260302165928.0e85b93c@kemnade.info \
--to=andreas@kemnade.info \
--cc=Frank.Li@nxp.com \
--cc=aaro.koskinen@iki.fi \
--cc=andi.shyti@kernel.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=brgl@kernel.org \
--cc=festevam@gmail.com \
--cc=florian.fainelli@broadcom.com \
--cc=geert+renesas@glider.be \
--cc=imx@lists.linux.dev \
--cc=jmkrzyszt@gmail.com \
--cc=kaleposti@gmail.com \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=magnus.damm@gmail.com \
--cc=mazziesaccount@gmail.com \
--cc=mukesh.savaliya@oss.qualcomm.com \
--cc=patrice.chotard@foss.st.com \
--cc=rjui@broadcom.com \
--cc=rogerq@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sbranden@broadcom.com \
--cc=shawnguo@kernel.org \
--cc=tony@atomide.com \
--cc=vigneshr@ti.com \
--cc=viken.dadhaniya@oss.qualcomm.com \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox