{"id":2227826,"url":"http://patchwork.ozlabs.org/api/patches/2227826/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-um/patch/20260424103101.2616338-1-johan@kernel.org/","project":{"id":60,"url":"http://patchwork.ozlabs.org/api/projects/60/?format=json","name":"User-mode Linux Development","link_name":"linux-um","list_id":"linux-um.lists.infradead.org","list_email":"linux-um@lists.infradead.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260424103101.2616338-1-johan@kernel.org>","list_archive_url":null,"date":"2026-04-24T10:31:01","name":"um: virtio_uml: switch to dynamic root device","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"31f7df316b7f6790c13196c7aa2fa478a6115555","submitter":{"id":64666,"url":"http://patchwork.ozlabs.org/api/people/64666/?format=json","name":"Johan Hovold","email":"johan@kernel.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-um/patch/20260424103101.2616338-1-johan@kernel.org/mbox/","series":[{"id":501339,"url":"http://patchwork.ozlabs.org/api/series/501339/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-um/list/?series=501339","date":"2026-04-24T10:31:01","name":"um: virtio_uml: switch to dynamic root device","version":1,"mbox":"http://patchwork.ozlabs.org/series/501339/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2227826/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2227826/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=gwUN/VHr;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=F9TFE92L;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g28Q76bsSz1yDD\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 20:31:20 +1000 (AEST)","from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wGDoW-0000000D2fF-2jxB;\n\tFri, 24 Apr 2026 10:31:12 +0000","from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wGDoV-0000000D2eu-0fPA\n\tfor linux-um@lists.infradead.org;\n\tFri, 24 Apr 2026 10:31:11 +0000","from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby tor.source.kernel.org (Postfix) with ESMTP id 3CF32600AE;\n\tFri, 24 Apr 2026 10:31:10 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id E7CEFC19425;\n\tFri, 24 Apr 2026 10:31:09 +0000 (UTC)","from johan by xi.lan with local (Exim 4.98.2)\n\t(envelope-from <johan@kernel.org>)\n\tid 1wGDoR-0000000AydH-3Ctp;\n\tFri, 24 Apr 2026 12:31:07 +0200"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help\n\t:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding:\n\tMIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type:\n\tContent-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:\n\tResent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner;\n\tbh=H4uVYoUgpKIkIvOZArZNMR6ZEOp/gVJeXZw7R1usUfU=; b=gwUN/VHrFffvrUnm0RxUNf8GWK\n\tYJKyIaINc3cTSABeYqg8KOq7Dh+M4pXJ19r4+2irLxQkZxLC4RQt9Z95JHhXs2zJxOOoyQktW/HNj\n\ta1nmS2xHpSm7+bt7Xv5XJgdDx9jPiGohlCzK4IGQ6eLvORTlHwz25JZCPyd1/yQejE+rcnzWMF4YT\n\tpFYofw86osw/njn+mzASyjzjcF0GYlEleMbt8DVW6EG/Pc8JnDrfpuz5Z12ZKEmnYrPn0RzRNY5GC\n\ts8ICbqIppJwb86en2MAOS5UbGbnfNE7BE0SHbfuX5Uy2/nGMPnDMan4r70DajhLif6qsIJbPg8fn/\n\thWH50j2g==;","v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777026669;\n\tbh=0Sz5oYEFlV8HCKTpRL+w9bwfpXJkeAd+kzEzv8vJVEM=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=F9TFE92LmJt5GDphUvhyod6GtDMcnlFGAeJ2RhOID6BG7L1HSCTgdxjbsnWbNGy7V\n\t AVpwy2TnChwkfotNYuD53O0gb0d/eOKM+blwzFrKZ4PSnMSiVzHL7YqI15D8cYpIpq\n\t 63mHXI2JFq5tAEfTh8eCCj2ssjB7atsHgOS7UB8g/Um4lNVgDgTpJ3LF5xAH3aYwDD\n\t rNho+ofx4y3Dm6Fo2G9UFKfK59mX6MbaKoLc82oBoB/6Xc5FxxJOYgsXeMYtFOwsc3\n\t /v8EGPP2YB5XHrt5GSP23a7Hc2b1r32+Go35bwbzas92GhFFNOJarbs9ZuJ5bUGhA/\n\t Dwq2PranVzO+A=="],"From":"Johan Hovold <johan@kernel.org>","To":"Richard Weinberger <richard@nod.at>,\n\tAnton Ivanov <anton.ivanov@cambridgegreys.com>,\n\tJohannes Berg <johannes@sipsolutions.net>","Cc":"Greg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\tlinux-um@lists.infradead.org,\n\tlinux-kernel@vger.kernel.org,\n\tJohan Hovold <johan@kernel.org>","Subject":"[PATCH] um: virtio_uml: switch to dynamic root device","Date":"Fri, 24 Apr 2026 12:31:01 +0200","Message-ID":"<20260424103101.2616338-1-johan@kernel.org>","X-Mailer":"git-send-email 2.53.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"linux-um@lists.infradead.org","X-Mailman-Version":"2.1.34","Precedence":"list","List-Id":"<linux-um.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-um>,\n <mailto:linux-um-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-um/>","List-Post":"<mailto:linux-um@lists.infradead.org>","List-Help":"<mailto:linux-um-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-um>,\n <mailto:linux-um-request@lists.infradead.org?subject=subscribe>","Sender":"\"linux-um\" <linux-um-bounces@lists.infradead.org>","Errors-To":"linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"},"content":"Driver core expects devices to be dynamically allocated and will, for\nexample, complain loudly when no release function has been provided.\n\nUse __root_device_register() to allocate and register the root device\ninstead of open coding using a static device.\n\nNote that root_device_register(), which also creates a link to the\nmodule, cannot be used as the device is registered when parsing the\nmodule parameters which happens before the module kobject has been\nset up.\n\nSigned-off-by: Johan Hovold <johan@kernel.org>\n---\n arch/um/drivers/virtio_uml.c | 24 ++++++++----------------\n 1 file changed, 8 insertions(+), 16 deletions(-)","diff":"diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c\nindex 7425a8548141..c43afb0af47f 100644\n--- a/arch/um/drivers/virtio_uml.c\n+++ b/arch/um/drivers/virtio_uml.c\n@@ -1274,14 +1274,7 @@ static void virtio_uml_remove(struct platform_device *pdev)\n \n /* Command line device list */\n \n-static void vu_cmdline_release_dev(struct device *d)\n-{\n-}\n-\n-static struct device vu_cmdline_parent = {\n-\t.init_name = \"virtio-uml-cmdline\",\n-\t.release = vu_cmdline_release_dev,\n-};\n+static struct device *vu_cmdline_parent;\n \n static DEFINE_MUTEX(vu_cmdline_lock);\n static bool vu_cmdline_parent_registered;\n@@ -1333,11 +1326,10 @@ static int vu_cmdline_set_device(const char *device)\n \t\treturn -EINVAL;\n \n \tif (!vu_cmdline_parent_registered) {\n-\t\terr = device_register(&vu_cmdline_parent);\n-\t\tif (err) {\n+\t\tvu_cmdline_parent = __root_device_register(\"virtio-uml-cmdline\", NULL);\n+\t\tif (IS_ERR(vu_cmdline_parent)) {\n \t\t\tpr_err(\"Failed to register parent device!\\n\");\n-\t\t\tput_device(&vu_cmdline_parent);\n-\t\t\treturn err;\n+\t\t\treturn PTR_ERR(vu_cmdline_parent);\n \t\t}\n \t\tvu_cmdline_parent_registered = true;\n \t}\n@@ -1352,7 +1344,7 @@ static int vu_cmdline_set_device(const char *device)\n \tpr_info(\"Registering device virtio-uml.%d id=%d at %s\\n\",\n \t\tvu_cmdline_id, virtio_device_id, socket_path);\n \n-\tpdev = platform_device_register_data(&vu_cmdline_parent, \"virtio-uml\",\n+\tpdev = platform_device_register_data(vu_cmdline_parent, \"virtio-uml\",\n \t\t\t\t\t     vu_cmdline_id++, &pdata,\n \t\t\t\t\t     sizeof(pdata));\n \terr = PTR_ERR_OR_ZERO(pdev);\n@@ -1393,7 +1385,7 @@ static int vu_cmdline_get(char *buffer, const struct kernel_param *kp)\n \n \tbuffer[0] = '\\0';\n \tif (vu_cmdline_parent_registered)\n-\t\tdevice_for_each_child(&vu_cmdline_parent, buffer,\n+\t\tdevice_for_each_child(vu_cmdline_parent, buffer,\n \t\t\t\t      vu_cmdline_get_device);\n \treturn strlen(buffer) + 1;\n }\n@@ -1417,9 +1409,9 @@ static void vu_unregister_cmdline_devices(void)\n \tguard(mutex)(&vu_cmdline_lock);\n \n \tif (vu_cmdline_parent_registered) {\n-\t\tdevice_for_each_child(&vu_cmdline_parent, NULL,\n+\t\tdevice_for_each_child(vu_cmdline_parent, NULL,\n \t\t\t\t      vu_unregister_cmdline_device);\n-\t\tdevice_unregister(&vu_cmdline_parent);\n+\t\troot_device_unregister(vu_cmdline_parent);\n \t\tvu_cmdline_parent_registered = false;\n \t}\n }\n","prefixes":[]}