2023-07-30 07:42:38

by Armin Wolf

[permalink] [raw]
Subject: [PATCH 1/3] platform/x86: wmi-bmof: Use device_create_bin_file()

Use device_create_bin_file() instead of sysfs_create_bin_file()
to avoid having to access the device kobject.

Tested on a ASUS PRIME B650-PLUS.

Signed-off-by: Armin Wolf <[email protected]>
---
drivers/platform/x86/wmi-bmof.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/wmi-bmof.c b/drivers/platform/x86/wmi-bmof.c
index 80137afb9753..d0516cacfcb5 100644
--- a/drivers/platform/x86/wmi-bmof.c
+++ b/drivers/platform/x86/wmi-bmof.c
@@ -75,7 +75,7 @@ static int wmi_bmof_probe(struct wmi_device *wdev, const void *context)
priv->bmof_bin_attr.read = read_bmof;
priv->bmof_bin_attr.size = priv->bmofdata->buffer.length;

- ret = sysfs_create_bin_file(&wdev->dev.kobj, &priv->bmof_bin_attr);
+ ret = device_create_bin_file(&wdev->dev, &priv->bmof_bin_attr);
if (ret)
goto err_free;

@@ -90,7 +90,7 @@ static void wmi_bmof_remove(struct wmi_device *wdev)
{
struct bmof_priv *priv = dev_get_drvdata(&wdev->dev);

- sysfs_remove_bin_file(&wdev->dev.kobj, &priv->bmof_bin_attr);
+ device_remove_bin_file(&wdev->dev, &priv->bmof_bin_attr);
kfree(priv->bmofdata);
}

--
2.39.2



2023-07-30 08:07:35

by Thomas Weißschuh

[permalink] [raw]
Subject: Re: [PATCH 1/3] platform/x86: wmi-bmof: Use device_create_bin_file()

On 2023-07-30 06:38:15+0200, Armin Wolf wrote:
> Use device_create_bin_file() instead of sysfs_create_bin_file()
> to avoid having to access the device kobject.
>
> Tested on a ASUS PRIME B650-PLUS.
>
> Signed-off-by: Armin Wolf <[email protected]>

Reviewed-by: Thomas Weißschuh <[email protected]>
Tested-by: Thomas Weißschuh <[email protected]>

> ---
> drivers/platform/x86/wmi-bmof.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/wmi-bmof.c b/drivers/platform/x86/wmi-bmof.c
> index 80137afb9753..d0516cacfcb5 100644
> --- a/drivers/platform/x86/wmi-bmof.c
> +++ b/drivers/platform/x86/wmi-bmof.c
> @@ -75,7 +75,7 @@ static int wmi_bmof_probe(struct wmi_device *wdev, const void *context)
> priv->bmof_bin_attr.read = read_bmof;
> priv->bmof_bin_attr.size = priv->bmofdata->buffer.length;
>
> - ret = sysfs_create_bin_file(&wdev->dev.kobj, &priv->bmof_bin_attr);
> + ret = device_create_bin_file(&wdev->dev, &priv->bmof_bin_attr);
> if (ret)
> goto err_free;
>
> @@ -90,7 +90,7 @@ static void wmi_bmof_remove(struct wmi_device *wdev)
> {
> struct bmof_priv *priv = dev_get_drvdata(&wdev->dev);
>
> - sysfs_remove_bin_file(&wdev->dev.kobj, &priv->bmof_bin_attr);
> + device_remove_bin_file(&wdev->dev, &priv->bmof_bin_attr);
> kfree(priv->bmofdata);
> }
>
> --
> 2.39.2
>