2021-12-13 12:42:13

by lianzhi chang

[permalink] [raw]
Subject: [PATCH v21] tty: Fix the keyboard led light display problem

Use the "ctrl+alt+Fn" key combination to switch the system from tty to
desktop or switch the system from desktop to tty. After the switch is
completed, it is found that the state of the keyboard lock is
inconsistent with the state of the keyboard Led light.The reasons are
as follows:

* The desktop environment (Xorg and other services) is bound to a tty
(assuming it is tty1), and the kb->kbdmode attribute value of tty1
will be set to VC_OFF. According to the current code logic, in the
desktop environment, the values of ledstate and kb->ledflagstate
of tty1 will not be modified anymore, so they are always 0.

* When switching between each tty, the final value of ledstate set by
the previous tty is compared with the kb->ledflagstate value of the
current tty to determine whether to set the state of the keyboard
light. The process of switching between desktop and tty is also the
process of switching between tty1 and other ttys. There are two
situations:

- (1) In the desktop environment, tty1 will not set the ledstate,
which will cause when switching from the desktop to other ttys,
if the desktop lights up the keyboard's led, after the switch is
completed, the keyboard's led light will always be on;

- (2) When switching from another tty to the desktop, this
mechanism will trigger tty1 to set the led state. If other tty
lights up the led of the keyboard before switching to the desktop,
the led will be forcibly turned off. This situation should
be avoided.

* Current patch explanation:When VT is switched,the keyboard LED
status will be set to the current tty saved value;the value of
kb->kbdledctl can be used to confirm whether the current VT
can change the status of the keyboard led light;kb->kbdledctl
is a new addition,you can use ioctl get or set.

Signed-off-by: lianzhi chang <[email protected]>
Suggested-by: Dmitry Torokhov <[email protected]>
---
v20:
New solution: kbd_struct adds a new "kbdledctl" attribute,
which can be obtained or changed through ioctl;
"kbdledctl" is used to determine whether the current VT
can set the keyboard led light;
v21:
Format correction

drivers/tty/vt/keyboard.c | 61 +++++++++++++++++++++++++++++++++++++++
drivers/tty/vt/vt_ioctl.c | 12 ++++++++
include/linux/kbd_kern.h | 4 +++
include/linux/vt_kern.h | 2 ++
include/uapi/linux/kd.h | 7 ++++-
5 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index c7fbbcdcc346..413e06a52648 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -153,6 +153,7 @@ static int shift_state = 0;

static unsigned int ledstate = -1U; /* undefined */
static unsigned char ledioctl;
+static bool vt_switch;

/*
* Notifier list for console keyboard events
@@ -414,6 +415,12 @@ void vt_set_leds_compute_shiftstate(void)
{
unsigned long flags;

+ /*
+ * When switching VT,according to the value of vt_switch,
+ * judge whether it is necessary to force the keyboard light
+ * state to be issued.
+ */
+ vt_switch = true;
set_leds();

