From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The dummy regulator driver does not need to create a platform device, it
only did so because it was simple to do. Change it over to use the
faux bus instead as this is NOT a real platform device, and it makes
the code even smaller than before.
Reviewed-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Message-Id: <2025021027-outclass-stress-59dd@gregkh>
(sudeep.holla: Made dummy_regulator_driver static)
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
drivers/regulator/dummy.c | 37 +++++++++----------------------------
1 file changed, 9 insertions(+), 28 deletions(-)
diff --git a/drivers/regulator/dummy.c b/drivers/regulator/dummy.c
index 5b9b9e4e762d52151847bb1880377d51b04eeb9d..c3e416fd3c3e29d54278eb65600ab79d828edbde 100644
--- a/drivers/regulator/dummy.c
+++ b/drivers/regulator/dummy.c
@@ -13,7 +13,7 @@
#include <linux/err.h>
#include <linux/export.h>
-#include <linux/platform_device.h>
+#include <linux/device/faux.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
@@ -37,15 +37,15 @@ static const struct regulator_desc dummy_desc = {
.ops = &dummy_ops,
};
-static int dummy_regulator_probe(struct platform_device *pdev)
+static int dummy_regulator_probe(struct faux_device *fdev)
{
struct regulator_config config = { };
int ret;
- config.dev = &pdev->dev;
+ config.dev = &fdev->dev;
config.init_data = &dummy_initdata;
- dummy_regulator_rdev = devm_regulator_register(&pdev->dev, &dummy_desc,
+ dummy_regulator_rdev = devm_regulator_register(&fdev->dev, &dummy_desc,
&config);
if (IS_ERR(dummy_regulator_rdev)) {
ret = PTR_ERR(dummy_regulator_rdev);
@@ -56,36 +56,17 @@ static int dummy_regulator_probe(struct platform_device *pdev)
return 0;
}
-static struct platform_driver dummy_regulator_driver = {
- .probe = dummy_regulator_probe,
- .driver = {
- .name = "reg-dummy",
- .probe_type = PROBE_PREFER_ASYNCHRONOUS,
- },
+static struct faux_device_ops dummy_regulator_driver = {
+ .probe = dummy_regulator_probe,
};
-static struct platform_device *dummy_pdev;
+static struct faux_device *dummy_fdev;
void __init regulator_dummy_init(void)
{
- int ret;
-
- dummy_pdev = platform_device_alloc("reg-dummy", -1);
- if (!dummy_pdev) {
+ dummy_fdev = faux_device_create("reg-dummy", NULL, &dummy_regulator_driver);
+ if (!dummy_fdev) {
pr_err("Failed to allocate dummy regulator device\n");
return;
}
-
- ret = platform_device_add(dummy_pdev);
- if (ret != 0) {
- pr_err("Failed to register dummy regulator device: %d\n", ret);
- platform_device_put(dummy_pdev);
- return;
- }
-
- ret = platform_driver_register(&dummy_regulator_driver);
- if (ret != 0) {
- pr_err("Failed to register dummy regulator driver: %d\n", ret);
- platform_device_unregister(dummy_pdev);
- }
}
--
2.34.1
On Mon, Mar 17, 2025 at 10:13:21AM +0000, Sudeep Holla wrote: > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Why are you resending my patch back to me? > The dummy regulator driver does not need to create a platform device, it > only did so because it was simple to do. Change it over to use the > faux bus instead as this is NOT a real platform device, and it makes > the code even smaller than before. > > Reviewed-by: Mark Brown <broonie@kernel.org> > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Message-Id: <2025021027-outclass-stress-59dd@gregkh> > (sudeep.holla: Made dummy_regulator_driver static) So this is a new version? And as was pointed out, this is already in my tree, and there's a conflict in linux-next with it. confused, greg k-h
On Mon, Mar 17, 2025 at 02:00:04PM +0100, Greg Kroah-Hartman wrote: > On Mon, Mar 17, 2025 at 10:13:21AM +0000, Sudeep Holla wrote: > > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > Why are you resending my patch back to me? > > > The dummy regulator driver does not need to create a platform device, it > > only did so because it was simple to do. Change it over to use the > > faux bus instead as this is NOT a real platform device, and it makes > > the code even smaller than before. > > > > Reviewed-by: Mark Brown <broonie@kernel.org> > > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > Message-Id: <2025021027-outclass-stress-59dd@gregkh> > > (sudeep.holla: Made dummy_regulator_driver static) > > So this is a new version? > Not really, I pulled your patch as I needed that as well to clean out all faux device out of platform. I just made dummy_regulator_driver static back again as compiler was warning. Definitely nothing new. I will drop it when posting v2. You can probably fix up to make dummy_regulator_driver static. > And as was pointed out, this is already in my tree, and there's a > conflict in linux-next with it. > Ah may be I missed to pull the updated next. I see I was still on next-20250311. Sorry for that. -- Regards, Sudeep
On Mon, Mar 17, 2025 at 02:13:49PM +0000, Sudeep Holla wrote: > On Mon, Mar 17, 2025 at 02:00:04PM +0100, Greg Kroah-Hartman wrote: > > On Mon, Mar 17, 2025 at 10:13:21AM +0000, Sudeep Holla wrote: > > > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > > > Why are you resending my patch back to me? > > > > > The dummy regulator driver does not need to create a platform device, it > > > only did so because it was simple to do. Change it over to use the > > > faux bus instead as this is NOT a real platform device, and it makes > > > the code even smaller than before. > > > > > > Reviewed-by: Mark Brown <broonie@kernel.org> > > > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > > Message-Id: <2025021027-outclass-stress-59dd@gregkh> > > > (sudeep.holla: Made dummy_regulator_driver static) > > > > So this is a new version? > > > > Not really, I pulled your patch as I needed that as well to clean out > all faux device out of platform. I just made dummy_regulator_driver > static back again as compiler was warning. Definitely nothing new. > I will drop it when posting v2. You can probably fix up to make > dummy_regulator_driver static. My tree can't be rebased, can you just send a patch to make that change instead? thanks, greg k-h
On Mon, Mar 17, 2025 at 03:26:00PM +0100, Greg Kroah-Hartman wrote: > On Mon, Mar 17, 2025 at 02:13:49PM +0000, Sudeep Holla wrote: > > On Mon, Mar 17, 2025 at 02:00:04PM +0100, Greg Kroah-Hartman wrote: > > > On Mon, Mar 17, 2025 at 10:13:21AM +0000, Sudeep Holla wrote: > > > > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > > > > > Why are you resending my patch back to me? > > > > > > > The dummy regulator driver does not need to create a platform device, it > > > > only did so because it was simple to do. Change it over to use the > > > > faux bus instead as this is NOT a real platform device, and it makes > > > > the code even smaller than before. > > > > > > > > Reviewed-by: Mark Brown <broonie@kernel.org> > > > > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > > > Message-Id: <2025021027-outclass-stress-59dd@gregkh> > > > > (sudeep.holla: Made dummy_regulator_driver static) > > > > > > So this is a new version? > > > > > > > Not really, I pulled your patch as I needed that as well to clean out > > all faux device out of platform. I just made dummy_regulator_driver > > static back again as compiler was warning. Definitely nothing new. > > I will drop it when posting v2. You can probably fix up to make > > dummy_regulator_driver static. > > My tree can't be rebased, can you just send a patch to make that change > instead? > Sure, will do that. -- Regards, Sudeep
On Mon, Mar 17, 2025 at 10:13:21AM +0000, Sudeep Holla wrote: > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > The dummy regulator driver does not need to create a platform device, it > only did so because it was simple to do. Change it over to use the > faux bus instead as this is NOT a real platform device, and it makes > the code even smaller than before. This is already in Greg's tree isn't it, what's going on here?
On Mon, Mar 17, 2025 at 10:24:11AM +0000, Mark Brown wrote: > On Mon, Mar 17, 2025 at 10:13:21AM +0000, Sudeep Holla wrote: > > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > > > The dummy regulator driver does not need to create a platform device, it > > only did so because it was simple to do. Change it over to use the > > faux bus instead as this is NOT a real platform device, and it makes > > the code even smaller than before. > > This is already in Greg's tree isn't it, what's going on here? Sorry if it is already queued. I just checked against linux-next and posted it as part of this series as I needed it as well to remove all the "faux" devices under /sys/devices/platform. I may be missing to check some other branch Greg has queued perhaps. -- Regards, Sudeep
© 2016 - 2025 Red Hat, Inc.