platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/x86: asus-wmi: Simplify some of the *_check_present() helpers
@ 2022-08-15 15:05 Hans de Goede
  2022-08-24 13:48 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2022-08-15 15:05 UTC (permalink / raw)
  To: Mark Gross
  Cc: Hans de Goede, Andy Shevchenko, platform-driver-x86, Luke D . Jones

After the recent cleanup patches, some of the *_check_present() helpers
just propagate the result of asus_wmi_dev_is_present().

Replace these with direct asus_wmi_dev_is_present() calls as a further
cleanup.

Cc: Luke D. Jones <luke@ljones.dev>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/asus-wmi.c | 47 +++------------------------------
 1 file changed, 3 insertions(+), 44 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 2d9d709aa59f..d72491fb218b 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -557,16 +557,6 @@ static void lid_flip_tablet_mode_get_state(struct asus_wmi *asus)
 }
 
 /* dGPU ********************************************************************/
-static int dgpu_disable_check_present(struct asus_wmi *asus)
-{
-	asus->dgpu_disable_available = false;
-
-	if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_DGPU))
-		asus->dgpu_disable_available = true;
-
-	return 0;
-}
-
 static ssize_t dgpu_disable_show(struct device *dev,
 				   struct device_attribute *attr, char *buf)
 {
@@ -620,16 +610,6 @@ static ssize_t dgpu_disable_store(struct device *dev,
 static DEVICE_ATTR_RW(dgpu_disable);
 
 /* eGPU ********************************************************************/
-static int egpu_enable_check_present(struct asus_wmi *asus)
-{
-	asus->egpu_enable_available = false;
-
-	if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU))
-		asus->egpu_enable_available = true;
-
-	return 0;
-}
-
 static ssize_t egpu_enable_show(struct device *dev,
 				   struct device_attribute *attr, char *buf)
 {
@@ -1497,16 +1477,6 @@ static int asus_wmi_rfkill_init(struct asus_wmi *asus)
 }
 
 /* Panel Overdrive ************************************************************/
-static int panel_od_check_present(struct asus_wmi *asus)
-{
-	asus->panel_overdrive_available = false;
-
-	if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD))
-		asus->panel_overdrive_available = true;
-
-	return 0;
-}
-
 static ssize_t panel_od_show(struct device *dev,
 				   struct device_attribute *attr, char *buf)
 {
@@ -3493,13 +3463,9 @@ static int asus_wmi_add(struct platform_device *pdev)
 	if (err)
 		goto fail_platform;
 
-	err = egpu_enable_check_present(asus);
-	if (err)
-		goto fail_egpu_enable;
-
-	err = dgpu_disable_check_present(asus);
-	if (err)
-		goto fail_dgpu_disable;
+	asus->egpu_enable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU);
+	asus->dgpu_disable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_DGPU);
+	asus->panel_overdrive_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD);
 
 	err = fan_boost_mode_check_present(asus);
 	if (err)
@@ -3515,10 +3481,6 @@ static int asus_wmi_add(struct platform_device *pdev)
 	if (err)
 		goto fail_platform_profile_setup;
 
-	err = panel_od_check_present(asus);
-	if (err)
-		goto fail_panel_od;
-
 	err = asus_wmi_sysfs_init(asus->platform_device);
 	if (err)
 		goto fail_sysfs;
@@ -3613,10 +3575,7 @@ static int asus_wmi_add(struct platform_device *pdev)
 	if (asus->platform_profile_support)
 		platform_profile_remove();
 fail_fan_boost_mode:
-fail_egpu_enable:
-fail_dgpu_disable:
 fail_platform:
-fail_panel_od:
 	kfree(asus);
 	return err;
 }
-- 
2.36.1


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

* Re: [PATCH] platform/x86: asus-wmi: Simplify some of the *_check_present() helpers
  2022-08-15 15:05 [PATCH] platform/x86: asus-wmi: Simplify some of the *_check_present() helpers Hans de Goede
