Re: [PATCH] gpio: sysfs: use const APIs for legacy sysfs attributes

From: Thomas Weißschuh

Date: Wed Oct 21 2026 - 07:18:01 EST


On Wed, Oct 21, 2026 at 12:47:25PM +0200, Bartosz Golaszewski wrote:
> Replace the deprecated non-const sysfs attribute APIs with modern const
> variants where applicable. This leaves out the attributes embedded in
> struct gpiod_data as this structure contains fields that are modified at
> run-time.

Leaving the dynamically allocated attributes with non-const signatures will
make it harder to remove the non-const APIs later on.
Would it be possible to switch those to const signatures, too and cast away
the constness in the store handlers?
I see that this is a legacy interface anyways, which might be gone by the
time we want to remove the non-const APIs. But that applies to the
currently proposed changes, too.

> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>

The code looks good.

Reviewed-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>

> ---
> drivers/gpio/gpiolib-sysfs.c | 37 ++++++++++++++++++-------------------
> 1 file changed, 18 insertions(+), 19 deletions(-)

(...)