Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345026
b: refs/heads/master
c: cb5faba
h: refs/heads/master
v: v3
  • Loading branch information
Viresh Kumar authored and Samuel Ortiz committed Nov 23, 2012
1 parent 7ebffa4 commit 093e55a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 40 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: 0c418844dce21fa7000b51190f393c7d6a7ee12d
refs/heads/master: cb5faba951142fc00c41b680eec7003f21947b92
60 changes: 21 additions & 39 deletions trunk/drivers/mfd/stmpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,17 +1052,17 @@ int __devinit stmpe_probe(struct stmpe_client_info *ci, int partnum)
int ret;

if (!pdata) {
if (np) {
pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return -ENOMEM;

stmpe_of_probe(pdata, np);
} else
if (!np)
return -EINVAL;

pdata = devm_kzalloc(ci->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return -ENOMEM;

stmpe_of_probe(pdata, np);
}

stmpe = kzalloc(sizeof(struct stmpe), GFP_KERNEL);
stmpe = devm_kzalloc(ci->dev, sizeof(struct stmpe), GFP_KERNEL);
if (!stmpe)
return -ENOMEM;

Expand All @@ -1084,11 +1084,12 @@ int __devinit stmpe_probe(struct stmpe_client_info *ci, int partnum)
ci->init(stmpe);

if (pdata->irq_over_gpio) {
ret = gpio_request_one(pdata->irq_gpio, GPIOF_DIR_IN, "stmpe");
ret = devm_gpio_request_one(ci->dev, pdata->irq_gpio,
GPIOF_DIR_IN, "stmpe");
if (ret) {
dev_err(stmpe->dev, "failed to request IRQ GPIO: %d\n",
ret);
goto out_free;
return ret;
}

stmpe->irq = gpio_to_irq(pdata->irq_gpio);
Expand All @@ -1105,63 +1106,44 @@ int __devinit stmpe_probe(struct stmpe_client_info *ci, int partnum)
dev_err(stmpe->dev,
"%s does not support no-irq mode!\n",
stmpe->variant->name);
ret = -ENODEV;
goto free_gpio;
return -ENODEV;
}
stmpe->variant = stmpe_noirq_variant_info[stmpe->partnum];
}

ret = stmpe_chip_init(stmpe);
if (ret)
goto free_gpio;
return ret;

if (stmpe->irq >= 0) {
ret = stmpe_irq_init(stmpe, np);
if (ret)
goto free_gpio;
return ret;

ret = request_threaded_irq(stmpe->irq, NULL, stmpe_irq,
pdata->irq_trigger | IRQF_ONESHOT,
ret = devm_request_threaded_irq(ci->dev, stmpe->irq, NULL,
stmpe_irq, pdata->irq_trigger | IRQF_ONESHOT,
"stmpe", stmpe);
if (ret) {
dev_err(stmpe->dev, "failed to request IRQ: %d\n",
ret);
goto free_gpio;
return ret;
}
}

ret = stmpe_devices_init(stmpe);
if (ret) {
dev_err(stmpe->dev, "failed to add children\n");
goto out_removedevs;
}

return 0;
if (!ret)
return 0;

out_removedevs:
dev_err(stmpe->dev, "failed to add children\n");
mfd_remove_devices(stmpe->dev);
if (stmpe->irq >= 0)
free_irq(stmpe->irq, stmpe);
free_gpio:
if (pdata->irq_over_gpio)
gpio_free(pdata->irq_gpio);
out_free:
kfree(stmpe);

return ret;
}

int stmpe_remove(struct stmpe *stmpe)
{
mfd_remove_devices(stmpe->dev);

if (stmpe->irq >= 0)
free_irq(stmpe->irq, stmpe);

if (stmpe->pdata->irq_over_gpio)
gpio_free(stmpe->pdata->irq_gpio);

kfree(stmpe);

return 0;
}

Expand Down

0 comments on commit 093e55a

Please sign in to comment.