Skip to content

Commit 397a46c

Browse files
author
Bartosz Golaszewski
committed
gpio: remove legacy GPIO line value setter callbacks
With no more users of the legacy GPIO line value setters - .set() and .set_multiple() - we can now remove them from the kernel. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 0074281 commit 397a46c

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

drivers/gpio/gpiolib.c

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,11 +1037,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
10371037
int base = 0;
10381038
int ret;
10391039

1040-
/* Only allow one set() and one set_multiple(). */
1041-
if ((gc->set && gc->set_rv) ||
1042-
(gc->set_multiple && gc->set_multiple_rv))
1043-
return -EINVAL;
1044-
10451040
/*
10461041
* First: allocate and populate the internal stat container, and
10471042
* set up the struct device.
@@ -2891,19 +2886,14 @@ static int gpiochip_set(struct gpio_chip *gc, unsigned int offset, int value)
28912886

28922887
lockdep_assert_held(&gc->gpiodev->srcu);
28932888

2894-
if (WARN_ON(unlikely(!gc->set && !gc->set_rv)))
2889+
if (WARN_ON(unlikely(!gc->set_rv)))
28952890
return -EOPNOTSUPP;
28962891

2897-
if (gc->set_rv) {
2898-
ret = gc->set_rv(gc, offset, value);
2899-
if (ret > 0)
2900-
ret = -EBADE;
2901-
2902-
return ret;
2903-
}
2892+
ret = gc->set_rv(gc, offset, value);
2893+
if (ret > 0)
2894+
ret = -EBADE;
29042895

2905-
gc->set(gc, offset, value);
2906-
return 0;
2896+
return ret;
29072897
}
29082898

29092899
static int gpiod_direction_output_raw_commit(struct gpio_desc *desc, int value)
@@ -2919,7 +2909,7 @@ static int gpiod_direction_output_raw_commit(struct gpio_desc *desc, int value)
29192909
* output-only, but if there is then not even a .set() operation it
29202910
* is pretty tricky to drive the output line.
29212911
*/
2922-
if (!guard.gc->set && !guard.gc->set_rv && !guard.gc->direction_output) {
2912+
if (!guard.gc->set_rv && !guard.gc->direction_output) {
29232913
gpiod_warn(desc,
29242914
"%s: missing set() and direction_output() operations\n",
29252915
__func__);
@@ -3673,11 +3663,6 @@ static int gpiochip_set_multiple(struct gpio_chip *gc,
36733663
return ret;
36743664
}
36753665

3676-
if (gc->set_multiple) {
3677-
gc->set_multiple(gc, mask, bits);
3678-
return 0;
3679-
}
3680-
36813666
/* set outputs if the corresponding mask bit is set */
36823667
for_each_set_bit(i, mask, gc->ngpio) {
36833668
ret = gpiochip_set(gc, i, test_bit(i, bits));

include/linux/gpio/driver.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,6 @@ struct gpio_irq_chip {
347347
* @get: returns value for signal "offset", 0=low, 1=high, or negative error
348348
* @get_multiple: reads values for multiple signals defined by "mask" and
349349
* stores them in "bits", returns 0 on success or negative error
350-
* @set: **DEPRECATED** - please use set_rv() instead
351-
* @set_multiple: **DEPRECATED** - please use set_multiple_rv() instead
352350
* @set_rv: assigns output value for signal "offset", returns 0 on success or
353351
* negative error value
354352
* @set_multiple_rv: assigns output values for multiple signals defined by
@@ -445,11 +443,6 @@ struct gpio_chip {
445443
int (*get_multiple)(struct gpio_chip *gc,
446444
unsigned long *mask,
447445
unsigned long *bits);
448-
void (*set)(struct gpio_chip *gc,
449-
unsigned int offset, int value);
450-
void (*set_multiple)(struct gpio_chip *gc,
451-
unsigned long *mask,
452-
unsigned long *bits);
453446
int (*set_rv)(struct gpio_chip *gc,
454447
unsigned int offset,
455448
int value);

0 commit comments

Comments
 (0)