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

Merge tag 'gpio-v3.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull gpio fixes from Linus Walleij:
"A small batch of GPIO fixes for the v3.15 series. I expect more to
come in but I'm a bit behind on mail, might as well get these to you
right now:

- Change a crucial semantic ordering in the GPIO irqchip helpers

- Fix two nasty regressions in the ACPI gpiolib extensions"

* tag 'gpio-v3.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
gpio / ACPI: Prevent potential wrap of GPIO value on OpRegion read
gpio / ACPI: Don't crash on NULL chip->dev
gpio: set data first, then chip and handler

+10 -4
+9 -3
drivers/gpio/gpiolib-acpi.c
··· 233 233 { 234 234 struct gpio_chip *chip = acpi_gpio->chip; 235 235 236 - if (!chip->dev || !chip->to_irq) 236 + if (!chip->to_irq) 237 237 return; 238 238 239 239 INIT_LIST_HEAD(&acpi_gpio->events); ··· 253 253 struct acpi_gpio_event *event, *ep; 254 254 struct gpio_chip *chip = acpi_gpio->chip; 255 255 256 - if (!chip->dev || !chip->to_irq) 256 + if (!chip->to_irq) 257 257 return; 258 258 259 259 list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { ··· 451 451 if (function == ACPI_WRITE) 452 452 gpiod_set_raw_value(desc, !!((1 << i) & *value)); 453 453 else 454 - *value |= gpiod_get_raw_value(desc) << i; 454 + *value |= (u64)gpiod_get_raw_value(desc) << i; 455 455 } 456 456 457 457 out: ··· 501 501 acpi_handle handle; 502 502 acpi_status status; 503 503 504 + if (!chip || !chip->dev) 505 + return; 506 + 504 507 handle = ACPI_HANDLE(chip->dev); 505 508 if (!handle) 506 509 return; ··· 533 530 struct acpi_gpio_chip *acpi_gpio; 534 531 acpi_handle handle; 535 532 acpi_status status; 533 + 534 + if (!chip || !chip->dev) 535 + return; 536 536 537 537 handle = ACPI_HANDLE(chip->dev); 538 538 if (!handle)
+1 -1
drivers/gpio/gpiolib.c
··· 1387 1387 { 1388 1388 struct gpio_chip *chip = d->host_data; 1389 1389 1390 - irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler); 1391 1390 irq_set_chip_data(irq, chip); 1391 + irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler); 1392 1392 #ifdef CONFIG_ARM 1393 1393 set_irq_flags(irq, IRQF_VALID); 1394 1394 #else