From: "Rafael J. Wysocki" <rafael@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux ACPI <linux-acpi@vger.kernel.org>,
Hans de Goede <hansg@kernel.org>,
platform-driver-x86@vger.kernel.org,
Azael Avalos <coproscefalo@gmail.com>
Subject: [PATCH v1 5/7] platform/x86: toshiba_bluetooth: Convert ACPI driver to a platform one
Date: Tue, 24 Mar 2026 21:01:28 +0100 [thread overview]
Message-ID: <3420881.44csPzL39Z@rafael.j.wysocki> (raw)
In-Reply-To: <6262981.lOV4Wx5bFT@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 Toshiba Bluetooth Enable driver from an
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/toshiba_bluetooth.c | 42 ++++++++++++------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/platform/x86/toshiba_bluetooth.c b/drivers/platform/x86/toshiba_bluetooth.c
index 3824c2beaf11..e50d4fc1e603 100644
--- a/drivers/platform/x86/toshiba_bluetooth.c
+++ b/drivers/platform/x86/toshiba_bluetooth.c
@@ -17,6 +17,7 @@
#include <linux/types.h>
#include <linux/acpi.h>
#include <linux/rfkill.h>
+#include <linux/platform_device.h>
#define BT_KILLSWITCH_MASK 0x01
#define BT_PLUGGED_MASK 0x40
@@ -35,8 +36,8 @@ struct toshiba_bluetooth_dev {
bool powered;
};
-static int toshiba_bt_rfkill_add(struct acpi_device *device);
-static void toshiba_bt_rfkill_remove(struct acpi_device *device);
+static int toshiba_bt_rfkill_probe(struct platform_device *pdev);
+static void toshiba_bt_rfkill_remove(struct platform_device *pdev);
static void toshiba_bt_rfkill_notify(acpi_handle handle, u32 event, void *data);
static const struct acpi_device_id bt_device_ids[] = {
@@ -50,15 +51,14 @@ static int toshiba_bt_resume(struct device *dev);
#endif
static SIMPLE_DEV_PM_OPS(toshiba_bt_pm, NULL, toshiba_bt_resume);
-static struct acpi_driver toshiba_bt_rfkill_driver = {
- .name = "Toshiba BT",
- .class = "Toshiba",
- .ids = bt_device_ids,
- .ops = {
- .add = toshiba_bt_rfkill_add,
- .remove = toshiba_bt_rfkill_remove,
- },
- .drv.pm = &toshiba_bt_pm,
+static struct platform_driver toshiba_bt_rfkill_driver = {
+ .probe = toshiba_bt_rfkill_probe,
+ .remove = toshiba_bt_rfkill_remove,
+ .driver = {
+ .name = "Toshiba BT",
+ .acpi_match_table = bt_device_ids,
+ .pm = &toshiba_bt_pm,
+ },
};
static int toshiba_bluetooth_present(acpi_handle handle)
@@ -215,11 +215,9 @@ static void toshiba_bt_rfkill_notify(acpi_handle handle, u32 event, void *data)
#ifdef CONFIG_PM_SLEEP
static int toshiba_bt_resume(struct device *dev)
{
- struct toshiba_bluetooth_dev *bt_dev;
+ struct toshiba_bluetooth_dev *bt_dev = dev_get_drvdata(dev);
int ret;
- bt_dev = acpi_driver_data(to_acpi_device(dev));
-
ret = toshiba_bluetooth_sync_status(bt_dev);
if (ret)
return ret;
@@ -230,8 +228,9 @@ static int toshiba_bt_resume(struct device *dev)
}
#endif
-static int toshiba_bt_rfkill_add(struct acpi_device *device)
+static int toshiba_bt_rfkill_probe(struct platform_device *pdev)
{
+ struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
struct toshiba_bluetooth_dev *bt_dev;
int result;
@@ -245,8 +244,8 @@ static int toshiba_bt_rfkill_add(struct acpi_device *device)
if (!bt_dev)
return -ENOMEM;
bt_dev->acpi_dev = device;
- device->driver_data = bt_dev;
- dev_set_drvdata(&device->dev, bt_dev);
+
+ platform_set_drvdata(pdev, bt_dev);
result = toshiba_bluetooth_sync_status(bt_dev);
if (result) {
@@ -255,7 +254,7 @@ static int toshiba_bt_rfkill_add(struct acpi_device *device)
}
bt_dev->rfk = rfkill_alloc("Toshiba Bluetooth",
- &device->dev,
+ &pdev->dev,
RFKILL_TYPE_BLUETOOTH,
&rfk_ops,
bt_dev);
@@ -291,9 +290,10 @@ static int toshiba_bt_rfkill_add(struct acpi_device *device)
return result;
}
-static void toshiba_bt_rfkill_remove(struct acpi_device *device)
+static void toshiba_bt_rfkill_remove(struct platform_device *pdev)
{
- struct toshiba_bluetooth_dev *bt_dev = acpi_driver_data(device);
+ struct toshiba_bluetooth_dev *bt_dev = platform_get_drvdata(pdev);
+ struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
/* clean up */
acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
@@ -309,4 +309,4 @@ static void toshiba_bt_rfkill_remove(struct acpi_device *device)
toshiba_bluetooth_disable(device->handle);
}
-module_acpi_driver(toshiba_bt_rfkill_driver);
+module_platform_driver(toshiba_bt_rfkill_driver);
--
2.51.0
next prev parent reply other threads:[~2026-03-24 20:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 19:57 [PATCH v1 0/7] platform/x86: toshiba: Bind to platform devices instead of ACPI ones Rafael J. Wysocki
2026-03-24 19:58 ` [PATCH v1 1/7] platform/x86: toshiba_acpi: Reorder code to avoid forward declaration Rafael J. Wysocki
2026-03-24 19:58 ` [PATCH v1 2/7] platform/x86: toshiba_acpi: Register ACPI notify handler directly Rafael J. Wysocki
2026-03-24 20:00 ` [PATCH v1 3/7] platform/x86: toshiba_acpi: Convert ACPI driver to a platform one Rafael J. Wysocki
2026-03-24 20:00 ` [PATCH v1 4/7] platform/x86: toshiba_bluetooth: Register ACPI notify handler directly Rafael J. Wysocki
2026-03-24 20:01 ` Rafael J. Wysocki [this message]
2026-03-24 20:02 ` [PATCH v1 6/7] platform/x86: toshiba_haps: " Rafael J. Wysocki
2026-03-24 20:03 ` [PATCH v1 7/7] platform/x86: toshiba_haps: Convert ACPI driver to a platform one Rafael J. Wysocki
2026-03-31 16:41 ` [PATCH v1 0/7] platform/x86: toshiba: 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=3420881.44csPzL39Z@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=coproscefalo@gmail.com \
--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