From nobody Fri Sep 25 18:24:50 2026 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 C174433F399 for ; Wed, 9 Sep 2026 17:04:47 +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=1788973487; cv=none; b=VAGTXOJeaYtr/SehWtzXPd8R+wJDcGrj0/F70OE/gjLms3FgF3JLjnSdofhQs7Aj89G1uxYZaluit8t/4VBdYNttgq8im+vzMuk5c2a+93AjgngqXDQ42XotwFklatpU70IM7WNpm54O8ZBMA5dBEuR0u1+y89T+dhfzxXycaUc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788973487; c=relaxed/simple; bh=LpKlJiaVIsQKsTlyaIZbqHjsJ9yGKW71aQcyPqxS5to=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=VMFpsOEpctM5ld1vVSQk282bBw1wR2U11arGwfLKoHEMbxrheJvrFql/7gyo2bsNSPHG6JH0TfydMnUvHmgWbdEybitvgyt/eZiBypUxZYSIYZscNA9Kcc2w/+uxjbMTBDo7tyvqPPl4lIGZIIXUeHB3Pg6vh0RvMRXd8JKvFFM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VFB6zFOX; 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="VFB6zFOX" Received: by smtp.kernel.org (Postfix) with ESMTPS id 345F8C2BCF4; Wed, 9 Sep 2026 17:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1788973487; bh=LpKlJiaVIsQKsTlyaIZbqHjsJ9yGKW71aQcyPqxS5to=; h=From:Date:Subject:To:Cc:Reply-To:From; b=VFB6zFOXxeYqx/x5OYlOcN6MKkmkPrjbOAZVw/dHIyn5e7N106G9+6xYU1GMK7/Fs 8EHMZXOHg6gDFjgvsAIUCjHlwqeJuBXNFb0poUpElNRi1soabtllxgU+uMLuQ2vm51 ufI/6iAUPXkc26k+qRs9rQenCTvtU7a48+S51sFt9MY+QObiqOrh9sVh5DDjKzAcQJ uBZlNZ9vy07ez/ZP/fef6gOAqcNbEPTwPMHCGGoq+B7gqqTn+ODbWF+Ybt30up0Tb1 8IF5wvwbYiUkLtBRTMw9+j4SH1Dn3K/UHqAqmLifJ8Z3CCUac8qpOsoY6clPc0If8D 2LlNgGvxq7yVA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BCB0C79FBD; Wed, 9 Sep 2026 17:04:47 +0000 (UTC) From: Vincent Jardin via B4 Relay Date: Wed, 09 Sep 2026 19:04:40 +0200 Subject: [PATCH v2] bus: fsl-mc: register the object drivers after misc_class exists Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260909-for-upstream-fsl-mc-initcall-order-v2-1-b7a04634fcf1@free.fr> X-B4-Tracking: v=1; b=H4sIAKeRoWoC/42NSw6CMBBAr0K6dkw/pogr72FYIMzIJEDJFBsN4 e5W4gFcvrd4b1URhTGqS7EqwcSRw5TBHgrV9s30QOAus7Lael1ZCxQEnnNcBJsRKA4wtsATL20 zDBCkQwF0znhX6dLYu8qhWZD4tU9udeae4xLkvT+T+dpfXpt/8smAAeeJ8HSm0pfdlQTxSKLqb ds+MEjWltIAAAA= To: Ioana Ciornei , "Christophe Leroy (CS GROUP)" Cc: Laurentiu Tudor , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable+noautosel@kernel.org, Vincent Jardin X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1788973486; l=3680; i=vjardin@free.fr; s=20260525; h=from:subject:message-id; bh=4w8EyLodWYbpAxy4IdhaZ8kc0Y8HbWHFCMkpK6NuPbI=; b=Rid5LvQoK9miq+gA7+YL1kd3AUGRJD8FeSxJ1xg5zimcVvmU64GZjtoDj5sORC46X9N1xjtkj HACM4entDAGAiqmRKDC0kGr5rSInrkDPfoIfd+y7zLR9ubxcwGErk7M X-Developer-Key: i=vjardin@free.fr; a=ed25519; pk=hppgLeFpGpKOi7LNwGEZ4jOYofJCoGd4Jf1ltAabiLw= X-Endpoint-Received: by B4 Relay for vjardin@free.fr/20260525 with auth_id=871 X-Original-From: Vincent Jardin Reply-To: vjardin@free.fr From: Vincent Jardin Unbinding and re-binding the root DPRC fails with: sysfs: cannot create duplicate filename '/dev/char/10:256' misc_register / fsl_mc_uapi_create_device_file / dprc_setup / dprc_probe It happens when the fsl-mc bus probe is not deferred, without SMMU: - the dprc driver is registered at postcore_initcall, - the DT node is populated at arch_initcall_sync, - the root DPRC probes right there, before misc_init() has registered misc_class at subsys_initcall. misc_register() still succeeds but the device gets no class, so misc_deregister() at unbind cannot find it: the minor is freed while the device and its /sys/dev/char/ link leak, and then the next bind collides on the same minor. Let's move the dprc and allocator drivers registration, and platform_driver_register(), to subsys_initcall_sync, after misc_init() at subsys_initcall. bus_register() and the platform-bus notifier stay at postcore_initcall so that fsl_mc_bus_notifier() still pauses the MC before the SMMU is probed. Cc: stable+noautosel@kernel.org # niche: root DPRC unbind/rebind only Fixes: 2cf1e703f066 ("bus: fsl-mc: add fsl-mc userspace support") Signed-off-by: Vincent Jardin Reviewed-by: Ioana Ciornei --- Issue found when unbinding/rebinding the root DPRC on an LX2160A. The failure is silent at bind time and only shows up as a duplicate /dev/char entry on the second bind. --- Changes in v2: - Commit message: the bug needs a non-deferred fsl-mc bus probe (no SMMU) - Ioana Ciornei - No code change - Link to v1: https://lore.kernel.org/r/20260901-for-upstream-fsl-mc-initca= ll-order-v1-1-36ffe48f767d@free.fr --- drivers/bus/fsl-mc/fsl-mc-bus.c | 40 ++++++++++++++++++++++++-------------= --- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bu= s.c index 66a4fa73c5b86..7f283844e4500 100644 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -1264,35 +1264,43 @@ static int __init fsl_mc_bus_driver_init(void) error =3D bus_register(&fsl_mc_bus_type); if (error < 0) { pr_err("bus type registration failed: %d\n", error); - goto error_cleanup_cache; + return error; } =20 - error =3D platform_driver_register(&fsl_mc_bus_driver); - if (error < 0) { - pr_err("platform_driver_register() failed: %d\n", error); + error =3D bus_register_notifier(&platform_bus_type, &fsl_mc_nb); + if (error < 0) goto error_cleanup_bus; - } + + return 0; + +error_cleanup_bus: + bus_unregister(&fsl_mc_bus_type); + return error; +} +postcore_initcall(fsl_mc_bus_driver_init); + +static int __init fsl_mc_bus_drivers_init(void) +{ + int error; =20 error =3D dprc_driver_init(); if (error < 0) - goto error_cleanup_driver; + return error; =20 error =3D fsl_mc_allocator_driver_init(); if (error < 0) goto error_cleanup_dprc_driver; =20 - return bus_register_notifier(&platform_bus_type, &fsl_mc_nb); + error =3D platform_driver_register(&fsl_mc_bus_driver); + if (error < 0) { + pr_err("platform_driver_register() failed: %d\n", error); + goto error_cleanup_dprc_driver; + } + + return 0; =20 error_cleanup_dprc_driver: dprc_driver_exit(); - -error_cleanup_driver: - platform_driver_unregister(&fsl_mc_bus_driver); - -error_cleanup_bus: - bus_unregister(&fsl_mc_bus_type); - -error_cleanup_cache: return error; } -postcore_initcall(fsl_mc_bus_driver_init); +subsys_initcall_sync(fsl_mc_bus_drivers_init); --- base-commit: 786262be6048deab760f68c8acc2c85607165894 change-id: 20260922-for-upstream-fsl-mc-initcall-order-e3316390712b Best regards, --=20 Vincent Jardin