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-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:

- fix IRQ initialization in gpiochip_irqchip_add_domain()

- add a missing return value check for platform_get_irq() in
gpio-sifive

- don't free irq_domains which GPIOLIB does not manage

* tag 'gpio-fixes-for-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
gpiolib: Fix irq_domain resource tracking for gpiochip_irqchip_add_domain()
gpio: sifive: add missing check for platform_get_irq
gpiolib: Fix GPIO chip IRQ initialization restriction

+24 -3
+6 -2
drivers/gpio/gpio-sifive.c
··· 221 221 return -ENODEV; 222 222 } 223 223 224 - for (i = 0; i < ngpio; i++) 225 - chip->irq_number[i] = platform_get_irq(pdev, i); 224 + for (i = 0; i < ngpio; i++) { 225 + ret = platform_get_irq(pdev, i); 226 + if (ret < 0) 227 + return ret; 228 + chip->irq_number[i] = ret; 229 + } 226 230 227 231 ret = bgpio_init(&chip->gc, dev, 4, 228 232 chip->base + SIFIVE_GPIO_INPUT_VAL,
+10 -1
drivers/gpio/gpiolib.c
··· 1745 1745 } 1746 1746 1747 1747 /* Remove all IRQ mappings and delete the domain */ 1748 - if (gc->irq.domain) { 1748 + if (!gc->irq.domain_is_allocated_externally && gc->irq.domain) { 1749 1749 unsigned int irq; 1750 1750 1751 1751 for (offset = 0; offset < gc->ngpio; offset++) { ··· 1791 1791 1792 1792 gc->to_irq = gpiochip_to_irq; 1793 1793 gc->irq.domain = domain; 1794 + gc->irq.domain_is_allocated_externally = true; 1795 + 1796 + /* 1797 + * Using barrier() here to prevent compiler from reordering 1798 + * gc->irq.initialized before adding irqdomain. 1799 + */ 1800 + barrier(); 1801 + 1802 + gc->irq.initialized = true; 1794 1803 1795 1804 return 0; 1796 1805 }
+8
include/linux/gpio/driver.h
··· 252 252 bool initialized; 253 253 254 254 /** 255 + * @domain_is_allocated_externally: 256 + * 257 + * True it the irq_domain was allocated outside of gpiolib, in which 258 + * case gpiolib won't free the irq_domain itself. 259 + */ 260 + bool domain_is_allocated_externally; 261 + 262 + /** 255 263 * @init_hw: optional routine to initialize hardware before 256 264 * an IRQ chip will be added. This is quite useful when 257 265 * a particular driver wants to clear IRQ related registers