lkml.org 
[lkml]   [2020]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/2] Input: i8042 - Prevent intermixing i8042 commands
On Thu, Aug 27, 2020 at 11:12 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Thu, Aug 27, 2020 at 10:52 PM Raul E Rangel <rrangel@chromium.org> wrote:

...

> > + mutex_lock(&i8042_mutex);
> > +
> > spin_lock_irqsave(&i8042_lock, flags);
> > retval = __i8042_command(param, command);
> > spin_unlock_irqrestore(&i8042_lock, flags);
> >
> > + mutex_unlock(&i8042_mutex);
>
> Question 1. Why do you need mutex at all in the above situation? Spin
> lock isn't enough?
>
> ...
>
> > - i8042_lock_chip();
> > -
> > if (value == LED_OFF)
> > i8042_command(NULL, CLEVO_MAIL_LED_OFF);
> > else if (value <= LED_HALF)
> > i8042_command(NULL, CLEVO_MAIL_LED_BLINK_0_5HZ);
> > else
> > i8042_command(NULL, CLEVO_MAIL_LED_BLINK_1HZ);
> > -
> > - i8042_unlock_chip();
> > -
>
> Now, these three commands are not considered as a transaction (no
> atomicity). That's why your patch is wrong.

Ah, I didn't pay attention that this is one command call. But still Q1 is valid.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2020-08-27 22:19    [W:0.081 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site