[RFC,v1,3/4] regulator: core: Probe regulator devices
Commit Message
Since devices added to a bus can be probed, add a stub probe function
for regulator devices.
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
drivers/regulator/core.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
Comments
On Sat, Feb 18, 2023 at 12:32:50AM -0800, Saravana Kannan wrote:
> Since devices added to a bus can be probed, add a stub probe function
> for regulator devices.
Why?
> +static int regulator_drv_probe(struct device *dev)
> +{
> + return 0;
> +}
This is just an empty function - why do we need it? Looking at
call_driver_probe() it doesn't appear to be required.
@@ -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 = ®ulator_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(®ulator_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(®ulator_bus);
unreg_compat:
class_compat_unregister(regulator_compat_class);
return ret;