Skip to content

Commit

Permalink
mfd: tps65218: Use devm_regmap_add_irq_chip and clean up error path i…
Browse files Browse the repository at this point in the history
…n probe()

Use devm_regmap_add_irq_chip and clean up error path in probe
and also the remove function.

Reported-by: Christian Hohnstaedt <Christian.Hohnstaedt@wago.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
Keerthy authored and Lee Jones committed Jan 3, 2019
1 parent 38df91c commit 75d4c5e
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions drivers/mfd/tps65218.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ static int tps65218_probe(struct i2c_client *client,

mutex_init(&tps->tps_lock);

ret = regmap_add_irq_chip(tps->regmap, tps->irq,
IRQF_ONESHOT, 0, &tps65218_irq_chip,
&tps->irq_data);
ret = devm_regmap_add_irq_chip(&client->dev, tps->regmap, tps->irq,
IRQF_ONESHOT, 0, &tps65218_irq_chip,
&tps->irq_data);
if (ret < 0)
return ret;

Expand All @@ -253,26 +253,9 @@ static int tps65218_probe(struct i2c_client *client,
ARRAY_SIZE(tps65218_cells), NULL, 0,
regmap_irq_get_domain(tps->irq_data));

if (ret < 0)
goto err_irq;

return 0;

err_irq:
regmap_del_irq_chip(tps->irq, tps->irq_data);

return ret;
}

static int tps65218_remove(struct i2c_client *client)
{
struct tps65218 *tps = i2c_get_clientdata(client);

regmap_del_irq_chip(tps->irq, tps->irq_data);

return 0;
}

static const struct i2c_device_id tps65218_id_table[] = {
{ "tps65218", TPS65218 },
{ },
Expand All @@ -285,7 +268,6 @@ static struct i2c_driver tps65218_driver = {
.of_match_table = of_tps65218_match_table,
},
.probe = tps65218_probe,
.remove = tps65218_remove,
.id_table = tps65218_id_table,
};

Expand Down

0 comments on commit 75d4c5e

Please sign in to comment.