[<prev] [next>] [day] [month] [year] [list]
Message-ID: <YXac+bpVemXEp9XR@smile.fi.intel.com>
Date: Mon, 25 Oct 2021 15:03:05 +0300
From: "andriy.shevchenko" <andriy.shevchenko@...ux.intel.com>
To: "changlianzhi@...ontech.com" <changlianzhi@...ontech.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
"dmitry.torokhov" <dmitry.torokhov@...il.com>,
gregkh <gregkh@...uxfoundation.org>,
jirislaby <jirislaby@...nel.org>, 282827961 <282827961@...com>
Subject: Re: [PATCH v6] tty: Fix the keyboard led light display problem
On Mon, Oct 25, 2021 at 01:29:18AM +0800, changlianzhi@...ontech.com wrote:
> >>On Thu, Oct 21, 2021 at 10:05:11AM +0800, lianzhi chang wrote:
> >> Switching from the desktop environment to the tty environment,
> >> the state of the keyboard led lights and the state of the keyboard
> >> lock are inconsistent. This is because the attribute kb->kbdmode
> >> of the tty bound in the desktop environment (xorg) is set to
> >> VC_OFF, which causes the ledstate and kb->ledflagstate
> >> values of the bound tty to always be 0, which causes the switch
> >> from the desktop When to the tty environment, the LED light
> >> status is inconsistent with the keyboard lock status.
>
> >...
>
> >> + unsigned long leds;
> >> +
> >> + leds = (unsigned long)ledstate;
>
> >Can be one line.
>
> >But most important question you are ignoring to answer / address is why do you
> >use casting?
> >>But most important question you are ignoring to answer / address is why do you
> >>use casting?
> Casting is used here because:
> The second parameter of test_bit is "volatile unsigned long *addr" (see constant_test_bit() in /arch/x86/include/asm/bitops.h), but ledstate is an "unsigned int" type. If casting is not used,
> compile Will report an error.
Wait, you are casting pointer to an integer?!
This is completely wrong in this case!
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists