From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: lianzhi chang <changlianzhi@uniontech.com>
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
jirislaby@kernel.org, andriy.shevchenko@linux.intel.com,
282827961@qq.com
Subject: Re: [PATCH v18] tty: Fix the keyboard led light display problem
Date: Sun, 28 Nov 2021 23:16:53 -0800 [thread overview]
Message-ID: <YaR+ZfOpmRbRUTMz@google.com> (raw)
In-Reply-To: <20211129040445.24134-1-changlianzhi@uniontech.com>
Hi,
On Mon, Nov 29, 2021 at 12:04:45PM +0800, lianzhi chang wrote:
> + /*
> + * When switching VT, according to the value of kb->kbdmode,
> + * judge whether it is necessary to force the keyboard light
> + * state to be issued.
> + */
> + kb = kbd_table + fg_console;
> + if (kb->kbdmode != VC_RAW ||
> + kb->kbdmode != VC_MEDIUMRAW ||
> + kb->kbdmode != VC_OFF) {
Please do not do that. Even if kbdmode is one of those states if might
be set up to show LED pattern set by ioctls (KDSETLED), so you still
want to restore LEDs.
Also, you are trying optimize something that happens pretty infrequently
and it is really easy to get it wrong. It is much safer to let the
kernel [re]set LEDs regardless of kbdmode and then let X do its own
thing.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2021-11-29 7:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 4:04 [PATCH v18] tty: Fix the keyboard led light display problem lianzhi chang
2021-11-29 7:16 ` Dmitry Torokhov [this message]
2021-11-29 11:35 ` Andy Shevchenko
2021-11-30 7:53 ` Dan Carpenter
2021-11-30 8:49 ` Andy Shevchenko
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=YaR+ZfOpmRbRUTMz@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=282827961@qq.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=changlianzhi@uniontech.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@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