Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'gpio-fixes-for-v5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:

- fix an bug generating spurious interrupts in gpio-rockchip

- fix a race condition in gpiod_to_irq() called by GPIO consumers

* tag 'gpio-fixes-for-v5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
gpio: Return EPROBE_DEFER if gc->to_irq is NULL
gpio: rockchip: Reset int_bothedge when changing trigger

+39 -27
+29 -27
drivers/gpio/gpio-rockchip.c
··· 410 410 level = rockchip_gpio_readl(bank, bank->gpio_regs->int_type); 411 411 polarity = rockchip_gpio_readl(bank, bank->gpio_regs->int_polarity); 412 412 413 - switch (type) { 414 - case IRQ_TYPE_EDGE_BOTH: 413 + if (type == IRQ_TYPE_EDGE_BOTH) { 415 414 if (bank->gpio_type == GPIO_TYPE_V2) { 416 - bank->toggle_edge_mode &= ~mask; 417 415 rockchip_gpio_writel_bit(bank, d->hwirq, 1, 418 416 bank->gpio_regs->int_bothedge); 419 417 goto out; ··· 429 431 else 430 432 polarity |= mask; 431 433 } 432 - break; 433 - case IRQ_TYPE_EDGE_RISING: 434 - bank->toggle_edge_mode &= ~mask; 435 - level |= mask; 436 - polarity |= mask; 437 - break; 438 - case IRQ_TYPE_EDGE_FALLING: 439 - bank->toggle_edge_mode &= ~mask; 440 - level |= mask; 441 - polarity &= ~mask; 442 - break; 443 - case IRQ_TYPE_LEVEL_HIGH: 444 - bank->toggle_edge_mode &= ~mask; 445 - level &= ~mask; 446 - polarity |= mask; 447 - break; 448 - case IRQ_TYPE_LEVEL_LOW: 449 - bank->toggle_edge_mode &= ~mask; 450 - level &= ~mask; 451 - polarity &= ~mask; 452 - break; 453 - default: 454 - ret = -EINVAL; 455 - goto out; 434 + } else { 435 + if (bank->gpio_type == GPIO_TYPE_V2) { 436 + rockchip_gpio_writel_bit(bank, d->hwirq, 0, 437 + bank->gpio_regs->int_bothedge); 438 + } else { 439 + bank->toggle_edge_mode &= ~mask; 440 + } 441 + switch (type) { 442 + case IRQ_TYPE_EDGE_RISING: 443 + level |= mask; 444 + polarity |= mask; 445 + break; 446 + case IRQ_TYPE_EDGE_FALLING: 447 + level |= mask; 448 + polarity &= ~mask; 449 + break; 450 + case IRQ_TYPE_LEVEL_HIGH: 451 + level &= ~mask; 452 + polarity |= mask; 453 + break; 454 + case IRQ_TYPE_LEVEL_LOW: 455 + level &= ~mask; 456 + polarity &= ~mask; 457 + break; 458 + default: 459 + ret = -EINVAL; 460 + goto out; 461 + } 456 462 } 457 463 458 464 rockchip_gpio_writel(bank, level, bank->gpio_regs->int_type);
+10
drivers/gpio/gpiolib.c
··· 3147 3147 3148 3148 return retirq; 3149 3149 } 3150 + #ifdef CONFIG_GPIOLIB_IRQCHIP 3151 + if (gc->irq.chip) { 3152 + /* 3153 + * Avoid race condition with other code, which tries to lookup 3154 + * an IRQ before the irqchip has been properly registered, 3155 + * i.e. while gpiochip is still being brought up. 3156 + */ 3157 + return -EPROBE_DEFER; 3158 + } 3159 + #endif 3150 3160 return -ENXIO; 3151 3161 } 3152 3162 EXPORT_SYMBOL_GPL(gpiod_to_irq);