From: "Luke D. Jones" <luke@ljones.dev>
To: hdegoede@redhat.com
Cc: corentin.chary@gmail.com, ilpo.jarvinen@linux.intel.com,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, "Luke D. Jones" <luke@ljones.dev>
Subject: [PATCH 9/9] platform/x86: asus-wmi: cleanup main struct to avoid some holes
Date: Mon, 25 Mar 2024 18:49:38 +1300 [thread overview]
Message-ID: <20240325054938.489732-10-luke@ljones.dev> (raw)
In-Reply-To: <20240325054938.489732-1-luke@ljones.dev>
Reorganises some attr-available calls to remove a few unrequired
booleans in the main driver struct which combined with some
reorganisation prevents a series of large holes seen with pahole.
Signed-off-by: Luke D. Jones <luke@ljones.dev>
---
drivers/platform/x86/asus-wmi.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 9927a48b2dc3..e2aadb61b490 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -251,6 +251,9 @@ struct asus_wmi {
u32 tablet_switch_dev_id;
bool tablet_switch_inverted;
+ /* The ROG Ally device requires the MCU USB device be disconnected before suspend */
+ bool ally_mcu_usb_switch;
+
enum fan_type fan_type;
enum fan_type gpu_fan_type;
enum fan_type mid_fan_type;
@@ -263,9 +266,7 @@ struct asus_wmi {
u8 fan_boost_mode_mask;
u8 fan_boost_mode;
- bool charge_mode_available;
bool egpu_enable_available;
- bool egpu_connect_available;
bool dgpu_disable_available;
bool gpu_mux_mode_available;
u32 gpu_mux_dev;
@@ -279,8 +280,8 @@ struct asus_wmi {
u32 nv_dynamic_boost;
u32 nv_temp_target;
- bool kbd_rgb_mode_available;
u32 kbd_rgb_dev;
+ bool kbd_rgb_mode_available;
bool kbd_rgb_state_available;
bool throttle_thermal_policy_available;
@@ -297,7 +298,6 @@ struct asus_wmi {
// The RSOC controls the maximum charging percentage.
bool battery_rsoc_available;
- bool panel_overdrive_available;
bool mini_led_mode_available;
u32 mini_led_dev_id;
@@ -309,9 +309,6 @@ struct asus_wmi {
bool fnlock_locked;
- /* The ROG Ally device requires the MCU USB device be disconnected before suspend */
- bool ally_mcu_usb_switch;
-
struct asus_wmi_debug debug;
struct asus_wmi_driver *driver;
@@ -4411,11 +4408,11 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
else if (attr == &dev_attr_als_enable.attr)
devid = ASUS_WMI_DEVID_ALS_ENABLE;
else if (attr == &dev_attr_charge_mode.attr)
- ok = asus->charge_mode_available;
+ devid = ASUS_WMI_DEVID_CHARGE_MODE;
else if (attr == &dev_attr_egpu_enable.attr)
ok = asus->egpu_enable_available;
else if (attr == &dev_attr_egpu_connected.attr)
- ok = asus->egpu_connect_available;
+ devid = ASUS_WMI_DEVID_EGPU_CONNECTED;
else if (attr == &dev_attr_dgpu_disable.attr)
ok = asus->dgpu_disable_available;
else if (attr == &dev_attr_gpu_mux_mode.attr)
@@ -4443,7 +4440,7 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
else if (attr == &dev_attr_boot_sound.attr)
devid = ASUS_WMI_DEVID_BOOT_SOUND;
else if (attr == &dev_attr_panel_od.attr)
- ok = asus->panel_overdrive_available;
+ devid = ASUS_WMI_DEVID_PANEL_OD;
else if (attr == &dev_attr_mini_led_mode.attr)
ok = asus->mini_led_mode_available;
@@ -4709,12 +4706,9 @@ static int asus_wmi_add(struct platform_device *pdev)
asus->nv_dynamic_boost = 5;
asus->nv_temp_target = 75;
- asus->charge_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_CHARGE_MODE);
asus->egpu_enable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU);
- asus->egpu_connect_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU_CONNECTED);
asus->dgpu_disable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_DGPU);
asus->kbd_rgb_state_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_STATE);
- asus->panel_overdrive_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD);
asus->ally_mcu_usb_switch = acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE)
&& dmi_match(DMI_BOARD_NAME, "RC71L");
--
2.44.0
prev parent reply other threads:[~2024-03-25 5:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-25 5:49 [PATCH 0/9] asus-wmi: add new features, clean up, fixes Luke D. Jones
2024-03-25 5:49 ` [PATCH 1/9] platform/x86: asus-wmi: add support for 2024 ROG Mini-LED Luke D. Jones
2024-03-25 13:47 ` Ilpo Järvinen
2024-03-25 20:35 ` Luke Jones
2024-03-26 11:49 ` Ilpo Järvinen
2024-03-27 3:01 ` Luke Jones
2024-03-25 5:49 ` [PATCH 2/9] platform/x86: asus-wmi: add support for Vivobook GPU MUX Luke D. Jones
2024-03-25 5:49 ` [PATCH 3/9] platform/x86: asus-wmi: add support variant of TUF RGB Luke D. Jones
2024-03-25 5:49 ` [PATCH 4/9] platform/x86: asus-wmi: support toggling POST sound Luke D. Jones
2024-03-25 13:51 ` Ilpo Järvinen
2024-03-25 14:02 ` Ilpo Järvinen
2024-03-25 20:40 ` Luke Jones
2024-03-25 5:49 ` [PATCH 5/9] platform/x86: asus-wmi: store a min default for ppt options Luke D. Jones
2024-03-25 5:49 ` [PATCH 6/9] platform/x86: asus-wmi: adjust formatting of ppt-<name>() functions Luke D. Jones
2024-03-25 5:49 ` [PATCH 7/9] platform/x86: asus-wmi: ROG Ally increase wait time, allow MCU powersave Luke D. Jones
2024-03-25 5:49 ` [PATCH 8/9] platform/x86: asus-wmi: Add support for " Luke D. Jones
2024-03-25 13:53 ` Ilpo Järvinen
2024-03-25 20:36 ` Luke Jones
2024-03-25 5:49 ` Luke D. Jones [this message]
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=20240325054938.489732-10-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.