diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-22 12:28:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-22 12:28:02 -0400 |
commit | 4d0fa8a0f01272d4de33704f20303dcecdb55df1 (patch) | |
tree | 28082c3272c174774eea029d05f439cadcee3aad | |
parent | 39bfe90706ab0f588db7cb4d1c0e6d1181e1d2f9 (diff) | |
parent | b5539fa2d59d697b7b8e28b4d08da844ff60f7cf (diff) |
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
-rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 12 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index bf0f8b476696..401add28933f 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -233,7 +233,7 @@ static void acpi_gpiochip_request_interrupts(struct acpi_gpio_chip *acpi_gpio) | |||
233 | { | 233 | { |
234 | struct gpio_chip *chip = acpi_gpio->chip; | 234 | struct gpio_chip *chip = acpi_gpio->chip; |
235 | 235 | ||
236 | if (!chip->dev || !chip->to_irq) | 236 | if (!chip->to_irq) |
237 | return; | 237 | return; |
238 | 238 | ||
239 | INIT_LIST_HEAD(&acpi_gpio->events); | 239 | INIT_LIST_HEAD(&acpi_gpio->events); |
@@ -253,7 +253,7 @@ static void acpi_gpiochip_free_interrupts(struct acpi_gpio_chip *acpi_gpio) | |||
253 | struct acpi_gpio_event *event, *ep; | 253 | struct acpi_gpio_event *event, *ep; |
254 | struct gpio_chip *chip = acpi_gpio->chip; | 254 | struct gpio_chip *chip = acpi_gpio->chip; |
255 | 255 | ||
256 | if (!chip->dev || !chip->to_irq) | 256 | if (!chip->to_irq) |
257 | return; | 257 | return; |
258 | 258 | ||
259 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { | 259 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { |
@@ -451,7 +451,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, | |||
451 | if (function == ACPI_WRITE) | 451 | if (function == ACPI_WRITE) |
452 | gpiod_set_raw_value(desc, !!((1 << i) & *value)); | 452 | gpiod_set_raw_value(desc, !!((1 << i) & *value)); |
453 | else | 453 | else |
454 | *value |= gpiod_get_raw_value(desc) << i; | 454 | *value |= (u64)gpiod_get_raw_value(desc) << i; |
455 | } | 455 | } |
456 | 456 | ||
457 | out: | 457 | out: |
@@ -501,6 +501,9 @@ void acpi_gpiochip_add(struct gpio_chip *chip) | |||
501 | acpi_handle handle; | 501 | acpi_handle handle; |
502 | acpi_status status; | 502 | acpi_status status; |
503 | 503 | ||
504 | if (!chip || !chip->dev) | ||
505 | return; | ||
506 | |||
504 | handle = ACPI_HANDLE(chip->dev); | 507 | handle = ACPI_HANDLE(chip->dev); |
505 | if (!handle) | 508 | if (!handle) |
506 | return; | 509 | return; |
@@ -531,6 +534,9 @@ void acpi_gpiochip_remove(struct gpio_chip *chip) | |||
531 | acpi_handle handle; | 534 | acpi_handle handle; |
532 | acpi_status status; | 535 | acpi_status status; |
533 | 536 | ||
537 | if (!chip || !chip->dev) | ||
538 | return; | ||
539 | |||
534 | handle = ACPI_HANDLE(chip->dev); | 540 | handle = ACPI_HANDLE(chip->dev); |
535 | if (!handle) | 541 | if (!handle) |
536 | return; | 542 | return; |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 761013f8b82f..f48817d97480 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1387,8 +1387,8 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq, | |||
1387 | { | 1387 | { |
1388 | struct gpio_chip *chip = d->host_data; | 1388 | struct gpio_chip *chip = d->host_data; |
1389 | 1389 | ||
1390 | irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler); | ||
1391 | irq_set_chip_data(irq, chip); | 1390 | irq_set_chip_data(irq, chip); |
1391 | irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler); | ||
1392 | #ifdef CONFIG_ARM | 1392 | #ifdef CONFIG_ARM |
1393 | set_irq_flags(irq, IRQF_VALID); | 1393 | set_irq_flags(irq, IRQF_VALID); |
1394 | #else | 1394 | #else |