FAILED: patch "[PATCH] platform/x86: asus-wmi: fix TUF keyboard power state shutdown naming" failed to apply to 6.6-stable tree
Sasha Levin
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 3d9a175707eeb15a2d577af1e669b98e0236719b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 3d9a175707eeb15a2d577af1e669b98e0236719b Mon Sep 17 00:00:00 2001
From: Bartu Alev <[email protected]>
Date: Sat, 10 Oct 2026 13:15:58 +0300
Subject: [PATCH] platform/x86: asus-wmi: fix TUF keyboard power state shutdown
naming
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The fourth state flag of kbd_rgb_state_index is named "keyboard" and has long been treated as having no effect. In hardware the flag, BIT(7) of the payload sent to the TUF RGB state device, gates whether the keyboard backlight stays lit while the machine powers off: with the bit set the keyboard lights up white during the ACPI S5 sequence, with the bit clear the machine powers off dark. Verified by A/B testing both values on a TUF Gaming A15 (FA507NV).
Rename the fourth field and its index entry from "keyboard" to "shutdown". The write format is unchanged, the value is still positional, and the diff is two variable names and one string, so it backports cleanly.
--- drivers/platform/x86/asus-wmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/x86/asus-wmi.c +4 -4
@@ -1130,10 +1130,10 @@ static ssize_t kbd_rgb_state_store(struct device *dev,struct device_attribute *attr, const char *buf, size_t count) { - u32 flags, cmd, boot, awake, sleep, keyboard; + u32 flags, cmd, boot, awake, sleep, shutdown;int err; -if (sscanf (buf,"%d %d %d %d %d" , &cmd, &boot, &awake, &sleep, &keyboard) !=5 ) +if (sscanf (buf,"%d %d %d %d %d" , &cmd, &boot, &awake, &sleep, &shutdown) !=5 )return -EINVAL ;if (cmd)
@@ -1146,7 +1146,7 @@ static ssize_t kbd_rgb_state_store(struct device *dev, flags |=BIT (3 );if (sleep) flags |=BIT (5 ); -if (keyboard) +if (shutdown) flags |=BIT (7 );/* 0xbd is the required default arg0 for the method. Nothing happens otherwise */
@@ -1160,7 +1160,7 @@ static ssize_t kbd_rgb_state_store(struct device *dev,static DEVICE_ATTR_WO (kbd_rgb_state); static DEVICE_STRING_ATTR_RO(kbd_rgb_state_index, 0444, - "cmd boot awake sleep keyboard"); + "cmd boot awake sleep shutdown");static struct attribute *kbd_rgb_state_attrs[] = { &dev_attr_kbd_rgb_state.attr,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/3 driver core: Add device_show_string() helper for sysfs attributes
From: Lukas Wunner <[email protected]>
[ Upstream commit 3cc50d07be10f67aff836f8247a240ec132c6a67 ]
For drivers wishing to expose an unsigned long, int or bool at a static memory location in sysfs, the driver core provides ready-made helpers such as device_show_ulong() to be used as ->show() callback.
Some drivers need to expose a string and so far they all provide their own ->show() implementation. arch/powerpc/perf/hv-24x7.c went so far as to create a device_show_string() helper but kept it private.
Make it public for reuse by other drivers. The pattern seems to be sufficiently frequent to merit a public helper.
Add a DEVICE_STRING_ATTR_RO() macro in line with the existing DEVICE_ULONG_ATTR() and similar macros to ease declaration of string attributes.
Stable-dep-of: 3d9a175707ee ("platform/x86: asus-wmi: fix TUF keyboard power state shutdown naming")
--- arch/powerpc/perf/hv-24x7.c | 10 ---------- drivers/base/core.c | 9 +++++++++ include/linux/device.h | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 10 deletions(-)
arch/powerpc/perf/hv-24x7.c +0 -10
@@ -425,16 +425,6 @@ static char *memdup_to_str(char *maybe_str, int max_len, gfp_t gfp)return kasprintf (gfp,"%.*s" , max_len, maybe_str); } -static ssize_t device_show_string (struct device *dev, -struct device_attribute *attr,char *buf) -{ -struct dev_ext_attribute *d; - - d = container_of(attr, struct dev_ext_attribute, attr); - -return sprintf (buf,"%s\n" , (char *)d->var); -} -static ssize_t cpumask_show (struct device *dev,struct device_attribute *attr,char *buf) {
drivers/base/core.c +9 -0
@@ -2548,6 +2548,15 @@ ssize_t device_show_bool(struct device *dev, struct device_attribute *attr, }EXPORT_SYMBOL_GPL (device_show_bool); +ssize_t device_show_string (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct dev_ext_attribute *ea =to_ext_attr (attr); + +return sysfs_emit (buf,"%s\n" , (char *)ea->var); +} +EXPORT_SYMBOL_GPL (device_show_string); +/** * device_release - free device structure. * @kobj: device's kobject.
include/linux/device.h +15 -0
@@ -138,6 +138,8 @@ ssize_t device_show_bool(struct device *dev, struct device_attribute *attr, char *buf);ssize_t device_store_bool (struct device *dev,struct device_attribute *attr,const char *buf,size_t count); +ssize_t device_show_string (struct device *dev,struct device_attribute *attr, +char *buf);/** * DEVICE_ATTR - Define a device attribute.
@@ -257,6 +259,19 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr, struct dev_ext_attribute dev_attr_##_name = \ {__ATTR (_name, _mode, device_show_bool, device_store_bool), &(_var) } +/** +* DEVICE_STRING_ATTR_RO - Define a device attribute backed by a r/o string. +* @_name: Attribute name. +* @_mode: File mode. +* @_var: Identifier of string. +* +* Like DEVICE_ULONG_ATTR(), but @_var is a string. Because the length of the +* string allocation is unknown, the attribute must be read-only. + */ +#define DEVICE_STRING_ATTR_RO (_name, _mode, _var) \ + struct dev_ext_attribute dev_attr_##_name = \ + { __ATTR(_name, (_mode) & ~0222, device_show_string, NULL), (_var) } +#define DEVICE_ATTR_IGNORE_LOCKDEP (_name, _mode, _show, _store) \ struct device_attribute dev_attr_##_name = \ __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/3 platform/x86: Use device_show_string() helper for sysfs attributes
From: Lukas Wunner <[email protected]>
[ Upstream commit 3182459b7bff642eb968d6203a08aea3862436c1 ]
Deduplicate sysfs ->show() callbacks which expose a string at a static memory location. Use the newly introduced device_show_string() helper in the driver core instead by declaring those sysfs attributes with DEVICE_STRING_ATTR_RO().
No functional change intended.
Stable-dep-of: 3d9a175707ee ("platform/x86: asus-wmi: fix TUF keyboard power state shutdown naming")
--- drivers/platform/x86/asus-wmi.c | 62 ++++++++--------------------- drivers/platform/x86/toshiba_acpi.c | 9 +---- 2 files changed, 18 insertions(+), 53 deletions(-)
drivers/platform/x86/asus-wmi.c +16 -46
@@ -913,17 +913,12 @@ static ssize_t kbd_rgb_mode_store(struct device *dev, }static DEVICE_ATTR_WO (kbd_rgb_mode); -static ssize_t kbd_rgb_mode_index_show (struct device *device, -struct device_attribute *attr, -char *buf) -{ -return sysfs_emit (buf,"%s\n" ,"cmd mode red green blue speed" ); -} -static DEVICE_ATTR_RO (kbd_rgb_mode_index); +static DEVICE_STRING_ATTR_RO(kbd_rgb_mode_index, 0444, + "cmd mode red green blue speed");static struct attribute *kbd_rgb_mode_attrs[] = { &dev_attr_kbd_rgb_mode.attr, - &dev_attr_kbd_rgb_mode_index.attr, + &dev_attr_kbd_rgb_mode_index.attr.attr,NULL , };
@@ -965,17 +960,12 @@ static ssize_t kbd_rgb_state_store(struct device *dev, }static DEVICE_ATTR_WO (kbd_rgb_state); -static ssize_t kbd_rgb_state_index_show (struct device *device, -struct device_attribute *attr, -char *buf) -{ -return sysfs_emit (buf,"%s\n" ,"cmd boot awake sleep keyboard" ); -} -static DEVICE_ATTR_RO (kbd_rgb_state_index); +static DEVICE_STRING_ATTR_RO(kbd_rgb_state_index, 0444, + "cmd boot awake sleep keyboard");static struct attribute *kbd_rgb_state_attrs[] = { &dev_attr_kbd_rgb_state.attr, - &dev_attr_kbd_rgb_state_index.attr, + &dev_attr_kbd_rgb_state_index.attr.attr,NULL , };
@@ -2492,13 +2482,6 @@ static ssize_t pwm1_enable_store(struct device *dev,return count; } -static ssize_t fan1_label_show (struct device *dev, -struct device_attribute *attr, -char *buf) -{ -return sysfs_emit (buf,"%s\n" ,ASUS_FAN_DESC ); -} -static ssize_t asus_hwmon_temp1 (struct device *dev,struct device_attribute *attr,char *buf)
@@ -2533,13 +2516,6 @@ static ssize_t fan2_input_show(struct device *dev,return sysfs_emit (buf,"%d\n" , value *100 ); } -static ssize_t fan2_label_show (struct device *dev, -struct device_attribute *attr, -char *buf) -{ -return sysfs_emit (buf,"%s\n" ,ASUS_GPU_FAN_DESC ); -} -/* Middle/Center fan on modern ROG laptops */ static ssize_t fan3_input_show(struct device *dev, struct device_attribute *attr,
@@ -2558,13 +2534,6 @@ static ssize_t fan3_input_show(struct device *dev,return sysfs_emit (buf,"%d\n" , value *100 ); } -static ssize_t fan3_label_show (struct device *dev, -struct device_attribute *attr, -char *buf) -{ -return sysfs_emit (buf,"%s\n" ,ASUS_MID_FAN_DESC ); -} -static ssize_t pwm2_enable_show (struct device *dev,struct device_attribute *attr,char *buf)
@@ -2661,15 +2630,16 @@ static ssize_t pwm3_enable_store(struct device *dev,static DEVICE_ATTR_RW (pwm1);static DEVICE_ATTR_RW (pwm1_enable);static DEVICE_ATTR_RO (fan1_input); -static DEVICE_ATTR_RO (fan1_label); +static DEVICE_STRING_ATTR_RO(fan1_label, 0444, ASUS_FAN_DESC); +/* Fan2 - GPU fan */ static DEVICE_ATTR_RW (pwm2_enable);static DEVICE_ATTR_RO (fan2_input); -static DEVICE_ATTR_RO (fan2_label); +static DEVICE_STRING_ATTR_RO(fan2_label, 0444, ASUS_GPU_FAN_DESC);/* Fan3 - Middle/center fan */ static DEVICE_ATTR_RW (pwm3_enable);static DEVICE_ATTR_RO (fan3_input); -static DEVICE_ATTR_RO (fan3_label); +static DEVICE_STRING_ATTR_RO(fan3_label, 0444, ASUS_MID_FAN_DESC);/* Temperature */ static DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL);
@@ -2680,11 +2650,11 @@ static struct attribute *hwmon_attributes[] = { &dev_attr_pwm2_enable.attr, &dev_attr_pwm3_enable.attr, &dev_attr_fan1_input.attr, - &dev_attr_fan1_label.attr, + &dev_attr_fan1_label.attr.attr, &dev_attr_fan2_input.attr, - &dev_attr_fan2_label.attr, + &dev_attr_fan2_label.attr.attr, &dev_attr_fan3_input.attr, - &dev_attr_fan3_label.attr, + &dev_attr_fan3_label.attr.attr, &dev_attr_temp1_input.attr,NULL
@@ -2701,17 +2671,17 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,if (asus->fan_type !=FAN_TYPE_AGFN )return 0 ; }else if (attr == &dev_attr_fan1_input.attr - || attr == &dev_attr_fan1_label.attr + || attr == &dev_attr_fan1_label.attr.attr || attr == &dev_attr_pwm1_enable.attr) {if (asus->fan_type ==FAN_TYPE_NONE )return 0 ; }else if (attr == &dev_attr_fan2_input.attr - || attr == &dev_attr_fan2_label.attr + || attr == &dev_attr_fan2_label.attr.attr || attr == &dev_attr_pwm2_enable.attr) {if (asus->gpu_fan_type ==FAN_TYPE_NONE )return 0 ; }else if (attr == &dev_attr_fan3_input.attr - || attr == &dev_attr_fan3_label.attr + || attr == &dev_attr_fan3_label.attr.attr || attr == &dev_attr_pwm3_enable.attr) {if (asus->mid_fan_type ==FAN_TYPE_NONE )return 0 ;
drivers/platform/x86/toshiba_acpi.c +2 -7
@@ -1820,12 +1820,7 @@ static DECLARE_WORK(kbd_bl_work, toshiba_acpi_kbd_bl_work);/* * Sysfs files */ -static ssize_t version_show (struct device *dev, -struct device_attribute *attr,char *buf) -{ -return sprintf (buf,"%s\n" ,TOSHIBA_ACPI_VERSION ); -} -static DEVICE_ATTR_RO (version); +static DEVICE_STRING_ATTR_RO(version, 0444, TOSHIBA_ACPI_VERSION); static ssize_t fan_store(struct device *dev, struct device_attribute *attr,
@@ -2434,7 +2429,7 @@ static ssize_t cooling_method_store(struct device *dev,static DEVICE_ATTR_RW (cooling_method);static struct attribute *toshiba_attributes[] = { - &dev_attr_version.attr, + &dev_attr_version.attr.attr, &dev_attr_fan.attr, &dev_attr_kbd_backlight_mode.attr, &dev_attr_kbd_type.attr,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/3 platform/x86: asus-wmi: fix TUF keyboard power state shutdown naming
In reply to Sasha LevinFrom: Bartu Alev <[email protected]>
[ Upstream commit 3d9a175707eeb15a2d577af1e669b98e0236719b ]
The fourth state flag of kbd_rgb_state_index is named "keyboard" and has long been treated as having no effect. In hardware the flag, BIT(7) of the payload sent to the TUF RGB state device, gates whether the keyboard backlight stays lit while the machine powers off: with the bit set the keyboard lights up white during the ACPI S5 sequence, with the bit clear the machine powers off dark. Verified by A/B testing both values on a TUF Gaming A15 (FA507NV).
Rename the fourth field and its index entry from "keyboard" to "shutdown". The write format is unchanged, the value is still positional, and the diff is two variable names and one string, so it backports cleanly.
--- drivers/platform/x86/asus-wmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/x86/asus-wmi.c +4 -4
@@ -931,10 +931,10 @@ static ssize_t kbd_rgb_state_store(struct device *dev,struct device_attribute *attr, const char *buf, size_t count) { - u32 flags, cmd, boot, awake, sleep, keyboard; + u32 flags, cmd, boot, awake, sleep, shutdown;int err; -if (sscanf (buf,"%d %d %d %d %d" , &cmd, &boot, &awake, &sleep, &keyboard) !=5 ) +if (sscanf (buf,"%d %d %d %d %d" , &cmd, &boot, &awake, &sleep, &shutdown) !=5 )return -EINVAL ;if (cmd)
@@ -947,7 +947,7 @@ static ssize_t kbd_rgb_state_store(struct device *dev, flags |=BIT (3 );if (sleep) flags |=BIT (5 ); -if (keyboard) +if (shutdown) flags |=BIT (7 );/* 0xbd is the required default arg0 for the method. Nothing happens otherwise */
@@ -961,7 +961,7 @@ static ssize_t kbd_rgb_state_store(struct device *dev,static DEVICE_ATTR_WO (kbd_rgb_state); static DEVICE_STRING_ATTR_RO(kbd_rgb_state_index, 0444, - "cmd boot awake sleep keyboard"); + "cmd boot awake sleep shutdown");static struct attribute *kbd_rgb_state_attrs[] = { &dev_attr_kbd_rgb_state.attr,
Signature · 1 line
2.53.0