mirror of
https://github.com/torvalds/linux.git
synced 2024-12-11 21:52:04 +00:00
Three GPIO fixes for the v3.12 series:
- A fix to the Lynxpoint IRQ handler - Two late fixes to fallout from the gpiod refactoring -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) iQIcBAABAgAGBQJSXkvPAAoJEEEQszewGV1z+MUP/2ooJI2x0tm58NgJ34J1f+C4 +lI0KKdNLrF9blxzOM6yHO1HaMD5NF2h4TkY4c/6WeJNyOVfcGko8wYaqKFEi3pa F30jn5wXFJfqMCP+lHKHQgqBfs+uYIt1jYuPcwu1ULkI8S1TGnU3p+9DuJuGDasD 1XzNuAHcOHQOaTA90D5qCTJDRBFZUVgeIOqtHbIng7dL3pTDJdDkybvd2d+W7wKK +r/UpMTuxortVwcNfCRoI1lArnq+01cxwHhDSAuY7O0UujaQks34GWF4gIuKL0Kn PhXWLYQBzOKafVUdgzyyxFxw+F8dqpm8DaUZ3sKTXsa07IHMyqfSa6iUtJClqcZS +ukIdyL6nOAQVfNpyOGklaGcAhY5HFeYrrRmF9rxAygX9k4C0blbPNrL3vl5PrjH fiUu8pdyB4THzN1BsAjx4JTrzWyEr5ZIY+FuoTBQTUMcl3NfQ9US7wJPTqXH3217 I6vOcxo4xohe4VWExg3yVZJ0QOjSvYzaiuv6n40zZi/oxymDnD/huuFpVs3u/5+X 4C5zpfZweNYnwHiUGl6dVMfenTGVY8MWcg1fQumsBfa2Rb3BJT5JdxeRGtg/muFN n6jm3kzr6F5VVBG5o6aKtEjnxdSncjXX9U85EDpFv4Hrf5fXRKwV+1rhXD3akj6D FcpwXlCt0Zf3YXlabbMM =SG11 -----END PGP SIGNATURE----- Merge tag 'gpio-v3.12-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull gpio fixes from Linus Walleij: "Three GPIO fixes for the v3.12 series: - A fix to the Lynxpoint IRQ handler - Two late fixes to fallout from the gpiod refactoring" * tag 'gpio-v3.12-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpiolib: let gpiod_request() return -EPROBE_DEFER gpiolib: safer implementation of desc_to_gpio() gpio/lynxpoint: check if the interrupt is enabled in IRQ handler
This commit is contained in:
commit
386aa05192
@ -248,14 +248,15 @@ static void lp_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
|
||||
struct lp_gpio *lg = irq_data_get_irq_handler_data(data);
|
||||
struct irq_chip *chip = irq_data_get_irq_chip(data);
|
||||
u32 base, pin, mask;
|
||||
unsigned long reg, pending;
|
||||
unsigned long reg, ena, pending;
|
||||
unsigned virq;
|
||||
|
||||
/* check from GPIO controller which pin triggered the interrupt */
|
||||
for (base = 0; base < lg->chip.ngpio; base += 32) {
|
||||
reg = lp_gpio_reg(&lg->chip, base, LP_INT_STAT);
|
||||
ena = lp_gpio_reg(&lg->chip, base, LP_INT_ENABLE);
|
||||
|
||||
while ((pending = inl(reg))) {
|
||||
while ((pending = (inl(reg) & inl(ena)))) {
|
||||
pin = __ffs(pending);
|
||||
mask = BIT(pin);
|
||||
/* Clear before handling so we don't lose an edge */
|
||||
|
@ -136,7 +136,7 @@ static struct gpio_desc *gpio_to_desc(unsigned gpio)
|
||||
*/
|
||||
static int desc_to_gpio(const struct gpio_desc *desc)
|
||||
{
|
||||
return desc->chip->base + gpio_chip_hwgpio(desc);
|
||||
return desc - &gpio_desc[0];
|
||||
}
|
||||
|
||||
|
||||
@ -1398,7 +1398,7 @@ static int gpiod_request(struct gpio_desc *desc, const char *label)
|
||||
int status = -EPROBE_DEFER;
|
||||
unsigned long flags;
|
||||
|
||||
if (!desc || !desc->chip) {
|
||||
if (!desc) {
|
||||
pr_warn("%s: invalid GPIO\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -1406,6 +1406,8 @@ static int gpiod_request(struct gpio_desc *desc, const char *label)
|
||||
spin_lock_irqsave(&gpio_lock, flags);
|
||||
|
||||
chip = desc->chip;
|
||||
if (chip == NULL)
|
||||
goto done;
|
||||
|
||||
if (!try_module_get(chip->owner))
|
||||
goto done;
|
||||
|
Loading…
Reference in New Issue
Block a user