lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250109150731.110799-11-kuurtb@gmail.com>
Date: Thu,  9 Jan 2025 10:06:23 -0500
From: Kurt Borja <kuurtb@...il.com>
To: 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,
	"Mario Limonciello" <mario.limonciello@....com>,
	"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>,
	Kurt Borja <kuurtb@...il.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>,
	Colin Ian King <colin.i.king@...il.com>,
	Alexis Belmonte <alexbelm48@...il.com>,
	Mark Pearson <mpearson-lenovo@...ebb.ca>,
	Ai Chao <aichao@...inos.cn>,
	Uwe Kleine-König <u.kleine-koenig@...libre.com>,
	Gergo Koteles <soyer@....hu>,
	Dell.Client.Kernel@...l.com,
	ibm-acpi-devel@...ts.sourceforge.net
Subject: [PATCH 10/18] platform/x86: ideapad-laptop: Use devm_platform_profile_register()

Replace platform_profile_register() with it's device managed version.
While at it, pass ideapad_dytc_priv to the class device as drvdata and
replace uses of container_of() with dev_get_drvdata().

Signed-off-by: Kurt Borja <kuurtb@...il.com>
---
 drivers/platform/x86/ideapad-laptop.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 43e4d9d8d595..d34d565172f5 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -936,7 +936,7 @@ static int convert_profile_to_dytc(enum platform_profile_option profile, int *pe
 static int dytc_profile_get(struct platform_profile_handler *pprof,
 			    enum platform_profile_option *profile)
 {
-	struct ideapad_dytc_priv *dytc = container_of(pprof, struct ideapad_dytc_priv, pprof);
+	struct ideapad_dytc_priv *dytc = dev_get_drvdata(&pprof->class_dev);
 
 	*profile = dytc->current_profile;
 	return 0;
@@ -989,7 +989,7 @@ static int dytc_cql_command(struct ideapad_private *priv, unsigned long cmd,
 static int dytc_profile_set(struct platform_profile_handler *pprof,
 			    enum platform_profile_option profile)
 {
-	struct ideapad_dytc_priv *dytc = container_of(pprof, struct ideapad_dytc_priv, pprof);
+	struct ideapad_dytc_priv *dytc = dev_get_drvdata(&pprof->class_dev);
 	struct ideapad_private *priv = dytc->priv;
 	unsigned long output;
 	int err;
@@ -1123,7 +1123,7 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv)
 	priv->dytc->pprof.ops = &dytc_profile_ops;
 
 	/* Create platform_profile structure and register */
-	err = platform_profile_register(&priv->dytc->pprof, NULL);
+	err = devm_platform_profile_register(&priv->dytc->pprof, &priv->dytc);
 	if (err)
 		goto pp_reg_failed;
 
@@ -1145,7 +1145,6 @@ static void ideapad_dytc_profile_exit(struct ideapad_private *priv)
 	if (!priv->dytc)
 		return;
 
-	platform_profile_remove(&priv->dytc->pprof);
 	mutex_destroy(&priv->dytc->mutex);
 	kfree(priv->dytc);
 
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