From: Hans de Goede <hdegoede@redhat.com>
To: "Barnabás Pőcze" <pobrn@protonmail.com>,
"Luke D. Jones" <luke@ljones.dev>
Cc: corentin.chary@gmail.com, mgross@linux.intel.com,
jdelvare@suse.com, linux@roeck-us.net,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] asus-wmi: Add dgpu disable method
Date: Tue, 6 Jul 2021 12:17:13 +0200 [thread overview]
Message-ID: <e933f74e-50d3-8de9-258a-a4000f3b6403@redhat.com> (raw)
In-Reply-To: <knw744OJB1AYrrFpo77N1Eei0JZC3SjKzg6SMoMhOsEchAiE8-klOIPTyFCAUSiVeTopPNqgFSefQJ2av6Gs_cS4TuIRXVQcHUxvw8YvSl0=@protonmail.com>
Hi,
Barnabás made some good points which I missed.
See me reply inline.
On 7/5/21 2:47 AM, Barnabás Pőcze wrote:
> Hi
>
> I have added a couple comments inline.
>
>
> 2021. július 5., hétfő 0:21 keltezéssel, Luke D. Jones írta:
>
<snip>
>> +static ssize_t dgpu_disable_store(struct device *dev,
>> + struct device_attribute *attr,
>> + const char *buf, size_t count)
>> +{
>> + int result;
>> + u8 disable;
>> + struct asus_wmi *asus = dev_get_drvdata(dev);
>> +
>> + result = kstrtou8(buf, 10, &disable);
>
> You could use `kstrtobool()`. I think that would be better since it accepts
> 'y', 'n', etc. in addition to 0 and 1.
Good point and the same applies to patch 1/3.
>> + if (result < 0)
>> + return result;
>> +
>> + if (disable > 1 || disable < 0)
>> + return -EINVAL;
>> +
>> + asus->dgpu_disable_mode = disable;
>> + /*
>> + * The ACPI call used does not save the mode unless the call is run twice.
>> + * Once to disable, then once to check status and save - this is two code
>> + * paths in the method in the ACPI dumps.
>> + */
>> + dgpu_disable_write(asus);
>> + dgpu_disable_write(asus);
>
> Is there any reason the potential error codes are not returned?
Good question.
<snip>
>> @@ -2699,6 +2792,10 @@ static int asus_wmi_add(struct platform_device *pdev)
>> if (err)
>> goto fail_platform;
>>
>> + err = dgpu_disable_check_present(asus);
>> + if (err)
>> + goto fail_dgpu_disable;
>> +
>
> Should this really be considered a "fatal" error?
Well dgpu_disable_check_present() does already contain:
if (err == -ENODEV)
return 0;
IOW it only returns an error on unexpected errors and asus_wmi_add()
already contains a couple of other foo_present() checks which are
dealt with in the same way, so this is consistent with that and
being consistent is good, so I think this is fine.
Regards,
Hans
next prev parent reply other threads:[~2021-07-06 10:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-04 22:21 [PATCH 0/3] Support for ASUS egpu, dpgu disable, panel overdrive Luke D. Jones
2021-07-04 22:21 ` [PATCH 1/3] asus-wmi: Add panel overdrive functionality Luke D. Jones
2021-07-04 23:48 ` kernel test robot
2021-07-06 10:07 ` Hans de Goede
2021-07-06 10:08 ` Hans de Goede
2021-07-04 22:21 ` [PATCH 2/3] asus-wmi: Add dgpu disable method Luke D. Jones
2021-07-05 0:47 ` Barnabás Pőcze
2021-07-06 10:17 ` Hans de Goede [this message]
2021-07-08 17:09 ` Barnabás Pőcze
2021-07-16 23:09 ` Luke Jones
2021-07-06 10:10 ` Hans de Goede
2021-07-16 23:12 ` Luke Jones
2021-07-04 22:21 ` [PATCH 3/3] asus-wmi: Add egpu enable method Luke D. Jones
2021-07-06 10:19 ` 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=e933f74e-50d3-8de9-258a-a4000f3b6403@redhat.com \
--to=hdegoede@redhat.com \
--cc=corentin.chary@gmail.com \
--cc=jdelvare@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=luke@ljones.dev \
--cc=mgross@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=pobrn@protonmail.com \
/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
all inboxes | Powered by JetHome®