gpio fixes for v6.7-rc7
- add protection against GPIO device removal to an overlooked ioctl() - synchronize the interrupt mask register manually in gpio-dwapb -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmWFXYkACgkQEacuoBRx 13IsAA/+K6QiKybX9tWQ6jSSWwrye3mu/mT7UHCmVOFDhmbvCUfFMnIBPAqf5cad r1dgsEofRYCSkQm3e+lackkx+JrJfYOzOLkIvrXSOktePUAA1ZhP7FLZOtQ2Dm4B 08hV5v9LQOw/HoXJiDHqohQcn/JKie/sE74wiCJiUmANml5nfbr8cirMJ69QMYJW Ua6kjglaNroWCEOvz+q3/0hMVJtAq4ND7BSkk70aMPXa11UUVmoD3k2CHQAXtjX+ w66L8HbVliAxnWaale6kXB83ST8qxQ9UBnA/2z03hunD7VfJuN1wFEs6HzxMV4pm vZE84X3/GHFBqJ2VG/u5GJuaZvYltuTmFmsEjVbKBsm/ZkCPpGEAsTnAmjUvb+tu MvT+cfhHOHW0BAgFf4T/tyxmeumE1T5zYyXiH+x49g7VaxLWcu37pUKwPtiRSEBy XC4FrXMsMQ2brIYnSZJWaGd8PFNaAyOycSLhe59xpOrZriDXWhvPXjjwz7KEUtNB FNceb67HKYZ/ZQErqCPFUj3OvJql4T3VaRTswJEemo9SVUUELW+UioECpjrid4zk cxKlZ/uffNwfBVXNCdac91lIkTWAKvReruna4sta/CZwAr4YtAbFz1DrA5Q11iBL nD2DxIItY3Lb0G3S6FRGOjIU84zd9r72+jlXzHcO1fLnVIqnyRM= =sKPW -----END PGP SIGNATURE----- Merge tag 'gpio-fixes-for-v6.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull gpio fixes from Bartosz Golaszewski: "Here's another round of fixes from the GPIO subsystem for this release cycle. There's one commit adding synchronization to an ioctl() we overlooked previously and another synchronization changeset for one of the drivers: - add protection against GPIO device removal to an overlooked ioctl() - synchronize the interrupt mask register manually in gpio-dwapb" * tag 'gpio-fixes-for-v6.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: dwapb: mask/unmask IRQ when disable/enale it gpiolib: cdev: add gpio_device locking wrapper around gpio_ioctl()
This commit is contained in:
commit
a9ca0330d2
@ -282,13 +282,15 @@ static void dwapb_irq_enable(struct irq_data *d)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
struct dwapb_gpio *gpio = to_dwapb_gpio(gc);
|
||||
irq_hw_number_t hwirq = irqd_to_hwirq(d);
|
||||
unsigned long flags;
|
||||
u32 val;
|
||||
|
||||
raw_spin_lock_irqsave(&gc->bgpio_lock, flags);
|
||||
val = dwapb_read(gpio, GPIO_INTEN);
|
||||
val |= BIT(irqd_to_hwirq(d));
|
||||
val = dwapb_read(gpio, GPIO_INTEN) | BIT(hwirq);
|
||||
dwapb_write(gpio, GPIO_INTEN, val);
|
||||
val = dwapb_read(gpio, GPIO_INTMASK) & ~BIT(hwirq);
|
||||
dwapb_write(gpio, GPIO_INTMASK, val);
|
||||
raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags);
|
||||
}
|
||||
|
||||
@ -296,12 +298,14 @@ static void dwapb_irq_disable(struct irq_data *d)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
struct dwapb_gpio *gpio = to_dwapb_gpio(gc);
|
||||
irq_hw_number_t hwirq = irqd_to_hwirq(d);
|
||||
unsigned long flags;
|
||||
u32 val;
|
||||
|
||||
raw_spin_lock_irqsave(&gc->bgpio_lock, flags);
|
||||
val = dwapb_read(gpio, GPIO_INTEN);
|
||||
val &= ~BIT(irqd_to_hwirq(d));
|
||||
val = dwapb_read(gpio, GPIO_INTMASK) | BIT(hwirq);
|
||||
dwapb_write(gpio, GPIO_INTMASK, val);
|
||||
val = dwapb_read(gpio, GPIO_INTEN) & ~BIT(hwirq);
|
||||
dwapb_write(gpio, GPIO_INTEN, val);
|
||||
raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags);
|
||||
}
|
||||
|
@ -2481,10 +2481,7 @@ static int lineinfo_unwatch(struct gpio_chardev_data *cdev, void __user *ip)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gpio_ioctl() - ioctl handler for the GPIO chardev
|
||||
*/
|
||||
static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
static long gpio_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct gpio_chardev_data *cdev = file->private_data;
|
||||
struct gpio_device *gdev = cdev->gdev;
|
||||
@ -2521,6 +2518,17 @@ static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gpio_ioctl() - ioctl handler for the GPIO chardev
|
||||
*/
|
||||
static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct gpio_chardev_data *cdev = file->private_data;
|
||||
|
||||
return call_ioctl_locked(file, cmd, arg, cdev->gdev,
|
||||
gpio_ioctl_unlocked);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static long gpio_ioctl_compat(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
|
Loading…
x
Reference in New Issue
Block a user