platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] platform/x86: asus-wmi:Use the function kobj_to_dev()
@ 2022-08-11  1:32 cgel.zte
  2022-08-15 13:20 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-08-11  1:32 UTC (permalink / raw)
  To: hdegoede
  Cc: corentin.chary, markgross, acpi4asus-user, platform-driver-x86,
	ye xingchen, Zeal Robot

From: ye xingchen <ye.xingchen@zte.com.cn>

Use kobj_to_dev() instead of open-coding it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 drivers/platform/x86/asus-wmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 89b604e04d7f..afb33a084f44 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -2006,7 +2006,7 @@ static struct attribute *hwmon_attributes[] = {
 static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
 					  struct attribute *attr, int idx)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct asus_wmi *asus = dev_get_drvdata(dev->parent);
 	u32 value = ASUS_WMI_UNSUPPORTED_METHOD;
 
@@ -3294,7 +3294,7 @@ static struct attribute *platform_attributes[] = {
 static umode_t asus_sysfs_is_visible(struct kobject *kobj,
 				    struct attribute *attr, int idx)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct asus_wmi *asus = dev_get_drvdata(dev);
 	bool ok = true;
 	int devid = -1;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux-next] platform/x86: asus-wmi:Use the function kobj_to_dev()
  2022-08-11  1:32 [PATCH linux-next] platform/x86: asus-wmi:Use the function kobj_to_dev() cgel.zte
@ 2022-08-15 13:20 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2022-08-15 13:20 UTC (permalink / raw)
  To: cgel.zte
  Cc: corentin.chary, markgross, acpi4asus-user, platform-driver-x86,
	ye xingchen, Zeal Robot

Hi,

On 8/11/22 03:32, cgel.zte@gmail.com wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
> 
> Use kobj_to_dev() instead of open-coding it.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>

Thank you for your patch, I've applied this patch 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

> ---
>  drivers/platform/x86/asus-wmi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 89b604e04d7f..afb33a084f44 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -2006,7 +2006,7 @@ static struct attribute *hwmon_attributes[] = {
>  static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
>  					  struct attribute *attr, int idx)
>  {
> -	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct device *dev = kobj_to_dev(kobj);
>  	struct asus_wmi *asus = dev_get_drvdata(dev->parent);
>  	u32 value = ASUS_WMI_UNSUPPORTED_METHOD;
>  
> @@ -3294,7 +3294,7 @@ static struct attribute *platform_attributes[] = {
>  static umode_t asus_sysfs_is_visible(struct kobject *kobj,
>  				    struct attribute *attr, int idx)
>  {
> -	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct device *dev = kobj_to_dev(kobj);
>  	struct asus_wmi *asus = dev_get_drvdata(dev);
>  	bool ok = true;
>  	int devid = -1;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-15 13:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11  1:32 [PATCH linux-next] platform/x86: asus-wmi:Use the function kobj_to_dev() cgel.zte
2022-08-15 13:20 ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).