aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/pca953x.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index a2b12aa1f2b9..501866662e05 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -345,7 +345,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid)
345 345
346 do { 346 do {
347 level = __ffs(pending); 347 level = __ffs(pending);
348 handle_nested_irq(level + chip->irq_base); 348 generic_handle_irq(level + chip->irq_base);
349 349
350 pending &= ~(1 << level); 350 pending &= ~(1 << level);
351 } while (pending); 351 } while (pending);
@@ -360,7 +360,8 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
360 struct pca953x_platform_data *pdata = client->dev.platform_data; 360 struct pca953x_platform_data *pdata = client->dev.platform_data;
361 int ret; 361 int ret;
362 362
363 if (pdata->irq_base && (id->driver_data & PCA953X_INT)) { 363 if (pdata->irq_base != -1
364 && (id->driver_data & PCA953X_INT)) {
364 int lvl; 365 int lvl;
365 366
366 ret = pca953x_read_reg(chip, PCA953X_INPUT, 367 ret = pca953x_read_reg(chip, PCA953X_INPUT,
@@ -383,7 +384,6 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
383 set_irq_chip_data(irq, chip); 384 set_irq_chip_data(irq, chip);
384 set_irq_chip_and_handler(irq, &pca953x_irq_chip, 385 set_irq_chip_and_handler(irq, &pca953x_irq_chip,
385 handle_edge_irq); 386 handle_edge_irq);
386 set_irq_nested_thread(irq, 1);
387#ifdef CONFIG_ARM 387#ifdef CONFIG_ARM
388 set_irq_flags(irq, IRQF_VALID); 388 set_irq_flags(irq, IRQF_VALID);
389#else 389#else
@@ -394,6 +394,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
394 ret = request_threaded_irq(client->irq, 394 ret = request_threaded_irq(client->irq,
395 NULL, 395 NULL,
396 pca953x_irq_handler, 396 pca953x_irq_handler,
397 IRQF_TRIGGER_RISING |
397 IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 398 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
398 dev_name(&client->dev), chip); 399 dev_name(&client->dev), chip);
399 if (ret) { 400 if (ret) {
@@ -408,13 +409,13 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
408 return 0; 409 return 0;
409 410
410out_failed: 411out_failed:
411 chip->irq_base = 0; 412 chip->irq_base = -1;
412 return ret; 413 return ret;
413} 414}
414 415
415static void pca953x_irq_teardown(struct pca953x_chip *chip) 416static void pca953x_irq_teardown(struct pca953x_chip *chip)
416{ 417{
417 if (chip->irq_base) 418 if (chip->irq_base != -1)
418 free_irq(chip->client->irq, chip); 419 free_irq(chip->client->irq, chip);
419} 420}
420#else /* CONFIG_GPIO_PCA953X_IRQ */ 421#else /* CONFIG_GPIO_PCA953X_IRQ */
@@ -424,7 +425,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
424 struct i2c_client *client = chip->client; 425 struct i2c_client *client = chip->client;
425 struct pca953x_platform_data *pdata = client->dev.platform_data; 426 struct pca953x_platform_data *pdata = client->dev.platform_data;
426 427
427 if (pdata->irq_base && (id->driver_data & PCA953X_INT)) 428 if (pdata->irq_base != -1 && (id->driver_data & PCA953X_INT))
428 dev_warn(&client->dev, "interrupt support not compiled in\n"); 429 dev_warn(&client->dev, "interrupt support not compiled in\n");
429 430
430 return 0; 431 return 0;