[v3,1/3] platform/x86: wmi-bmof: Use device_create_bin_file()

Message ID 20230730204550.3402-1-W_Armin@gmx.de
State New
Headers
Series [v3,1/3] platform/x86: wmi-bmof: Use device_create_bin_file() |

Commit Message

Armin Wolf July 30, 2023, 8:45 p.m. UTC
  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.

Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Tested-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
Changes since v1:
- add Reviewed-by and Tested-by tags
---
 drivers/platform/x86/wmi-bmof.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.39.2
  

Comments

Hans de Goede July 31, 2023, 2:09 p.m. UTC | #1
Hi,

On 7/30/23 22:45, 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.
> 
> Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
> Tested-by: Thomas Weißschuh <linux@weissschuh.net>
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>

Thank you for your patch-series, I've applied the series to my
review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans



> ---
> Changes since v1:
> - add Reviewed-by and Tested-by tags
> ---
>  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
>
  

Patch

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);
 }