spin_lock_irqsave(&kbd_event_lock, flags);
@@ -1247,14 +1254,24 @@ void vt_kbd_con_stop(unsigned int console)
*/
static void kbd_bh(struct tasklet_struct *unused)
{
+ struct kbd_struct *kb;
unsigned int leds;
unsigned long flags;

+ kb = kbd_table + fg_console;
+ if (kb->kbdledctl == VC_LEDCTL_OFF)
+ return;
+
spin_lock_irqsave(&led_lock, flags);
leds = getleds();
leds |= (unsigned int)kbd->lockstate << 8;
spin_unlock_irqrestore(&led_lock, flags);

+ if (vt_switch) {
+ ledstate = ~leds;
+ vt_switch = false;
+ }
+
if (leds != ledstate) {
kbd_propagate_led_state(ledstate, leds);
ledstate = leds;
@@ -1857,6 +1874,35 @@ int vt_do_kdskbmode(unsigned int console, unsigned int arg)
return ret;
}

+/**
+ * vt_do_kdskbledctl - set whether VT can control led
+ * @console: the console to use
+ * @arg: the requested mode
+ *
+ * Whether to allow the current vt to change the
+ * keyboard light
+ */
+int vt_do_kdskbledctl(unsigned int console, unsigned int arg)
+{
+ struct kbd_struct *kb = &kbd_table[console];
+ unsigned long flags;
+ int ret = 0;
+
+ spin_lock_irqsave(&kbd_event_lock, flags);
+ switch (arg) {
+ case K_LEDCTL_ON:
+ kb->kbdledctl = VC_LEDCTL_ON;
+ break;
+ case K_LEDCTL_OFF:
+ kb->kbdledctl = VC_LEDCTL_OFF;
+ break;
+ default:
+ ret = -EINVAL;
+ }
+ spin_unlock_irqrestore(&kbd_event_lock, flags);
+ return ret;
+}
+
/**
* vt_do_kdskbmeta - set keyboard meta state
* @console: the console to use
@@ -2157,6 +2203,21 @@ int vt_do_kdgkbmode(unsigned int console)
}
}

+int vt_do_kdgkbledctl(unsigned int console)
+{
+ struct kbd_struct *kb = &kbd_table[console];
+
+ /* This is a spot read so needs no locking */
+ switch (kb->kbdledctl) {
+ case VC_LEDCTL_ON:
+ return K_LEDCTL_ON;
+ case VC_LEDCTL_OFF:
+ return K_LEDCTL_OFF;
+ default:
+ return K_LEDCTL_ON;
+ }
+}
+
/**
* vt_do_kdgkbmeta - report meta status
* @console: console to report
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
index 3639bb6dc372..c78bd452af55 100644
--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -405,6 +405,18 @@ static int vt_k_ioctl(struct tty_struct *tty, unsigned int cmd,
case KDGKBMODE:
return put_user(vt_do_kdgkbmode(console), (int __user *)arg);

+ case KDSKBLEDCTL:
+ if (!perm)
+ return -EPERM;
+ ret = vt_do_kdskbledctl(console, arg);
+ if (ret)
+ return ret;
+ tty_ldisc_flush(tty);
+ break;
+
+ case KDGKBLEDCTL:
+ return put_user(vt_do_kdgkbledctl(console), (int __user *)arg);
+
/* this could be folded into KDSKBMODE, but for compatibility
reasons it is not so easy to fold KDGKBMETA into KDGKBMODE */
case KDSKBMETA:
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index c40811d79769..92c3d1ad3c28 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -32,6 +32,10 @@ struct kbd_struct {
#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */
unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */

+ unsigned char kbdledctl:1; /* Whether to allow to control the led of the keyboard */
+#define VC_LEDCTL_ON 0 /* VT can set the keyboard light */
+#define VC_LEDCTL_OFF 1 /* Prohibit VT to set the keyboard light */
+
unsigned char ledmode:1;
#define LED_SHOW_FLAGS 0 /* traditional state */
#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index b5ab452fca5b..67bdf3eddb5a 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -149,6 +149,7 @@ void hide_boot_cursor(bool hide);
/* keyboard provided interfaces */
int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm);
int vt_do_kdskbmode(unsigned int console, unsigned int arg);
+int vt_do_kdskbledctl(unsigned int console, unsigned int arg);
int vt_do_kdskbmeta(unsigned int console, unsigned int arg);
int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc,
int perm);
@@ -157,6 +158,7 @@ int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm,
int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm);
int vt_do_kdskled(unsigned int console, int cmd, unsigned long arg, int perm);
int vt_do_kdgkbmode(unsigned int console);
+int vt_do_kdgkbledctl(unsigned int console);
int vt_do_kdgkbmeta(unsigned int console);
void vt_reset_unicode(unsigned int console);
int vt_get_shift_state(void);
diff --git a/include/uapi/linux/kd.h b/include/uapi/linux/kd.h
index ee929ece4112..138d636adf3e 100644
--- a/include/uapi/linux/kd.h
+++ b/include/uapi/linux/kd.h
@@ -86,6 +86,11 @@ struct unimapinit {
#define KDGKBMODE 0x4B44 /* gets current keyboard mode */
#define KDSKBMODE 0x4B45 /* sets current keyboard mode */

+#define K_LEDCTL_ON 0x00
+#define K_LEDCTL_OFF 0x01
+#define KDGKBLEDCTL 0x4B73 /* set whether to allow control of keyboard lights */
+#define KDSKBLEDCTL 0x4B74 /* get whether the keyboard light is currently allowed to be set */
+
#define K_METABIT 0x03
#define K_ESCPREFIX 0x04
#define KDGKBMETA 0x4B62 /* gets meta key handling mode */
@@ -179,6 +184,6 @@ struct console_font {

/* note: 0x4B00-0x4B4E all have had a value at some time;
don't reuse for the time being */
-/* note: 0x4B60-0x4B6D, 0x4B70-0x4B72 used above */
+/* note: 0x4B60-0x4B6D, 0x4B70-0x4B74 used above */

#endif /* _UAPI_LINUX_KD_H */
--
2.20.1





2021-12-13 14:00:53

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v21] tty: Fix the keyboard led light display problem

On Mon, Dec 13, 2021 at 08:41:22PM +0800, lianzhi chang wrote:

> v20:
> New solution: kbd_struct adds a new "kbdledctl" attribute,
> which can be obtained or changed through ioctl;
> "kbdledctl" is used to determine whether the current VT
> can set the keyboard led light;
> v21:
> Format correction

It's good to wait at least 24h before sending a new version. Not everybody who
might comment is awake, for example.

--
With Best Regards,
Andy Shevchenko



2021-12-13 18:26:03

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v21] tty: Fix the keyboard led light display problem

