From: Andrew Davis <afd@ti.com>
To: Lee Jones <lee@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, Andrew Davis <afd@ti.com>
Subject: [PATCH] mfd: tps65912: Use devm helper functions to simplify probe
Date: Mon, 10 Jun 2024 10:38:24 -0500 [thread overview]
Message-ID: <20240610153824.218260-1-afd@ti.com> (raw)
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 <afd@ti.com>
---
drivers/mfd/tps65912-core.c | 21 +++++++--------------
drivers/mfd/tps65912-i2c.c | 8 --------
drivers/mfd/tps65912-spi.c | 8 --------
include/linux/mfd/tps65912.h | 1 -
4 files changed, 7 insertions(+), 31 deletions(-)
diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c
index 2305ea60367ac..87ee6aac37636 100644
--- a/drivers/mfd/tps65912-core.c
+++ b/drivers/mfd/tps65912-core.c
@@ -90,29 +90,22 @@ int tps65912_device_init(struct tps65912 *tps)
{
int ret;
- ret = regmap_add_irq_chip(tps->regmap, tps->irq, IRQF_ONESHOT, 0,
- &tps65912_irq_chip, &tps->irq_data);
+ ret = devm_regmap_add_irq_chip(tps->dev, tps->regmap, tps->irq,
+ IRQF_ONESHOT, 0, &tps65912_irq_chip,
+ &tps->irq_data);
if (ret)
return ret;
- ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65912_cells,
- ARRAY_SIZE(tps65912_cells), NULL, 0,
- regmap_irq_get_domain(tps->irq_data));
- if (ret) {
- regmap_del_irq_chip(tps->irq, tps->irq_data);
+ ret = devm_mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65912_cells,
+ ARRAY_SIZE(tps65912_cells), NULL, 0,
+ regmap_irq_get_domain(tps->irq_data));
+ if (ret)
return ret;
- }
return 0;
}
EXPORT_SYMBOL_GPL(tps65912_device_init);
-void tps65912_device_exit(struct tps65912 *tps)
-{
- regmap_del_irq_chip(tps->irq, tps->irq_data);
-}
-EXPORT_SYMBOL_GPL(tps65912_device_exit);
-
MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
MODULE_DESCRIPTION("TPS65912x MFD Driver");
MODULE_LICENSE("GPL v2");
diff --git a/drivers/mfd/tps65912-i2c.c b/drivers/mfd/tps65912-i2c.c
index 3c5ac781b6c16..41ae996852a60 100644
--- a/drivers/mfd/tps65912-i2c.c
+++ b/drivers/mfd/tps65912-i2c.c
@@ -42,13 +42,6 @@ static int tps65912_i2c_probe(struct i2c_client *client)
return tps65912_device_init(tps);
}
-static void tps65912_i2c_remove(struct i2c_client *client)
-{
- struct tps65912 *tps = i2c_get_clientdata(client);
-
- tps65912_device_exit(tps);
-}
-
static const struct i2c_device_id tps65912_i2c_id_table[] = {
{ "tps65912", 0 },
{ /* sentinel */ }
@@ -61,7 +54,6 @@ static struct i2c_driver tps65912_i2c_driver = {
.of_match_table = tps65912_i2c_of_match_table,
},
.probe = tps65912_i2c_probe,
- .remove = tps65912_i2c_remove,
.id_table = tps65912_i2c_id_table,
};
module_i2c_driver(tps65912_i2c_driver);
diff --git a/drivers/mfd/tps65912-spi.c b/drivers/mfd/tps65912-spi.c
index 9e976f9c6bbe3..2a77dccd60599 100644
--- a/drivers/mfd/tps65912-spi.c
+++ b/drivers/mfd/tps65912-spi.c
@@ -42,13 +42,6 @@ static int tps65912_spi_probe(struct spi_device *spi)
return tps65912_device_init(tps);
}
-static void tps65912_spi_remove(struct spi_device *spi)
-{
- struct tps65912 *tps = spi_get_drvdata(spi);
-
- tps65912_device_exit(tps);
-}
-
static const struct spi_device_id tps65912_spi_id_table[] = {
{ "tps65912", 0 },
{ /* sentinel */ }
@@ -61,7 +54,6 @@ static struct spi_driver tps65912_spi_driver = {
.of_match_table = tps65912_spi_of_match_table,
},
.probe = tps65912_spi_probe,
- .remove = tps65912_spi_remove,
.id_table = tps65912_spi_id_table,
};
module_spi_driver(tps65912_spi_driver);
diff --git a/include/linux/mfd/tps65912.h b/include/linux/mfd/tps65912.h
index 860ec0a16c963..e5373c302722c 100644
--- a/include/linux/mfd/tps65912.h
+++ b/include/linux/mfd/tps65912.h
@@ -314,6 +314,5 @@ struct tps65912 {
extern const struct regmap_config tps65912_regmap_config;
int tps65912_device_init(struct tps65912 *tps);
-void tps65912_device_exit(struct tps65912 *tps);
#endif /* __LINUX_MFD_TPS65912_H */
--
2.39.2
next reply other threads:[~2024-06-10 15:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 15:38 Andrew Davis [this message]
2024-06-13 17:13 ` [PATCH] mfd: tps65912: Use devm helper functions to simplify probe Lee Jones
2024-06-14 9:03 ` (subset) " Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240610153824.218260-1-afd@ti.com \
--to=afd@ti.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox