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()
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAl5cvT4ACgkQEacuoBRx
 13IiXRAA4O77PW0rci/y/PGaCxo+vk8TV2UVod2b/6I6Vv/+x9Tnf6saFMhC/zFr
 oEb2EUCzXnPJfrmToiICKm9eoY0WpvQBYDAbkzWoSOclXM7dgRMMB95wFa83zMKO
 /V7sn9XCLHijz6eT7jKaU6cXa+EalB4FCe8DGrYMn8CL/dFAcsJvyYylcgRnTrvI
 p3Ss0HYw7prRPYCyyn1odJdR9NdCMuK4D1gyOHnKboE7ejeVVzQog8s5OI50PQ1E
 K07/gh4SGTht0NyR9WrHPYoTWW9CqpdKDeBMhIWmvzwH6olv2OMhVWoK/6yF++Cn
 Ns9vmrQk3hKr+uvq9ifJfI7+XE/25bNsouS5aUb/bkSoOrz5cwBw7dDAFoS8M2o3
 BNLRZc3JUbB93HUG+zImj1yT8l9MhWGK5RQk4xoi+Azu2+S3xgfMYslZ3OmQgIXS
 LpFeWaMORa+krilaHNnv1NV3ipRkHiSlMEe8u2Zf9MOq4GeIN7UnVLtn/vHxQuhi
 U+OczqRCgaMNZSfawWIdMEi10XKXqMcEMnjkMbJnsMoyhkF68926pVvpQwttOapC
 tED3I1J8T8cVhwHzoqzaB6AdzrEG18L7scGRWLcpMZdTghA6zCrG0TxoTc0wuSoj
 FQ4tEKJx71r3q/KPVAOMRnA2d4rTpE18/9CWcEb52N2olYpMsiI=
 =ASHn
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Linus Walleij 2020-03-03 13:35:10 +01:00
commit 5779925c23
2 changed files with 10 additions and 10 deletions

View File

@ -30,7 +30,7 @@ struct uniphier_gpio_priv {
struct irq_domain *domain;
void __iomem *regs;
spinlock_t lock;
u32 saved_vals[0];
u32 saved_vals[];
};
static unsigned int uniphier_gpio_bank_to_reg(unsigned int bank)

View File

@ -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));