Re: [PATCH v10 05/14] platform/x86: alienware-wmi: Refactor hdmi, amplifier, deepslp methods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 07, 2025 at 10:46:01AM -0500, Kurt Borja wrote:
> Refactor show/store methods for hdmi, amplifier, deepslp sysfs groups to
> use alienware_wmi_command() instead of alienware_wmax_command() which
> uses deprecated WMI methods.

...

> +	pr_err("alienware-wmi: unknown HDMI cable status: %d\n", ret);

Rather introduce pr_fmt() and drop all these prefixes.

> +	if (!ret) {

Traditional patter is to check for errors:

	if (ret) {
		...do error handling...
	}

>  		if (out_data == 1)
>  			return sysfs_emit(buf, "[input] gpu unknown\n");

>  		else if (out_data == 2)

Redundant 'else'.

>  			return sysfs_emit(buf, "input [gpu] unknown\n");
>  	}
> -	pr_err("alienware-wmi: unknown HDMI source status: %u\n", status);
> +
> +	pr_err("alienware-wmi: unknown HDMI source status: %u\n", ret);
>  	return sysfs_emit(buf, "input gpu [unknown]\n");


...

>  	if (strcmp(buf, "gpu\n") == 0)

Wow! This should be fixed to use sysfs_streq()

...

> +		pr_err("alienware-wmi: HDMI toggle failed: results: %u\n", ret);

pr_fmt()

...

> +	pr_err("alienware-wmi: unknown amplifier cable status: %d\n", ret);

Ditto.

Also note, if you have a struct device available, use the respective dev_*()
macros instead.

...

>  	if (strcmp(buf, "disabled\n") == 0)

sysfs_streq() / sysfs_match_string() — whatever suits better.

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux