From: Sander Vanheule <sander@svanheule.net>
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regmap: define cleanup helper for regmap_field
Date: Fri, 20 Feb 2026 16:59:59 +0100 [thread overview]
Message-ID: <7698648ffb4515b7d6b3b5e3d6c62042e8d8dcc8.camel@svanheule.net> (raw)
In-Reply-To: <4ddbaa4d-7dc5-4fbe-aadd-d903b3e99778@sirena.org.uk>
On Fri, 2026-02-20 at 15:43 +0000, Mark Brown wrote:
> On Fri, Feb 20, 2026 at 04:36:46PM +0100, Sander Vanheule wrote:
>
> > struct regmap_field *field = regmap_field_alloc(...);
> > if (!field)
> > return -ENOMEM;
> >
> > int err = regmap_field_write(...);
> >
> > regmap_field_free(field);
> >
> > return err;
>
> That seems like a bit of an odd pattern, I'd expect the fields to live
> for the lifetime of the driver rather than a function. OTOH if people
> are doing that then sure.
That is usually the case yes. I did find myself using devm_regmap_field_alloc()
in a proposed driver [1] to avoid goto's in less trivial logic. I'll update the
example in v2 to show the benefit a bit more.
[1] https://lore.kernel.org/all/20251215175115.135294-5-sander@svanheule.net/
Best,
Sander
prev parent reply other threads:[~2026-02-20 16:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-20 15:36 Sander Vanheule
2026-02-20 15:40 ` Sander Vanheule
2026-02-20 15:43 ` Mark Brown
2026-02-20 15:59 ` Sander Vanheule [this message]
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=7698648ffb4515b7d6b3b5e3d6c62042e8d8dcc8.camel@svanheule.net \
--to=sander@svanheule.net \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®