From: Maximilian Luz <luzmaximilian@gmail.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
"Barnabás Pőcze" <pobrn@protonmail.com>
Cc: Mark Pearson <markpearson@lenovo.com>,
Hans de Goede <hdegoede@redhat.com>,
Mark Gross <mgross@linux.intel.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Platform Driver <platform-driver-x86@vger.kernel.org>,
Bastien Nocera <hadess@hadess.net>,
Mario Limonciello <mario.limonciello@dell.com>,
Elia Devito <eliadevito@gmail.com>,
Benjamin Berg <bberg@redhat.com>,
Darren Hart <dvhart@infradead.org>,
"njosh1@lenovo.com" <njosh1@lenovo.com>
Subject: Re: [External] Re: [PATCH v6 2/3] ACPI: platform-profile: Add platform profile support
Date: Thu, 17 Dec 2020 16:18:19 +0100 [thread overview]
Message-ID: <aa65eb2a-5b0a-26de-e667-d9c68f2341a5@gmail.com> (raw)
In-Reply-To: <CAJZ5v0gzXrft6x03tEtpn492StzSH=8jJbOmS6ncpVRRvscNKg@mail.gmail.com>
On 12/17/20 4:09 PM, Rafael J. Wysocki wrote:
> On Thu, Dec 17, 2020 at 4:02 PM Barnabás Pőcze <pobrn@protonmail.com> wrote:
>>
>> 2020. december 17., csütörtök 14:36 keltezéssel, Rafael J. Wysocki <rafael@kernel.org> írta:
>>
>>> [...]
>>>>>> My thinking here that I shouldn't make assumptions for future platform
>>>>>> implementations - there may be valid cases in the future where being
>>>>>> able to return an error condition if there was an error would be useful.
>>>>>>
>>>>>> Just trying to keep this somewhat future proof. Returning an error
>>>>>> condition seemed a useful thing to have available.
>>>>>
>>>>> You can still return an error while returning a platform_profile_option value.
>>>>>
>>>>> Just add a special value representing an error to that set.
>>>>>
>>>> I'd like to understand what is better about that approach than having an
>>>> error and a returnable parameter?
>>>>
>>>> I'm probably missing something obvious but if I add an extra
>>>> platform_profile option (e.g PLATFORM_PROFILE_ERROR) to be used in an
>>>> error case (and return just an enum platform_profile_option) it seems I
>>>> lose the granularity of being able to return a specific error condition.
>>>> It doesn't feel like an improvement.
>>>
>>> And what's the user expected to do about the different error codes
>>> that can be returned?
>>
>> Even assuming the users of the API cannot or will not handle different errors
>> differently, who would benefit from getting rid of this information which may be
>> an aid in debugging for those who know what they're looking at?
>>
>> And if a new enum value is introduced to signal an error condition, how is that
>> going to be communicated to the users? A magic string like "error" or "-1"?
>> Or under a single errno like -EIO?
>
> Yes.
>
>> Personally, I believe neither of these two
>> solutions are better than returning the actual errno which is deemed most
>> appropriate by the platform profile handler. Or am I missing a third way?
>
> Can we please defer this until we actually have a driver needing to
> return different error values from ->get_profile() (and I find it hard
> to believe that there will be any drivers like that)?
I can maybe give an example. On Microsoft Surface devices, the
performance mode / platform profile is set via a request to the embedded
controller and can be queried the same way. This request can fail (most
notably with ETIMEDOUT and EREMOTEIO). I think at least being able to
show users an error in this case would be helpful.
A driver for that is currently at [1], but I haven't adapted that yet to
the platform profile patchset.
On the other hand, I can also query and store the profile when loading
the driver and then update it when it's changed. That'd require that no
one else changes the profile, but I think we can safely assume that.
[1]: https://github.com/linux-surface/surface-aggregator-module/blob/master/module/src/clients/surface_perfmode.c,
Regards,
Max
>
> Let's do the simpler thing until we have a real need to do the more
> complicated one.
>
> Otherwise we're preparing for things that may never happen.
>
next prev parent reply other threads:[~2020-12-17 15:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 2:06 [PATCH v6 1/3] Documentation: Add documentation for new platform_profile sysfs attribute Mark Pearson
2020-12-11 2:06 ` [PATCH v6 2/3] ACPI: platform-profile: Add platform profile support Mark Pearson
2020-12-16 18:13 ` Rafael J. Wysocki
2020-12-16 18:42 ` Barnabás Pőcze
2020-12-16 18:47 ` Rafael J. Wysocki
2020-12-16 19:18 ` [External] " Mark Pearson
2020-12-16 19:50 ` Rafael J. Wysocki
2020-12-16 21:36 ` Mark Pearson
2020-12-17 13:36 ` Rafael J. Wysocki
2020-12-17 14:38 ` Mark Pearson
2020-12-17 15:02 ` Barnabás Pőcze
2020-12-17 15:09 ` Rafael J. Wysocki
2020-12-17 15:18 ` Maximilian Luz [this message]
2020-12-17 15:20 ` Rafael J. Wysocki
2020-12-11 2:06 ` [PATCH v6 3/3] platform/x86: thinkpad_acpi: " Mark Pearson
2020-12-16 18:34 ` [PATCH v6 1/3] Documentation: Add documentation for new platform_profile sysfs attribute Rafael J. Wysocki
2020-12-16 19:26 ` [External] " Mark Pearson
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=aa65eb2a-5b0a-26de-e667-d9c68f2341a5@gmail.com \
--to=luzmaximilian@gmail.com \
--cc=bberg@redhat.com \
--cc=dvhart@infradead.org \
--cc=eliadevito@gmail.com \
--cc=hadess@hadess.net \
--cc=hdegoede@redhat.com \
--cc=linux-acpi@vger.kernel.org \
--cc=mario.limonciello@dell.com \
--cc=markpearson@lenovo.com \
--cc=mgross@linux.intel.com \
--cc=njosh1@lenovo.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=pobrn@protonmail.com \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
/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).