提交 8a233f01 编写于 作者: A Alek Du 提交者: Linus Torvalds

pca953x: pca953x driver fixes for x86 mrst

Our Moorestown platform has two max7315 chips which is covered by pca953x
i2c gpio driver.

A while ago this driver got updated with nested irq thread support, and it
broke the compatibity with "request_irq".  For example, the gpio_keys.c
driver can not work with this driver now.  This patch fixes the issue by
switching to generic_handle_irq.

Also fix the irq_base issue: irq_base == 0 is valid, and a "-1" value
should mean invalid. IRQ 0 is not a valid IRQ, irq_base of 0 is valid.
Signed-off-by: NAlek Du <alek.du@intel.com>
Signed-off-by: NAlan Cox <alan@linux.intel.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 2e85c4dd
...@@ -345,7 +345,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid) ...@@ -345,7 +345,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid)
do { do {
level = __ffs(pending); level = __ffs(pending);
handle_nested_irq(level + chip->irq_base); generic_handle_irq(level + chip->irq_base);
pending &= ~(1 << level); pending &= ~(1 << level);
} while (pending); } while (pending);
...@@ -360,7 +360,8 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, ...@@ -360,7 +360,8 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
struct pca953x_platform_data *pdata = client->dev.platform_data; struct pca953x_platform_data *pdata = client->dev.platform_data;
int ret; int ret;
if (pdata->irq_base && (id->driver_data & PCA953X_INT)) { if (pdata->irq_base != -1
&& (id->driver_data & PCA953X_INT)) {
int lvl; int lvl;
ret = pca953x_read_reg(chip, PCA953X_INPUT, ret = pca953x_read_reg(chip, PCA953X_INPUT,
...@@ -383,7 +384,6 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, ...@@ -383,7 +384,6 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
set_irq_chip_data(irq, chip); set_irq_chip_data(irq, chip);
set_irq_chip_and_handler(irq, &pca953x_irq_chip, set_irq_chip_and_handler(irq, &pca953x_irq_chip,
handle_edge_irq); handle_edge_irq);
set_irq_nested_thread(irq, 1);
#ifdef CONFIG_ARM #ifdef CONFIG_ARM
set_irq_flags(irq, IRQF_VALID); set_irq_flags(irq, IRQF_VALID);
#else #else
...@@ -394,6 +394,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, ...@@ -394,6 +394,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
ret = request_threaded_irq(client->irq, ret = request_threaded_irq(client->irq,
NULL, NULL,
pca953x_irq_handler, pca953x_irq_handler,
IRQF_TRIGGER_RISING |
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
dev_name(&client->dev), chip); dev_name(&client->dev), chip);
if (ret) { if (ret) {
...@@ -408,13 +409,13 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, ...@@ -408,13 +409,13 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
return 0; return 0;
out_failed: out_failed:
chip->irq_base = 0; chip->irq_base = -1;
return ret; return ret;
} }
static void pca953x_irq_teardown(struct pca953x_chip *chip) static void pca953x_irq_teardown(struct pca953x_chip *chip)
{ {
if (chip->irq_base) if (chip->irq_base != -1)
free_irq(chip->client->irq, chip); free_irq(chip->client->irq, chip);
} }
#else /* CONFIG_GPIO_PCA953X_IRQ */ #else /* CONFIG_GPIO_PCA953X_IRQ */
...@@ -424,7 +425,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, ...@@ -424,7 +425,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
struct i2c_client *client = chip->client; struct i2c_client *client = chip->client;
struct pca953x_platform_data *pdata = client->dev.platform_data; struct pca953x_platform_data *pdata = client->dev.platform_data;
if (pdata->irq_base && (id->driver_data & PCA953X_INT)) if (pdata->irq_base != -1 && (id->driver_data & PCA953X_INT))
dev_warn(&client->dev, "interrupt support not compiled in\n"); dev_warn(&client->dev, "interrupt support not compiled in\n");
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册