From: Johan Hovold <johan@kernel.org>
To: Finn Thain <fthain@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
Johan Hovold <johan@kernel.org>
Subject: [PATCH] nubus: switch to dynamic root device
Date: Fri, 24 Apr 2026 12:40:11 +0200 [thread overview]
Message-ID: <20260424104011.2616970-1-johan@kernel.org> (raw)
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>
---
drivers/nubus/nubus.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c
index 559dce302d06..40ce4991c356 100644
--- a/drivers/nubus/nubus.c
+++ b/drivers/nubus/nubus.c
@@ -41,9 +41,7 @@ module_param_named(populate_procfs, nubus_populate_procfs, bool, 0);
LIST_HEAD(nubus_func_rsrcs);
-static struct device nubus_parent = {
- .init_name = "nubus",
-};
+static struct device *nubus_parent;
/* Meaning of "bytelanes":
@@ -833,7 +831,7 @@ static void __init nubus_add_board(int slot, int bytelanes)
list_add_tail(&fres->list, &nubus_func_rsrcs);
}
- if (nubus_device_register(&nubus_parent, board))
+ if (nubus_device_register(nubus_parent, board))
put_device(&board->dev);
}
@@ -880,18 +878,17 @@ static void __init nubus_scan_bus(void)
static int __init nubus_init(void)
{
- int err;
-
if (!MACH_IS_MAC)
return 0;
nubus_proc_init();
- err = device_register(&nubus_parent);
- if (err) {
- put_device(&nubus_parent);
- return err;
- }
+
+ nubus_parent = root_device_register("nubus");
+ if (IS_ERR(nubus_parent))
+ return PTR_ERR(nubus_parent);
+
nubus_scan_bus();
+
return 0;
}
--
2.53.0
next reply other threads:[~2026-04-24 10:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 10:40 Johan Hovold [this message]
2026-04-25 4:07 ` [PATCH] nubus: switch to dynamic root device Finn Thain
2026-04-27 15:30 ` Johan Hovold
2026-04-28 7:24 ` Finn Thain
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=20260424104011.2616970-1-johan@kernel.org \
--to=johan@kernel.org \
--cc=fthain@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.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