From: "Giedrius Statkevičius" <giedrius.statkevicius@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Corentin Chary <corentin.chary@gmail.com>,
"dvhart@infradead.org" <dvhart@infradead.org>,
acpi4asus-user@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] asus-laptop: correct error handling in asus_read_brightness()
Date: Fri, 22 Apr 2016 10:43:30 +0300 [thread overview]
Message-ID: <20160422074329.GA15499@tyrael> (raw)
In-Reply-To: <CAHp75VeS86iWKxTGVWmSgVcJ9cTgLWM7tDAmdonipB7pskJEHg@mail.gmail.com>
On Fri, Apr 22, 2016 at 02:09:22AM +0300, Andy Shevchenko wrote:
> On Sat, Apr 16, 2016 at 3:27 AM, Giedrius Statkevičius
> <giedrius.statkevicius@gmail.com> wrote:
> > It is possible that acpi_evaluate_integer might fail and value would not be
> > set to any value so correct this defect by returning 0 in case of an
> > error. This is also the correct thing to return because the backlight
> > subsystem will print the old value of brightness in this case.
> >
> > Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
> > ---
> > drivers/platform/x86/asus-laptop.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
> > index 9a69734..15f1311 100644
> > --- a/drivers/platform/x86/asus-laptop.c
> > +++ b/drivers/platform/x86/asus-laptop.c
> > @@ -775,8 +775,10 @@ static int asus_read_brightness(struct backlight_device *bd)
> >
> > rv = acpi_evaluate_integer(asus->handle, METHOD_BRIGHTNESS_GET,
> > NULL, &value);
> > - if (ACPI_FAILURE(rv))
> > + if (ACPI_FAILURE(rv)) {
> > pr_warn("Error reading brightness\n");
> > + return 0;
> > + }
>
> This looks like a workaround.
> I suppose the real fix is to return here an error code and fix all callers, like
> drivers/video/backlight/backlight.c.
>
It just fixes the behaviour according to the current code in that file. I
suppose that would be nice but I don't think it would make any difference
because the backlight core code still prints out ->props.brightness in case
ops->get_brightness fails. Just the difference would be that now actual error
messages are printed in the drivers themselves instead of generic messages from
the backlight core. Anyway, I think the current behaviour is more useful because
the drivers know better about what has failed.
next prev parent reply other threads:[~2016-04-22 7:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-16 0:27 [PATCH] asus-laptop: correct error handling in asus_read_brightness() Giedrius Statkevičius
2016-04-21 23:09 ` Andy Shevchenko
2016-04-22 7:43 ` Giedrius Statkevičius [this message]
2016-04-25 17:46 ` Darren Hart
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=20160422074329.GA15499@tyrael \
--to=giedrius.statkevicius@gmail.com \
--cc=acpi4asus-user@lists.sourceforge.net \
--cc=andy.shevchenko@gmail.com \
--cc=corentin.chary@gmail.com \
--cc=dvhart@infradead.org \
--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