From: Armin Wolf <W_Armin@gmx.de>
To: hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, linux@weissschuh.net,
Dell.Client.Kernel@dell.com, corbet@lwn.net,
linux-doc@vger.kernel.org
Subject: [PATCH v2 8/9] platform/x86: wmi-bmof: Use new buffer-based WMI API
Date: Sat, 20 Dec 2025 21:46:21 +0100 [thread overview]
Message-ID: <20251220204622.3541-9-W_Armin@gmx.de> (raw)
In-Reply-To: <20251220204622.3541-1-W_Armin@gmx.de>
Use the new buffer-based WMI API to also support ACPI firmware
implementations that do not use ACPI buffers to return the BMOF data.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
drivers/platform/x86/wmi-bmof.c | 34 +++++++++++++++------------------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/drivers/platform/x86/wmi-bmof.c b/drivers/platform/x86/wmi-bmof.c
index 5b00370a9a22..e3a126de421b 100644
--- a/drivers/platform/x86/wmi-bmof.c
+++ b/drivers/platform/x86/wmi-bmof.c
@@ -8,7 +8,6 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/kernel.h>
@@ -24,9 +23,9 @@ static ssize_t bmof_read(struct file *filp, struct kobject *kobj, const struct b
char *buf, loff_t off, size_t count)
{
struct device *dev = kobj_to_dev(kobj);
- union acpi_object *obj = dev_get_drvdata(dev);
+ struct wmi_buffer *buffer = dev_get_drvdata(dev);
- return memory_read_from_buffer(buf, count, &off, obj->buffer.pointer, obj->buffer.length);
+ return memory_read_from_buffer(buf, count, &off, buffer->data, buffer->length);
}
static const BIN_ATTR_ADMIN_RO(bmof, 0);
@@ -39,9 +38,9 @@ static const struct bin_attribute * const bmof_attrs[] = {
static size_t bmof_bin_size(struct kobject *kobj, const struct bin_attribute *attr, int n)
{
struct device *dev = kobj_to_dev(kobj);
- union acpi_object *obj = dev_get_drvdata(dev);
+ struct wmi_buffer *buffer = dev_get_drvdata(dev);
- return obj->buffer.length;
+ return buffer->length;
}
static const struct attribute_group bmof_group = {
@@ -56,30 +55,27 @@ static const struct attribute_group *bmof_groups[] = {
static int wmi_bmof_probe(struct wmi_device *wdev, const void *context)
{
- union acpi_object *obj;
+ struct wmi_buffer *buffer;
+ int ret;
- obj = wmidev_block_query(wdev, 0);
- if (!obj) {
- dev_err(&wdev->dev, "failed to read Binary MOF\n");
- return -EIO;
- }
+ buffer = devm_kzalloc(&wdev->dev, sizeof(*buffer), GFP_KERNEL);
+ if (!buffer)
+ return -ENOMEM;
- if (obj->type != ACPI_TYPE_BUFFER) {
- dev_err(&wdev->dev, "Binary MOF is not a buffer\n");
- kfree(obj);
- return -EIO;
- }
+ ret = wmidev_query_block(wdev, 0, buffer);
+ if (ret < 0)
+ return ret;
- dev_set_drvdata(&wdev->dev, obj);
+ dev_set_drvdata(&wdev->dev, buffer);
return 0;
}
static void wmi_bmof_remove(struct wmi_device *wdev)
{
- union acpi_object *obj = dev_get_drvdata(&wdev->dev);
+ struct wmi_buffer *buffer = dev_get_drvdata(&wdev->dev);
- kfree(obj);
+ kfree(buffer->data);
}
static const struct wmi_device_id wmi_bmof_id_table[] = {
--
2.39.5
next prev parent reply other threads:[~2025-12-20 20:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-20 20:46 [PATCH v2 0/9] platform/wmi: Introduce marshalling support Armin Wolf
2025-12-20 20:46 ` [PATCH v2 1/9] " Armin Wolf
2026-01-06 15:35 ` Ilpo Järvinen
2026-01-06 15:56 ` Ilpo Järvinen
2025-12-20 20:46 ` [PATCH v2 2/9] platform/wmi: Add kunit test for the marshalling code Armin Wolf
2026-01-06 15:39 ` Ilpo Järvinen
2025-12-20 20:46 ` [PATCH v2 3/9] platform/wmi: Add helper functions for WMI string conversions Armin Wolf
2025-12-20 20:46 ` [PATCH v2 4/9] platform/wmi: Add kunit test for the string conversion code Armin Wolf
2025-12-20 20:46 ` [PATCH v2 5/9] platform/x86: intel-wmi-sbl-fw-update: Use new buffer-based WMI API Armin Wolf
2025-12-20 20:46 ` [PATCH v2 6/9] platform/x86/intel/wmi: thunderbolt: " Armin Wolf
2025-12-20 20:46 ` [PATCH v2 7/9] platform/x86: xiaomi-wmi: " Armin Wolf
2025-12-20 20:46 ` Armin Wolf [this message]
2025-12-20 20:46 ` [PATCH v2 9/9] platform/wmi: Update driver development guide Armin Wolf
2026-01-06 15:15 ` [PATCH v2 0/9] platform/wmi: Introduce marshalling support Armin Wolf
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=20251220204622.3541-9-W_Armin@gmx.de \
--to=w_armin@gmx.de \
--cc=Dell.Client.Kernel@dell.com \
--cc=corbet@lwn.net \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--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