From: Pavel Machek <pavel@ucw.cz>
To: Raul E Rangel <rrangel@chromium.org>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com,
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>, Rajat Jain <rajatja@google.com>,
Stephen Boyd <swboyd@chromium.org>,
linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org,
platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 1/2] Input: i8042 - Prevent intermixing i8042 commands
Date: Sat, 29 Aug 2020 09:47:58 +0200 [thread overview]
Message-ID: <20200829074758.GA16838@amd> (raw)
In-Reply-To: <20200827135205.1.I6981f9a9f0c12e60f8038f3b574184f8ffc1b9b5@changeid>
[-- Attachment #1: Type: text/plain, Size: 1378 bytes --]
On Thu 2020-08-27 13:52:22, Raul E Rangel wrote:
> The i8042_mutex must be held by writers of the AUX and KBD ports, as
> well as users of i8042_command. There were a lot of users of
> i8042_command that were not calling i8042_lock_chip/i8042_unlock_chip.
> This resulted in i8042_commands being issues in between PS/2
> transactions.
>
> This change moves the mutex lock into i8042_command and removes the
> burden of locking the mutex from the callers.
>
> It is expected that the i8042_mutex is locked before calling
> i8042_aux_write or i8042_kbd_write. This is currently done by the PS/2
> layer via ps2_begin_command and ps2_end_command. Other modules
> (serio_raw) do not currently lock the mutex, so there is still a
> possibility for intermixed commands.
> @@ -343,10 +330,14 @@ int i8042_command(unsigned char *param, int command)
> unsigned long flags;
> int retval;
>
> + 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);
> +
> return retval;
There's something wrong with whitespace here. Checkpatch?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2020-08-29 7:48 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
2020-08-27 20:20 ` Raul Rangel
2020-08-29 7:47 ` Pavel Machek [this message]
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=20200829074758.GA16838@amd \
--to=pavel@ucw.cz \
--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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.