[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zftmj6s1.fsf@mail.lhotse>
Date: Mon, 22 Apr 2024 15:38:54 +1000
From: Michael Ellerman <mpe@...erman.id.au>
To: Lukas Wunner <lukas@...ner.de>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
linux-kernel@...r.kernel.org
Cc: linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH 1/6] driver core: Add device_show_string() helper for
sysfs attributes
Lukas Wunner <lukas@...ner.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@...ner.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@...erman.id.au> (powerpc)
cheers
Powered by blists - more mailing lists