* [PATCH 0/3] powerpc: switch to dynamic root devices
@ 2026-04-24 10:36 Johan Hovold
2026-04-24 10:36 ` [PATCH 1/3] powerpc/ps3: switch to dynamic system bus root device Johan Hovold
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Johan Hovold @ 2026-04-24 10:36 UTC (permalink / raw)
To: Geoff Levand, Madhavan Srinivasan, Michael Ellerman
Cc: Nicholas Piggin, Christophe Leroy, Greg Kroah-Hartman,
linuxppc-dev, linux-kernel, Johan Hovold
This series replaces static root devices with dynamically allocated
ones. Included is also a related printk cleanup.
Johan
Johan Hovold (3):
powerpc/ps3: switch to dynamic system bus root device
powerpc/pseries: switch to dynamic ibmebus root device
powerpc/pseries: clean up ibmebus printks
arch/powerpc/platforms/ps3/system-bus.c | 10 +++----
arch/powerpc/platforms/pseries/ibmebus.c | 34 +++++++++---------------
2 files changed, 17 insertions(+), 27 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] powerpc/ps3: switch to dynamic system bus root device
2026-04-24 10:36 [PATCH 0/3] powerpc: switch to dynamic root devices Johan Hovold
@ 2026-04-24 10:36 ` Johan Hovold
2026-04-24 10:36 ` [PATCH 2/3] powerpc/pseries: switch to dynamic ibmebus " Johan Hovold
2026-04-24 10:36 ` [PATCH 3/3] powerpc/pseries: clean up ibmebus printks Johan Hovold
2 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2026-04-24 10:36 UTC (permalink / raw)
To: Geoff Levand, Madhavan Srinivasan, Michael Ellerman
Cc: Nicholas Piggin, Christophe Leroy, Greg Kroah-Hartman,
linuxppc-dev, linux-kernel, Johan Hovold
Driver core expects devices to be dynamically allocated and will, for
example, complain loudly if a device that lacks a release function
is ever freed.
Use root_device_register() to allocate and register the root device
instead of open coding using a static device.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
arch/powerpc/platforms/ps3/system-bus.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index 0537a678a32f..4ead6ccea259 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -20,9 +20,7 @@
#include "platform.h"
-static struct device ps3_system_bus = {
- .init_name = "ps3_system",
-};
+static struct device *ps3_system_bus;
/* FIXME: need device usage counters! */
static struct {
@@ -486,8 +484,8 @@ static int __init ps3_system_bus_init(void)
mutex_init(&usage_hack.mutex);
- result = device_register(&ps3_system_bus);
- BUG_ON(result);
+ ps3_system_bus = root_device_register("ps3_system");
+ BUG_ON(IS_ERR(ps3_system_bus));
result = bus_register(&ps3_system_bus_type);
BUG_ON(result);
@@ -744,7 +742,7 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
static unsigned int dev_lpm_count;
if (!dev->core.parent)
- dev->core.parent = &ps3_system_bus;
+ dev->core.parent = ps3_system_bus;
dev->core.bus = &ps3_system_bus_type;
dev->core.release = ps3_system_bus_release_device;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] powerpc/pseries: switch to dynamic ibmebus root device
2026-04-24 10:36 [PATCH 0/3] powerpc: switch to dynamic root devices Johan Hovold
2026-04-24 10:36 ` [PATCH 1/3] powerpc/ps3: switch to dynamic system bus root device Johan Hovold
@ 2026-04-24 10:36 ` Johan Hovold
2026-04-24 10:36 ` [PATCH 3/3] powerpc/pseries: clean up ibmebus printks Johan Hovold
2 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2026-04-24 10:36 UTC (permalink / raw)
To: Geoff Levand, Madhavan Srinivasan, Michael Ellerman
Cc: Nicholas Piggin, Christophe Leroy, Greg Kroah-Hartman,
linuxppc-dev, linux-kernel, Johan Hovold
Driver core expects devices to be dynamically allocated and will, for
example, complain loudly if a device that lacks a release function is
ever freed.
Use root_device_register() to allocate and register the root device
instead of open coding using a static device.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
arch/powerpc/platforms/pseries/ibmebus.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c
index cad2deb7e70d..e3b41e2d844f 100644
--- a/arch/powerpc/platforms/pseries/ibmebus.c
+++ b/arch/powerpc/platforms/pseries/ibmebus.c
@@ -51,9 +51,7 @@
#include <asm/ibmebus.h>
#include <asm/machdep.h>
-static struct device ibmebus_bus_device = { /* fake "parent" device */
- .init_name = "ibmebus",
-};
+static struct device *ibmebus_bus_device; /* fake "parent" device */
const struct bus_type ibmebus_bus_type;
@@ -171,7 +169,7 @@ static int ibmebus_create_device(struct device_node *dn)
struct platform_device *dev;
int ret;
- dev = of_device_alloc(dn, NULL, &ibmebus_bus_device);
+ dev = of_device_alloc(dn, NULL, ibmebus_bus_device);
if (!dev)
return -ENOMEM;
@@ -458,11 +456,11 @@ static int __init ibmebus_bus_init(void)
return err;
}
- err = device_register(&ibmebus_bus_device);
- if (err) {
- printk(KERN_WARNING "%s: device_register returned %i\n",
+ ibmebus_bus_device = root_device_register("ibmebus");
+ if (IS_ERR(ibmebus_bus_device)) {
+ err = PTR_ERR(ibmebus_bus_device);
+ printk(KERN_WARNING "%s: root_device_register returned %i\n",
__func__, err);
- put_device(&ibmebus_bus_device);
bus_unregister(&ibmebus_bus_type);
return err;
@@ -470,7 +468,7 @@ static int __init ibmebus_bus_init(void)
err = ibmebus_create_devices(ibmebus_matches);
if (err) {
- device_unregister(&ibmebus_bus_device);
+ root_device_unregister(ibmebus_bus_device);
bus_unregister(&ibmebus_bus_type);
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] powerpc/pseries: clean up ibmebus printks
2026-04-24 10:36 [PATCH 0/3] powerpc: switch to dynamic root devices Johan Hovold
2026-04-24 10:36 ` [PATCH 1/3] powerpc/ps3: switch to dynamic system bus root device Johan Hovold
2026-04-24 10:36 ` [PATCH 2/3] powerpc/pseries: switch to dynamic ibmebus " Johan Hovold
@ 2026-04-24 10:36 ` Johan Hovold
2 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2026-04-24 10:36 UTC (permalink / raw)
To: Geoff Levand, Madhavan Srinivasan, Michael Ellerman
Cc: Nicholas Piggin, Christophe Leroy, Greg Kroah-Hartman,
linuxppc-dev, linux-kernel, Johan Hovold
Clean up the imbebus printks by switching to pr_warn() and pr_err(),
adding a missing newline and making the error messages a bit more
uniform.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
arch/powerpc/platforms/pseries/ibmebus.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c
index e3b41e2d844f..8797b2137d9c 100644
--- a/arch/powerpc/platforms/pseries/ibmebus.c
+++ b/arch/powerpc/platforms/pseries/ibmebus.c
@@ -203,8 +203,7 @@ static int ibmebus_create_devices(const struct of_device_id *matches)
ret = ibmebus_create_device(child);
if (ret) {
- printk(KERN_ERR "%s: failed to create device (%i)",
- __func__, ret);
+ pr_err("%s: failed to create device: %d\n", __func__, ret);
of_node_put(child);
break;
}
@@ -282,8 +281,7 @@ static ssize_t probe_store(const struct bus_type *bus, const char *buf, size_t c
ibmebus_match_path);
if (dev) {
put_device(dev);
- printk(KERN_WARNING "%s: %s has already been probed\n",
- __func__, path);
+ pr_warn("%s: %s has already been probed\n", __func__, path);
rc = -EEXIST;
goto out;
}
@@ -292,8 +290,7 @@ static ssize_t probe_store(const struct bus_type *bus, const char *buf, size_t c
rc = ibmebus_create_device(dn);
of_node_put(dn);
} else {
- printk(KERN_WARNING "%s: no such device node: %s\n",
- __func__, path);
+ pr_warn("%s: no such device node: %s\n", __func__, path);
rc = -ENODEV;
}
@@ -322,8 +319,7 @@ static ssize_t remove_store(const struct bus_type *bus, const char *buf, size_t
kfree(path);
return count;
} else {
- printk(KERN_WARNING "%s: %s not on the bus\n",
- __func__, path);
+ pr_warn("%s: %s not on the bus\n", __func__, path);
kfree(path);
return -ENODEV;
@@ -447,20 +443,18 @@ static int __init ibmebus_bus_init(void)
{
int err;
- printk(KERN_INFO "IBM eBus Device Driver\n");
+ pr_info("IBM eBus Device Driver\n");
err = bus_register(&ibmebus_bus_type);
if (err) {
- printk(KERN_ERR "%s: failed to register IBM eBus.\n",
- __func__);
+ pr_err("%s: failed to register IBM eBus\n", __func__);
return err;
}
ibmebus_bus_device = root_device_register("ibmebus");
if (IS_ERR(ibmebus_bus_device)) {
err = PTR_ERR(ibmebus_bus_device);
- printk(KERN_WARNING "%s: root_device_register returned %i\n",
- __func__, err);
+ pr_err("%s: failed to register root device: %d\n", __func__, err);
bus_unregister(&ibmebus_bus_type);
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-24 10:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-24 10:36 [PATCH 0/3] powerpc: switch to dynamic root devices Johan Hovold
2026-04-24 10:36 ` [PATCH 1/3] powerpc/ps3: switch to dynamic system bus root device Johan Hovold
2026-04-24 10:36 ` [PATCH 2/3] powerpc/pseries: switch to dynamic ibmebus " Johan Hovold
2026-04-24 10:36 ` [PATCH 3/3] powerpc/pseries: clean up ibmebus printks Johan Hovold
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.