Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296824
b: refs/heads/master
c: 38040c8
h: refs/heads/master
v: v3
  • Loading branch information
Chris Blair authored and Samuel Ortiz committed Mar 6, 2012
1 parent f4b5b66 commit 5549407
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e31f9b826486c48f20e4f1066aa3e23e111c3a4e
refs/heads/master: 38040c858cbd4c06080e7d1e79e9ff4c74c33d2c
41 changes: 25 additions & 16 deletions trunk/drivers/gpio/gpio-stmpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,11 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev)
struct stmpe_gpio_platform_data *pdata;
struct stmpe_gpio *stmpe_gpio;
int ret;
int irq;
int irq = 0;

pdata = stmpe->pdata->gpio;

irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;

stmpe_gpio = kzalloc(sizeof(struct stmpe_gpio), GFP_KERNEL);
if (!stmpe_gpio)
Expand All @@ -330,21 +328,28 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev)
stmpe_gpio->chip.dev = &pdev->dev;
stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1;

stmpe_gpio->irq_base = stmpe->irq_base + STMPE_INT_GPIO(0);
if (irq >= 0)
stmpe_gpio->irq_base = stmpe->irq_base + STMPE_INT_GPIO(0);
else
dev_info(&pdev->dev,
"device configured in no-irq mode; "
"irqs are not available\n");

ret = stmpe_enable(stmpe, STMPE_BLOCK_GPIO);
if (ret)
goto out_free;

ret = stmpe_gpio_irq_init(stmpe_gpio);
if (ret)
goto out_disable;
if (irq >= 0) {
ret = stmpe_gpio_irq_init(stmpe_gpio);
if (ret)
goto out_disable;

ret = request_threaded_irq(irq, NULL, stmpe_gpio_irq, IRQF_ONESHOT,
"stmpe-gpio", stmpe_gpio);
if (ret) {
dev_err(&pdev->dev, "unable to get irq: %d\n", ret);
goto out_removeirq;
ret = request_threaded_irq(irq, NULL, stmpe_gpio_irq,
IRQF_ONESHOT, "stmpe-gpio", stmpe_gpio);
if (ret) {
dev_err(&pdev->dev, "unable to get irq: %d\n", ret);
goto out_removeirq;
}
}

ret = gpiochip_add(&stmpe_gpio->chip);
Expand All @@ -361,9 +366,11 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev)
return 0;

out_freeirq:
free_irq(irq, stmpe_gpio);
if (irq >= 0)
free_irq(irq, stmpe_gpio);
out_removeirq:
stmpe_gpio_irq_remove(stmpe_gpio);
if (irq >= 0)
stmpe_gpio_irq_remove(stmpe_gpio);
out_disable:
stmpe_disable(stmpe, STMPE_BLOCK_GPIO);
out_free:
Expand Down Expand Up @@ -391,8 +398,10 @@ static int __devexit stmpe_gpio_remove(struct platform_device *pdev)

stmpe_disable(stmpe, STMPE_BLOCK_GPIO);

free_irq(irq, stmpe_gpio);
stmpe_gpio_irq_remove(stmpe_gpio);
if (irq >= 0) {
free_irq(irq, stmpe_gpio);
stmpe_gpio_irq_remove(stmpe_gpio);
}
platform_set_drvdata(pdev, NULL);
kfree(stmpe_gpio);

Expand Down

0 comments on commit 5549407

Please sign in to comment.