Skip to content

Commit 13c151a

Browse files
glneolag-linaro
authored andcommitted
mfd: tps65912: Use devm helper functions to simplify probe
This simplifies probe and also allows us to remove the remove callbacks from the core and interface drivers. Do that here. Signed-off-by: Andrew Davis <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 0ddabc8 commit 13c151a

File tree

4 files changed

+7
-31
lines changed

4 files changed

+7
-31
lines changed

drivers/mfd/tps65912-core.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,29 +90,22 @@ int tps65912_device_init(struct tps65912 *tps)
9090
{
9191
int ret;
9292

93-
ret = regmap_add_irq_chip(tps->regmap, tps->irq, IRQF_ONESHOT, 0,
94-
&tps65912_irq_chip, &tps->irq_data);
93+
ret = devm_regmap_add_irq_chip(tps->dev, tps->regmap, tps->irq,
94+
IRQF_ONESHOT, 0, &tps65912_irq_chip,
95+
&tps->irq_data);
9596
if (ret)
9697
return ret;
9798

98-
ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65912_cells,
99-
ARRAY_SIZE(tps65912_cells), NULL, 0,
100-
regmap_irq_get_domain(tps->irq_data));
101-
if (ret) {
102-
regmap_del_irq_chip(tps->irq, tps->irq_data);
99+
ret = devm_mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65912_cells,
100+
ARRAY_SIZE(tps65912_cells), NULL, 0,
101+
regmap_irq_get_domain(tps->irq_data));
102+
if (ret)
103103
return ret;
104-
}
105104

106105
return 0;
107106
}
108107
EXPORT_SYMBOL_GPL(tps65912_device_init);
109108

110-
void tps65912_device_exit(struct tps65912 *tps)
111-
{
112-
regmap_del_irq_chip(tps->irq, tps->irq_data);
113-
}
114-
EXPORT_SYMBOL_GPL(tps65912_device_exit);
115-
116109
MODULE_AUTHOR("Andrew F. Davis <[email protected]>");
117110
MODULE_DESCRIPTION("TPS65912x MFD Driver");
118111
MODULE_LICENSE("GPL v2");

drivers/mfd/tps65912-i2c.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ static int tps65912_i2c_probe(struct i2c_client *client)
4242
return tps65912_device_init(tps);
4343
}
4444

45-
static void tps65912_i2c_remove(struct i2c_client *client)
46-
{
47-
struct tps65912 *tps = i2c_get_clientdata(client);
48-
49-
tps65912_device_exit(tps);
50-
}
51-
5245
static const struct i2c_device_id tps65912_i2c_id_table[] = {
5346
{ "tps65912" },
5447
{ /* sentinel */ }
@@ -61,7 +54,6 @@ static struct i2c_driver tps65912_i2c_driver = {
6154
.of_match_table = tps65912_i2c_of_match_table,
6255
},
6356
.probe = tps65912_i2c_probe,
64-
.remove = tps65912_i2c_remove,
6557
.id_table = tps65912_i2c_id_table,
6658
};
6759
module_i2c_driver(tps65912_i2c_driver);

drivers/mfd/tps65912-spi.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ static int tps65912_spi_probe(struct spi_device *spi)
4242
return tps65912_device_init(tps);
4343
}
4444

45-
static void tps65912_spi_remove(struct spi_device *spi)
46-
{
47-
struct tps65912 *tps = spi_get_drvdata(spi);
48-
49-
tps65912_device_exit(tps);
50-
}
51-
5245
static const struct spi_device_id tps65912_spi_id_table[] = {
5346
{ "tps65912", 0 },
5447
{ /* sentinel */ }
@@ -61,7 +54,6 @@ static struct spi_driver tps65912_spi_driver = {
6154
.of_match_table = tps65912_spi_of_match_table,
6255
},
6356
.probe = tps65912_spi_probe,
64-
.remove = tps65912_spi_remove,
6557
.id_table = tps65912_spi_id_table,
6658
};
6759
module_spi_driver(tps65912_spi_driver);

include/linux/mfd/tps65912.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,5 @@ struct tps65912 {
314314
extern const struct regmap_config tps65912_regmap_config;
315315

316316
int tps65912_device_init(struct tps65912 *tps);
317-
void tps65912_device_exit(struct tps65912 *tps);
318317

319318
#endif /* __LINUX_MFD_TPS65912_H */

0 commit comments

Comments
 (0)