From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Kurt Borja <kuurtb@gmail.com>,
Hans de Goede <hdegoede@redhat.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Lyndon Sanche <lsanche@lyndeno.ca>,
Mario Limonciello <mario.limonciello@amd.com>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] platform/x86: dell-pc: Transition to faux device
Date: Wed, 23 Apr 2025 16:27:37 +0300 (EEST) [thread overview]
Message-ID: <2afb6e58-44cb-486e-8062-074ff397dc2c@linux.intel.com> (raw)
In-Reply-To: <20250411-dell-faux-v1-3-ea1f1c929b7e@gmail.com>
On Fri, 11 Apr 2025, Kurt Borja wrote:
> Use a faux device parent for registering the platform_profile instead of
> a "fake" platform device.
>
> The faux bus is a minimalistic, single driver bus designed for this
> purpose.
Hi Kurt, Hans & Greg,
I'm not sure about this change. So dell-pc not a platform device but
a "fake".
I'm not saying this is wrong, but feel I'm a bit just lost where the
dividing line is. Is it just because this driver only happens to call
dell_send_request(), etc., not contains that low-level access code within?
Or is that dell-smbios "fake" too?
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> ---
> drivers/platform/x86/dell/dell-pc.c | 46 +++++++++++--------------------------
> 1 file changed, 13 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c
> index 794924913be0c6f13ed4aed8b01ffd21f1d34dea..48cc7511905a62d2828e3a7b593b3d2dae893e34 100644
> --- a/drivers/platform/x86/dell/dell-pc.c
> +++ b/drivers/platform/x86/dell/dell-pc.c
> @@ -13,18 +13,18 @@
> #include <linux/bitfield.h>
> #include <linux/bitops.h>
> #include <linux/bits.h>
> +#include <linux/device/faux.h>
> #include <linux/dmi.h>
> #include <linux/err.h>
> #include <linux/init.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/platform_profile.h>
> -#include <linux/platform_device.h>
> #include <linux/slab.h>
>
> #include "dell-smbios.h"
>
> -static struct platform_device *platform_device;
> +static struct faux_device *dell_pc_fdev;
> static int supported_modes;
>
> static const struct dmi_system_id dell_device_table[] __initconst = {
> @@ -246,7 +246,7 @@ static const struct platform_profile_ops dell_pc_platform_profile_ops = {
> .profile_set = thermal_platform_profile_set,
> };
>
> -static int thermal_init(void)
> +static int dell_pc_faux_probe(struct faux_device *fdev)
> {
> struct device *ppdev;
> int ret;
> @@ -258,51 +258,31 @@ static int thermal_init(void)
> if (ret < 0)
> return ret;
>
> - platform_device = platform_device_register_simple("dell-pc", PLATFORM_DEVID_NONE, NULL, 0);
> - if (IS_ERR(platform_device))
> - return PTR_ERR(platform_device);
> + ppdev = devm_platform_profile_register(&fdev->dev, "dell-pc", NULL,
> + &dell_pc_platform_profile_ops);
>
> - ppdev = devm_platform_profile_register(&platform_device->dev, "dell-pc",
> - NULL, &dell_pc_platform_profile_ops);
> - if (IS_ERR(ppdev)) {
> - ret = PTR_ERR(ppdev);
> - goto cleanup_platform_device;
> - }
> -
> - return 0;
> -
> -cleanup_platform_device:
> - platform_device_unregister(platform_device);
> -
> - return ret;
> + return PTR_ERR_OR_ZERO(ppdev);
> }
>
> -static void thermal_cleanup(void)
> -{
> - platform_device_unregister(platform_device);
> -}
> +static const struct faux_device_ops dell_pc_faux_ops = {
> + .probe = dell_pc_faux_probe,
> +};
>
> static int __init dell_init(void)
> {
> - int ret;
> -
> if (!dmi_check_system(dell_device_table))
> return -ENODEV;
>
> - ret = thermal_init();
> - if (ret)
> - goto fail_thermal;
> + dell_pc_fdev = faux_device_create("dell-pc", NULL, &dell_pc_faux_ops);
> + if (!dell_pc_fdev)
> + return -ENODEV;
>
> return 0;
> -
> -fail_thermal:
> - thermal_cleanup();
> - return ret;
> }
>
> static void __exit dell_exit(void)
> {
> - thermal_cleanup();
> + faux_device_destroy(dell_pc_fdev);
> }
>
> module_init(dell_init);
>
>
--
i.
next prev parent reply other threads:[~2025-04-23 13:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 14:36 [PATCH 0/3] platform/x86: dell-pc: Transition to faux device Kurt Borja
2025-04-11 14:36 ` [PATCH 1/3] platform/x86: dell-pc: Propagate errors when detecting feature support Kurt Borja
2025-04-11 14:36 ` [PATCH 2/3] platform/x86: dell-pc: Use non-atomic bitmap operations Kurt Borja
2025-04-11 14:36 ` [PATCH 3/3] platform/x86: dell-pc: Transition to faux device Kurt Borja
2025-04-23 13:27 ` Ilpo Järvinen [this message]
2025-04-23 13:44 ` Hans de Goede
2025-04-23 13:59 ` Greg Kroah-Hartman
2025-04-23 14:12 ` Lyndon Sanche
2025-04-23 16:14 ` Kurt Borja
2025-04-23 17:05 ` Hans de Goede
2025-04-24 11:57 ` Ilpo Järvinen
2025-04-25 7:48 ` Kurt Borja
2025-04-25 11:50 ` Ilpo Järvinen
2025-04-24 14:06 ` [PATCH 0/3] " Ilpo Järvinen
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=2afb6e58-44cb-486e-8062-074ff397dc2c@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=kuurtb@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lsanche@lyndeno.ca \
--cc=mario.limonciello@amd.com \
--cc=platform-driver-x86@vger.kernel.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