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: <20250106044605.12494-4-kuurtb@gmail.com>
Date: Sun,  5 Jan 2025 23:45:51 -0500
From: Kurt Borja <kuurtb@...il.com>
To: platform-driver-x86@...r.kernel.org
Cc: josh@...huagrisham.com,
	hridesh699@...il.com,
	derekjohn.clark@...il.com,
	Kurt Borja <kuurtb@...il.com>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Len Brown <lenb@...nel.org>,
	Maximilian Luz <luzmaximilian@...il.com>,
	Hans de Goede <hdegoede@...hat.com>,
	Ilpo Järvinen <ilpo.jarvinen@...ux.intel.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>,
	Armin Wolf <W_Armin@....de>,
	Mario Limonciello <mario.limonciello@....com>,
	Mark Pearson <mpearson-lenovo@...ebb.ca>,
	Colin Ian King <colin.i.king@...il.com>,
	Alexis Belmonte <alexbelm48@...il.com>,
	Ai Chao <aichao@...inos.cn>,
	Uwe Kleine-König <u.kleine-koenig@...libre.com>,
	Gergo Koteles <soyer@....hu>,
	linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Dell.Client.Kernel@...l.com,
	ibm-acpi-devel@...ts.sourceforge.net
Subject: [RFC PATCH 3/3] ACPI: platform_profile: Add platform_profile_refresh_choices()

Let drivers dynamically refresh selected choices safely, while holding
`profile_lock`.

Signed-off-by: Kurt Borja <kuurtb@...il.com>
---
 drivers/acpi/platform_profile.c  | 23 +++++++++++++++++++++++
 include/linux/platform_profile.h |  1 +
 2 files changed, 24 insertions(+)

diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
index ec749c2d0695..087280d786b1 100644
--- a/drivers/acpi/platform_profile.c
+++ b/drivers/acpi/platform_profile.c
@@ -459,6 +459,29 @@ int platform_profile_cycle(void)
 }
 EXPORT_SYMBOL_GPL(platform_profile_cycle);
 
+int platform_profile_refresh_choices(struct platform_profile_handler *pprof)
+{
+	unsigned long backup[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
+	int err;
+
+	scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) {
+		bitmap_copy(backup, pprof->choices, PLATFORM_PROFILE_LAST);
+
+		err = pprof->ops->choices(pprof);
+		if (err) {
+			bitmap_copy(pprof->choices, backup, PLATFORM_PROFILE_LAST);
+			return err;
+		}
+
+		_notify_class_profile(pprof->class_dev, NULL);
+	}
+
+	sysfs_notify(acpi_kobj, NULL, "platform_profile");
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(platform_profile_refresh_choices);
+
 int platform_profile_register(struct platform_profile_handler *pprof)
 {
 	int err;
diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h
index 7f266a60b41a..7d543dd8c164 100644
--- a/include/linux/platform_profile.h
+++ b/include/linux/platform_profile.h
@@ -50,6 +50,7 @@ int platform_profile_register(struct platform_profile_handler *pprof);
 int platform_profile_remove(struct platform_profile_handler *pprof);
 int devm_platform_profile_register(struct platform_profile_handler *pprof);
 int platform_profile_cycle(void);
+int platform_profile_refresh_choices(struct platform_profile_handler *pprof);
 void platform_profile_notify(struct platform_profile_handler *pprof);
 
 #endif  /*_PLATFORM_PROFILE_H_*/
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