@ 2022-08-24 13:48 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2022-08-24 13:48 UTC (permalink / raw)
  To: Mark Gross; +Cc: Andy Shevchenko, platform-driver-x86, Luke D . Jones

Hi All,

On 8/15/22 17:05, Hans de Goede wrote:
> After the recent cleanup patches, some of the *_check_present() helpers
> just propagate the result of asus_wmi_dev_is_present().
> 
> Replace these with direct asus_wmi_dev_is_present() calls as a further
> cleanup.
> 
> Cc: Luke D. Jones <luke@ljones.dev>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

I've added this to my review-hans (soon to be for-next) branch now.

Regards,

Hans


> ---
>  drivers/platform/x86/asus-wmi.c | 47 +++------------------------------
>  1 file changed, 3 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 2d9d709aa59f..d72491fb218b 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -557,16 +557,6 @@ static void lid_flip_tablet_mode_get_state(struct asus_wmi *asus)
>  }
>  
>  /* dGPU ********************************************************************/
> -static int dgpu_disable_check_present(struct asus_wmi *asus)
> -{
> -	asus->dgpu_disable_available = false;
> -
> -	if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_DGPU))
> -		asus->dgpu_disable_available = true;
> -
> -	return 0;
> -}
> -
>  static ssize_t dgpu_disable_show(struct device *dev,
>  				   struct device_attribute *attr, char *buf)
>  {
> @@ -620,16 +610,6 @@ static ssize_t dgpu_disable_store(struct device *dev,
>  static DEVICE_ATTR_RW(dgpu_disable);
>  
>  /* eGPU ********************************************************************/
> -static int egpu_enable_check_present(struct asus_wmi *asus)
> -{
> -	asus->egpu_enable_available = false;
> -
> -	if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU))
> -		asus->egpu_enable_available = true;
> -
> -	return 0;
> -}
> -
>  static ssize_t egpu_enable_show(struct device *dev,
>  				   struct device_attribute *attr, char *buf)
>  {
> @@ -1497,16 +1477,6 @@ static int asus_wmi_rfkill_init(struct asus_wmi *asus)
>  }
>  
>  /* Panel Overdrive ************************************************************/
> -static int panel_od_check_present(struct asus_wmi *asus)
> -{
> -	asus->panel_overdrive_available = false;
> -
> -	if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD))
> -		asus->panel_overdrive_available = true;
> -
> -	return 0;
> -}
> -
>  static ssize_t panel_od_show(struct device *dev,
>  				   struct device_attribute *attr, char *buf)
>  {
> @@ -3493,13 +3463,9 @@ static int asus_wmi_add(struct platform_device *pdev)
>  	if (err)
>  		goto fail_platform;
>  
> -	err = egpu_enable_check_present(asus);
> -	if (err)
> -		goto fail_egpu_enable;
> -
> -	err = dgpu_disable_check_present(asus);
> -	if (err)
> -		goto fail_dgpu_disable;
> +	asus->egpu_enable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU);
> +	asus->dgpu_disable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_DGPU);
> +	asus->panel_overdrive_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD);
>  
>  	err = fan_boost_mode_check_present(asus);
>  	if (err)
> @@ -3515,10 +3481,6 @@ static int asus_wmi_add(struct platform_device *pdev)
>  	if (err)
>  		goto fail_platform_profile_setup;
>  
> -	err = panel_od_check_present(asus);
> -	if (err)
> -		goto fail_panel_od;
> -
>  	err = asus_wmi_sysfs_init(asus->platform_device);
>  	if (err)
>  		goto fail_sysfs;
> @@ -3613,10 +3575,7 @@ static int asus_wmi_add(struct platform_device *pdev)
>  	if (asus->platform_profile_support)
>  		platform_profile_remove();
>  fail_fan_boost_mode:
> -fail_egpu_enable:
> -fail_dgpu_disable:
>  fail_platform:
> -fail_panel_od:
>  	kfree(asus);
>  	return err;
>  }


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 15:05 [PATCH] platform/x86: asus-wmi: Simplify some of the *_check_present() helpers Hans de Goede
2022-08-24 13:48 ` 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).