Re: [PATCH v17] tty: Fix the keyboard led light display problem

From: Andy Shevchenko
Date: Fri Nov 26 2021 - 10:54:33 EST


On Fri, Nov 26, 2021 at 07:27:27PM +0800, lianzhi chang wrote:
> By judging the value of kb->kbdmode to determine whether it is necessary
> to forcibly set the led state of the keyboard when switching between
> different ttys. Solve the problem of the inconsistency between the
> keyboard led status and the keyboard lock status in some scenarios,
> such as the scenario where the desktop and tty switch mutually.

Since it will be a next version, see one comment below you may address as well.

...

> + /*
> + * 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) {

checkpatch usually complains on indentation above.

Can you simply do it like

if (kb->kbdmode == VC_RAW ||
kb->kbdmode == VC_MEDIUMRAW ||
kb->kbdmode == VC_OFF) {

?

Alternatively it might be converted to a switch-case, but it takes more LOCs.

switch {
case VC_RAW:
case VC_MEDIUMRAW :
case VC_OFF:
vt_switch = true;
set_leds();
break;
default:
break;
}

> + vt_switch = true;
> + set_leds();
> + }

--
With Best Regards,
Andy Shevchenko