[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6t8y7VvZL6UDEck@black.fi.intel.com>
Date: Tue, 11 Feb 2025 18:37:31 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Kurt Borja <kuurtb@...il.com>
Cc: platform-driver-x86@...r.kernel.org,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Armin Wolf <W_Armin@....de>,
Mario Limonciello <mario.limonciello@....com>,
Hans de Goede <hdegoede@...hat.com>, Dell.Client.Kernel@...l.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v10 05/14] platform/x86: alienware-wmi: Refactor hdmi,
amplifier, deepslp methods
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
Powered by blists - more mailing lists