A few fixes for the GPIO tree:

- Change a crucial semantic ordering in the GPIO irqchip
   helpers.
 
 - Fix two nasty regressions in the ACPI gpiolib extensions.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTUQ+6AAoJEEEQszewGV1zue0P/iXpOgzTffwqS67ZtRCjHk2C
 nQ5plRWLgPXJndMuuGKu38kf1HkwKbdTUAZ+tqtVe/m1kGPcv+V5XkMiPCB+nzYw
 eOyMTJCPLVv485BmSlKdHLrZW8wLvq03Hs+EsKJ90YxHUYFhJNnqUkuiHqidL+eg
 b/Z8Nzq2x4VSji0n4vzJKdhiSwJt4uTo9hzkC+UHylL7mM3x5/+pfRPRpbToEBCH
 zitDXgcCyXLCucHeEc10e7uHXwYxdiLC8WwxK+ztnEFCK0EWWRdlSg+C0PJEnnD9
 4/kEZXn69dDTSpOxgNKjGm8NLrA5FOzN7YqMuznz88RWNvtTmd3NKm7tYTlS1T4D
 8BO9TJkyY8bis49Q6pwgr5J9MNdEBZimUZUjHzJYdekKxY1WBT7xPKM7CvtH2d/3
 gq0qBd8HGG5fmxs6cKxgOehyOnBBMVpxTSiQmNQxPqIcz4jrtnIqVTj3zkxcb7Kf
 MttAGKNf2MqIFZmRXg3TXu+KhNZsQD8oL61xNknog3TosWoLC5yQTF7HCCU+8hIz
 EdOmaMoAV+K8v7mY0/KWJiKros6RNHhRUdXK/jGpNl2U5yy+Rfp9SU7jzwmv8J+O
 khDKGOb2KHbc9ydzW9Ut/65Ys6oMkIbiTnwZqsdTZ/Pv2nYDOyP9L1M6ng0k1tNj
 lZ34WI4WAafxZwglhLdy
 =Tc0Z
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2014-04-22 09:28:02 -07:00
commit 4d0fa8a0f0
2 changed files with 10 additions and 4 deletions

View file

@ -233,7 +233,7 @@ static void acpi_gpiochip_request_interrupts(struct acpi_gpio_chip *acpi_gpio)
{ {
struct gpio_chip *chip = acpi_gpio->chip; struct gpio_chip *chip = acpi_gpio->chip;
if (!chip->dev || !chip->to_irq) if (!chip->to_irq)
return; return;
INIT_LIST_HEAD(&acpi_gpio->events); INIT_LIST_HEAD(&acpi_gpio->events);
@ -253,7 +253,7 @@ static void acpi_gpiochip_free_interrupts(struct acpi_gpio_chip *acpi_gpio)
struct acpi_gpio_event *event, *ep; struct acpi_gpio_event *event, *ep;
struct gpio_chip *chip = acpi_gpio->chip; struct gpio_chip *chip = acpi_gpio->chip;
if (!chip->dev || !chip->to_irq) if (!chip->to_irq)
return; return;
list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { 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,
if (function == ACPI_WRITE) if (function == ACPI_WRITE)
gpiod_set_raw_value(desc, !!((1 << i) & *value)); gpiod_set_raw_value(desc, !!((1 << i) & *value));
else else
*value |= gpiod_get_raw_value(desc) << i; *value |= (u64)gpiod_get_raw_value(desc) << i;
} }
out: out:
@ -501,6 +501,9 @@ void acpi_gpiochip_add(struct gpio_chip *chip)
acpi_handle handle; acpi_handle handle;
acpi_status status; acpi_status status;
if (!chip || !chip->dev)
return;
handle = ACPI_HANDLE(chip->dev); handle = ACPI_HANDLE(chip->dev);
if (!handle) if (!handle)
return; return;
@ -531,6 +534,9 @@ void acpi_gpiochip_remove(struct gpio_chip *chip)
acpi_handle handle; acpi_handle handle;
acpi_status status; acpi_status status;
if (!chip || !chip->dev)
return;
handle = ACPI_HANDLE(chip->dev); handle = ACPI_HANDLE(chip->dev);
if (!handle) if (!handle)
return; return;

View file

@ -1387,8 +1387,8 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
{ {
struct gpio_chip *chip = d->host_data; struct gpio_chip *chip = d->host_data;
irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler);
irq_set_chip_data(irq, chip); irq_set_chip_data(irq, chip);
irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler);
#ifdef CONFIG_ARM #ifdef CONFIG_ARM
set_irq_flags(irq, IRQF_VALID); set_irq_flags(irq, IRQF_VALID);
#else #else