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

Merge tag 'gpio-5.0-rc4-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into fixes

GPIO fixes for 5.0-rc4

- fix from Roger Quadros for a warning resulting from reusing the same
irqchip for multiple pcf857x instances
- fix for missing line event timestamp when using nested interrupts
- two fixes for the sprd driver dealing with value reading and
the irq chip
- fix for the direction_output callback for altera-a10sr

+36 -17
+3 -1
drivers/gpio/gpio-altera-a10sr.c
··· 66 66 static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc, 67 67 unsigned int nr, int value) 68 68 { 69 - if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) 69 + if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) { 70 + altr_a10sr_gpio_set(gc, nr, value); 70 71 return 0; 72 + } 71 73 return -EINVAL; 72 74 } 73 75
+13 -1
drivers/gpio/gpio-eic-sprd.c
··· 180 180 181 181 static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset) 182 182 { 183 - return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); 183 + struct sprd_eic *sprd_eic = gpiochip_get_data(chip); 184 + 185 + switch (sprd_eic->type) { 186 + case SPRD_EIC_DEBOUNCE: 187 + return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); 188 + case SPRD_EIC_ASYNC: 189 + return sprd_eic_read(chip, offset, SPRD_EIC_ASYNC_DATA); 190 + case SPRD_EIC_SYNC: 191 + return sprd_eic_read(chip, offset, SPRD_EIC_SYNC_DATA); 192 + default: 193 + return -ENOTSUPP; 194 + } 184 195 } 185 196 186 197 static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset) ··· 379 368 irq_set_handler_locked(data, handle_edge_irq); 380 369 break; 381 370 case IRQ_TYPE_EDGE_BOTH: 371 + sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0); 382 372 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1); 383 373 irq_set_handler_locked(data, handle_edge_irq); 384 374 break;
+12 -14
drivers/gpio/gpio-pcf857x.c
··· 84 84 */ 85 85 struct pcf857x { 86 86 struct gpio_chip chip; 87 + struct irq_chip irqchip; 87 88 struct i2c_client *client; 88 89 struct mutex lock; /* protect 'out' */ 89 90 unsigned out; /* software latch */ ··· 253 252 mutex_unlock(&gpio->lock); 254 253 } 255 254 256 - static struct irq_chip pcf857x_irq_chip = { 257 - .name = "pcf857x", 258 - .irq_enable = pcf857x_irq_enable, 259 - .irq_disable = pcf857x_irq_disable, 260 - .irq_ack = noop, 261 - .irq_mask = noop, 262 - .irq_unmask = noop, 263 - .irq_set_wake = pcf857x_irq_set_wake, 264 - .irq_bus_lock = pcf857x_irq_bus_lock, 265 - .irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, 266 - }; 267 - 268 255 /*-------------------------------------------------------------------------*/ 269 256 270 257 static int pcf857x_probe(struct i2c_client *client, ··· 365 376 366 377 /* Enable irqchip if we have an interrupt */ 367 378 if (client->irq) { 379 + gpio->irqchip.name = "pcf857x", 380 + gpio->irqchip.irq_enable = pcf857x_irq_enable, 381 + gpio->irqchip.irq_disable = pcf857x_irq_disable, 382 + gpio->irqchip.irq_ack = noop, 383 + gpio->irqchip.irq_mask = noop, 384 + gpio->irqchip.irq_unmask = noop, 385 + gpio->irqchip.irq_set_wake = pcf857x_irq_set_wake, 386 + gpio->irqchip.irq_bus_lock = pcf857x_irq_bus_lock, 387 + gpio->irqchip.irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, 368 388 status = gpiochip_irqchip_add_nested(&gpio->chip, 369 - &pcf857x_irq_chip, 389 + &gpio->irqchip, 370 390 0, handle_level_irq, 371 391 IRQ_TYPE_NONE); 372 392 if (status) { ··· 390 392 if (status) 391 393 goto fail; 392 394 393 - gpiochip_set_nested_irqchip(&gpio->chip, &pcf857x_irq_chip, 395 + gpiochip_set_nested_irqchip(&gpio->chip, &gpio->irqchip, 394 396 client->irq); 395 397 gpio->irq_parent = client->irq; 396 398 }
+8 -1
drivers/gpio/gpiolib.c
··· 828 828 /* Do not leak kernel stack to userspace */ 829 829 memset(&ge, 0, sizeof(ge)); 830 830 831 - ge.timestamp = le->timestamp; 831 + /* 832 + * We may be running from a nested threaded interrupt in which case 833 + * we didn't get the timestamp from lineevent_irq_handler(). 834 + */ 835 + if (!le->timestamp) 836 + ge.timestamp = ktime_get_real_ns(); 837 + else 838 + ge.timestamp = le->timestamp; 832 839 833 840 if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE 834 841 && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) {