[PATCH 1/3] platform/x86: asus-wmi: explicitly mark more code with CONFIG_ASUS_WMI_DEPRECATED_ATTRS

Denis Benato posted 3 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH 1/3] platform/x86: asus-wmi: explicitly mark more code with CONFIG_ASUS_WMI_DEPRECATED_ATTRS
Posted by Denis Benato 1 month, 2 weeks ago
Be more explicit in code that will be excluded when compiling
with CONFIG_ASUS_WMI_DEPRECATED_ATTRS disabled.

Signed-off-by: Denis Benato <denis.benato@linux.dev>
---
 drivers/platform/x86/asus-wmi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 4aec7ec69250..a49447eff4f4 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -302,7 +302,11 @@ struct asus_wmi {
 	u32 nv_temp_target;
 
 	u32 kbd_rgb_dev;
+
+#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
 	bool kbd_rgb_state_available;
+#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
+
 	bool oobe_state_available;
 
 	u8 throttle_thermal_policy_mode;
@@ -1060,6 +1064,7 @@ static const struct attribute_group kbd_rgb_mode_group = {
 };
 
 /* TUF Laptop Keyboard RGB State **********************************************/
+#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
 static ssize_t kbd_rgb_state_store(struct device *dev,
 				 struct device_attribute *attr,
 				 const char *buf, size_t count)
@@ -1106,6 +1111,8 @@ static const struct attribute_group kbd_rgb_state_group = {
 	.attrs = kbd_rgb_state_attrs,
 };
 
+#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
+
 static const struct attribute_group *kbd_rgb_mode_groups[] = {
 	NULL,
 	NULL,
@@ -1861,8 +1868,11 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
 
 	if (asus->kbd_rgb_dev)
 		kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_mode_group;
+
+#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
 	if (asus->kbd_rgb_state_available)
 		kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_state_group;
+#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
 
 	asus->led_workqueue = create_singlethread_workqueue("led_workqueue");
 	if (!asus->led_workqueue)
-- 
2.52.0
Re: [PATCH 1/3] platform/x86: asus-wmi: explicitly mark more code with CONFIG_ASUS_WMI_DEPRECATED_ATTRS
Posted by Ilpo Järvinen 1 month, 1 week ago
On Thu, 25 Dec 2025, Denis Benato wrote:

> Be more explicit in code that will be excluded when compiling
> with CONFIG_ASUS_WMI_DEPRECATED_ATTRS disabled.

Does this result in build fails or warnings? If that's the case, it should 
be mentioned in the changelog + Fixes tag added.

> Signed-off-by: Denis Benato <denis.benato@linux.dev>
> ---
>  drivers/platform/x86/asus-wmi.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 4aec7ec69250..a49447eff4f4 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -302,7 +302,11 @@ struct asus_wmi {
>  	u32 nv_temp_target;
>  
>  	u32 kbd_rgb_dev;
> +
> +#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
>  	bool kbd_rgb_state_available;
> +#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
> +
>  	bool oobe_state_available;
>  
>  	u8 throttle_thermal_policy_mode;
> @@ -1060,6 +1064,7 @@ static const struct attribute_group kbd_rgb_mode_group = {
>  };
>  
>  /* TUF Laptop Keyboard RGB State **********************************************/
> +#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
>  static ssize_t kbd_rgb_state_store(struct device *dev,
>  				 struct device_attribute *attr,
>  				 const char *buf, size_t count)
> @@ -1106,6 +1111,8 @@ static const struct attribute_group kbd_rgb_state_group = {
>  	.attrs = kbd_rgb_state_attrs,
>  };
>  
> +#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
> +
>  static const struct attribute_group *kbd_rgb_mode_groups[] = {
>  	NULL,
>  	NULL,
> @@ -1861,8 +1868,11 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
>  
>  	if (asus->kbd_rgb_dev)
>  		kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_mode_group;
> +
> +#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
>  	if (asus->kbd_rgb_state_available)
>  		kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_state_group;
> +#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
>  
>  	asus->led_workqueue = create_singlethread_workqueue("led_workqueue");
>  	if (!asus->led_workqueue)
> 

-- 
 i.
Re: [PATCH 1/3] platform/x86: asus-wmi: explicitly mark more code with CONFIG_ASUS_WMI_DEPRECATED_ATTRS
Posted by Denis Benato 1 month, 1 week ago
On 12/29/25 11:06, Ilpo Järvinen wrote:
> On Thu, 25 Dec 2025, Denis Benato wrote:
>
>> Be more explicit in code that will be excluded when compiling
>> with CONFIG_ASUS_WMI_DEPRECATED_ATTRS disabled.
> Does this result in build fails or warnings? If that's the case, it should 
> be mentioned in the changelog + Fixes tag added.
Hi,

Sadly no, despite a property in a struct instantiated only once
being forcefully set to false no warning is emitted by neither
clang nor gcc :(
>> Signed-off-by: Denis Benato <denis.benato@linux.dev>
>> ---
>>  drivers/platform/x86/asus-wmi.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
>> index 4aec7ec69250..a49447eff4f4 100644
>> --- a/drivers/platform/x86/asus-wmi.c
>> +++ b/drivers/platform/x86/asus-wmi.c
>> @@ -302,7 +302,11 @@ struct asus_wmi {
>>  	u32 nv_temp_target;
>>  
>>  	u32 kbd_rgb_dev;
>> +
>> +#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
>>  	bool kbd_rgb_state_available;
>> +#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
>> +
>>  	bool oobe_state_available;
>>  
>>  	u8 throttle_thermal_policy_mode;
>> @@ -1060,6 +1064,7 @@ static const struct attribute_group kbd_rgb_mode_group = {
>>  };
>>  
>>  /* TUF Laptop Keyboard RGB State **********************************************/
>> +#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
>>  static ssize_t kbd_rgb_state_store(struct device *dev,
>>  				 struct device_attribute *attr,
>>  				 const char *buf, size_t count)
>> @@ -1106,6 +1111,8 @@ static const struct attribute_group kbd_rgb_state_group = {
>>  	.attrs = kbd_rgb_state_attrs,
>>  };
>>  
>> +#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
>> +
>>  static const struct attribute_group *kbd_rgb_mode_groups[] = {
>>  	NULL,
>>  	NULL,
>> @@ -1861,8 +1868,11 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
>>  
>>  	if (asus->kbd_rgb_dev)
>>  		kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_mode_group;
>> +
>> +#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
>>  	if (asus->kbd_rgb_state_available)
>>  		kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_state_group;
>> +#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
>>  
>>  	asus->led_workqueue = create_singlethread_workqueue("led_workqueue");
>>  	if (!asus->led_workqueue)
>>
Re: [PATCH 1/3] platform/x86: asus-wmi: explicitly mark more code with CONFIG_ASUS_WMI_DEPRECATED_ATTRS
Posted by Ilpo Järvinen 1 month, 1 week ago
On Tue, 30 Dec 2025, Denis Benato wrote:
> On 12/29/25 11:06, Ilpo Järvinen wrote:
> > On Thu, 25 Dec 2025, Denis Benato wrote:
> >
> >> Be more explicit in code that will be excluded when compiling
> >> with CONFIG_ASUS_WMI_DEPRECATED_ATTRS disabled.
> > Does this result in build fails or warnings? If that's the case, it should 
> > be mentioned in the changelog + Fixes tag added.
> Hi,
> 
> Sadly no, despite a property in a struct instantiated only once
> being forcefully set to false no warning is emitted by neither
> clang nor gcc :(

Ah, I was mainly expecting unused function warning but apparently since it 
was still being "used" it obviously won't trigger that warning.

-- 
 i.

> >> Signed-off-by: Denis Benato <denis.benato@linux.dev>
> >> ---
> >>  drivers/platform/x86/asus-wmi.c | 10 ++++++++++
> >>  1 file changed, 10 insertions(+)
> >>
> >> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> >> index 4aec7ec69250..a49447eff4f4 100644
> >> --- a/drivers/platform/x86/asus-wmi.c
> >> +++ b/drivers/platform/x86/asus-wmi.c
> >> @@ -302,7 +302,11 @@ struct asus_wmi {
> >>  	u32 nv_temp_target;
> >>  
> >>  	u32 kbd_rgb_dev;
> >> +
> >> +#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
> >>  	bool kbd_rgb_state_available;
> >> +#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
> >> +
> >>  	bool oobe_state_available;
> >>  
> >>  	u8 throttle_thermal_policy_mode;
> >> @@ -1060,6 +1064,7 @@ static const struct attribute_group kbd_rgb_mode_group = {
> >>  };
> >>  
> >>  /* TUF Laptop Keyboard RGB State **********************************************/
> >> +#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
> >>  static ssize_t kbd_rgb_state_store(struct device *dev,
> >>  				 struct device_attribute *attr,
> >>  				 const char *buf, size_t count)
> >> @@ -1106,6 +1111,8 @@ static const struct attribute_group kbd_rgb_state_group = {
> >>  	.attrs = kbd_rgb_state_attrs,
> >>  };
> >>  
> >> +#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
> >> +
> >>  static const struct attribute_group *kbd_rgb_mode_groups[] = {
> >>  	NULL,
> >>  	NULL,
> >> @@ -1861,8 +1868,11 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
> >>  
> >>  	if (asus->kbd_rgb_dev)
> >>  		kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_mode_group;
> >> +
> >> +#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS)
> >>  	if (asus->kbd_rgb_state_available)
> >>  		kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_state_group;
> >> +#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */
> >>  
> >>  	asus->led_workqueue = create_singlethread_workqueue("led_workqueue");
> >>  	if (!asus->led_workqueue)
> >>
> 
5~
Re: [PATCH 1/3] platform/x86: asus-wmi: explicitly mark more code with CONFIG_ASUS_WMI_DEPRECATED_ATTRS
Posted by Denis Benato 1 month, 1 week ago
On 12/30/25 14:41, Ilpo Järvinen wrote:
> On Tue, 30 Dec 2025, Denis Benato wrote:
>> On 12/29/25 11:06, Ilpo Järvinen wrote:
>>> On Thu, 25 Dec 2025, Denis Benato wrote:
>>>
>>>> Be more explicit in code that will be excluded when compiling
>>>> with CONFIG_ASUS_WMI_DEPRECATED_ATTRS disabled.
>>> Does this result in build fails or warnings? If that's the case, it should 
>>> be mentioned in the changelog + Fixes tag added.
>> Hi,
>>
>> Sadly no, despite a property in a struct instantiated only once
>> being forcefully set to false no warning is emitted by neither
>> clang nor gcc :(
> Ah, I was mainly expecting unused function warning but apparently since it 
> was still being "used" it obviously won't trigger that warning.
>
Plus if gcc/clang could have catched it build bots would have done so
when posting the asus-armoury series as they catched other things.