Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gpio: sysfs: Remove redundant check for struct gpio_chip

gpiochip_sysfs_unregister() is only called by gpiochip_remove() where
the struct gpio_chip is ensured.

Remove the redundant check.

Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://patch.msgid.link/20260223061726.82161-4-tzungbi@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

authored by

Tzung-Bi Shih and committed by
Bartosz Golaszewski
395b8e55 049f7113

+6 -11
+3 -8
drivers/gpio/gpiolib-sysfs.c
··· 1053 1053 return 0; 1054 1054 } 1055 1055 1056 - void gpiochip_sysfs_unregister(struct gpio_device *gdev) 1056 + void gpiochip_sysfs_unregister(struct gpio_chip *gc) 1057 1057 { 1058 + struct gpio_device *gdev = gc->gpiodev; 1058 1059 struct gpiodev_data *data; 1059 1060 struct gpio_desc *desc; 1060 - struct gpio_chip *chip; 1061 1061 1062 1062 guard(mutex)(&sysfs_lock); 1063 1063 ··· 1065 1065 if (!data) 1066 1066 return; 1067 1067 1068 - guard(srcu)(&gdev->srcu); 1069 - chip = srcu_dereference(gdev->chip, &gdev->srcu); 1070 - if (!chip) 1071 - return; 1072 - 1073 1068 /* unregister gpiod class devices owned by sysfs */ 1074 - for_each_gpio_desc_with_flag(chip, desc, GPIOD_FLAG_SYSFS) { 1069 + for_each_gpio_desc_with_flag(gc, desc, GPIOD_FLAG_SYSFS) { 1075 1070 gpiod_unexport_unlocked(desc); 1076 1071 gpiod_free(desc); 1077 1072 }
+2 -2
drivers/gpio/gpiolib-sysfs.h
··· 8 8 #ifdef CONFIG_GPIO_SYSFS 9 9 10 10 int gpiochip_sysfs_register(struct gpio_device *gdev); 11 - void gpiochip_sysfs_unregister(struct gpio_device *gdev); 11 + void gpiochip_sysfs_unregister(struct gpio_chip *gc); 12 12 13 13 #else 14 14 ··· 17 17 return 0; 18 18 } 19 19 20 - static inline void gpiochip_sysfs_unregister(struct gpio_device *gdev) 20 + static inline void gpiochip_sysfs_unregister(struct gpio_chip *gc) 21 21 { 22 22 } 23 23
+1 -1
drivers/gpio/gpiolib.c
··· 1286 1286 struct gpio_device *gdev = gc->gpiodev; 1287 1287 1288 1288 /* FIXME: should the legacy sysfs handling be moved to gpio_device? */ 1289 - gpiochip_sysfs_unregister(gdev); 1289 + gpiochip_sysfs_unregister(gc); 1290 1290 gpiochip_free_hogs(gc); 1291 1291 gpiochip_free_remaining_irqs(gc); 1292 1292