On Tue Feb 11, 2025 at 11:37 AM -05, Andy Shevchenko wrote: > 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. This was not introduced by me so it probably requires a different patch. > >> + if (!ret) { > > Traditional patter is to check for errors: I wanted to change as little as possible the original function, as in my opinion this would require a different patch. > > 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. Same as above, this was not my line to begin with so I left it as is. > > ... > >> if (strcmp(buf, "disabled\n") == 0) > > sysfs_streq() / sysfs_match_string() — whatever suits better. I can send fixes for these tho. IMO this requiere different patches. -- ~ Kurt