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-next>] [day] [month] [year] [list]
Message-ID: <20250109150731.110799-1-kuurtb@gmail.com>
Date: Thu,  9 Jan 2025 10:06:13 -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>,
	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: [PATCH 00/18] Hide platform_profile_handler from consumers

Hello :)

These series removes every use of platform_profile_handler outside
platform_profile.c and fundamentally modifies the platform profile API.

Currently, drivers have to allocate a platform_profile_handler and then
manually setup undocumented (as far as I know) members, before
registering the class device. This approach leaves exposed internal
members that should be managed *only* by the platform_profile module.
This has not been a problem yet because the interface is very simple,
but that could change in the future.

These series tackles this problem by presenting a new interface which
works around the following method:

struct *platform_profile_register(struct device *dev, const char *name,
				  void *drvdata,
				  const struct platform_profile_ops *ops)

Which now returns a pointer to the new allocated class device assigned
with *drvdata. I think this both is easier to use for future developers
and safer, because it protects internal structures that shouldn't be
meddled with.

If you want more details about this interface you can read patch [18/18]
which adds kerneldoc to exported methods.

These series would also make it trivial to implement a method that
"updates" selected choices, in a similar fashion to how
sysfs_update_group() updates attribute visibility. I proposed this a
couple days ago [1], but no drivers currently need this, so I dropped
the idea for the time being.

Your feedback is much appreciated!

Tested for the alienware-wmi driver on an Alienware x15 R1.

~ Kurt

[1] https://lore.kernel.org/platform-driver-x86/20250106044605.12494-1-kuurtb@gmail.com/

Kurt Borja (18):
  ACPI: platform_profile: Add `ops` member to handlers
  ACPI: platform_profile: Add `choices` to platform_profile_ops
  ACPI: platform_profile: Replace *class_dev member with class_dev
  ACPI: platform_profile: Let drivers set drvdata to the class device
  platform/surface: surface_platform_profile: Use
    devm_platform_profile_register()
  platform/x86: acer-wmi: Use devm_platform_profile_register()
  platform/x86: amd: pmf: sps: Use devm_platform_profile_register()
  platform/x86: asus-wmi: Use devm_platform_profile_register()
  platform/x86: dell-pc: Use devm_platform_profile_register()
  platform/x86: ideapad-laptop: Use devm_platform_profile_register()
  platform/x86: hp-wmi: Use devm_platform_profile_register()
  platform/x86: inspur_platform_profile: Use
    devm_platform_profile_register()
  platform/x86: thinkpad_acpi: Use devm_platform_profile_register()
  ACPI: platform_profile: Remove platform_profile_handler from exported
    symbols
  ACPI: platform_profile: Remove platform_profile_handler from callbacks
  ACPI: platform_profile: Move platform_profile_handler
  ACPI: platform_profile: Clean platform_profile_handler
  ACPI: platform_profile: Add documentation

 .../ABI/testing/sysfs-class-platform-profile  |  44 +++++
 drivers/acpi/platform_profile.c               | 168 +++++++++++++-----
 .../surface/surface_platform_profile.c        |  48 ++---
 drivers/platform/x86/acer-wmi.c               |  58 +++---
 drivers/platform/x86/amd/pmf/core.c           |   1 -
 drivers/platform/x86/amd/pmf/pmf.h            |   3 +-
 drivers/platform/x86/amd/pmf/sps.c            |  47 ++---
 drivers/platform/x86/asus-wmi.c               |  54 +++---
 drivers/platform/x86/dell/alienware-wmi.c     |  34 ++--
 drivers/platform/x86/dell/dell-pc.c           |  60 +++----
 drivers/platform/x86/hp/hp-wmi.c              |  83 +++++----
 drivers/platform/x86/ideapad-laptop.c         |  44 +++--
 .../platform/x86/inspur_platform_profile.c    |  48 +++--
 drivers/platform/x86/thinkpad_acpi.c          |  37 ++--
 include/linux/platform_profile.h              |  27 ++-
 15 files changed, 454 insertions(+), 302 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-class-platform-profile


base-commit: 6b228cfc52a6e9b7149cf51e247076963d6561cd
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