From: Johan Hovold <johan@kernel.org>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: "Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>,
"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
"Andi Shyti" <andi.shyti@kernel.org>,
"Chen-Yu Tsai" <wens@kernel.org>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Samuel Holland" <samuel@sholland.org>,
"Khalil Blaiech" <kblaiech@nvidia.com>,
"Asmaa Mnebhi" <asmaa@nvidia.com>,
"Jean Delvare" <jdelvare@suse.com>,
"Madhavan Srinivasan" <maddy@linux.ibm.com>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
"Andreas Färber" <afaerber@suse.de>,
"Manivannan Sadhasivam" <mani@kernel.org>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linuxppc-dev@lists.ozlabs.org,
linux-actions@lists.infradead.org
Subject: Re: [PATCH 00/12] i2c: add and start using i2c_adapter-specific printk helpers
Date: Mon, 19 Jan 2026 12:32:28 +0100 [thread overview]
Message-ID: <aW4WTP8ZJXIe4Mg1@hovoldconsulting.com> (raw)
In-Reply-To: <CAMRc=McfiKGT9RSJqZtCtHHHjwDLGPkNwA4Kot9-9frfpCGVmQ@mail.gmail.com>
On Mon, Jan 19, 2026 at 12:17:49PM +0100, Bartosz Golaszewski wrote:
> On Mon, Jan 19, 2026 at 12:03 PM Johan Hovold <johan@kernel.org> wrote:
> >
> > On Tue, Dec 23, 2025 at 04:11:08PM +0100, Bartosz Golaszewski wrote:
> > > On Tue, Dec 23, 2025 at 3:24 PM Johan Hovold <johan@kernel.org> wrote:
> > > >
> > > > On Tue, Dec 23, 2025 at 11:02:22AM +0100, Bartosz Golaszewski wrote:
> > > > > It's been another year of discussing the object life-time problems at
> > > > > conferences. I2C is one of the offenders and its problems are more
> > > > > complex than those of some other subsystems. It seems the revocable[1]
> > > > > API may make its way into the kernel this year but even with it in
> > > > > place, I2C won't be able to use it as there's currently nothing to
> > > > > *revoke*. The struct device is embedded within the i2c_adapter struct
> > > > > whose lifetime is tied to the provider device being bound to its driver.
> > > > >
> > > > > Fixing this won't be fast and easy but nothing's going to happen if we
> > > > > don't start chipping away at it. The ultimate goal in order to be able
> > > > > to use an SRCU-based solution (revocable or otherwise) is to convert the
> > > > > embedded struct device in struct i2c_adapter into an __rcu pointer that
> > > > > can be *revoked*. To that end we need to hide all dereferences of
> > > > > adap->dev in drivers.
> > > >
> > > > No, this is not the way to do it. You start with designing and showing
> > > > what the end result will look like *before* you start rewriting world
> > > > like you are doing here.
> > >
> > > The paragraph you're commenting under explains exactly what I propose
> > > to do: move struct device out of struct i2c_adapter and protect the
> > > pointer storing its address with SRCU. This is a well-known design
> > > that's being generalized to a common "revocable" API which will
> > > possibly be available upstream by the time we're ready to use it.
> >
> > Revocable, as presented in plumbers, is not going upstream.
> >
>
> Oh really? :)
>
> https://lore.kernel.org/all/2026011607-canister-catalyst-9fdd@gregkh/
Looks like a bad call as Laurent immediately pointed out:
https://lore.kernel.org/all/20260116160454.GN30544@pendragon.ideasonboard.com/#t
Let's see where that goes.
> > > You know I can't possibly *show* the end result in a single series
> > > because - as the paragraph before explains - we need to first hide all
> > > direct dereferences of struct device in struct i2c_adapter behind
> > > dedicated interfaces so that we when do the conversion, it'll affect
> > > only a limited number of places. It can't realistically be done at
> > > once.
> >
> > You can post an RFC converting one driver with a proper description of
> > the problem you're trying to solve.
> >
>
> It's not a one-driver problem. It's a subsystem-wide problem requiring
> a subsystem-wide solution. Wolfram explained it really well in his
> summary, I'm not going to repeat it here.
Of course it is, but you still don't have to rewrite world to post an
RFC where the problem can be discussed. A single driver is more than
enough.
> I also don't agree that i2c-specific helpers make code harder to read.
> Is device_set_node() harder to read than
>
> dev->fwnode = fwnode;
> dev->of_node = to_of_node(fwnode);
>
> ?
>
> Even if you answer yes - it at least helps hide the implementation
> details of the OF layer where fwnode-level is preferred. We do it all
> the time in the kernel. This kind of helpers allows easier transitions
> when some implementation detail needs to change - as is the case here.
Magic helpers that hide what's really going on hurts readability. So
introducing them when they are not really needed should be avoided.
(But yeah, we have a problem with developers introducing esoteric
helpers while seemingly thinking all that matters is LOC count, and too
few people raising their voice against bad ideas.)
Johan
next prev parent reply other threads:[~2026-01-19 11:32 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 10:02 [PATCH 00/12] i2c: add and start using i2c_adapter-specific printk helpers Bartosz Golaszewski
2025-12-23 10:02 ` [PATCH 01/12] i2c: add " Bartosz Golaszewski
2025-12-25 18:30 ` kernel test robot
2025-12-25 19:33 ` kernel test robot
2025-12-23 10:02 ` [PATCH 02/12] i2c: sun6i-p2wi: use " Bartosz Golaszewski
2025-12-23 11:04 ` Chen-Yu Tsai
2025-12-23 10:02 ` [PATCH 03/12] i2c: mlxbf: " Bartosz Golaszewski
2025-12-23 10:02 ` [PATCH 04/12] i2c: isch: " Bartosz Golaszewski
2025-12-23 10:02 ` [PATCH 05/12] i2c: ali1535: " Bartosz Golaszewski
2025-12-23 10:02 ` [PATCH 06/12] i2c: scmi: " Bartosz Golaszewski
2025-12-23 10:02 ` [PATCH 07/12] i2c: ali15x3: " Bartosz Golaszewski
2025-12-23 10:02 ` [PATCH 08/12] i2c: powermac: " Bartosz Golaszewski
2025-12-23 10:02 ` [PATCH 09/12] i2c: owl: " Bartosz Golaszewski
2025-12-23 10:02 ` [PATCH 10/12] i2c: nforce2: " Bartosz Golaszewski
2025-12-23 10:02 ` [PATCH 11/12] i2c: amd756: " Bartosz Golaszewski
2025-12-23 10:02 ` [PATCH 12/12] i2c: piix4: " Bartosz Golaszewski
2025-12-23 14:23 ` [PATCH 00/12] i2c: add and start using " Johan Hovold
2025-12-23 15:11 ` Bartosz Golaszewski
2026-01-19 11:03 ` Johan Hovold
2026-01-19 11:17 ` Bartosz Golaszewski
2026-01-19 11:32 ` Johan Hovold [this message]
2026-01-13 10:03 ` Big I2C core changes coming up this year (was: " Wolfram Sang
2026-01-19 10:58 ` Johan Hovold
2026-01-13 10:44 ` Wolfram Sang
2026-01-13 10:59 ` Bartosz Golaszewski
2026-01-13 11:50 ` Wolfram Sang
2026-01-14 13:36 ` Bartosz Golaszewski
2026-01-14 15:22 ` Wolfram Sang
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=aW4WTP8ZJXIe4Mg1@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=afaerber@suse.de \
--cc=andi.shyti@kernel.org \
--cc=asmaa@nvidia.com \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=chleroy@kernel.org \
--cc=jdelvare@suse.com \
--cc=jernej.skrabec@gmail.com \
--cc=kblaiech@nvidia.com \
--cc=linux-actions@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mani@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=samuel@sholland.org \
--cc=wens@kernel.org \
--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