[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfABOpx1TLhF2wYapNm8h5Yhu0eRqtdaYpRK9MN5hfo2g@mail.gmail.com>
Date: Sat, 6 Aug 2022 13:12:25 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Luke Jones <luke@...nes.dev>
Cc: Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>,
Platform Driver <platform-driver-x86@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/5] asus-wmi: Add support for TUF laptop keyboard RGB
mode control
On Sat, Aug 6, 2022 at 12:34 PM Luke Jones <luke@...nes.dev> wrote:
> On Sat, Aug 6 2022 at 11:56:58 +0200, Andy Shevchenko
> <andy.shevchenko@...il.com> wrote:
> > On Fri, Aug 5, 2022 at 10:20 AM Luke D. Jones <luke@...nes.dev> wrote:
...
> >> + if (sscanf(buf, "%hhd %hhd %hhd", &save, &mode, &speed) !=
> >> 3)
> >> + return -EINVAL;
> >
> > Usually we have three separate nodes for that, but they are kinda
> > hidden in one driver, so I don't care much.
>
> I don't really understand what you mean sorry.
Each value is in a separate sysfs "file" (we call it "sysfs node"),
but it seems Pavel proposed a better solution so LED framework has
something to offer you.
...
> >> + /* These are the known usable modes across all TUF/ROG */
> >> + asus->keyboard_rgb_mode.mode = mode < 12 && mode != 9 ?
> >> mode : 0x0a;
This also can be improved
if (mode >= 12 || mode == 9)
...mode = 10;
else
...mode = mode;
Or, if it's important, switch all above to be hexadecimal constants.
...
> >> + err = tuf_rgb_brightness_set(cdev, cdev->brightness);
> >> + if (err)
> >> + return err;
> >> + return 0;
> >
> > return tuf_rgb_brightness_set(...);
>
> This causes a hang (waiting for return somewhere?) if I don't return
> count. Especially true if the return is 0.
I didn't get this, because what I suggested is an equivalent to the
above 4 lines.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists