From: Luke Jones <luke@ljones.dev>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Hans de Goede <hdegoede@redhat.com>,
Bastien Nocera <hadess@hadess.net>,
Platform Driver <platform-driver-x86@vger.kernel.org>
Subject: Re: [PATCH v3 1/1] asus-wmi: Add support for platform_profile
Date: Sat, 14 Aug 2021 23:46:06 +1200 [thread overview]
Message-ID: <UCVTXQ.8ME64G0S1BQ8@ljones.dev> (raw)
In-Reply-To: <CAHp75VcCzjb7TKZ84iVjJr27+nCcA10n38nwCAGATucfAAMkKA@mail.gmail.com>
Hi Andy, thanks for the feedback. All is addressed, and some inline
comment/reply. New version incoming pending pr_info() vs dev_info()
On Sat, Aug 14 2021 at 12:40:39 +0300, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Sat, Aug 14, 2021 at 7:33 AM Luke D. Jones <luke@ljones.dev> wrote:
>>
>> Add initial support for platform_profile where the support is
>> based on availability of ASUS_THROTTLE_THERMAL_POLICY.
>>
>> Because throttle_thermal_policy is used by platform_profile and is
>> writeable separately to platform_profile any userspace changes to
>> throttle_thermal_policy need to notify platform_profile.
>>
>> In future throttle_thermal_policy sysfs should be removed so that
>> only one method controls the laptop power profile.
>
> Some comments below.
>
> ...
>
>> + /*
>> + * Ensure that platform_profile updates userspace with the
>> change to ensure
>> + * that platform_profile and throttle_thermal_policy_mode
>> are in sync
>
> Missed period here and in other multi-line comments.
>
>> + */
>
> ...
>
>> + /* All possible toggles like throttle_thermal_policy here */
>> + if (asus->throttle_thermal_policy_available) {
>> + tp = asus->throttle_thermal_policy_mode;
>> + } else {
>> + return -1;
>> + }
>> +
>> + if (tp < 0)
>> + return tp;
>
> This will be better in a form
>
> if (!..._available)
> return -ENODATA; // what -1 means?
>
I wasn't sure what the best return was here. On your suggestion I've
changed to ENODATA
> tp = ...;
> if (tp < 0)
> return tp;
>
> ...
>
>> + /* All possible toggles like throttle_thermal_policy here */
>> + if (!asus->throttle_thermal_policy_available) {
>> + return -1;
>
> See above.
>
>> + }
>
> ...
>
>> + if (asus->throttle_thermal_policy_available) {
>> + pr_info("Using throttle_thermal_policy for
>> platform_profile support\n");
>
> Why pr_*()?
That seemed to be the convention? I see there is also dev_info(), so
I've switched to that as it seems more appropriate.
>
>> + } else {
>> + /*
>> + * Not an error if a component platform_profile
>> relies on is unavailable
>> + * so early return, skipping the setup of
>> platform_profile.
>> + */
>> + return 0;
>
> Do it other way around,
>
> /*
> * Comment
> */
> if (!...)
> return 0;
Thanks, I think I was transliterating thought process to code as I went
along.
All updated now.
>
>> + }
>
>
> --
> With Best Regards,
> Andy Shevchenko
next prev parent reply other threads:[~2021-08-14 11:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-14 4:31 [PATCH v3 0/1] asus-wmi: add platform_profile support Luke D. Jones
2021-08-14 4:31 ` [PATCH v3 1/1] asus-wmi: Add support for platform_profile Luke D. Jones
2021-08-14 9:40 ` Andy Shevchenko
2021-08-14 11:46 ` Luke Jones [this message]
2021-08-14 12:47 ` Luke Jones
2021-08-14 19:51 ` Andy Shevchenko
2021-08-15 13:45 ` Hans de Goede
2021-08-14 19:49 ` Andy Shevchenko
2021-08-14 7:51 ` [PATCH v3 0/1] asus-wmi: add platform_profile support Luke Jones
2021-08-15 13:48 ` Hans de Goede
2021-08-15 14:10 ` Bastien Nocera
2021-08-15 23:00 ` Luke Jones
2021-08-16 8:09 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=UCVTXQ.8ME64G0S1BQ8@ljones.dev \
--to=luke@ljones.dev \
--cc=andy.shevchenko@gmail.com \
--cc=hadess@hadess.net \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).