mirror of
https://github.com/torvalds/linux.git
synced 2026-11-28 01:13:11 +00:00
platform/x86: asus-wmi: don't allow eGPU switching if eGPU not connected
Check the ASUS_WMI_DEVID_EGPU_CONNECTED method for eGPU connection before allowing the ASUS_WMI_DEVID_EGPU method to run. Signed-off-by: Luke D. Jones <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
This commit is contained in:
committed by
Hans de Goede
parent
d4eca58aaf
commit
d49f4d1a30
@@ -693,6 +693,15 @@ static ssize_t egpu_enable_store(struct device *dev,
|
||||
if (enable > 1)
|
||||
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);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, enable, &result);
|
||||
if (err) {
|
||||
pr_warn("Failed to set egpu disable: %d\n", err);
|
||||
|
||||
Reference in New Issue
Block a user