linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] platform/x86: asus-wmi: corrections to egpu safety check
@ 2023-08-30  2:29 Luke D. Jones
  2023-08-30  2:29 ` [PATCH v2 1/1] " Luke D. Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Luke D. Jones @ 2023-08-30  2:29 UTC (permalink / raw)
  To: hdegoede
  Cc: corentin.chary, markgross, linux-kernel, platform-driver-x86,
	Luke D. Jones

Changelog:
- v2
  - Apply on platform-drivers/for-next and reference correct commit
  - Fix an incorrectly name err/result

Luke D. Jones (1):
  platform/x86: asus-wmi: corrections to egpu safety check

 drivers/platform/x86/asus-wmi.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

-- 
2.41.0


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

* [PATCH v2 1/1] platform/x86: asus-wmi: corrections to egpu safety check
  2023-08-30  2:29 [PATCH v2 0/1] platform/x86: asus-wmi: corrections to egpu safety check Luke D. Jones
@ 2023-08-30  2:29 ` Luke D. Jones
  2023-08-30 11:31   ` Ilpo Järvinen
  2023-08-30 13:25   ` Hans de Goede
  0 siblings, 2 replies; 5+ messages in thread
From: Luke D. Jones @ 2023-08-30  2:29 UTC (permalink / raw)
  To: hdegoede
  Cc: corentin.chary, markgross, linux-kernel, platform-driver-x86,
	Luke D. Jones

An incorrect if statement was preventing the enablement of the egpu.

Fixes: d49f4d1a30ac ("platform/x86: asus-wmi: don't allow eGPU switching if eGPU not connected")

Signed-off-by: Luke D. Jones <luke@ljones.dev>
---
 drivers/platform/x86/asus-wmi.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 9783893d2d6e..f54178d6f780 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -726,19 +726,18 @@ static ssize_t egpu_enable_store(struct device *dev,
 		return -EINVAL;
 
 	err = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU_CONNECTED);
