Skip to contentSkip to conversation

gpio: sysfs: constify gpio class

PATCH Applied Bartosz Golaszewski 2 participants 3 messages Oct 14, 2024 – Oct 17, 2024 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: sysfs: constify gpio class

From: Bartosz Golaszewski <[email protected]>

All class functions used here take a const pointer to the class structure. We can constify gpio_class.

While at it: remove a stray newline and use a tab in the struct definition for consistency with the line above.

---
 drivers/gpio/gpiolib-sysfs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpio/gpiolib-sysfs.c +2 -3
index 20426d6e04d5..0c713baa7784 100644
@@ -549,12 +549,11 @@ static struct attribute *gpio_class_attrs[] = {
 };
 ATTRIBUTE_GROUPS(gpio_class);
 
-static struct class gpio_class = {
+static const struct class gpio_class = {
 	.name =		"gpio",
-	.class_groups = gpio_class_groups,
+	.class_groups =	gpio_class_groups,
 };
 
-
 /**
  * gpiod_export - export a GPIO through sysfs
  * @desc: GPIO to make available, already requested
Signature · 1 line
2.43.0
author Applied
#2 lore raw
In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Quoted 8 lines · Bartosz Golaszewski

All class functions used here take a const pointer to the class structure. We can constify gpio_class.

While at it: remove a stray newline and use a tab in the struct definition for consistency with the line above.

[...]

Applied, thanks!

[1/1] gpio: sysfs: constify gpio class

      commit: b6f7aeaf1bfd8d78d55868f0857e397b06a01777

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>