Skip to content

Commit

Permalink
gpiolib: remove warnning of allocations with IRQs disabled
Browse files Browse the repository at this point in the history
Move of_gpiochip_add outof spin_lock, since kzalloc inside
of_gpiochip_add -> of_gpiochip_add_pin_range -> gpiochip_add_pin_range -> kzalloc

WARNING: at kernel/lockdep.c:2740 lockdep_trace_alloc+0xf8/0xfc()
DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags))

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Zhangfei Gao authored and Linus Walleij committed Jun 20, 2013
1 parent 61e3884 commit 3bae481
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1214,15 +1214,14 @@ int gpiochip_add(struct gpio_chip *chip)
}
}

spin_unlock_irqrestore(&gpio_lock, flags);

#ifdef CONFIG_PINCTRL
INIT_LIST_HEAD(&chip->pin_ranges);
#endif

of_gpiochip_add(chip);

unlock:
spin_unlock_irqrestore(&gpio_lock, flags);

if (status)
goto fail;

Expand All @@ -1235,6 +1234,9 @@ int gpiochip_add(struct gpio_chip *chip)
chip->label ? : "generic");

return 0;

unlock:
spin_unlock_irqrestore(&gpio_lock, flags);
fail:
/* failures here can mean systems won't boot... */
pr_err("gpiochip_add: gpios %d..%d (%s) failed to register\n",
Expand Down

0 comments on commit 3bae481

Please sign in to comment.