-	if (err < 0)
-		return err;
-	if (err < 1) {
-		err = -ENODEV;
-		pr_warn("Failed to set egpu disable: %d\n", err);
+	if (err < 0) {
+		pr_warn("Failed to get egpu connection status: %d\n", err);
 		return err;
 	}
 
 	if (asus->gpu_mux_mode_available) {
 		result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX);
-		if (result < 0)
+		if (result < 0) {
 			/* An error here may signal greater failure of GPU handling */
+			pr_warn("Failed to get gpu mux status: %d\n", err);
 			return result;
+		}
 		if (!result && enable) {
 			err = -ENODEV;
 			pr_warn("Can not enable eGPU when the MUX is in dGPU mode: %d\n", err);
@@ -748,12 +747,12 @@ static ssize_t egpu_enable_store(struct device *dev,
 
 	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, enable, &result);
 	if (err) {
-		pr_warn("Failed to set egpu disable: %d\n", err);
+		pr_warn("Failed to set egpu state: %d\n", err);
 		return err;
 	}
 
 	if (result > 1) {
-		pr_warn("Failed to set egpu disable (retval): 0x%x\n", result);
+		pr_warn("Failed to set egpu state (retval): 0x%x\n", result);
 		return -EIO;
 	}
 
-- 
2.41.0


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

* Re: [PATCH v2 1/1] platform/x86: asus-wmi: corrections to egpu safety check
  2023-08-30  2:29 ` [PATCH v2 1/1] " Luke D. Jones
@ 2023-08-30 11:31   ` Ilpo Järvinen
  2023-08-30 13:20     ` Hans de Goede
  2023-08-30 13:25   ` Hans de Goede
  1 sibling, 1 reply; 5+ messages in thread
From: Ilpo Järvinen @ 2023-08-30 11:31 UTC (permalink / raw)
  To: Luke D. Jones
  Cc: hdegoede, corentin.chary, markgross, LKML, platform-driver-x86

On Wed, 30 Aug 2023, Luke D. Jones wrote:

> An incorrect if statement was preventing the enablement of the egpu.
> 
> Fixes: d49f4d1a30ac ("platform/x86: asus-wmi: don't allow eGPU switching if eGPU not connected")
> 
> Signed-off-by: Luke D. Jones <luke@ljones.dev>

Please don't leave extra spaces into tags block.

> ---
>  drivers/platform/x86/asus-wmi.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 9783893d2d6e..f54178d6f780 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -726,19 +726,18 @@ static ssize_t egpu_enable_store(struct device *dev,
>  		return -EINVAL;
>  
>  	err = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU_CONNECTED);
> -	if (err < 0)
> -		return err;
> -	if (err < 1) {
> -		err = -ENODEV;
> -		pr_warn("Failed to set egpu disable: %d\n", err);
> +	if (err < 0) {
> +		pr_warn("Failed to get egpu connection status: %d\n", err);

So this is the Fixes: part? You should make own patch out of it.

>  		return err;
>  	}
>  
>  	if (asus->gpu_mux_mode_available) {
>  		result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX);
> -		if (result < 0)
> +		if (result < 0) {
>  			/* An error here may signal greater failure of GPU handling */
> +			pr_warn("Failed to get gpu mux status: %d\n", err);
>  			return result;
> +		}
>  		if (!result && enable) {
>  			err = -ENODEV;
>  			pr_warn("Can not enable eGPU when the MUX is in dGPU mode: %d\n", err);
> @@ -748,12 +747,12 @@ static ssize_t egpu_enable_store(struct device *dev,
>  
>  	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, enable, &result);
>  	if (err) {
> -		pr_warn("Failed to set egpu disable: %d\n", err);
> +		pr_warn("Failed to set egpu state: %d\n", err);
>  		return err;
>  	}
>  
>  	if (result > 1) {
> -		pr_warn("Failed to set egpu disable (retval): 0x%x\n", result);
> +		pr_warn("Failed to set egpu state (retval): 0x%x\n", result);
>  		return -EIO;
>  	}
>  
> 

These others are good changes too but just not to be made in the same 
patch.


-- 
 i.




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

* Re: [PATCH v2 1/1] platform/x86: asus-wmi: corrections to egpu safety check
  2023-08-30 11:31   ` Ilpo Järvinen
@ 2023-08-30 13:20     ` Hans de Goede
  0 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2023-08-30 13:20 UTC (permalink / raw)
  To: Ilpo Järvinen, Luke D. Jones
  Cc: corentin.chary, markgross, LKML, platform-driver-x86

Hi All,

On 8/30/23 13:31, Ilpo Järvinen wrote:
> On Wed, 30 Aug 2023, Luke D. Jones wrote:
> 
>> An incorrect if statement was preventing the enablement of the egpu.
>>
>> Fixes: d49f4d1a30ac ("platform/x86: asus-wmi: don't allow eGPU switching if eGPU not connected")
>>
>> Signed-off-by: Luke D. Jones <luke@ljones.dev>
> 
> Please don't leave extra spaces into tags block.
> 
>> ---
>>  drivers/platform/x86/asus-wmi.c | 15 +++++++--------
>>  1 file changed, 7 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
>> index 9783893d2d6e..f54178d6f780 100644
>> --- a/drivers/platform/x86/asus-wmi.c
>> +++ b/drivers/platform/x86/asus-wmi.c
>> @@ -726,19 +726,18 @@ static ssize_t egpu_enable_store(struct device *dev,
>>  		return -EINVAL;
>>  
>>  	err = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU_CONNECTED);
>> -	if (err < 0)
>> -		return err;
>> -	if (err < 1) {
>> -		err = -ENODEV;
>> -		pr_warn("Failed to set egpu disable: %d\n", err);
>> +	if (err < 0) {
>> +		pr_warn("Failed to get egpu connection status: %d\n", err);
> 
> So this is the Fixes: part? You should make own patch out of it.
> 
>>  		return err;
>>  	}
>>  
>>  	if (asus->gpu_mux_mode_available) {
>>  		result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX);
>> -		if (result < 0)
>> +		if (result < 0) {
>>  			/* An error here may signal greater failure of GPU handling */
>> +			pr_warn("Failed to get gpu mux status: %d\n", err);
>>  			return result;
>> +		}
>>  		if (!result && enable) {
>>  			err = -ENODEV;
>>  			pr_warn("Can not enable eGPU when the MUX is in dGPU mode: %d\n", err);
>> @@ -748,12 +747,12 @@ static ssize_t egpu_enable_store(struct device *dev,
>>  
>>  	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, enable, &result);
>>  	if (err) {
>> -		pr_warn("Failed to set egpu disable: %d\n", err);
>> +		pr_warn("Failed to set egpu state: %d\n", err);
>>  		return err;
>>  	}
>>  
>>  	if (result > 1) {
>> -		pr_warn("Failed to set egpu disable (retval): 0x%x\n", result);
>> +		pr_warn("Failed to set egpu state (retval): 0x%x\n", result);
>>  		return -EIO;
>>  	}
>>  
>>
> 
> These others are good changes too but just not to be made in the same 
> patch.

Ilpo, you are right this should have really been 2 patches.

But the other changes are fixes (correction of wrong error messages) too,
which would be good to get out there.

So I've decided to take this as is, so that this can be included in
the main pdx86 pull-req for 6.6:

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



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

* Re: [PATCH v2 1/1] platform/x86: asus-wmi: corrections to egpu safety check
  2023-08-30  2:29 ` [PATCH v2 1/1] " Luke D. Jones
  2023-08-30 11:31   ` Ilpo Järvinen
@ 2023-08-30 13:25   ` Hans de Goede
  1 sibling, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2023-08-30 13:25 UTC (permalink / raw)
  To: Luke D. Jones
  Cc: corentin.chary, markgross, linux-kernel, platform-driver-x86

Hi Luke,

On 8/30/23 04:29, Luke D. Jones wrote:
> An incorrect if statement was preventing the enablement of the egpu.
> 
> Fixes: d49f4d1a30ac ("platform/x86: asus-wmi: don't allow eGPU switching if eGPU not connected")
> 
> Signed-off-by: Luke D. Jones <luke@ljones.dev>
> ---
>  drivers/platform/x86/asus-wmi.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 9783893d2d6e..f54178d6f780 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -726,19 +726,18 @@ static ssize_t egpu_enable_store(struct device *dev,
>  		return -EINVAL;
>  
>  	err = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU_CONNECTED);
> -	if (err < 0)
> -		return err;
> -	if (err < 1) {
> -		err = -ENODEV;
> -		pr_warn("Failed to set egpu disable: %d\n", err);
> +	if (err < 0) {
> +		pr_warn("Failed to get egpu connection status: %d\n", err);
>  		return err;
>  	}
>  
>  	if (asus->gpu_mux_mode_available) {
>  		result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX);
> -		if (result < 0)
> +		if (result < 0) {
>  			/* An error here may signal greater failure of GPU handling */
> +			pr_warn("Failed to get gpu mux status: %d\n", err);

The error-code to print here should be result not err, since the error is stored in result.

I've fixed this up while merging this.

Regards,

Hans



>  			return result;
> +		}
>  		if (!result && enable) {
>  			err = -ENODEV;
>  			pr_warn("Can not enable eGPU when the MUX is in dGPU mode: %d\n", err);
> @@ -748,12 +747,12 @@ static ssize_t egpu_enable_store(struct device *dev,
>  
>  	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, enable, &result);
>  	if (err) {
> -		pr_warn("Failed to set egpu disable: %d\n", err);
> +		pr_warn("Failed to set egpu state: %d\n", err);
>  		return err;
>  	}
>  
>  	if (result > 1) {
> -		pr_warn("Failed to set egpu disable (retval): 0x%x\n", result);
> +		pr_warn("Failed to set egpu state (retval): 0x%x\n", result);
>  		return -EIO;
>  	}
>  


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

end of thread, other threads:[~2023-08-30 19:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30  2:29 [PATCH v2 0/1] platform/x86: asus-wmi: corrections to egpu safety check Luke D. Jones
2023-08-30  2:29 ` [PATCH v2 1/1] " Luke D. Jones
2023-08-30 11:31   ` Ilpo Järvinen
2023-08-30 13:20     ` Hans de Goede
2023-08-30 13:25   ` 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).