Hi lianzhi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on linux/master linus/master v5.16-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/lianzhi-chang/tty-Fix-the-keyboard-led-light-display-problem/20211213-204404
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: openrisc-randconfig-r033-20211213 (https://download.01.org/0day-ci/archive/20211214/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/8cc658e5dd82e5d70fa3ac9dace8fe62eaed325f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review lianzhi-chang/tty-Fix-the-keyboard-led-light-display-problem/20211213-204404
git checkout 8cc658e5dd82e5d70fa3ac9dace8fe62eaed325f
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=openrisc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

In file included from drivers/tty/vt/vt_ioctl.c:37:
include/linux/kbd_kern.h:35:34: error: stray '\357' in program
35 | unsigned char kbdledctl:1; /* Whether to allow to control the led of the keyboard */
| ^~
>> include/linux/kbd_kern.h:39:9: error: expected ',', ';' or '}' before 'unsigned'
39 | unsigned char ledmode:1;
| ^~~~~~~~
include/linux/kbd_kern.h: In function 'vc_kbd_mode':
>> include/linux/kbd_kern.h:78:21: error: 'struct kbd_struct' has no member named 'modeflags'
78 | return ((kbd->modeflags >> flag) & 1);
| ^~
include/linux/kbd_kern.h: In function 'vc_kbd_led':
>> include/linux/kbd_kern.h:83:21: error: 'struct kbd_struct' has no member named 'ledflagstate'
83 | return ((kbd->ledflagstate >> flag) & 1);
| ^~
include/linux/kbd_kern.h: In function 'set_vc_kbd_mode':
include/linux/kbd_kern.h:88:12: error: 'struct kbd_struct' has no member named 'modeflags'
88 | kbd->modeflags |= 1 << flag;
| ^~
include/linux/kbd_kern.h: In function 'set_vc_kbd_led':
include/linux/kbd_kern.h:93:12: error: 'struct kbd_struct' has no member named 'ledflagstate'
93 | kbd->ledflagstate |= 1 << flag;
| ^~
include/linux/kbd_kern.h: In function 'clr_vc_kbd_mode':
include/linux/kbd_kern.h:98:12: error: 'struct kbd_struct' has no member named 'modeflags'
98 | kbd->modeflags &= ~(1 << flag);
| ^~
include/linux/kbd_kern.h: In function 'clr_vc_kbd_led':
include/linux/kbd_kern.h:103:12: error: 'struct kbd_struct' has no member named 'ledflagstate'
103 | kbd->ledflagstate &= ~(1 << flag);
| ^~
include/linux/kbd_kern.h: In function 'chg_vc_kbd_mode':
include/linux/kbd_kern.h:118:12: error: 'struct kbd_struct' has no member named 'modeflags'
118 | kbd->modeflags ^= 1 << flag;
| ^~
include/linux/kbd_kern.h: In function 'chg_vc_kbd_led':
include/linux/kbd_kern.h:123:12: error: 'struct kbd_struct' has no member named 'ledflagstate'
123 | kbd->ledflagstate ^= 1 << flag;
| ^~
--
In file included from drivers/tty/vt/keyboard.c:33:
include/linux/kbd_kern.h:35:34: error: stray '\357' in program
35 | unsigned char kbdledctl:1; /* Whether to allow to control the led of the keyboard */
| ^~
>> include/linux/kbd_kern.h:39:9: error: expected ',', ';' or '}' before 'unsigned'
39 | unsigned char ledmode:1;
| ^~~~~~~~
include/linux/kbd_kern.h: In function 'vc_kbd_mode':
>> include/linux/kbd_kern.h:78:21: error: 'struct kbd_struct' has no member named 'modeflags'
78 | return ((kbd->modeflags >> flag) & 1);
| ^~
include/linux/kbd_kern.h: In function 'vc_kbd_led':
>> include/linux/kbd_kern.h:83:21: error: 'struct kbd_struct' has no member named 'ledflagstate'
83 | return ((kbd->ledflagstate >> flag) & 1);
| ^~
include/linux/kbd_kern.h: In function 'set_vc_kbd_mode':
include/linux/kbd_kern.h:88:12: error: 'struct kbd_struct' has no member named 'modeflags'
88 | kbd->modeflags |= 1 << flag;
| ^~
include/linux/kbd_kern.h: In function 'set_vc_kbd_led':
include/linux/kbd_kern.h:93:12: error: 'struct kbd_struct' has no member named 'ledflagstate'
93 | kbd->ledflagstate |= 1 << flag;
| ^~
include/linux/kbd_kern.h: In function 'clr_vc_kbd_mode':
include/linux/kbd_kern.h:98:12: error: 'struct kbd_struct' has no member named 'modeflags'
98 | kbd->modeflags &= ~(1 << flag);
| ^~
include/linux/kbd_kern.h: In function 'clr_vc_kbd_led':
include/linux/kbd_kern.h:103:12: error: 'struct kbd_struct' has no member named 'ledflagstate'
103 | kbd->ledflagstate &= ~(1 << flag);
| ^~
include/linux/kbd_kern.h: In function 'chg_vc_kbd_mode':
include/linux/kbd_kern.h:118:12: error: 'struct kbd_struct' has no member named 'modeflags'
118 | kbd->modeflags ^= 1 << flag;
| ^~
include/linux/kbd_kern.h: In function 'chg_vc_kbd_led':
include/linux/kbd_kern.h:123:12: error: 'struct kbd_struct' has no member named 'ledflagstate'
123 | kbd->ledflagstate ^= 1 << flag;
| ^~
In file included from include/linux/init.h:5,
from drivers/tty/vt/keyboard.c:29:
drivers/tty/vt/keyboard.c: In function 'handle_diacr':
>> drivers/tty/vt/keyboard.c:457:16: error: 'struct kbd_struct' has no member named 'kbdmode'
457 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:457:9: note: in expansion of macro 'if'
457 | if (kbd->kbdmode == VC_UNICODE)
| ^~
>> drivers/tty/vt/keyboard.c:457:16: error: 'struct kbd_struct' has no member named 'kbdmode'
457 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:457:9: note: in expansion of macro 'if'
457 | if (kbd->kbdmode == VC_UNICODE)
| ^~
>> drivers/tty/vt/keyboard.c:457:16: error: 'struct kbd_struct' has no member named 'kbdmode'
457 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:457:9: note: in expansion of macro 'if'
457 | if (kbd->kbdmode == VC_UNICODE)
| ^~
drivers/tty/vt/keyboard.c: In function 'fn_enter':
drivers/tty/vt/keyboard.c:474:24: error: 'struct kbd_struct' has no member named 'kbdmode'
474 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:474:17: note: in expansion of macro 'if'
474 | if (kbd->kbdmode == VC_UNICODE)
| ^~
drivers/tty/vt/keyboard.c:474:24: error: 'struct kbd_struct' has no member named 'kbdmode'
474 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:474:17: note: in expansion of macro 'if'
474 | if (kbd->kbdmode == VC_UNICODE)
| ^~
drivers/tty/vt/keyboard.c:474:24: error: 'struct kbd_struct' has no member named 'kbdmode'
474 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:474:17: note: in expansion of macro 'if'
474 | if (kbd->kbdmode == VC_UNICODE)
| ^~
drivers/tty/vt/keyboard.c: In function 'k_spec':
drivers/tty/vt/keyboard.c:662:17: error: 'struct kbd_struct' has no member named 'kbdmode'
662 | if ((kbd->kbdmode == VC_RAW ||
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:662:9: note: in expansion of macro 'if'
662 | if ((kbd->kbdmode == VC_RAW ||
| ^~
drivers/tty/vt/keyboard.c:663:17: error: 'struct kbd_struct' has no member named 'kbdmode'
663 | kbd->kbdmode == VC_MEDIUMRAW ||
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:662:9: note: in expansion of macro 'if'
662 | if ((kbd->kbdmode == VC_RAW ||
| ^~
drivers/tty/vt/keyboard.c:664:17: error: 'struct kbd_struct' has no member named 'kbdmode'
664 | kbd->kbdmode == VC_OFF) &&
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:662:9: note: in expansion of macro 'if'
662 | if ((kbd->kbdmode == VC_RAW ||
| ^~
drivers/tty/vt/keyboard.c:662:17: error: 'struct kbd_struct' has no member named 'kbdmode'
662 | if ((kbd->kbdmode == VC_RAW ||
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:662:9: note: in expansion of macro 'if'
662 | if ((kbd->kbdmode == VC_RAW ||
| ^~
drivers/tty/vt/keyboard.c:663:17: error: 'struct kbd_struct' has no member named 'kbdmode'
663 | kbd->kbdmode == VC_MEDIUMRAW ||
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:662:9: note: in expansion of macro 'if'
662 | if ((kbd->kbdmode == VC_RAW ||
| ^~
drivers/tty/vt/keyboard.c:664:17: error: 'struct kbd_struct' has no member named 'kbdmode'
664 | kbd->kbdmode == VC_OFF) &&
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:662:9: note: in expansion of macro 'if'
662 | if ((kbd->kbdmode == VC_RAW ||
| ^~
drivers/tty/vt/keyboard.c:662:17: error: 'struct kbd_struct' has no member named 'kbdmode'
662 | if ((kbd->kbdmode == VC_RAW ||
| ^~
--
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:662:9: note: in expansion of macro 'if'
662 | if ((kbd->kbdmode == VC_RAW ||
| ^~
drivers/tty/vt/keyboard.c: In function 'k_unicode':
drivers/tty/vt/keyboard.c:688:16: error: 'struct kbd_struct' has no member named 'kbdmode'
688 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:688:9: note: in expansion of macro 'if'
688 | if (kbd->kbdmode == VC_UNICODE)
| ^~
drivers/tty/vt/keyboard.c:688:16: error: 'struct kbd_struct' has no member named 'kbdmode'
688 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:688:9: note: in expansion of macro 'if'
688 | if (kbd->kbdmode == VC_UNICODE)
| ^~
drivers/tty/vt/keyboard.c:688:16: error: 'struct kbd_struct' has no member named 'kbdmode'
688 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:688:9: note: in expansion of macro 'if'
688 | if (kbd->kbdmode == VC_UNICODE)
| ^~
drivers/tty/vt/keyboard.c: In function 'k_shift':
drivers/tty/vt/keyboard.c:885:24: error: 'struct kbd_struct' has no member named 'kbdmode'
885 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:885:17: note: in expansion of macro 'if'
885 | if (kbd->kbdmode == VC_UNICODE)
| ^~
drivers/tty/vt/keyboard.c:885:24: error: 'struct kbd_struct' has no member named 'kbdmode'
885 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:885:17: note: in expansion of macro 'if'
885 | if (kbd->kbdmode == VC_UNICODE)
| ^~
drivers/tty/vt/keyboard.c:885:24: error: 'struct kbd_struct' has no member named 'kbdmode'
885 | if (kbd->kbdmode == VC_UNICODE)
| ^~
include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:885:17: note: in expansion of macro 'if'
885 | if (kbd->kbdmode == VC_UNICODE)
| ^~
drivers/tty/vt/keyboard.c: In function 'k_brl':
drivers/tty/vt/keyboard.c:983:16: error: 'struct kbd_struct' has no member named 'kbdmode'
983 | if (kbd->kbdmode != VC_UNICODE) {
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:983:9: note: in expansion of macro 'if'
983 | if (kbd->kbdmode != VC_UNICODE) {
| ^~
drivers/tty/vt/keyboard.c:983:16: error: 'struct kbd_struct' has no member named 'kbdmode'
983 | if (kbd->kbdmode != VC_UNICODE) {
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:983:9: note: in expansion of macro 'if'
983 | if (kbd->kbdmode != VC_UNICODE) {
| ^~
drivers/tty/vt/keyboard.c:983:16: error: 'struct kbd_struct' has no member named 'kbdmode'
983 | if (kbd->kbdmode != VC_UNICODE) {
| ^~
include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:983:9: note: in expansion of macro 'if'
983 | if (kbd->kbdmode != VC_UNICODE) {
| ^~
drivers/tty/vt/keyboard.c: In function 'setledstate':
>> drivers/tty/vt/keyboard.c:1156:19: error: 'struct kbd_struct' has no member named 'ledmode'
1156 | kb->ledmode = LED_SHOW_IOCTL;
| ^~
drivers/tty/vt/keyboard.c:1158:19: error: 'struct kbd_struct' has no member named 'ledmode'
1158 | kb->ledmode = LED_SHOW_FLAGS;
| ^~
In file included from include/linux/init.h:5,
from drivers/tty/vt/keyboard.c:29:
drivers/tty/vt/keyboard.c: In function 'getleds':
drivers/tty/vt/keyboard.c:1168:15: error: 'struct kbd_struct' has no member named 'ledmode'
1168 | if (kb->ledmode == LED_SHOW_IOCTL)
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:1168:9: note: in expansion of macro 'if'
1168 | if (kb->ledmode == LED_SHOW_IOCTL)
| ^~
drivers/tty/vt/keyboard.c:1168:15: error: 'struct kbd_struct' has no member named 'ledmode'
1168 | if (kb->ledmode == LED_SHOW_IOCTL)
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:1168:9: note: in expansion of macro 'if'
1168 | if (kb->ledmode == LED_SHOW_IOCTL)
| ^~
drivers/tty/vt/keyboard.c:1168:15: error: 'struct kbd_struct' has no member named 'ledmode'
1168 | if (kb->ledmode == LED_SHOW_IOCTL)
| ^~
include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:1168:9: note: in expansion of macro 'if'
1168 | if (kb->ledmode == LED_SHOW_IOCTL)
| ^~
>> drivers/tty/vt/keyboard.c:1171:18: error: 'struct kbd_struct' has no member named 'ledflagstate'
1171 | return kb->ledflagstate;
| ^~
In file included from include/linux/init.h:5,
from drivers/tty/vt/keyboard.c:29:
drivers/tty/vt/keyboard.c: In function 'kbd_rawcode':
drivers/tty/vt/keyboard.c:1398:16: error: 'struct kbd_struct' has no member named 'kbdmode'
1398 | if (kbd->kbdmode == VC_RAW)
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:1398:9: note: in expansion of macro 'if'
1398 | if (kbd->kbdmode == VC_RAW)
| ^~
drivers/tty/vt/keyboard.c:1398:16: error: 'struct kbd_struct' has no member named 'kbdmode'
1398 | if (kbd->kbdmode == VC_RAW)
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:1398:9: note: in expansion of macro 'if'
1398 | if (kbd->kbdmode == VC_RAW)
| ^~
drivers/tty/vt/keyboard.c:1398:16: error: 'struct kbd_struct' has no member named 'kbdmode'
1398 | if (kbd->kbdmode == VC_RAW)
| ^~
include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:1398:9: note: in expansion of macro 'if'
1398 | if (kbd->kbdmode == VC_RAW)
| ^~
drivers/tty/vt/keyboard.c: In function 'kbd_keycode':
drivers/tty/vt/keyboard.c:1429:24: error: 'struct kbd_struct' has no member named 'kbdmode'
1429 | raw_mode = (kbd->kbdmode == VC_RAW);
| ^~
In file included from include/linux/init.h:5,
from drivers/tty/vt/keyboard.c:29:
drivers/tty/vt/keyboard.c:1443:16: error: 'struct kbd_struct' has no member named 'kbdmode'
1443 | if (kbd->kbdmode == VC_MEDIUMRAW) {
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:1443:9: note: in expansion of macro 'if'
1443 | if (kbd->kbdmode == VC_MEDIUMRAW) {
| ^~
drivers/tty/vt/keyboard.c:1443:16: error: 'struct kbd_struct' has no member named 'kbdmode'
1443 | if (kbd->kbdmode == VC_MEDIUMRAW) {
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:1443:9: note: in expansion of macro 'if'
1443 | if (kbd->kbdmode == VC_MEDIUMRAW) {
| ^~
drivers/tty/vt/keyboard.c:1443:16: error: 'struct kbd_struct' has no member named 'kbdmode'
1443 | if (kbd->kbdmode == VC_MEDIUMRAW) {
| ^~
include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:1443:9: note: in expansion of macro 'if'
1443 | if (kbd->kbdmode == VC_MEDIUMRAW) {
| ^~
drivers/tty/vt/keyboard.c:1477:29: error: 'struct kbd_struct' has no member named 'ledflagstate'
1477 | param.ledstate = kbd->ledflagstate;
| ^~
In file included from include/linux/init.h:5,
from drivers/tty/vt/keyboard.c:29:
drivers/tty/vt/keyboard.c:1526:29: error: 'struct kbd_struct' has no member named 'kbdmode'
1526 | if ((raw_mode || kbd->kbdmode == VC_OFF) && type != KT_SPEC && type != KT_SHIFT)
| ^~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:1526:9: note: in expansion of macro 'if'
1526 | if ((raw_mode || kbd->kbdmode == VC_OFF) && type != KT_SPEC && type != KT_SHIFT)
| ^~
drivers/tty/vt/keyboard.c:1526:29: error: 'struct kbd_struct' has no member named 'kbdmode'
1526 | if ((raw_mode || kbd->kbdmode == VC_OFF) && type != KT_SPEC && type != KT_SHIFT)
| ^~
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
drivers/tty/vt/keyboard.c:1526:9: note: in expansion of macro 'if'
1526 | if ((raw_mode || kbd->kbdmode == VC_OFF) && type != KT_SPEC && type != KT_SHIFT)
| ^~
drivers/tty/vt/keyboard.c:1526:29: error: 'struct kbd_struct' has no member named 'kbdmode'
1526 | if ((raw_mode || kbd->kbdmode == VC_OFF) && type != KT_SPEC && type != KT_SHIFT)
| ^~
include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:1526:9: note: in expansion of macro 'if'
1526 | if ((raw_mode || kbd->kbdmode == VC_OFF) && type != KT_SPEC && type != KT_SHIFT)
| ^~
drivers/tty/vt/keyboard.c:1531:29: error: 'struct kbd_struct' has no member named 'ledflagstate'
1531 | param.ledstate = kbd->ledflagstate;
| ^~
drivers/tty/vt/keyboard.c: In function 'kbd_init':
drivers/tty/vt/keyboard.c:1664:29: error: 'struct kbd_struct' has no member named 'ledflagstate'
1664 | kbd_table[i].ledflagstate = kbd_defleds();
| ^
>> drivers/tty/vt/keyboard.c:1665:29: error: 'struct kbd_struct' has no member named 'default_ledflagstate'
1665 | kbd_table[i].default_ledflagstate = kbd_defleds();
| ^
drivers/tty/vt/keyboard.c:1666:29: error: 'struct kbd_struct' has no member named 'ledmode'
1666 | kbd_table[i].ledmode = LED_SHOW_FLAGS;
| ^
>> drivers/tty/vt/keyboard.c:1669:29: error: 'struct kbd_struct' has no member named 'modeflags'
1669 | kbd_table[i].modeflags = KBD_DEFMODE;
| ^
drivers/tty/vt/keyboard.c:1670:29: error: 'struct kbd_struct' has no member named 'kbdmode'
1670 | kbd_table[i].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
| ^
drivers/tty/vt/keyboard.c: In function 'vt_do_kdskbmode':
drivers/tty/vt/keyboard.c:1854:19: error: 'struct kbd_struct' has no member named 'kbdmode'
1854 | kb->kbdmode = VC_RAW;
| ^~
drivers/tty/vt/keyboard.c:1857:19: error: 'struct kbd_struct' has no member named 'kbdmode'
1857 | kb->kbdmode = VC_MEDIUMRAW;
| ^~
drivers/tty/vt/keyboard.c:1860:19: error: 'struct kbd_struct' has no member named 'kbdmode'
1860 | kb->kbdmode = VC_XLATE;
| ^~
drivers/tty/vt/keyboard.c:1864:19: error: 'struct kbd_struct' has no member named 'kbdmode'
1864 | kb->kbdmode = VC_UNICODE;
| ^~
drivers/tty/vt/keyboard.c:1868:19: error: 'struct kbd_struct' has no member named 'kbdmode'
1868 | kb->kbdmode = VC_OFF;
| ^~
In file included from include/linux/uaccess.h:11,
from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs.h:33,
from include/linux/input.h:20,
from drivers/tty/vt/keyboard.c:30:
drivers/tty/vt/keyboard.c: In function 'vt_do_kdsk_ioctl':
drivers/tty/vt/keyboard.c:2067:47: error: 'struct kbd_struct' has no member named 'kbdmode'
2067 | return put_user(vt_kdgkbent(kb->kbdmode, kbe.kb_index,
| ^~
arch/openrisc/include/asm/uaccess.h:146:23: note: in definition of macro '__put_user_asm'
146 | : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err))
| ^
arch/openrisc/include/asm/uaccess.h:106:17: note: in expansion of macro '__put_user_size'
106 | __put_user_size((x), __pu_addr, (size), __pu_err); \
| ^~~~~~~~~~~~~~~
arch/openrisc/include/asm/uaccess.h:85:9: note: in expansion of macro '__put_user_check'
85 | __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
| ^~~~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:2067:24: note: in expansion of macro 'put_user'
2067 | return put_user(vt_kdgkbent(kb->kbdmode, kbe.kb_index,
| ^~~~~~~~
drivers/tty/vt/keyboard.c:2067:47: error: 'struct kbd_struct' has no member named 'kbdmode'
2067 | return put_user(vt_kdgkbent(kb->kbdmode, kbe.kb_index,
| ^~
arch/openrisc/include/asm/uaccess.h:146:23: note: in definition of macro '__put_user_asm'
146 | : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err))
| ^
arch/openrisc/include/asm/uaccess.h:106:17: note: in expansion of macro '__put_user_size'
106 | __put_user_size((x), __pu_addr, (size), __pu_err); \
| ^~~~~~~~~~~~~~~
arch/openrisc/include/asm/uaccess.h:85:9: note: in expansion of macro '__put_user_check'
85 | __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
| ^~~~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:2067:24: note: in expansion of macro 'put_user'
2067 | return put_user(vt_kdgkbent(kb->kbdmode, kbe.kb_index,
| ^~~~~~~~
drivers/tty/vt/keyboard.c:2067:47: error: 'struct kbd_struct' has no member named 'kbdmode'
2067 | return put_user(vt_kdgkbent(kb->kbdmode, kbe.kb_index,
| ^~
arch/openrisc/include/asm/uaccess.h:146:23: note: in definition of macro '__put_user_asm'
146 | : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err))
| ^
arch/openrisc/include/asm/uaccess.h:106:17: note: in expansion of macro '__put_user_size'
106 | __put_user_size((x), __pu_addr, (size), __pu_err); \
| ^~~~~~~~~~~~~~~
arch/openrisc/include/asm/uaccess.h:85:9: note: in expansion of macro '__put_user_check'
85 | __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
| ^~~~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:2067:24: note: in expansion of macro 'put_user'
2067 | return put_user(vt_kdgkbent(kb->kbdmode, kbe.kb_index,
| ^~~~~~~~
drivers/tty/vt/keyboard.c:2067:47: error: 'struct kbd_struct' has no member named 'kbdmode'
2067 | return put_user(vt_kdgkbent(kb->kbdmode, kbe.kb_index,
| ^~
arch/openrisc/include/asm/uaccess.h:164:23: note: in definition of macro '__put_user_asm2'
164 | : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err))
| ^
arch/openrisc/include/asm/uaccess.h:106:17: note: in expansion of macro '__put_user_size'
106 | __put_user_size((x), __pu_addr, (size), __pu_err); \
| ^~~~~~~~~~~~~~~
arch/openrisc/include/asm/uaccess.h:85:9: note: in expansion of macro '__put_user_check'
85 | __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
| ^~~~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:2067:24: note: in expansion of macro 'put_user'
2067 | return put_user(vt_kdgkbent(kb->kbdmode, kbe.kb_index,
| ^~~~~~~~
drivers/tty/vt/keyboard.c:2073:38: error: 'struct kbd_struct' has no member named 'kbdmode'
2073 | return vt_kdskbent(kb->kbdmode, kbe.kb_index, kbe.kb_table,
| ^~
drivers/tty/vt/keyboard.c: In function 'vt_do_kdskled':
drivers/tty/vt/keyboard.c:2157:27: error: 'struct kbd_struct' has no member named 'ledflagstate'
2157 | ucval = kb->ledflagstate | (kb->default_ledflagstate << 4);
| ^~
drivers/tty/vt/keyboard.c:2157:47: error: 'struct kbd_struct' has no member named 'default_ledflagstate'
2157 | ucval = kb->ledflagstate | (kb->default_ledflagstate << 4);
| ^~


vim +/357 +35 include/linux/kbd_kern.h

21
22 unsigned char lockstate;
23 /* 8 modifiers - the names do not have any meaning at all;
24 they can be associated to arbitrarily chosen keys */
25 #define VC_SHIFTLOCK KG_SHIFT /* shift lock mode */
26 #define VC_ALTGRLOCK KG_ALTGR /* altgr lock mode */
27 #define VC_CTRLLOCK KG_CTRL /* control lock mode */
28 #define VC_ALTLOCK KG_ALT /* alt lock mode */
29 #define VC_SHIFTLLOCK KG_SHIFTL /* shiftl lock mode */
30 #define VC_SHIFTRLOCK KG_SHIFTR /* shiftr lock mode */
31 #define VC_CTRLLLOCK KG_CTRLL /* ctrll lock mode */
32 #define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */
33 unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */
34
> 35 unsigned char kbdledctl:1; /* Whether to allow to control the led of the keyboard */
36 #define VC_LEDCTL_ON 0 /* VT can set the keyboard light */
37 #define VC_LEDCTL_OFF 1 /* Prohibit VT to set the keyboard light */
38
> 39 unsigned char ledmode:1;
40 #define LED_SHOW_FLAGS 0 /* traditional state */
41 #define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */
42
43 unsigned char ledflagstate:4; /* flags, not lights */
44 unsigned char default_ledflagstate:4;
45 #define VC_SCROLLOCK 0 /* scroll-lock mode */
46 #define VC_NUMLOCK 1 /* numeric lock mode */
47 #define VC_CAPSLOCK 2 /* capslock mode */
48 #define VC_KANALOCK 3 /* kanalock mode */
49
50 unsigned char kbdmode:3; /* one 3-bit value */
51 #define VC_XLATE 0 /* translate keycodes using keymap */
52 #define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */
53 #define VC_RAW 2 /* raw (scancode) mode */
54 #define VC_UNICODE 3 /* Unicode mode */
55 #define VC_OFF 4 /* disabled mode */
56
57 unsigned char modeflags:5;
58 #define VC_APPLIC 0 /* application key mode */
59 #define VC_CKMODE 1 /* cursor key mode */
60 #define VC_REPEAT 2 /* keyboard repeat */
61 #define VC_CRLF 3 /* 0 - enter sends CR, 1 - enter sends CRLF */
62 #define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */
63 };
64
65 extern int kbd_init(void);
66
67 extern void setledstate(struct kbd_struct *kbd, unsigned int led);
68
69 extern int do_poke_blanked_console;
70
71 extern void (*kbd_ledfunc)(unsigned int led);
72
73 extern int set_console(int nr);
74 extern void schedule_console_callback(void);
75
76 static inline int vc_kbd_mode(struct kbd_struct * kbd, int flag)
77 {
> 78 return ((kbd->modeflags >> flag) & 1);
79 }
80
81 static inline int vc_kbd_led(struct kbd_struct * kbd, int flag)
82 {
> 83 return ((kbd->ledflagstate >> flag) & 1);
84 }
85

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

2021-12-13 19:17:58

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v21] tty: Fix the keyboard led light display problem

Hi lianzhi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on linux/master linus/master v5.16-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/lianzhi-chang/tty-Fix-the-keyboard-led-light-display-problem/20211213-204404
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: mips-randconfig-r022-20211213 (https://download.01.org/0day-ci/archive/20211214/[email protected]/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2ddb6c8ac29412b1361810972e15221fa021c)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/0day-ci/linux/commit/8cc658e5dd82e5d70fa3ac9dace8fe62eaed325f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review lianzhi-chang/tty-Fix-the-keyboard-led-light-display-problem/20211213-204404
git checkout 8cc658e5dd82e5d70fa3ac9dace8fe62eaed325f
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/tty/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

In file included from drivers/tty/sysrq.c:31:
include/linux/kbd_kern.h:35:27: error: character <U+FF1B> not allowed in an identifier
unsigned char kbdledctl:1; /* Whether to allow to control the led of the keyboard */
^~
include/linux/kbd_kern.h:35:27: error: invalid suffix ';' on integer constant
In file included from drivers/tty/sysrq.c:51:
In file included from include/linux/syscalls.h:88:
In file included from include/trace/syscall.h:7:
In file included from include/linux/trace_events.h:6:
In file included from include/linux/ring_buffer.h:7:
>> include/linux/poll.h:142:27: warning: division by zero is undefined [-Wdivision-by-zero]
M(RDNORM) | M(RDBAND) | M(WRNORM) | M(WRBAND) |
^~~~~~~~~
include/linux/poll.h:140:32: note: expanded from macro 'M'
#define M(X) (__force __poll_t)__MAP(val, POLL##X, (__force __u16)EPOLL##X)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/poll.h:126:51: note: expanded from macro '__MAP'
(from < to ? (v & from) * (to/from) : (v & from) / (from/to))
^ ~~~~~~~~~
include/linux/poll.h:142:39: warning: division by zero is undefined [-Wdivision-by-zero]
M(RDNORM) | M(RDBAND) | M(WRNORM) | M(WRBAND) |
^~~~~~~~~
include/linux/poll.h:140:32: note: expanded from macro 'M'
#define M(X) (__force __poll_t)__MAP(val, POLL##X, (__force __u16)EPOLL##X)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/poll.h:126:51: note: expanded from macro '__MAP'
(from < to ? (v & from) * (to/from) : (v & from) / (from/to))
^ ~~~~~~~~~
2 warnings and 2 errors generated.


vim +142 include/linux/poll.h

7a163b2195cda0 Al Viro 2018-02-01 137
7a163b2195cda0 Al Viro 2018-02-01 138 static inline __poll_t demangle_poll(u16 val)
7a163b2195cda0 Al Viro 2018-02-01 139 {
7a163b2195cda0 Al Viro 2018-02-01 140 #define M(X) (__force __poll_t)__MAP(val, POLL##X, (__force __u16)EPOLL##X)
7a163b2195cda0 Al Viro 2018-02-01 141 return M(IN) | M(OUT) | M(PRI) | M(ERR) | M(NVAL) |
7a163b2195cda0 Al Viro 2018-02-01 @142 M(RDNORM) | M(RDBAND) | M(WRNORM) | M(WRBAND) |
7a163b2195cda0 Al Viro 2018-02-01 143 M(HUP) | M(RDHUP) | M(MSG);
7a163b2195cda0 Al Viro 2018-02-01 144 #undef M
7a163b2195cda0 Al Viro 2018-02-01 145 }
7a163b2195cda0 Al Viro 2018-02-01 146 #undef __MAP
7a163b2195cda0 Al Viro 2018-02-01 147
7a163b2195cda0 Al Viro 2018-02-01 148

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]