Skip to content

Commit f067372

Browse files
author
Bartosz Golaszewski
committed
gpio: remove the RW semaphore from the GPIO device
With all accesses to gdev->chip being protected with SRCU, we can now remove the RW-semaphore specific to the character device which fulfilled the same role up to this point. Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Acked-by: Andy Shevchenko <[email protected]>
1 parent d83cee3 commit f067372

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

drivers/gpio/gpiolib.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
963963

964964
BLOCKING_INIT_NOTIFIER_HEAD(&gdev->line_state_notifier);
965965
BLOCKING_INIT_NOTIFIER_HEAD(&gdev->device_notifier);
966-
init_rwsem(&gdev->sem);
967966

968967
ret = init_srcu_struct(&gdev->srcu);
969968
if (ret)
@@ -1102,8 +1101,6 @@ void gpiochip_remove(struct gpio_chip *gc)
11021101
struct gpio_device *gdev = gc->gpiodev;
11031102
unsigned int i;
11041103

1105-
down_write(&gdev->sem);
1106-
11071104
/* FIXME: should the legacy sysfs handling be moved to gpio_device? */
11081105
gpiochip_sysfs_unregister(gdev);
11091106
gpiochip_free_hogs(gc);
@@ -1142,7 +1139,6 @@ void gpiochip_remove(struct gpio_chip *gc)
11421139
* gone.
11431140
*/
11441141
gcdev_unregister(gdev);
1145-
up_write(&gdev->sem);
11461142
gpio_device_put(gdev);
11471143
}
11481144
EXPORT_SYMBOL_GPL(gpiochip_remove);

drivers/gpio/gpiolib.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <linux/gpio/driver.h>
1717
#include <linux/module.h>
1818
#include <linux/notifier.h>
19-
#include <linux/rwsem.h>
2019
#include <linux/srcu.h>
2120

2221
#define GPIOCHIP_NAME "gpiochip"
@@ -46,9 +45,6 @@
4645
* requested, released or reconfigured
4746
* @device_notifier: used to notify character device wait queues about the GPIO
4847
* device being unregistered
49-
* @sem: protects the structure from a NULL-pointer dereference of @chip by
50-
* user-space operations when the device gets unregistered during
51-
* a hot-unplug event
5248
* @srcu: protects the pointer to the underlying GPIO chip
5349
* @pin_ranges: range of pins served by the GPIO driver
5450
*
@@ -73,7 +69,6 @@ struct gpio_device {
7369
struct list_head list;
7470
struct blocking_notifier_head line_state_notifier;
7571
struct blocking_notifier_head device_notifier;
76-
struct rw_semaphore sem;
7772
struct srcu_struct srcu;
7873

7974
#ifdef CONFIG_PINCTRL

0 commit comments

Comments
 (0)