platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Luke Jones <luke@ljones.dev>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	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: Sun, 15 Aug 2021 15:45:26 +0200	[thread overview]
Message-ID: <7846a887-a96b-fb8e-d1ee-e105b88a77bf@redhat.com> (raw)
In-Reply-To: <T6YTXQ.N7QG3527OXWU1@ljones.dev>

Hi,

On 8/14/21 2:47 PM, Luke Jones wrote:
> A very quick question: should I be enabling platform_profile by default if asus_wmi is enabled in kconfig?

You should add a "select ACPI_PLATFORM_PROFILE" to the Kconfig part for ASUS_WMI,
the PLATFORM_PROFILE support / common code is a library, so it needs to be selected
by the drivers which need it.

Regards,

Hans


> 
> On Sat, Aug 14 2021 at 23:46:06 +1200, Luke Jones <luke@ljones.dev> wrote:
>> 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 \x7f\x7fchange to ensure
>>>>  +        * that platform_profile and throttle_thermal_policy_mode \x7f\x7fare 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 \x7f\x7fplatform_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 \x7f\x7frelies on is unavailable
>>>>  +                * so early return, skipping the setup of \x7f\x7fplatform_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
>>
> 
> 


  parent reply	other threads:[~2021-08-15 13:45 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
2021-08-14 12:47       ` Luke Jones
2021-08-14 19:51         ` Andy Shevchenko
2021-08-15 13:45         ` Hans de Goede [this message]
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=7846a887-a96b-fb8e-d1ee-e105b88a77bf@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=hadess@hadess.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --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).