[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D7PT36DCB1P5.2YE8H1MHFAE15@gmail.com>
Date: Tue, 11 Feb 2025 12:51:59 -0500
From: "Kurt Borja" <kuurtb@...il.com>
To: "Andy Shevchenko" <andriy.shevchenko@...el.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 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
Powered by blists - more mailing lists