Devicetree
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "James Hilliard" <james.hilliard1@gmail.com>,
	"Lee Jones" <lee@kernel.org>, "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>
Cc: mfd@lists.linux.dev, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/3] mfd: syscon: Add managed registration for external regmaps
Date: Tue, 11 Aug 2026 10:46:19 +0200	[thread overview]
Message-ID: <159b4ed3-3718-4563-badd-3627bc51a41b@app.fastmail.com> (raw)
In-Reply-To: <20260811-submit-ac200-mfd-v6-2-c5b1292c8498@gmail.com>

On Tue, Aug 11, 2026, at 10:27, James Hilliard wrote:
> of_syscon_register_regmap() publishes an externally owned regmap in the
> global syscon list, but provides no way for a removable driver to
> withdraw it. Registering a devm-managed regmap from such a driver would
> therefore leave a stale pointer after unbind.
>
> Factor external registration through an internal helper and add
> devm_of_syscon_register_regmap(). The managed action removes the entry
> under the syscon list lock before later devres actions release the
> regmap. Hold a device-node reference for the lifetime of every
> externally registered entry so its lookup key also remains valid.
>
> Consumers of a removable provider remain responsible for ordering
> teardown, for example with a managed device link.
>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>

Hi James,

I don't think this is the right way to do it. As far as I can tell,
the device you have here is a generic mfd that uses a regmap, which
is not the same thing we usually call a syscon.

The of_syscon_register_regmap() code path was added specifically
for chips that have a traditional syscon but depending on the
firmware may have to access this by some other means. This is
already stretching the definition of syscon. I don't think we
should take this further and allow normal device drivers like
yours to register through the syscon framework.

Since you already have a top-level mfd device here, just use
that to pass the regmap to the child devices like we do for
other mfd drivers. You can e.g. do this when populating the child
devices through platform_data, or get the pointer from the
parent drvdata.

     Arnd

  reply	other threads:[~2026-08-11  8:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11  8:27 [PATCH v6 0/3] mfd: add X-Powers AC200 support James Hilliard
2026-08-11  8:27 ` [PATCH v6 1/3] dt-bindings: mfd: x-powers: Add AC200 James Hilliard
2026-08-11  8:27 ` [PATCH v6 2/3] mfd: syscon: Add managed registration for external regmaps James Hilliard
2026-08-11  8:46   ` Arnd Bergmann [this message]
2026-08-11  9:17     ` James Hilliard
2026-08-11 11:03       ` Arnd Bergmann
2026-08-11  8:27 ` [PATCH v6 3/3] mfd: ac200: Add X-Powers AC200 support James Hilliard

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=159b4ed3-3718-4563-badd-3627bc51a41b@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    /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