Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1384751
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Giedrius Statkevičius <giedrius.statkevicius@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] asus-laptop: correct error handling in asus_read_brightness() |
| Date | Fri, 22 Apr 2016 09:50:01 +0200 |
| Message-ID | <rqE0F-6O2-15@gated-at.bofh.it> (permalink) |
| References | <romrh-3hf-29@gated-at.bofh.it> <rqvTs-qs-17@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=rqBMO+l43QszJjT4R/XCr9yQkuAEbRBsR1I6XP64B4A=; b=r21ZvtuRuf5AnUCKNdzOiDCE4i+pO46HgXYwHnAAXkqg2s93Z2FfERTT/qR+QDroBW +wx/MyNe1RZJK9sLRaKyH6gKSips3ruXgkvKXRx2bbiJBAh3TxIzk00ucoHLydLaRIvI tTJfpWXAfrK4pBFT1qXzugCd34xgUrQ5Y8cA4MnePbuIs2EPC/qTuovVFOUiAUlTbT7O sSpj1UvddlIgk5BJ3PAd+iLvIqOPeDlFvs5P/h2yUbARXt2dzxP3kWlzRgKoZGsSaJFi ISfqa6qJpe7IGiKwaGwCiuLNp3Ovwth7vLH4IO7mAjFb41W5YCBEIYeT0pPeHIkkn4yd kneg== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=rqBMO+l43QszJjT4R/XCr9yQkuAEbRBsR1I6XP64B4A=; b=SqnozhfJNk6DuAQ+Tb936thTxhrO5tX1fvb2UhHLEe0N+esazhZ3H2oI3XtJuBHYij KW0b0yNTLtGaWKNNlFB/svvP2T1LHuPhVymdnl05Cl/G75hNGjweAD5OqSlmo0Uct4J+ J/USAHnSXiP+c8xyvzUOaZbvXxmuz5FY3FpVHUxor+qsI30xgESi1n/xGOd8+els3ZtX vk2KK0V1wu02ft9nxpGkz+QFYy8gloL7BkhY9o5+iFPnn7c5nmN58WBMB1Cdv0OU1qpt 5LVi0/Kevh8HgaW243J667iAhpu2Q2xiTDIpR9UM3nu/r4X2azFwQKPl+GcD0gXhw7Xv LIPw== |
| X-Gm-Message-State | AOPr4FUhIWNSlk0dxv5qvjEFG5emGnz4BqOGn0yF7txeF+29TBPtZHrnzzQqOYwJWgjREQ== |
| X-Received | by 10.28.46.19 with SMTP id u19mr2154135wmu.98.1461311012416; Fri, 22 Apr 2016 00:43:32 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Disposition | inline |
| Content-Transfer-Encoding | 8bit |
| User-Agent | Mutt/1.6.0 (2016-04-01) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 39 |
| Organization | linux.* mail to news gateway |
| X-Original-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> |
| X-Original-Date | Fri, 22 Apr 2016 10:43:30 +0300 |
| X-Original-Message-ID | <20160422074329.GA15499@tyrael> |
| X-Original-References | <1460766432-5390-1-git-send-email-giedrius.statkevicius@gmail.com> <CAHp75VeS86iWKxTGVWmSgVcJ9cTgLWM7tDAmdonipB7pskJEHg@mail.gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1384751 |
Show key headers only | View raw
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.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] asus-laptop: correct error handling in asus_read_brightness() Giedrius Statkevičius <giedrius.statkevicius@gmail.com> - 2016-04-16 02:40 +0200
Re: [PATCH] asus-laptop: correct error handling in asus_read_brightness() Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-04-22 01:10 +0200
Re: [PATCH] asus-laptop: correct error handling in asus_read_brightness() Giedrius Statkevičius <giedrius.statkevicius@gmail.com> - 2016-04-22 09:50 +0200
Re: [PATCH] asus-laptop: correct error handling in asus_read_brightness() Darren Hart <dvhart@infradead.org> - 2016-04-25 19:50 +0200
csiph-web