[RFC v1 3/4] regulator: core: Probe regulator devices

From: Saravana Kannan
Date: Sat Feb 18 2023 - 03:33:13 EST


Since devices added to a bus can be probed, add a stub probe function
for regulator devices.

Signed-off-by: Saravana Kannan <saravanak@xxxxxxxxxx>
---
drivers/regulator/core.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index b6700d50d230..d5f9fdd79c14 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -5780,6 +5780,17 @@ static const struct dev_pm_ops __maybe_unused regulator_pm_ops = {
};
#endif

+static int regulator_drv_probe(struct device *dev)
+{
+ return 0;
+}
+
+static struct device_driver regulator_drv = {
+ .name = "regulator_drv",
+ .bus = &regulator_bus,
+ .probe = regulator_drv_probe,
+};
+
struct bus_type regulator_bus = {
.name = "regulator",
.remove = regulator_dev_release,
@@ -6123,6 +6134,10 @@ static int __init regulator_init(void)
if (ret)
goto unreg_compat;

+ ret = driver_register(&regulator_drv);
+ if (ret)
+ goto unreg_bus;
+
debugfs_root = debugfs_create_dir("regulator", NULL);
if (!debugfs_root)
pr_warn("regulator: Failed to create debugfs directory\n");
@@ -6141,6 +6156,8 @@ static int __init regulator_init(void)

return ret;

+unreg_bus:
+ bus_unregister(&regulator_bus);
unreg_compat:
class_compat_unregister(regulator_compat_class);
return ret;
--
2.39.2.637.g21b0678d19-goog