From nobody Wed Dec 17 15:34:42 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EDEE222CBCB; Mon, 17 Mar 2025 10:13:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206435; cv=none; b=N0a+C6qIcMHPA+dY4eI3QChpLBaIt6E5T/EPcIBJ/Z7qMDrogBY8GO0HyfsA+YjZPur0DiU9YUFrYz8Mwmjxqwits/L+md0DACKqoq5J4gxJkuEIH6PbRkmsdCgWqmFch5QLBC2ifvNV1AykYEatlGvGsHHymW90x+mkTEUoDI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206435; c=relaxed/simple; bh=CI87/B0Z+bu/xDS4edBZdD4AK/oZaz/fs000mRMbt+U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YLp9rHBYTHTPvxS78ay1bXvpwyYVJWPl7fyro0hZ7d2ni6UDG1+N+u3gsDwXioU//7jIU+wizL72NN2Zwkh/h/vuDyFlS061H9miDVw/awQ9gvMlOYNSjs8y56cZCllKDCiXyWu32X/Cd/HIzg9YrXEParbqYh8+iwIwnBK07kA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 19E6A169E; Mon, 17 Mar 2025 03:14:02 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 02BD43F673; Mon, 17 Mar 2025 03:13:51 -0700 (PDT) From: Sudeep Holla Date: Mon, 17 Mar 2025 10:13:13 +0000 Subject: [PATCH 1/9] cpuidle: psci: Transition to the faux device interface 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: <20250317-plat2faux_dev-v1-1-5fe67c085ad5@arm.com> References: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> In-Reply-To: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , Lorenzo Pieralisi , "Rafael J. Wysocki" , Daniel Lezcano , linux-pm@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2777; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=CI87/B0Z+bu/xDS4edBZdD4AK/oZaz/fs000mRMbt+U=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBn1/XaZ+U6uYLveI1x2mPg1VMHlAy/5EmFDW6ki UUkAdRCsUeJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZ9f12gAKCRAAQbq8MX7i mAZAEACbwv+dihKcag5jpxHMiyu2m1tRcIhD3ISHTbNxkv4JJPcLPZ0C5U6Zxk3ubxo2O5yNx5O zmuft6lLuUIPHFTbHPA1mMHxtL3Jv6Bgmr/hg54CREtWOEIrJbpbu8NYVXKjBNn7cfdxOw9xMti x6m+2zCOM/22nDJgRDg40HFMEBKuvf08hl/shDtJMSULUwRXHehbGCP5ADE8L8bEZ2nv7Y++MmB rectjYgKvEFvZZqcBh3svsU13HPf2oCDJcaAjbQsIt9q8SLCZR/w+EP4ABRdTfoaXHWI2gjmvL4 Gts2p0FO7A6DSvPLVyh4gAspH+nRuxH5XOStdgDXfmefCl1P/aPLFER4VgH+LgVp7Srkw8u3iGE fDPolaWURybWKp92n+4eEJo0ybIxzA5GzWmbFYq/w/yqyP/Ka6RV+p42gGjfFVWFLe5luhfbI7j JoFZDl5uzhjiFuMCz5o87CgLRPUf62N6S79Khkbkq5Tdc8TCu4bnxQl0g868gnWHl/cjmRP1ph3 Es56Jyan+ewb9aRvp0xOGb30yh9aSghwwg2m61FegFXSTObTxy7mDM1GV12GUiey6PHPeEAFb0P VYEhCnFWBzFAUchrmzyqPlJz1SVle7YqIFS06lj+zFbwt8WH0I8wKtLzGCMcRXRjPw0mfZEEi1A RQv2dLcNIgXb/Zw== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 The PSCI cpuidle driver does not require the creation of a platform device. Originally, this approach was chosen for simplicity when the driver was first implemented. With the introduction of the lightweight faux device interface, we now have a more appropriate alternative. Migrate the driver to utilize the faux bus, given that the platform device it previously created was not a real one anyway. This will simplify the code, reducing its footprint while maintaining functionality. Cc: Lorenzo Pieralisi Cc: "Rafael J. Wysocki" Cc: Daniel Lezcano Cc: linux-pm@vger.kernel.org Signed-off-by: Sudeep Holla --- drivers/cpuidle/cpuidle-psci.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index 2562dc001fc1de69732ef28f383d2809262a3d96..3e38f712dab3785d5caa8d103fd= 0146156005921 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include @@ -404,14 +404,14 @@ static int psci_idle_init_cpu(struct device *dev, int= cpu) * to register cpuidle driver then rollback to cancel all CPUs * registration. */ -static int psci_cpuidle_probe(struct platform_device *pdev) +static int psci_cpuidle_probe(struct faux_device *fdev) { int cpu, ret; struct cpuidle_driver *drv; struct cpuidle_device *dev; =20 for_each_possible_cpu(cpu) { - ret =3D psci_idle_init_cpu(&pdev->dev, cpu); + ret =3D psci_idle_init_cpu(&fdev->dev, cpu); if (ret) goto out_fail; } @@ -431,26 +431,18 @@ static int psci_cpuidle_probe(struct platform_device = *pdev) return ret; } =20 -static struct platform_driver psci_cpuidle_driver =3D { +static struct faux_device_ops psci_cpuidle_ops =3D { .probe =3D psci_cpuidle_probe, - .driver =3D { - .name =3D "psci-cpuidle", - }, }; =20 static int __init psci_idle_init(void) { - struct platform_device *pdev; - int ret; + struct faux_device *fdev; =20 - ret =3D platform_driver_register(&psci_cpuidle_driver); - if (ret) - return ret; - - pdev =3D platform_device_register_simple("psci-cpuidle", -1, NULL, 0); - if (IS_ERR(pdev)) { - platform_driver_unregister(&psci_cpuidle_driver); - return PTR_ERR(pdev); + fdev =3D faux_device_create("psci-cpuidle", NULL, &psci_cpuidle_ops); + if (!fdev) { + pr_err("Failed to create psci-cpuidle device\n"); + return -ENODEV; } =20 return 0; --=20 2.34.1 From nobody Wed Dec 17 15:34:42 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CD9523373A; Mon, 17 Mar 2025 10:13:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206436; cv=none; b=bsk0lVOQg0TrkqxOpQud96x5zM15Hq1beCE8P5vfS6RYOj+UgE1+11SZGp8CKcn3+lpyiK7WLWSzDd0qhQUb9PdfyrwLYTp8fxrDpQhxxXG5H7KtgblLCY1G3z54vKcTE/qUy218c5Vn7JftlejbV8zMaqtMniWxIC1Pdc/xqyU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206436; c=relaxed/simple; bh=W3iR8KyjlR4HJ4ebZ4zdbJscuXyuwHmntWmxKR0MThg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S3sAr1xmuHAMfekH9CvWg4DyfWNtJ2vtu3s8TPy4dkugMcvPc5srQs0hJJLqtIeohZat+y99SDKlz8ISk0GLcFtAbcOG7Mzwuy1vw5AnBNxyBRB4mTado3m61cdRHeVgqyUJwWaFdkL1GY9AvFi/GYeMpKf6D53s72nCf9YuhSQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8C9BD2573; Mon, 17 Mar 2025 03:14:03 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 74D523F673; Mon, 17 Mar 2025 03:13:53 -0700 (PDT) From: Sudeep Holla Date: Mon, 17 Mar 2025 10:13:14 +0000 Subject: [PATCH 2/9] hwrng: arm-smccc-trng - transition to the faux device interface 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: <20250317-plat2faux_dev-v1-2-5fe67c085ad5@arm.com> References: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> In-Reply-To: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , Andre Przywara , Herbert Xu , Jeff Johnson , linux-crypto@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4989; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=W3iR8KyjlR4HJ4ebZ4zdbJscuXyuwHmntWmxKR0MThg=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBn1/XbzQBCOprmjqQXP8AvPYDsVkXXAwu4hW/9j bUHAw5iPGuJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZ9f12wAKCRAAQbq8MX7i mOK4D/wJDZIpz0HVPixe2YLXS2h4mgkw4nAlBTPrkjzL+jBjHJiYBuFHBMlGheXq0rOX545pDnW IK63VTS+lLKoFEnWeAYG4/ue0Ypu5BULhIRnD1t2P3qOaAFcm05eh3QWzmNkM0t0vzYNAhfANKz g6vrHf4KCdIEcmMzxqzbEn5zUGIpJ2RR0sO5xQG3DsYq79gcvajCqrgMfy4AkFVO4G9BldljaHB R6piMew3fE87FLqerinW/5iWJe/9c1S04eO2p9t+6BmTQ0HoH/fEfWMdY1oGP9yB1/EfkH2nNVc xqoPfRu432JGKioPfMyt21cdZgfjjvngphIK9Weh4RUQK18D5P/Qvi+z6bBoKMwYQ0aN5t6/XDc rPAu64977zZJDa3rkonMe9TS+8PKTOlbTRn4ZFfwkQ0U67nL8vskuTENquUiE+H4Yf7ZItLEspF rvjwVoLNhGk+bOpeqMFkCeGUxCRXDNg7wTULBW3fs9ndhhYqONM0ia5hlYumONjgyHY0tTTond3 D1Iz29F/jVugpAgZlEEttvSK/K/p6jBSpCEVtJd4HzjktnZs1bP28wYpuGLhLKdDxkZKOLjKi0G OtiQ5wJ2tY7FbgQaWvhe2AeE2YBG4pCvdf1ND9rr3lbZ8QFAhNULN2n820Hl9cTSPTTBAGF5nZI TxonQGwQvcTMSYw== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 The Arm SMCCC based true random number generator driver does not require the creation of a platform device/driver. Originally, this approach was chosen for simplicity when the driver was first implemented. With the introduction of the lightweight faux device interface, we now have a more appropriate alternative. Migrate the driver to utilize the faux bus, given that the platform device it previously created was not a real one anyway. This will simplify the code, reducing its footprint while maintaining functionality. Cc: Andre Przywara Cc: Herbert Xu Cc: Jeff Johnson Cc: linux-crypto@vger.kernel.org Signed-off-by: Sudeep Holla --- drivers/char/hw_random/arm_smccc_trng.c | 40 ++++++++++++++++++++++++-----= ---- drivers/firmware/smccc/smccc.c | 21 ----------------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/drivers/char/hw_random/arm_smccc_trng.c b/drivers/char/hw_rand= om/arm_smccc_trng.c index dcb8e7f37f25c6b39f76050369b9f324b7fb2e33..2ceab17f6360baaee999a23f3d7= 370b7b5b7d246 100644 --- a/drivers/char/hw_random/arm_smccc_trng.c +++ b/drivers/char/hw_random/arm_smccc_trng.c @@ -16,9 +16,11 @@ #include #include #include -#include +#include #include =20 +#include + #ifdef CONFIG_ARM64 #define ARM_SMCCC_TRNG_RND ARM_SMCCC_TRNG_RND64 #define MAX_BITS_PER_CALL (3 * 64UL) @@ -33,6 +35,8 @@ #define SMCCC_RET_TRNG_INVALID_PARAMETER -2 #define SMCCC_RET_TRNG_NO_ENTROPY -3 =20 +bool __ro_after_init smccc_trng_available; + static int copy_from_registers(char *buf, struct arm_smccc_res *res, size_t bytes) { @@ -94,29 +98,43 @@ static int smccc_trng_read(struct hwrng *rng, void *dat= a, size_t max, bool wait) return copied; } =20 -static int smccc_trng_probe(struct platform_device *pdev) +static int smccc_trng_probe(struct faux_device *fdev) { struct hwrng *trng; =20 - trng =3D devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL); + trng =3D devm_kzalloc(&fdev->dev, sizeof(*trng), GFP_KERNEL); if (!trng) return -ENOMEM; =20 trng->name =3D "smccc_trng"; trng->read =3D smccc_trng_read; =20 - return devm_hwrng_register(&pdev->dev, trng); + return devm_hwrng_register(&fdev->dev, trng); } =20 -static struct platform_driver smccc_trng_driver =3D { - .driver =3D { - .name =3D "smccc_trng", - }, - .probe =3D smccc_trng_probe, +static struct faux_device_ops smccc_trng_ops =3D { + .probe =3D smccc_trng_probe, }; -module_platform_driver(smccc_trng_driver); =20 -MODULE_ALIAS("platform:smccc_trng"); +static int __init smccc_trng_init(void) +{ + struct faux_device *fdev; + + smccc_trng_available =3D smccc_probe_trng(); + if (!smccc_trng_available) + return 0; + + fdev =3D faux_device_create("smccc_trng", NULL, &smccc_trng_ops); + if (!fdev) { + pr_err("smccc_trng: could not create the device\n"); + return -ENODEV; + } + + return 0; +} +device_initcall(smccc_trng_init); + +MODULE_ALIAS("faux:smccc_trng"); MODULE_AUTHOR("Andre Przywara"); MODULE_DESCRIPTION("Arm SMCCC TRNG firmware interface support"); MODULE_LICENSE("GPL"); diff --git a/drivers/firmware/smccc/smccc.c b/drivers/firmware/smccc/smccc.c index a74600d9f2d72a5aa0096004f53088c255927a43..0fcd175a53eeaa957d06071b3b2= 6f4c3a3c7116e 100644 --- a/drivers/firmware/smccc/smccc.c +++ b/drivers/firmware/smccc/smccc.c @@ -9,13 +9,10 @@ #include #include #include -#include -#include =20 static u32 smccc_version =3D ARM_SMCCC_VERSION_1_0; static enum arm_smccc_conduit smccc_conduit =3D SMCCC_CONDUIT_NONE; =20 -bool __ro_after_init smccc_trng_available =3D false; s32 __ro_after_init smccc_soc_id_version =3D SMCCC_RET_NOT_SUPPORTED; s32 __ro_after_init smccc_soc_id_revision =3D SMCCC_RET_NOT_SUPPORTED; =20 @@ -26,8 +23,6 @@ void __init arm_smccc_version_init(u32 version, enum arm_= smccc_conduit conduit) smccc_version =3D version; smccc_conduit =3D conduit; =20 - smccc_trng_available =3D smccc_probe_trng(); - if ((smccc_version >=3D ARM_SMCCC_VERSION_1_2) && (smccc_conduit !=3D SMCCC_CONDUIT_NONE)) { arm_smccc_1_1_invoke(ARM_SMCCC_ARCH_FEATURES_FUNC_ID, @@ -66,19 +61,3 @@ s32 arm_smccc_get_soc_id_revision(void) return smccc_soc_id_revision; } EXPORT_SYMBOL_GPL(arm_smccc_get_soc_id_revision); - -static int __init smccc_devices_init(void) -{ - struct platform_device *pdev; - - if (smccc_trng_available) { - pdev =3D platform_device_register_simple("smccc_trng", -1, - NULL, 0); - if (IS_ERR(pdev)) - pr_err("smccc_trng: could not register device: %ld\n", - PTR_ERR(pdev)); - } - - return 0; -} -device_initcall(smccc_devices_init); --=20 2.34.1 From nobody Wed Dec 17 15:34:42 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29D7D235360; Mon, 17 Mar 2025 10:13:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206437; cv=none; b=TH4WmmtslXcfug0LEI6FJFz9ZAlsNOZyKQIHHyGZz9mAXQ30HyU7WxB38wqfndLyUKOrATI14flPEUde0Thjzxa1jblCGmf7/J+FmYCvuA1VtFPvrzP8tWt/CV11R8CMMSxcN1nQ8nXXA4Ewswin1EmFcZBrp5SX4aIyVrzQoNQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206437; c=relaxed/simple; bh=VEokSnJyXhEftEdyfwGq561rgvWcBLhUDuj1r+l6rgs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jF7QW8qqOdSNovS5olfWlTkIwmjfRRigQ6v3sCsFjElfBrT7MHHb77SGOJiqCgvmo/IozJSrdpUrWSQdXB6YkMz4ZG5eLaXzPmEU0mXL/LodpbKqGv1QzRUjgDVx/GQfTnNdlW+K783T8FRjk4ZQdktoe3aLN1XcgnV6ojqEVuY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B67A3169E; Mon, 17 Mar 2025 03:14:04 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E6F0D3F673; Mon, 17 Mar 2025 03:13:54 -0700 (PDT) From: Sudeep Holla Date: Mon, 17 Mar 2025 10:13:15 +0000 Subject: [PATCH 3/9] efi: Remove redundant creation of the "efivars" platform device 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: <20250317-plat2faux_dev-v1-3-5fe67c085ad5@arm.com> References: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> In-Reply-To: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , Ard Biesheuvel , linux-efi@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=952; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=VEokSnJyXhEftEdyfwGq561rgvWcBLhUDuj1r+l6rgs=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBn1/Xb8mFJLpEV+BhIVgycTArbsBBiSD4DZ+jOf qb6lqCzxdyJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZ9f12wAKCRAAQbq8MX7i mKiAD/9eS/QzJomSLZGIIvoB2Xft1eCCfIJ9MHNOGSAyiYGUUQdgMNbhKU6WSBErRXJ29MVHIm6 RKf8gKO0AmycYRuNT5OJYxDryIfGFRw72BYS8bb2PbHtWsbPKppb7Mf0zu2ELBtTvkrB+azesJo 5+WFz8caY01SVQJMDN6071RiTA0/b4GMkQcT39EMGwvnkN9oMe4lP5gPFhUkpSgHreZEdR22C6i 9SHeQlRjW3D+NTBuI+XgcIiPuI6mhxCDFEXh+CvxVmGulrSsno6kJKl28ciOqVzvXdT6kldSeMl VzulCOHD144uw7Cdd9ol4Ql3byCmcqlJAj/E4GYcT0W3gQZe+iG/kvTdLgfgOC9+btKWN7zrUKS mpaeRm25sM73daoBKSqbew++xyyOMhrzewzML0i6L07572YOelE8uLXNTmgXLCMZ8oQrM1/zwuE Ui2LYf+7suP83xYCTRT4fCGLo/8vkoDFpJq4I9JovlSv+XcBvWfSEfDmlyHjyukyUBKJm0i6ObL 4O2YBy6Zit2pG/drAFU8M0HDNSGVKAiHKggdknATOyeIKb41WU2O+/SClwRVBKsGW1vbclzmoa/ BlJ11U48D5wrEtXGMIgiQBYDQGjRaovJWZRFo7O9hNhraC6/RO24VZF7Xc6FXiZ3vzoVQLA6iTi 4YwqYKJMxNzvk1g== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 The "efivars" platform device is created but never tracked or used, as there is no driver associated with it. Since this device serves no functional purpose, removing its creation without affecting any functionality. Cc: Ard Biesheuvel Cc: linux-efi@vger.kernel.org Signed-off-by: Sudeep Holla --- drivers/firmware/efi/efi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 7309394b8fc98cf7a3424af209b752f0251c8c89..eec173cb1f398d3b4f28b42c917= e50e1728dc277 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -446,7 +446,6 @@ static int __init efisubsys_init(void) error =3D efivar_ssdt_load(); if (error) pr_err("efi: failed to load SSDT, error %d.\n", error); - platform_device_register_simple("efivars", 0, NULL, 0); } =20 BLOCKING_INIT_NOTIFIER_HEAD(&efivar_ops_nh); --=20 2.34.1 From nobody Wed Dec 17 15:34:42 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6EA4F2356DF; Mon, 17 Mar 2025 10:13:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206439; cv=none; b=hE2jOi+2GFgb3HJHpitOYhlLo28YtS2NXI+guWFzxvXahpXKAcG6+IdOVEl7fg7qlyxXLwRFvQNwpCLNdU7CgExBGpgImzzOo6h74y/U8/KBBzvHjvfyxbjlAb6KlaH7ONEJThndKOLLgS1le9jQ49/s3S0pqDTlGvjCVfpyZIc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206439; c=relaxed/simple; bh=8+Snn7+zAHJ8zARLouJiCc2WV16JKNpnlg5grt9kebU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kJVAVn2V9o3ZWRDJrtg32JyGN6C86gVWSOjh2Ht9AYzTbM6gFPe1JyIo7pGelBMR0JQtySqd20BVJaEtcDNZMn1s8kV7PteZWFFIpV61BtIHLOmDk4yp/E5YaNvTzPttphDy0K+RaWXqfq7VvxyZNUnvQLgxlFCt0SBrTGJGpGk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 349AA2573; Mon, 17 Mar 2025 03:14:06 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1D8063F673; Mon, 17 Mar 2025 03:13:55 -0700 (PDT) From: Sudeep Holla Date: Mon, 17 Mar 2025 10:13:16 +0000 Subject: [PATCH 4/9] rtc: efi: Transition to the faux device interface 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: <20250317-plat2faux_dev-v1-4-5fe67c085ad5@arm.com> References: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> In-Reply-To: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , Ard Biesheuvel , Alexandre Belloni , linux-rtc@vger.kernel.org, linux-efi@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3403; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=8+Snn7+zAHJ8zARLouJiCc2WV16JKNpnlg5grt9kebU=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBn1/XbWKka2eLGn0AP84f7vbJzDApSPEweWIXpC dS+fIQgsEKJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZ9f12wAKCRAAQbq8MX7i mO3dEACvzO7b+JVHI/fiE0cRm+TCy2p/QMeIQsv1qkebgzoF+oQDVwE+SYoUpP9Ak9t1g+eTtLp VhaKNJNEWVoqhHNQMzh7YEvdDZ5EQu1lx9O/HzD1QhZQfncraXmaVYcm+7nZxWvVwJC8NdGwlpP 5fSwTL6J0+NLaqDtmowAieW20iINeQe+Y2Xb9SdIz3jSVafmS901t9p6P29jhiU32tPPKIfw0ME fDyRmR42G+PdCIRh1Pu2JjpQ+K9dns+4FNqqqbtDiPfSofVdf5ONaKNmeFO/X+V0OwJUF+Jlytm ipDbQbtnffrWoDl1GBpwfm5qssISe1/8KM+IpIdi5p6S4WFkyWgI5imA/RuuBHjPOdfm4L86T3+ 3DmuX/Vpp7VNwAhbS/4d+7baJDyco/qzSrP/XnM4xYkU8VsIAhRdZKLjmUmzy1wSrChHobMwhkp 7VFP8aBU9NpgtZNDDUzblhJxUogeiK8iaC9pkKFT9Fn0JO+W/vcfN3TogXypR2KpqCq4Xq6AkWF TK/c+6edL5l4ViBE8jZ9VN2JoL2CgA3a1n83VsTcGxfijbiZrozA4yTbYb1dI18pSWKNYK0dtQk 6kplRF84wGuo6XWGtZQfiA7yFblCjKU9CbxUhyFvHOQoXsm4D9RDSI80oRaZYrjIzbVQ2lkbEf1 MSBnA4QOyWhKa7w== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 The EFI RTC driver does not require the creation of a platform device. Originally, this approach was chosen for simplicity when the driver was first implemented. With the introduction of the lightweight faux device interface, we now have a more appropriate alternative. Migrate the driver to utilize the faux bus, given that the platform device it previously created was not a real one anyway. This will simplify the code, reducing its footprint while maintaining functionality. Cc: Ard Biesheuvel Cc: Alexandre Belloni Cc: linux-rtc@vger.kernel.org Cc: linux-efi@vger.kernel.org Signed-off-by: Sudeep Holla --- drivers/firmware/efi/efi.c | 3 --- drivers/rtc/rtc-efi.c | 31 ++++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index eec173cb1f398d3b4f28b42c917e50e1728dc277..18deb2d212ce6944927f5e3a9a4= 0bb6754e7ffa9 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -427,9 +427,6 @@ static int __init efisubsys_init(void) } } =20 - if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES)) - platform_device_register_simple("rtc-efi", 0, NULL, 0); - /* We register the efi directory at /sys/firmware/efi */ efi_kobj =3D kobject_create_and_add("efi", firmware_kobj); if (!efi_kobj) { diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index fa8bf82df9488e7d1c23c058b4a3032dde74bc6e..3d21a470e8ff9777c5eeb991f3a= a9170f6351930 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include =20 @@ -254,7 +254,7 @@ static const struct rtc_class_ops efi_rtc_ops =3D { .proc =3D efi_procfs, }; =20 -static int __init efi_rtc_probe(struct platform_device *dev) +static int __init efi_rtc_probe(struct faux_device *dev) { struct rtc_device *rtc; efi_time_t eft; @@ -268,7 +268,7 @@ static int __init efi_rtc_probe(struct platform_device = *dev) if (IS_ERR(rtc)) return PTR_ERR(rtc); =20 - platform_set_drvdata(dev, rtc); + faux_device_set_drvdata(dev, rtc); =20 rtc->ops =3D &efi_rtc_ops; clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features); @@ -282,15 +282,28 @@ static int __init efi_rtc_probe(struct platform_devic= e *dev) return devm_rtc_register_device(rtc); } =20 -static struct platform_driver efi_rtc_driver =3D { - .driver =3D { - .name =3D "rtc-efi", - }, +static struct faux_device_ops efi_rtc_fdev_ops =3D { + .probe =3D efi_rtc_probe, }; =20 -module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe); +static int __init rtc_efi_init(void) +{ + struct faux_device *fdev; + + if (!efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES)) + return 0; + + fdev =3D faux_device_create("rtc-efi", NULL, &efi_rtc_fdev_ops); + if (!fdev) { + pr_err("rtc-efi: could not create the device\n"); + return -ENODEV; + } + + return 0; +} +device_initcall(rtc_efi_init); =20 MODULE_AUTHOR("dann frazier "); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("EFI RTC driver"); -MODULE_ALIAS("platform:rtc-efi"); +MODULE_ALIAS("faux:rtc-efi"); --=20 2.34.1 From nobody Wed Dec 17 15:34:42 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BA2B23645D; Mon, 17 Mar 2025 10:13:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206440; cv=none; b=tQZtu9uL0uT8dGvNEuPQMZxCWf++lHJh5mfWzYeNX+5DfF5NS8C4gHRm+9v1dX6b9q4j05KgxvRSwFJrbwa2jvQPFsK+SB42BpS1S3eP1sOk+IpSPWMHpcwPr3b9t9M1g4u0EOWoeMm6yO4PJVfqqpQHgXDK/b7QxQrD3vsqTc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206440; c=relaxed/simple; bh=oY5sBJ+KkkG3u5X9v2vQKvNgoaMo5GzExyJV9eh/oKw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cPImclo25qh+kvGRPoF23Xn7caJ5x+HNwMl2JSqoKJsx29BQu2eAiq14BEFQz/5V60RzRLNZnS9P7GymhtJOfoH8DJp1QrGmyXrYzLI2aVDmXAP5bQGg6xfthLqKWgGe/raYwWGjVsF9P/xALmvFwYc0ATfOVEbJ0Ky/QOwEuEU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6087E2576; Mon, 17 Mar 2025 03:14:07 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8FAF93F673; Mon, 17 Mar 2025 03:13:57 -0700 (PDT) From: Sudeep Holla Date: Mon, 17 Mar 2025 10:13:17 +0000 Subject: [PATCH 5/9] virt: efi_secret: Transition to the faux device interface 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: <20250317-plat2faux_dev-v1-5-5fe67c085ad5@arm.com> References: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> In-Reply-To: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , Ard Biesheuvel , linux-efi@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4901; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=oY5sBJ+KkkG3u5X9v2vQKvNgoaMo5GzExyJV9eh/oKw=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBn1/Xb9hLR34OMZ3kH3QO2MD2CArym3+Y0dZJx6 F42iy2aR3SJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZ9f12wAKCRAAQbq8MX7i mFfrEADQiDjMjlGjIwyiZkhAey8tBlfgC76m6I+alJHVMAbKPl0FPDymiexP66PTKM7NRkpkYa6 iJczYQDfPTrnGRwjJzcd54mp4SBaQhZSY8+CNHFdLrbeAdR0ab65ERhffXA9gzdTXR+sfDjlLfo 3N43XyaEp9/A1u25XanYuP4MNAGx7ZJmfzEWwvm1ROpEA2X6gQtCkT5GjqK9IJFwdnj+Yfan4Xh fxx79tm653437zwNlzlXuFlafUx1p9F1wQ6+PNcPoArWh/mhieSioBFWjYh8qlSvfhJRqzn3x1e /KMOWCot5SFEFNv4Pa3AnbP0X1dHbbYqY0uKqS/0mRZHoz2jwuZbmCLZ6usfybMlHHyjkBAuSQO 7e6/4FP9BoZzORnjIkltEFfAuoKqRKo6JTD3HoV3JP1DzoAF0lPrJAye6hvGHZ9gSMQI2WiPE3l ma1M0+H9W5w+WzAV3sow+n0pt0A6R5EV0IKOXjoECZDqWwvdvm4lGw34khXbSqEgg0mcIBy5QfL U7/Mm1g6mjK9hK7gDhJc8d7NM5Tk8kuLBc2Ih0YcgDazI7lzVfWrFTFV3rWBi+FOYsteyFqd/bY wlPiBpAZstoBRvhWNspMuOrC+e4t9T5A2z349dmlY5f4dY7Un36K/pzIJS4ReZmpZisg/e+M1Ij A/ra1efQ7SWi5Qw== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 The EFI secret area driver does not require the creation of a platform device. Originally, this approach was chosen for simplicity when the driver was first implemented. With the introduction of the lightweight faux device interface, we now have a more appropriate alternative. Migrate the driver to utilize the faux bus, given that the platform device it previously created was not a real one anyway. This will simplify the code, reducing its footprint while maintaining functionality. Cc: Ard Biesheuvel Cc: linux-efi@vger.kernel.org Signed-off-by: Sudeep Holla --- drivers/firmware/efi/efi.c | 6 ----- drivers/virt/coco/efi_secret/efi_secret.c | 41 ++++++++++++++++++---------= ---- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 18deb2d212ce6944927f5e3a9a40bb6754e7ffa9..4654a88d4e12f354a891118edf9= 001755285c69a 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -464,11 +463,6 @@ static int __init efisubsys_init(void) if (efi_enabled(EFI_DBG) && efi_enabled(EFI_PRESERVE_BS_REGIONS)) efi_debugfs_init(); =20 -#ifdef CONFIG_EFI_COCO_SECRET - if (efi.coco_secret !=3D EFI_INVALID_TABLE_ADDR) - platform_device_register_simple("efi_secret", 0, NULL, 0); -#endif - return 0; =20 err_remove_group: diff --git a/drivers/virt/coco/efi_secret/efi_secret.c b/drivers/virt/coco/= efi_secret/efi_secret.c index 1864f9f80617e082feb574a15327949972c8cc1e..4ba1a9f3b8a90981795d296d0a8= dfdc9edb22966 100644 --- a/drivers/virt/coco/efi_secret/efi_secret.c +++ b/drivers/virt/coco/efi_secret/efi_secret.c @@ -16,7 +16,7 @@ * is the GUID of the secret entry, and its content is the secret data. */ =20 -#include +#include #include #include #include @@ -152,17 +152,12 @@ static const struct inode_operations efi_secret_dir_i= node_operations =3D { .unlink =3D efi_secret_unlink, }; =20 -static int efi_secret_map_area(struct platform_device *dev) +static int efi_secret_map_area(struct faux_device *dev) { int ret; struct efi_secret *s =3D efi_secret_get(); struct linux_efi_coco_secret_area *secret_area; =20 - if (efi.coco_secret =3D=3D EFI_INVALID_TABLE_ADDR) { - dev_err(&dev->dev, "Secret area address is not available\n"); - return -EINVAL; - } - secret_area =3D memremap(efi.coco_secret, sizeof(*secret_area), MEMREMAP_= WB); if (secret_area =3D=3D NULL) { dev_err(&dev->dev, "Could not map secret area EFI config entry\n"); @@ -191,7 +186,7 @@ static int efi_secret_map_area(struct platform_device *= dev) return ret; } =20 -static void efi_secret_securityfs_teardown(struct platform_device *dev) +static void efi_secret_securityfs_teardown(struct faux_device *dev) { struct efi_secret *s =3D efi_secret_get(); int i; @@ -210,7 +205,7 @@ static void efi_secret_securityfs_teardown(struct platf= orm_device *dev) dev_dbg(&dev->dev, "Removed securityfs entries\n"); } =20 -static int efi_secret_securityfs_setup(struct platform_device *dev) +static int efi_secret_securityfs_setup(struct faux_device *dev) { struct efi_secret *s =3D efi_secret_get(); int ret =3D 0, i =3D 0, bytes_left; @@ -307,7 +302,7 @@ static void efi_secret_unmap_area(void) } } =20 -static int efi_secret_probe(struct platform_device *dev) +static int efi_secret_probe(struct faux_device *dev) { int ret; =20 @@ -326,23 +321,35 @@ static int efi_secret_probe(struct platform_device *d= ev) return ret; } =20 -static void efi_secret_remove(struct platform_device *dev) +static void efi_secret_remove(struct faux_device *dev) { efi_secret_securityfs_teardown(dev); efi_secret_unmap_area(); } =20 -static struct platform_driver efi_secret_driver =3D { +static struct faux_device_ops efi_secret_ops =3D { .probe =3D efi_secret_probe, .remove =3D efi_secret_remove, - .driver =3D { - .name =3D "efi_secret", - }, }; =20 -module_platform_driver(efi_secret_driver); +static int __init efi_secret_init(void) +{ + struct faux_device *fdev; + + if (efi.coco_secret =3D=3D EFI_INVALID_TABLE_ADDR) + return 0; + + fdev =3D faux_device_create("efi_secret", NULL, &efi_secret_ops); + if (!fdev) { + pr_err("efi_secret: could not create the device\n"); + return -ENODEV; + } + + return 0; +} +device_initcall(efi_secret_init); =20 MODULE_DESCRIPTION("Confidential computing EFI secret area access"); MODULE_AUTHOR("IBM"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:efi_secret"); +MODULE_ALIAS("faux:efi_secret"); --=20 2.34.1 From nobody Wed Dec 17 15:34:42 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09FC62376E6; Mon, 17 Mar 2025 10:14:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206441; cv=none; b=Je87YVQaAHcsKJPykVROSmrUsLfBGkrpel+dlc02FOJo7lnUTPLjCqYeWdHHE4Cql98BF8wusN709bouAcE3Z71nlJjt4cOylfFt5FpQePSnsZjg3v6N0ahFwa9PhEtj7BV4hx13z2XLhPAk6943Vcua0U3uvKsq4jTs+gUTORw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206441; c=relaxed/simple; bh=x7ZXz4mU9CnfHVM3Z0rwNB7yQx/AvIfPWEc4rRfZlD4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eSj3zy+pAug3PPM2RgmfR+l0HiZ4ftE7OI6ZzfGdIPKtvSnQQV2JhtVdNY6shZr3iCXdgQ7vMWiDM0b86V9P77hsLbn4KYisx007G90R4ur6eL7d1Qnr6jtzxHIlldCJPW/MEgfE4h85Q8ucRhzXzloMh5v3fZAinw4zf87wUOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ADDE325DC; Mon, 17 Mar 2025 03:14:08 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BA95A3F673; Mon, 17 Mar 2025 03:13:58 -0700 (PDT) From: Sudeep Holla Date: Mon, 17 Mar 2025 10:13:18 +0000 Subject: [PATCH 6/9] ASoC: soc-utils: Transition to the faux device interface 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: <20250317-plat2faux_dev-v1-6-5fe67c085ad5@arm.com> References: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> In-Reply-To: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , Mark Brown , Takashi Iwai , linux-sound@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2889; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=x7ZXz4mU9CnfHVM3Z0rwNB7yQx/AvIfPWEc4rRfZlD4=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBn1/XbmOULwGG3cHOXBy6u8uWE/0CxGGLIC0/+t aN37NJqvBeJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZ9f12wAKCRAAQbq8MX7i mFuFD/9kHeBWU8kPBSge1BvTUCZIXjgpxVnY7k1Zh+ekqiPVFbfa81bN0OyWbSDu/g/PFRDpNzp zWED2iQIlyFANDMYLWij1/l1G+/6tsbL7zDM6fWNP6H5WSTr2VGCXfsCd0D3P3/IttypSKlFdGd s9lqG1VyfE73bAyY5ZHXKRotN/LCM0aFbjEx73+FqVv+38qNJy7k7mlcOwpGS7WD41k2cVdXyIt 7lTETqX1kXnllOce9FSzIc1wRlVuYHzGSr1XIHvz3UmQwA9rp+3tg2FI0CJHMOiWJRIUpJy8cuT Pm7n2FPUEJ+iUtfRpNhCIT4LpkxDKwr8+vTV3Jw5fgNh5AAd6Ev/s+eX9jwl7t3X5C5EYcUX9cz XJyiI3hmRqnqHjX0KbS52OsEsnR/mRkF0ynMNpSojBvLRkik9vItSJGjTdByLiBex8bks//hgPy lH1vZUomA+ToZdQTwgb5nv4aWgI1+qWUR3x9hQIO9GnXjAuj4iw1uplJXBCNMn/HVTwb4EMQSSj K6gIuOpc7m7hvrnfrNrEqKJLnfQWU+7xuufhjKJ3SfegdIZeVk/eLhbU9Q+S2Nj1QMqWgR464ES mFEJZkzxKyfjZJjOKnXU38L7RahpcfGkYVkTsqQS7ABr9R4j+Zh9jnccK2CaxYMrwLr1VuB93wg 2dbwUo65FNOwI4g== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 The ASoC soc-utils driver does not require the creation of a platform device. Originally, this approach was chosen for simplicity when the driver was first implemented. With the introduction of the lightweight faux device interface, we now have a more appropriate alternative. Migrate the driver to utilize the faux bus, given that the platform device it previously created was not a real one anyway. This will simplify the code, reducing its footprint while maintaining functionality. Cc: Mark Brown Cc: Takashi Iwai Cc: linux-sound@vger.kernel.org Signed-off-by: Sudeep Holla --- sound/soc/soc-utils.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c index aa93e77ac937b0255c5dfa519207693fb560a6d6..a795c21756f79411cf59e209133= db9f88edeb44c 100644 --- a/sound/soc/soc-utils.c +++ b/sound/soc/soc-utils.c @@ -7,7 +7,7 @@ // Author: Mark Brown // Liam Girdwood =20 -#include +#include #include #include #include @@ -235,48 +235,38 @@ struct snd_soc_dai_link_component snd_soc_dummy_dlc = =3D { }; EXPORT_SYMBOL_GPL(snd_soc_dummy_dlc); =20 -static int snd_soc_dummy_probe(struct platform_device *pdev) +static int snd_soc_dummy_probe(struct faux_device *fdev) { int ret; =20 - ret =3D devm_snd_soc_register_component(&pdev->dev, + ret =3D devm_snd_soc_register_component(&fdev->dev, &dummy_codec, &dummy_dai, 1); if (ret < 0) return ret; =20 - ret =3D devm_snd_soc_register_component(&pdev->dev, &dummy_platform, + ret =3D devm_snd_soc_register_component(&fdev->dev, &dummy_platform, NULL, 0); =20 return ret; } =20 -static struct platform_driver soc_dummy_driver =3D { - .driver =3D { - .name =3D "snd-soc-dummy", - }, +static struct faux_device_ops soc_dummy_ops =3D { .probe =3D snd_soc_dummy_probe, }; =20 -static struct platform_device *soc_dummy_dev; +static struct faux_device *soc_dummy_dev; =20 int __init snd_soc_util_init(void) { - int ret; - - soc_dummy_dev =3D - platform_device_register_simple("snd-soc-dummy", -1, NULL, 0); - if (IS_ERR(soc_dummy_dev)) - return PTR_ERR(soc_dummy_dev); + soc_dummy_dev =3D faux_device_create("snd-soc-dummy", NULL, + &soc_dummy_ops); + if (!soc_dummy_dev) + return -ENODEV; =20 - ret =3D platform_driver_register(&soc_dummy_driver); - if (ret !=3D 0) - platform_device_unregister(soc_dummy_dev); - - return ret; + return 0; } =20 void snd_soc_util_exit(void) { - platform_driver_unregister(&soc_dummy_driver); - platform_device_unregister(soc_dummy_dev); + faux_device_destroy(soc_dummy_dev); } --=20 2.34.1 From nobody Wed Dec 17 15:34:42 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC0E3237A3B; Mon, 17 Mar 2025 10:14:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206443; cv=none; b=EbO/Kf0ig35iwTDKde1rcQZ8E0rIA/aO4lEbX7VLiHS6dCkS99K+simNf8tncpq5JzOSnvqMDKwWb58ixKrpSdRjCcKKniEkUEa24g9cmVj2+Z3ou1ugX4x4v4OrUYcVU7kTGpcFLtkMaM0xo+qEyQOuh+QmZoPeLFowK17GXjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206443; c=relaxed/simple; bh=HHdZErm8BjMqpB8v6zRi2otchdcjI/bZfyLzXogt27A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gH2vyKzB70kRJMc26fdELk87qVOd6ZLh8aOIkKEFdDk8WAsHhP4cXWqHsGtRQp0j2J3TQDPlT5+kI596aGfhqHwaSqFPhFvIhfGkia1qHGSFuV9USpgxv5b5InBniFs0wFo14B18q0/rDmCoPzMahvP4Rk/zVMVyVI/3ofj9Xak= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2C1A313D5; Mon, 17 Mar 2025 03:14:10 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 151073F673; Mon, 17 Mar 2025 03:13:59 -0700 (PDT) From: Sudeep Holla Date: Mon, 17 Mar 2025 10:13:19 +0000 Subject: [PATCH 7/9] net: phy: fixed_phy: transition to the faux device interface 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: <20250317-plat2faux_dev-v1-7-5fe67c085ad5@arm.com> References: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> In-Reply-To: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , Andrew Lunn , "David S. Miller" , netdev@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2841; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=HHdZErm8BjMqpB8v6zRi2otchdcjI/bZfyLzXogt27A=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBn1/XbYQ+ahwD2Rp/tJLJcXVQOmij9MazsBlzLX 3EfFytNcp+JAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZ9f12wAKCRAAQbq8MX7i mMkaEACN4Q898YXIMORP4uejPLi+PJpMCR63s8LYHzmcB8LM9LW17y7nWG/BZ9nXw0DaJ4Nnk0z FXxKz+Ago6xlZNMw9/VCg7lbfcb1z7cynB3kazM8lMuFbJCBkOM5rAMjQ90W3bnqj1hYSsnQREw NtqYnIi0BHrreuPiNks955noZYRz+mp2RkPNABqEwFIapBMNA++PjB6AGvKJrjywdo34To6YPSM RGcApKgBFBPG7IEQzxiHO50Bg45cDkemgACDe5XLul1/R1Gl67caO3SsAW7cwm//iMxzztAIUGo ++dIuoBBNAMkYPPNr/+xjlW5dybynxQHL1CBxK9NMKIpf6hvopSj72HGI3yz9L6hEKUSUzg0mt5 A0oph4NyCesqnUtjHfxbk3KHf7yDHhQTiysUAntdllTKUcEmJxfjmu0CRiS1VgzQLeWPwpekTyH +c7xgk7q5PO2Gr7Kmb2mnKyHzK9YrpE+8wGrPsJOaUc2a/JYcEt73swswnL3A95eD7ZdE3lOwNI 0eMvNgQiLJpGP03YgFo3efTHcR8iIOBOU1E/we9S3HiLRBy/aSouGefa0h/zuQQq0xrOexCduSq WfIEy+nu3qVeccB4e1isFSHmqqRbuPHPjrs/xCmlWU9srk4bE3Mo+t1Bnv1xJR2pRW9hYiPrmR6 Zx1x+J7STU3Wk7w== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 The net fixed phy driver does not require the creation of a platform device. Originally, this approach was chosen for simplicity when the driver was first implemented. With the introduction of the lightweight faux device interface, we now have a more appropriate alternative. Migrate the driver to utilize the faux bus, given that the platform device it previously created was not a real one anyway. This will simplify the code, reducing its footprint while maintaining functionality. Cc: Andrew Lunn Cc: "David S. Miller" Cc: netdev@vger.kernel.org Signed-off-by: Sudeep Holla --- drivers/net/phy/fixed_phy.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c index aef739c20ac4d5a271465a677a85ef7c18cfce70..ee7831a9849b3728ca9c541da35= d17e089985da2 100644 --- a/drivers/net/phy/fixed_phy.c +++ b/drivers/net/phy/fixed_phy.c @@ -10,7 +10,7 @@ =20 #include #include -#include +#include #include #include #include @@ -40,7 +40,7 @@ struct fixed_phy { struct gpio_desc *link_gpiod; }; =20 -static struct platform_device *pdev; +static struct faux_device *fdev; static struct fixed_mdio_bus platform_fmb =3D { .phys =3D LIST_HEAD_INIT(platform_fmb.phys), }; @@ -337,9 +337,9 @@ static int __init fixed_mdio_bus_init(void) struct fixed_mdio_bus *fmb =3D &platform_fmb; int ret; =20 - pdev =3D platform_device_register_simple("Fixed MDIO bus", 0, NULL, 0); - if (IS_ERR(pdev)) - return PTR_ERR(pdev); + fdev =3D faux_device_create("Fixed MDIO bus", NULL, NULL); + if (!fdev) + return -ENODEV; =20 fmb->mii_bus =3D mdiobus_alloc(); if (fmb->mii_bus =3D=3D NULL) { @@ -350,7 +350,7 @@ static int __init fixed_mdio_bus_init(void) snprintf(fmb->mii_bus->id, MII_BUS_ID_SIZE, "fixed-0"); fmb->mii_bus->name =3D "Fixed MDIO Bus"; fmb->mii_bus->priv =3D fmb; - fmb->mii_bus->parent =3D &pdev->dev; + fmb->mii_bus->parent =3D &fdev->dev; fmb->mii_bus->read =3D &fixed_mdio_read; fmb->mii_bus->write =3D &fixed_mdio_write; fmb->mii_bus->phy_mask =3D ~0; @@ -364,7 +364,7 @@ static int __init fixed_mdio_bus_init(void) err_mdiobus_alloc: mdiobus_free(fmb->mii_bus); err_mdiobus_reg: - platform_device_unregister(pdev); + faux_device_destroy(fdev); return ret; } module_init(fixed_mdio_bus_init); @@ -376,7 +376,7 @@ static void __exit fixed_mdio_bus_exit(void) =20 mdiobus_unregister(fmb->mii_bus); mdiobus_free(fmb->mii_bus); - platform_device_unregister(pdev); + faux_device_destroy(fdev); =20 list_for_each_entry_safe(fp, tmp, &fmb->phys, node) { list_del(&fp->node); --=20 2.34.1 From nobody Wed Dec 17 15:34:42 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C308023645D; Mon, 17 Mar 2025 10:14:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206444; cv=none; b=VwtZsrif7XxfJB8npXMybk11/b5kiTC/4wFH+9vUTrZKYlkvXCW388LrDxqP37U3lRwxhWiID9BeJ8hkFhn6tAPArKpO4Uc5e4tbzjUCK5AhhkAx1RAMLGaA3Dbo72ffVzgILQGBDVCUrAEeeoOtNGoR6lNas/ArALrHgltCDlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206444; c=relaxed/simple; bh=ywFI/S2i8yTE8gFcovtkn//B6t4qpEs2iVleL9VM4zs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jdUZGv6p0mL1Cp5Ri8ltFEMYb8N2pi9OqAQmMnTTpgyRxtGH89HQvXUXAM8tlVlHwJzuqZWiEipledErZ4v1af2lkJoEePijOt0LUDjaWh5DGotAtz+M3ieN8zxQlwatNvCQeEn7l9vKKBQBVedXbgTM7KTiGAsKyP8rIZPW19Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 797142573; Mon, 17 Mar 2025 03:14:11 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 638563F7B4; Mon, 17 Mar 2025 03:14:01 -0700 (PDT) From: Sudeep Holla Date: Mon, 17 Mar 2025 10:13:20 +0000 Subject: [PATCH 8/9] ACPI: APEI: EINJ: Transition to the faux device interface 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: <20250317-plat2faux_dev-v1-8-5fe67c085ad5@arm.com> References: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> In-Reply-To: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Borislav Petkov , linux-acpi@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3336; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=ywFI/S2i8yTE8gFcovtkn//B6t4qpEs2iVleL9VM4zs=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBn1/XbxK02iKuh6vcw6iAjehSa3S6UMiG+96MsM zJXFbdf1/qJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZ9f12wAKCRAAQbq8MX7i mB37D/4ovEInkPK8eY+oQASeTRDXRzeQzFPmc3cvH2vvGwTUh6fkSHbcNhowbmb+kePLcPvoLvO za89HLvSPZ+m/BklTEmqUBaTPtPcW6uNYuOHzH8jr/7ewAFnszg9UNhZnnug1gZVByE1O7cWOXy SumTbvEeSlKFRhT2RbcvSxpSmZLg1xwIvBT2i8YhCbd8xQhcR8d7/YVveToZxTT9PvkGWcSEx7x jwaN1N2uAvnftBcSBBTYnoP11p9o7lQJCdIahs+LErslMC4c+pW0e8c/Aw434Em0c+Ii3nHYvn3 vGY0aEvpdyYur+RC113iuutTbE90ooZaVwFvp7Lu5JE0DFqRSynNbchnB46R1mz12n6jq2eecLE WZbPu1u1anOGpYJC5lcwh7ZF7do061cx1FBrHHyBiT0Ee9iq5lxijmDRllLp1mKYQ1L/ttaAQCS VG8Rjn7vd15DuaOQ3zWCTZX/ANnF19nb1bjMCdosB0osj/f6Un31v4Ou9V+mVN64DzywR+6bPu0 jNv9rAyjMDrNEQIMZIlffF8GPYN1EEXmYpcAIS6ids37wsYGpCeGOsu0/O/OZ478Dpaye10Wqqw mSZGwkURhSCiUoJGU3RGRGBtq+PVQS2vW53wsbvQolxO4w2uZ9dnm6pCHI3lkr4FchNX6Azv5W7 tCzC6UZeeGPtTzw== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 The APEI error injection driver does not require the creation of a platform device. Originally, this approach was chosen for simplicity when the driver was first implemented. With the introduction of the lightweight faux device interface, we now have a more appropriate alternative. Migrate the driver to utilize the faux bus, given that the platform device it previously created was not a real one anyway. This will simplify the code, reducing its footprint while maintaining functionality. Cc: "Rafael J. Wysocki" Cc: Borislav Petkov Cc: linux-acpi@vger.kernel.org Signed-off-by: Sudeep Holla --- drivers/acpi/apei/einj-core.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c index 04731a5b01faaba534bad853d0acc4c8a873a53b..7ff334422899e757de918107202= 507dd171d61da 100644 --- a/drivers/acpi/apei/einj-core.c +++ b/drivers/acpi/apei/einj-core.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include =20 #include "apei-internal.h" @@ -749,7 +749,7 @@ static int einj_check_table(struct acpi_table_einj *ein= j_tab) return 0; } =20 -static int __init einj_probe(struct platform_device *pdev) +static int __init einj_probe(struct faux_device *fdev) { int rc; acpi_status status; @@ -851,7 +851,7 @@ static int __init einj_probe(struct platform_device *pd= ev) return rc; } =20 -static void __exit einj_remove(struct platform_device *pdev) +static void __exit einj_remove(struct faux_device *fdev) { struct apei_exec_context ctx; =20 @@ -872,34 +872,25 @@ static void __exit einj_remove(struct platform_device= *pdev) acpi_put_table((struct acpi_table_header *)einj_tab); } =20 -static struct platform_device *einj_dev; +static struct faux_device *einj_dev; /* * einj_remove() lives in .exit.text. For drivers registered via * platform_driver_probe() this is ok because they cannot get unbound at * runtime. So mark the driver struct with __refdata to prevent modpost * triggering a section mismatch warning. */ -static struct platform_driver einj_driver __refdata =3D { +static struct faux_device_ops einj_device_ops __refdata =3D { + .probe =3D einj_probe, .remove =3D __exit_p(einj_remove), - .driver =3D { - .name =3D "acpi-einj", - }, }; =20 static int __init einj_init(void) { - struct platform_device_info einj_dev_info =3D { - .name =3D "acpi-einj", - .id =3D -1, - }; - int rc; - - einj_dev =3D platform_device_register_full(&einj_dev_info); - if (IS_ERR(einj_dev)) - return PTR_ERR(einj_dev); + einj_dev =3D faux_device_create("acpi-einj", NULL, &einj_device_ops); + if (!einj_dev) + return -ENODEV; =20 - rc =3D platform_driver_probe(&einj_driver, einj_probe); - einj_initialized =3D rc =3D=3D 0; + einj_initialized =3D true; =20 return 0; } @@ -907,9 +898,8 @@ static int __init einj_init(void) static void __exit einj_exit(void) { if (einj_initialized) - platform_driver_unregister(&einj_driver); + faux_device_destroy(einj_dev); =20 - platform_device_unregister(einj_dev); } =20 module_init(einj_init); --=20 2.34.1 From nobody Wed Dec 17 15:34:42 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C66AC2376E1 for ; Mon, 17 Mar 2025 10:14:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206445; cv=none; b=beHNIUxSKnCFbXOHMXNsCHl1WNzO3ujNcT7uR4aMYQYMWxo7i2QGPtm171YCX5Sc4BnHNvtKP8lr3yFB3F+JYA1xKv1IJUK3u7Tx1QIw5+uuqstEbS/ESEcJxmn5Rl+/1BMx/N8pLvFGEDgVH+bgT3VB0jbuuYf6OY3XMB6TcBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742206445; c=relaxed/simple; bh=xV5MMTtJh2o/E03BwDcI4WhIzb9LIMQcGRUOsL8ojRg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=c8OVHl3QYmhaQXm6WqtTWVDtLvzWbutbkBpcyL9DBsnW+q5+hkXx49TnHFtsof3xQQEjiSkAwJioiusCSQsfv9ajQsa/GAT8gn1ud9eRmMPFW6QHzq2Cj0x80cO+72oKMvXAnlS8jFK9l9vJUXnpf8/fyquHnm0tvLM7GRaqZmU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8191913D5; Mon, 17 Mar 2025 03:14:12 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B20E13F673; Mon, 17 Mar 2025 03:14:02 -0700 (PDT) From: Sudeep Holla Date: Mon, 17 Mar 2025 10:13:21 +0000 Subject: [PATCH 9/9] regulator: dummy: convert to use the faux device interface 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: <20250317-plat2faux_dev-v1-9-5fe67c085ad5@arm.com> References: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> In-Reply-To: <20250317-plat2faux_dev-v1-0-5fe67c085ad5@arm.com> To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , Mark Brown , Jonathan Cameron X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3008; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=99Apj0NBoQeeN4bVc+HR7nRC+LgtFnkO/+yRk88Cfq4=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBn1/Xbul7UMAeus237x3bLZHa7lEFN1fNczVeGs Ot5xC6C34OJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZ9f12wAKCRAAQbq8MX7i mFgRD/4tSvHl+/pfVasVtz+76+ymy2wgGTFqzFdW9gxjXKXVvnK86HZ2cWErXjlvIALKguOA2Pj eEv7HJA6CKTHBWenqOCOQ8GfVej5vybeZC23RVzFhy3AQMkkkfxTnB4ISMKBzvX9F2aujy+aj5z kJS4MpymHjMiLLtArIq/LOgr3AxhEdpr2OEq3G/ucXwS0kMFeKd2dKr/4TkGa58ukCseIxqg7+Y u/nuPE24Pv9mGKwQBjZTcZCEjKY2RYkAetW9J0VUKYeWgZmAkQYV1BCZf1ax05NC1LY3BT1GyN7 P+0qu8NTzro8JMIp6DKGZPYwrL7TwiSI33HoWChFqssJ2ufrNt7w57PcayG7304TWdZUlKFMJjQ HmDjrzS4no3eraa+VyE/havbcgvGdyvHye+xVy33wLIRLpcRGx3WP4YQy7iPUkBmYh8y4/e7SL3 U3VDtMjNW/E4+W2z2PrLAynsdbcsy/LnKB4XTRl5P5/OcYI5hL6F9uCJfqv/yiyjjQAu8w1EuLl rGh3xDlXZbg5SOMgpa0STxaJwJuKkJFjRTM104WgH8CXKYnVoDGmV3IpqsMY5fDUxMPDtF/cOMr GnckETGzeiAhKhUpmHvLyDZvmBNxWVhqo6jdGUXNwh5+uUxNJrgo6TA3mvS4xJUmU3u5H86jzM0 oI8YpHuKyW9igUg== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 From: Greg Kroah-Hartman The dummy regulator driver does not need to create a platform device, it only did so because it was simple to do. Change it over to use the faux bus instead as this is NOT a real platform device, and it makes the code even smaller than before. Reviewed-by: Mark Brown Reviewed-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman Message-Id: <2025021027-outclass-stress-59dd@gregkh> (sudeep.holla: Made dummy_regulator_driver static) Signed-off-by: Sudeep Holla --- drivers/regulator/dummy.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/drivers/regulator/dummy.c b/drivers/regulator/dummy.c index 5b9b9e4e762d52151847bb1880377d51b04eeb9d..c3e416fd3c3e29d54278eb65600= ab79d828edbde 100644 --- a/drivers/regulator/dummy.c +++ b/drivers/regulator/dummy.c @@ -13,7 +13,7 @@ =20 #include #include -#include +#include #include #include =20 @@ -37,15 +37,15 @@ static const struct regulator_desc dummy_desc =3D { .ops =3D &dummy_ops, }; =20 -static int dummy_regulator_probe(struct platform_device *pdev) +static int dummy_regulator_probe(struct faux_device *fdev) { struct regulator_config config =3D { }; int ret; =20 - config.dev =3D &pdev->dev; + config.dev =3D &fdev->dev; config.init_data =3D &dummy_initdata; =20 - dummy_regulator_rdev =3D devm_regulator_register(&pdev->dev, &dummy_desc, + dummy_regulator_rdev =3D devm_regulator_register(&fdev->dev, &dummy_desc, &config); if (IS_ERR(dummy_regulator_rdev)) { ret =3D PTR_ERR(dummy_regulator_rdev); @@ -56,36 +56,17 @@ static int dummy_regulator_probe(struct platform_device= *pdev) return 0; } =20 -static struct platform_driver dummy_regulator_driver =3D { - .probe =3D dummy_regulator_probe, - .driver =3D { - .name =3D "reg-dummy", - .probe_type =3D PROBE_PREFER_ASYNCHRONOUS, - }, +static struct faux_device_ops dummy_regulator_driver =3D { + .probe =3D dummy_regulator_probe, }; =20 -static struct platform_device *dummy_pdev; +static struct faux_device *dummy_fdev; =20 void __init regulator_dummy_init(void) { - int ret; - - dummy_pdev =3D platform_device_alloc("reg-dummy", -1); - if (!dummy_pdev) { + dummy_fdev =3D faux_device_create("reg-dummy", NULL, &dummy_regulator_dri= ver); + if (!dummy_fdev) { pr_err("Failed to allocate dummy regulator device\n"); return; } - - ret =3D platform_device_add(dummy_pdev); - if (ret !=3D 0) { - pr_err("Failed to register dummy regulator device: %d\n", ret); - platform_device_put(dummy_pdev); - return; - } - - ret =3D platform_driver_register(&dummy_regulator_driver); - if (ret !=3D 0) { - pr_err("Failed to register dummy regulator driver: %d\n", ret); - platform_device_unregister(dummy_pdev); - } } --=20 2.34.1