From: Michael Ellerman <mpe@ellerman.id.au>
To: Lukas Wunner <lukas@wunner.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
linux-kernel@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/6] driver core: Add device_show_string() helper for sysfs attributes
Date: Mon, 22 Apr 2024 15:38:54 +1000 [thread overview]
Message-ID: <87zftmj6s1.fsf@mail.lhotse> (raw)
In-Reply-To: <2e3eaaf2600bb55c0415c23ba301e809403a7aa2.1713608122.git.lukas@wunner.de>
Lukas Wunner <lukas@wunner.de> writes:
> For drivers wishing to expose an unsigned long, int or bool at a static
> memory location in sysfs, the driver core provides ready-made helpers
> such as device_show_ulong() to be used as ->show() callback.
>
> Some drivers need to expose a string and so far they all provide their
> own ->show() implementation. arch/powerpc/perf/hv-24x7.c went so far
> as to create a device_show_string() helper but kept it private.
>
> Make it public for reuse by other drivers. The pattern seems to be
> sufficiently frequent to merit a public helper.
>
> Add a DEVICE_STRING_ATTR_RO() macro in line with the existing
> DEVICE_ULONG_ATTR() and similar macros to ease declaration of string
> attributes.
>
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
> arch/powerpc/perf/hv-24x7.c | 10 ----------
> drivers/base/core.c | 9 +++++++++
> include/linux/device.h | 15 +++++++++++++++
> 3 files changed, 24 insertions(+), 10 deletions(-)
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
cheers
next prev parent reply other threads:[~2024-04-22 5:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-20 20:00 [PATCH 0/6] Deduplicate string exposure in sysfs Lukas Wunner
2024-04-20 20:00 ` [PATCH 1/6] driver core: Add device_show_string() helper for sysfs attributes Lukas Wunner
2024-04-22 5:38 ` Michael Ellerman [this message]
2024-05-04 14:31 ` [PATCH 0/6] Deduplicate string exposure in sysfs Lukas Wunner
2024-05-04 15:36 ` Greg Kroah-Hartman
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=87zftmj6s1.fsf@mail.lhotse \
--to=mpe@ellerman.id.au \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lukas@wunner.de \
--cc=rafael@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;
as well as URLs for NNTP newsgroup(s).