linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Raul E Rangel <rrangel@chromium.org>
Cc: linux-input <linux-input@vger.kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	"S, Shirish" <Shirish.S@amd.com>,
	Andy Shevchenko <andy@infradead.org>, Dan Murphy <dmurphy@ti.com>,
	Darren Hart <dvhart@infradead.org>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	"Lee, Chun-Yi" <jlee@suse.com>, Pavel Machek <pavel@ucw.cz>,
	Rajat Jain <rajatja@google.com>,
	Stephen Boyd <swboyd@chromium.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux LED Subsystem <linux-leds@vger.kernel.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>
Subject: Re: [PATCH 1/2] Input: i8042 - Prevent intermixing i8042 commands
Date: Thu, 27 Aug 2020 23:18:23 +0300	[thread overview]
Message-ID: <CAHp75VeOMe2rGhuhCs8=oizwmCEXR_rStHY-TthkEu=3Csjh8A@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VfM-61vN_Ptz1YWz3JmRJ7eqssVykXuCircuiz9HL3TVA@mail.gmail.com>

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

  reply	other threads:[~2020-08-27 20:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 19:52 [PATCH 1/2] Input: i8042 - Prevent intermixing i8042 commands Raul E Rangel
2020-08-27 19:52 ` [PATCH 2/2] Input: i8042 - Lock i8042_mutex before flushing Raul E Rangel
2020-08-27 20:12 ` [PATCH 1/2] Input: i8042 - Prevent intermixing i8042 commands Andy Shevchenko
2020-08-27 20:18   ` Andy Shevchenko [this message]
2020-08-27 20:20   ` Raul Rangel
2020-08-29  7:47 ` Pavel Machek
2020-08-31 13:39   ` Raul Rangel

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='CAHp75VeOMe2rGhuhCs8=oizwmCEXR_rStHY-TthkEu=3Csjh8A@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=Shirish.S@amd.com \
    --cc=andy@infradead.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dmurphy@ti.com \
    --cc=dvhart@infradead.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=jlee@suse.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rajatja@google.com \
    --cc=rrangel@chromium.org \
    --cc=swboyd@chromium.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;
as well as URLs for NNTP newsgroup(s).