public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Hans de Goede <hansg@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	platform-driver-x86@vger.kernel.org
Subject: [PATCH v1 1/2] platform/x86: intel/rst: Convert ACPI driver to a platform one
Date: Sat, 28 Feb 2026 16:27:33 +0100	[thread overview]
Message-ID: <3599223.QJadu78ljV@rafael.j.wysocki> (raw)
In-Reply-To: <8692017.NyiUUSuA9g@rafael.j.wysocki>

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

In all cases in which a struct acpi_driver is used for binding a driver
to an ACPI device object, a corresponding platform device is created by
the ACPI core and that device is regarded as a proper representation of
underlying hardware.  Accordingly, a struct platform_driver should be
used by driver code to bind to that device.  There are multiple reasons
why drivers should not bind directly to ACPI device objects [1].

Overall, it is better to bind drivers to platform devices than to their
ACPI companions, so convert the Intel Rapid Start Technology (rst) ACPI
driver to a platform one.

While this is not expected to alter functionality, it changes sysfs
layout and so it will be visible to user space.

Link: https://lore.kernel.org/all/2396510.ElGaqSPkdT@rafael.j.wysocki/ [1]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/intel/rst.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/platform/x86/intel/rst.c b/drivers/platform/x86/intel/rst.c
index f3a60e14d4c1..4bd10927aad9 100644
--- a/drivers/platform/x86/intel/rst.c
+++ b/drivers/platform/x86/intel/rst.c
@@ -5,6 +5,7 @@
 
 #include <linux/acpi.h>
 #include <linux/module.h>
+#include <linux/platform_device.h>
 #include <linux/slab.h>
 
 MODULE_DESCRIPTION("Intel Rapid Start Technology Driver");
@@ -99,8 +100,9 @@ static struct device_attribute irst_timeout_attr = {
 	.store = irst_store_wakeup_time
 };
 
-static int irst_add(struct acpi_device *acpi)
+static int irst_probe(struct platform_device *pdev)
 {
+	struct acpi_device *acpi = ACPI_COMPANION(&pdev->dev);
 	int error;
 
 	error = device_create_file(&acpi->dev, &irst_timeout_attr);
@@ -114,8 +116,10 @@ static int irst_add(struct acpi_device *acpi)
 	return error;
 }
 
-static void irst_remove(struct acpi_device *acpi)
+static void irst_remove(struct platform_device *pdev)
 {
+	struct acpi_device *acpi = ACPI_COMPANION(&pdev->dev);
+
 	device_remove_file(&acpi->dev, &irst_wakeup_attr);
 	device_remove_file(&acpi->dev, &irst_timeout_attr);
 }
@@ -125,16 +129,15 @@ static const struct acpi_device_id irst_ids[] = {
 	{"", 0}
 };
 
-static struct acpi_driver irst_driver = {
-	.name = "intel_rapid_start",
-	.class = "intel_rapid_start",
-	.ids = irst_ids,
-	.ops = {
-		.add = irst_add,
-		.remove = irst_remove,
+static struct platform_driver irst_driver = {
+	.probe = irst_probe,
+	.remove = irst_remove,
+	.driver = {
+		.name = "intel_rapid_start",
+		.acpi_match_table = irst_ids,
 	},
 };
 
-module_acpi_driver(irst_driver);
+module_platform_driver(irst_driver);
 
 MODULE_DEVICE_TABLE(acpi, irst_ids);
-- 
2.51.0





  reply	other threads:[~2026-02-28 15:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-28 15:26 [PATCH v1 0/2] platform/x86: intel: Bind to platform devices instead of ACPI ones Rafael J. Wysocki
2026-02-28 15:27 ` Rafael J. Wysocki [this message]
2026-02-28 15:28 ` [PATCH v1 2/2] platform/x86: intel/smartconnect: Convert ACPI driver to a platform one Rafael J. Wysocki
2026-03-09 14:58 ` [PATCH v1 0/2] platform/x86: intel: Bind to platform devices instead of ACPI ones 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=3599223.QJadu78ljV@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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