From: "Luke D. Jones" <luke@ljones.dev>
To: hdegoede@redhat.com
Cc: ilpo.jarvinen@linux.intel.com, corentin.chary@gmail.com,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, "Luke D. Jones" <luke@ljones.dev>
Subject: [PATCH 5/9] platform/x86: asus-wmi: use WMI_SIMPLE_SHOW in more places
Date: Tue, 28 May 2024 13:36:22 +1200 [thread overview]
Message-ID: <20240528013626.14066-6-luke@ljones.dev> (raw)
In-Reply-To: <20240528013626.14066-1-luke@ljones.dev>
Further reduce code duplication by using the new macros in a few more
places.
Signed-off-by: Luke D. Jones <luke@ljones.dev>
---
drivers/platform/x86/asus-wmi.c | 30 ++++--------------------------
1 file changed, 4 insertions(+), 26 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 5c03e28ff252..260548aa6a42 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -813,19 +813,6 @@ static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus)
}
/* dGPU ********************************************************************/
-static ssize_t dgpu_disable_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct asus_wmi *asus = dev_get_drvdata(dev);
- int result;
-
- result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_DGPU);
- if (result < 0)
- return result;
-
- return sysfs_emit(buf, "%d\n", result);
-}
-
/*
* A user may be required to store the value twice, typcial store first, then
* rescan PCI bus to activate power, then store a second time to save correctly.
@@ -875,22 +862,11 @@ static ssize_t dgpu_disable_store(struct device *dev,
return count;
}
+
+WMI_SIMPLE_SHOW(dgpu_disable, "%d\n", ASUS_WMI_DEVID_DGPU);
static DEVICE_ATTR_RW(dgpu_disable);
/* eGPU ********************************************************************/
-static ssize_t egpu_enable_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct asus_wmi *asus = dev_get_drvdata(dev);
- int result;
-
- result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU);
- if (result < 0)
- return result;
-
- return sysfs_emit(buf, "%d\n", result);
-}
-
/* The ACPI call to enable the eGPU also disables the internal dGPU */
static ssize_t egpu_enable_store(struct device *dev,
struct device_attribute *attr,
@@ -943,6 +919,8 @@ static ssize_t egpu_enable_store(struct device *dev,
return count;
}
+
+WMI_SIMPLE_SHOW(egpu_enable, "%d\n", ASUS_WMI_DEVID_EGPU);
static DEVICE_ATTR_RW(egpu_enable);
/* gpu mux switch *************************************************************/
--
2.45.1
next prev parent reply other threads:[~2024-05-28 1:36 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 1:36 [PATCH 0/9] platform-x86-asus-wmi: multiple fixes, improvements, features Luke D. Jones
2024-05-28 1:36 ` [PATCH 1/9] platform/x86: asus-wmi: add debug print in more key places Luke D. Jones
2024-05-28 1:36 ` [PATCH 2/9] platform/x86: asus-wmi: don't fail if platform_profile already registered Luke D. Jones
2024-05-28 1:36 ` [PATCH 3/9] platform/x86: asus-wmi: add macros and expose min/max sysfs for ppt tunables Luke D. Jones
2024-05-28 8:50 ` Ilpo Järvinen
2024-06-04 5:14 ` kernel test robot
2024-05-28 1:36 ` [PATCH 4/9] platform/x86: asus-wmi: reduce code duplication with macros Luke D. Jones
2024-05-28 8:55 ` Ilpo Järvinen
2024-05-28 9:03 ` Ilpo Järvinen
2024-05-28 1:36 ` Luke D. Jones [this message]
2024-05-28 9:06 ` [PATCH 5/9] platform/x86: asus-wmi: use WMI_SIMPLE_SHOW in more places Ilpo Järvinen
2024-05-28 1:36 ` [PATCH 6/9] platform/x86: asus-wmi: add panel-fhd functionality Luke D. Jones
2024-05-28 9:18 ` Ilpo Järvinen
2024-05-28 1:36 ` [PATCH 7/9] platform/x86: asus-wmi: add enable/disable CPU cores Luke D. Jones
2024-05-28 9:27 ` Ilpo Järvinen
2024-05-28 21:37 ` Luke Jones
2024-05-28 1:36 ` [PATCH 8/9] platform/x86: asus-wmi: add apu_mem setting Luke D. Jones
2024-05-28 2:19 ` Limonciello, Mario
2024-05-28 2:40 ` Luke Jones
2024-05-28 13:27 ` Mario Limonciello
2024-05-28 21:04 ` Luke Jones
2024-05-28 21:16 ` Mario Limonciello
2024-05-28 21:34 ` Luke Jones
2024-05-28 21:36 ` Mario Limonciello
2024-05-28 21:37 ` Mario Limonciello
2024-05-28 1:36 ` [PATCH 9/9] platform/x86: asus-wmi: add setting dGPU TGP Luke D. Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240528013626.14066-6-luke@ljones.dev \
--to=luke@ljones.dev \
--cc=corentin.chary@gmail.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®