summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2020-03-03 13:35:10 +0100
committerLinus Walleij <linus.walleij@linaro.org>2020-03-03 13:35:10 +0100
commit5779925c23e1b9cc4cffb6dafe0b70a47beb364d (patch)
tree946c51e781077bc79388a69bd2156cbbfa8e234f /drivers/gpio/gpiolib.c
parentca18a852ee3696ea625efa13b1fac3c33f025a53 (diff)
parent1931479788c5e3c0396a0bde3606e517c64b9f95 (diff)
Merge tag 'gpio-updates-for-v5.7-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into devel
gpio updates for v5.7 part 2 - replace z zero-length array with flexible-array member in gpio-uniphier - make naming of variables consistent in uapi line event code - fix the behavior of line watch/unwatch ioctl()
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 0879731caf25..02f8b2b81199 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -830,11 +830,11 @@ static ssize_t lineevent_read(struct file *filep,
loff_t *f_ps)
{
struct lineevent_state *le = filep->private_data;
- struct gpioevent_data event;
+ struct gpioevent_data ge;
ssize_t bytes_read = 0;
int ret;
- if (count < sizeof(event))
+ if (count < sizeof(ge))
return -EINVAL;
do {
@@ -858,7 +858,7 @@ static ssize_t lineevent_read(struct file *filep,
}
}
- ret = kfifo_out(&le->events, &event, 1);
+ ret = kfifo_out(&le->events, &ge, 1);
spin_unlock(&le->wait.lock);
if (ret != 1) {
/*
@@ -870,10 +870,10 @@ static ssize_t lineevent_read(struct file *filep,
break;
}
- if (copy_to_user(buf + bytes_read, &event, sizeof(event)))
+ if (copy_to_user(buf + bytes_read, &ge, sizeof(ge)))
return -EFAULT;
- bytes_read += sizeof(event);
- } while (count >= bytes_read + sizeof(event));
+ bytes_read += sizeof(ge);
+ } while (count >= bytes_read + sizeof(ge));
return bytes_read;
}
@@ -1261,7 +1261,7 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
return -EFAULT;
if (cmd == GPIO_GET_LINEINFO_WATCH_IOCTL)
- set_bit(desc_to_gpio(desc), priv->watched_lines);
+ set_bit(gpio_chip_hwgpio(desc), priv->watched_lines);
return 0;
} else if (cmd == GPIO_GET_LINEHANDLE_IOCTL) {
@@ -1276,7 +1276,7 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (IS_ERR(desc))
return PTR_ERR(desc);
- clear_bit(desc_to_gpio(desc), &desc->flags);
+ clear_bit(gpio_chip_hwgpio(desc), priv->watched_lines);
return 0;
}
return -EINVAL;
@@ -1304,7 +1304,7 @@ static int lineinfo_changed_notify(struct notifier_block *nb,
struct gpio_desc *desc = data;
int ret;
- if (!test_bit(desc_to_gpio(desc), priv->watched_lines))
+ if (!test_bit(gpio_chip_hwgpio(desc), priv->watched_lines))
return NOTIFY_DONE;
memset(&chg, 0, sizeof(chg));