Skip to content

Commit

Permalink
Merge tag 'gpio-v3.15-2' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
torvalds committed Apr 22, 2014
2 parents 39bfe90 + b5539fa commit 4d0fa8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions drivers/gpio/gpiolib-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static void acpi_gpiochip_request_interrupts(struct acpi_gpio_chip *acpi_gpio)
{
struct gpio_chip *chip = acpi_gpio->chip;

if (!chip->dev || !chip->to_irq)
if (!chip->to_irq)
return;

INIT_LIST_HEAD(&acpi_gpio->events);
Expand All @@ -253,7 +253,7 @@ static void acpi_gpiochip_free_interrupts(struct acpi_gpio_chip *acpi_gpio)
struct acpi_gpio_event *event, *ep;
struct gpio_chip *chip = acpi_gpio->chip;

if (!chip->dev || !chip->to_irq)
if (!chip->to_irq)
return;

list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) {
Expand Down Expand Up @@ -451,7 +451,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
if (function == ACPI_WRITE)
gpiod_set_raw_value(desc, !!((1 << i) & *value));
else
*value |= gpiod_get_raw_value(desc) << i;
*value |= (u64)gpiod_get_raw_value(desc) << i;
}

out:
Expand Down Expand Up @@ -501,6 +501,9 @@ void acpi_gpiochip_add(struct gpio_chip *chip)
acpi_handle handle;
acpi_status status;

if (!chip || !chip->dev)
return;

handle = ACPI_HANDLE(chip->dev);
if (!handle)
return;
Expand Down Expand Up @@ -531,6 +534,9 @@ void acpi_gpiochip_remove(struct gpio_chip *chip)
acpi_handle handle;
acpi_status status;

if (!chip || !chip->dev)
return;

handle = ACPI_HANDLE(chip->dev);
if (!handle)
return;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1387,8 +1387,8 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
{
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_and_handler(irq, chip->irqchip, chip->irq_handler);
#ifdef CONFIG_ARM
set_irq_flags(irq, IRQF_VALID);
#else
Expand Down

0 comments on commit 4d0fa8a

Please sign in to comment.