[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5907bdd7-2b91-482a-b633-71a286f0743a@amd.com>
Date: Thu, 9 Jan 2025 10:36:34 -0600
From: Mario Limonciello <mario.limonciello@....com>
To: Kurt Borja <kuurtb@...il.com>, platform-driver-x86@...r.kernel.org
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
Armin Wolf <W_Armin@....de>, Joshua Grisham <josh@...huagrisham.com>,
"Derek J . Clark" <derekjohn.clark@...il.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Hans de Goede <hdegoede@...hat.com>, Maximilian Luz
<luzmaximilian@...il.com>, "Lee, Chun-Yi" <jlee@...e.com>,
Shyam Sundar S K <Shyam-sundar.S-k@....com>,
Corentin Chary <corentin.chary@...il.com>, "Luke D. Jones"
<luke@...nes.dev>, Lyndon Sanche <lsanche@...deno.ca>,
Ike Panhc <ike.pan@...onical.com>,
Henrique de Moraes Holschuh <hmh@....eng.br>,
Mark Pearson <mpearson-lenovo@...ebb.ca>,
Colin Ian King <colin.i.king@...il.com>,
Alexis Belmonte <alexbelm48@...il.com>, Ai Chao <aichao@...inos.cn>,
Gergo Koteles <soyer@....hu>, Dell.Client.Kernel@...l.com,
ibm-acpi-devel@...ts.sourceforge.net
Subject: Re: [PATCH 05/18] platform/surface: surface_platform_profile: Use
devm_platform_profile_register()
On 1/9/2025 09:06, Kurt Borja wrote:
> Replace platform_profile_register() with it's device managed version.
> While at it, pass ssam_platform_profile_device to the class device as
> drvdata and replace uses of container_of() with dev_get_drvdata().
>
> Signed-off-by: Kurt Borja <kuurtb@...il.com>
Reviewed-by: Mario Limonciello <mario.limonciello@....com>
> ---
> .../platform/surface/surface_platform_profile.c | 15 +++------------
> 1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c
> index 00a1178e552f..efb6653ed1d5 100644
> --- a/drivers/platform/surface/surface_platform_profile.c
> +++ b/drivers/platform/surface/surface_platform_profile.c
> @@ -161,7 +161,7 @@ static int ssam_platform_profile_get(struct platform_profile_handler *pprof,
> enum ssam_tmp_profile tp;
> int status;
>
> - tpd = container_of(pprof, struct ssam_platform_profile_device, handler);
> + tpd = dev_get_drvdata(&pprof->class_dev);
>
> status = ssam_tmp_profile_get(tpd->sdev, &tp);
> if (status)
> @@ -181,7 +181,7 @@ static int ssam_platform_profile_set(struct platform_profile_handler *pprof,
> struct ssam_platform_profile_device *tpd;
> int tp;
>
> - tpd = container_of(pprof, struct ssam_platform_profile_device, handler);
> + tpd = dev_get_drvdata(&pprof->class_dev);
>
> tp = convert_profile_to_ssam_tmp(tpd->sdev, profile);
> if (tp < 0)
> @@ -234,15 +234,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev)
>
> tpd->has_fan = device_property_read_bool(&sdev->dev, "has_fan");
>
> - return platform_profile_register(&tpd->handler, NULL);
> -}
> -
> -static void surface_platform_profile_remove(struct ssam_device *sdev)
> -{
> - struct ssam_platform_profile_device *tpd;
> -
> - tpd = ssam_device_get_drvdata(sdev);
> - platform_profile_remove(&tpd->handler);
> + return devm_platform_profile_register(&tpd->handler, tpd);
> }
>
> static const struct ssam_device_id ssam_platform_profile_match[] = {
> @@ -253,7 +245,6 @@ MODULE_DEVICE_TABLE(ssam, ssam_platform_profile_match);
>
> static struct ssam_device_driver surface_platform_profile = {
> .probe = surface_platform_profile_probe,
> - .remove = surface_platform_profile_remove,
> .match_table = ssam_platform_profile_match,
> .driver = {
> .name = "surface_platform_profile",
Powered by blists - more mailing lists