From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A325B37FF7A for ; Fri, 24 Apr 2026 10:36:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777026977; cv=none; b=PUpSs06s1fzmXdQmRkeoC1qzIRRAjYI1zXQLwr0eGsdv3jvLMsPhKanDYZx2Y00eIMNVdtZaIImfOfCFyyLnMTCltl0ExBAkaAndETu5g8v/eWdtCBHGJjddq2LYJBlahxSQlJRq/1SwwiZLcGdMbJ3XSl0dqm21dZUdIXSUgHY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777026977; c=relaxed/simple; bh=ZwE069RHo6hyU8LL6FzDYw0Wg1+bXUJujekvNAdWEys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u5jFUf7e3ZXrNI9m7d6aIbYIvj0cfmK9JVVZVz5JzMK1fV8HQwFzeAmB8gA8TbH5pm+Q3Og02atsAgQN1segzPfeETO297VfwnL0CFWggqHzz05d/JxMo75Aq6F8ds6fGBNaT3WHDDJRxVPJYthOlRlbNPVjfFCA+DTcbi5fYn0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SPR35I1X; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SPR35I1X" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59653C2BCB5; Fri, 24 Apr 2026 10:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777026977; bh=ZwE069RHo6hyU8LL6FzDYw0Wg1+bXUJujekvNAdWEys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SPR35I1XRiFR74YKSQrmPc+aOFKBUE9q3V7EgK8pKe4GjghnPqPWyQvysQg8hz7/N fpIU6UD7f4UQrANglzvxWiNlXVxuIHC57QnJPPOLhFooUVNm/LV3D1CfG4QvHFAWNG mAs1SWtzElv1BTIurhdgFod9UlXLchTVVARpqP38oJ1WR8HNh4oF5KXL3ITouA5gs4 NzHvYl6LcBncryWJ3bRsPbDzzrOW6LDEgr7Qh90vmEqJLAklHPWLYnFzgQ1auQDO00 xUiPZNbIFXkLa5yKImyi33bkcGDxXtY3xEY3dP/x5N0EfRw04S2RYd8slsCIEe2EOY 5CIu3OGt452kw== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1wGDtP-0000000Ayib-0rYe; Fri, 24 Apr 2026 12:36:15 +0200 From: Johan Hovold To: Geoff Levand , Madhavan Srinivasan , Michael Ellerman Cc: Nicholas Piggin , Christophe Leroy , Greg Kroah-Hartman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/3] powerpc/pseries: switch to dynamic ibmebus root device Date: Fri, 24 Apr 2026 12:36:03 +0200 Message-ID: <20260424103604.2616657-3-johan@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424103604.2616657-1-johan@kernel.org> References: <20260424103604.2616657-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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 #include -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