gpio: sysfs: remove the mockdev pointer from struct gpio_device
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 10 Jun 2025 14:38:21 +0000 (16:38 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 20 Jun 2025 07:29:15 +0000 (09:29 +0200)
commitfd19792851db77e74cff4e2dc772d25a83cdc34d
treec645b0f81aac16433ccd40a93a3e173a27429516
parent982ec96c3876349e65e60c7b4fd91d767099837e
gpio: sysfs: remove the mockdev pointer from struct gpio_device

The usage of the mockdev pointer in struct gpio_device is limited to the
GPIO sysfs code. There's no reason to keep it in this top-level
structure. Create a separate structure containing the reference to the
GPIO device and the dummy class device that will be passed to
device_create_with_groups(). The !gdev->mockdev checks can be removed as
long as we make sure that all operations on the GPIO class are protected
with the sysfs lock.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250610-gpio-sysfs-chip-export-v1-6-a8c7aa4478b1@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpiolib-sysfs.c
drivers/gpio/gpiolib.h