summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-10-19 23:24:03 +0200
committerLinus Walleij <linus.walleij@linaro.org>2013-10-19 23:24:03 +0200
commitb41fb43911b4cb864812adec88d028cc6219f23e (patch)
treef383de554dc3640ec3081ad41fa34f7cab68de82 /drivers/gpio
parent0963d59bc0bbed48b06733950f5eb167e9b9a8fa (diff)
parent31d141e3a666269a3b6fcccddb0351caf7454240 (diff)
downloadop-kernel-dev-b41fb43911b4cb864812adec88d028cc6219f23e.zip
op-kernel-dev-b41fb43911b4cb864812adec88d028cc6219f23e.tar.gz
Merge tag 'v3.12-rc6' into devel
Linux 3.12-rc6 Conflicts: drivers/gpio/gpio-lynxpoint.c
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-lynxpoint.c5
-rw-r--r--drivers/gpio/gpiolib.c6
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
index 21603e6..a080474 100644
--- a/drivers/gpio/gpio-lynxpoint.c
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -248,13 +248,14 @@ static void lp_gpio_irq_handler(unsigned hwirq, 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;
/* 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)))) {
unsigned irq;
pin = __ffs(pending);
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 1014cb5..d66139d 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -183,7 +183,7 @@ static struct gpio_desc *gpiochip_offset_to_desc(struct gpio_chip *chip,
*/
static int desc_to_gpio(const struct gpio_desc *desc)
{
- return desc->chip->base + gpio_chip_hwgpio(desc);
+ return desc - &gpio_desc[0];
}
@@ -1452,7 +1452,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;
}
@@ -1460,6 +1460,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;
OpenPOWER on IntegriCloud