]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
I2C: mv64xxx: fix race between FSM/interrupt and process context
authorRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 16 May 2013 20:39:12 +0000 (21:39 +0100)
committerWolfram Sang <wsa@the-dreams.de>
Wed, 5 Jun 2013 21:06:48 +0000 (23:06 +0200)
commit4243fa0bad551b8c8d4ff7104e8fd557ae848845
tree0c1ed68b9ed3963663dc71ba093d83b47318e3ba
parent3420afbc06058c9c13f7d69cf48b9d5429db6bd9
I2C: mv64xxx: fix race between FSM/interrupt and process context

Asking for a multi-part message to be handled by this driver is racy; it
has been observed that the following sequence is possible with this
driver:

- send start
- send address + write
- send data
- send (repeated) start
- send address + write
- send (repeated) start
- send address + read
- unrecoverable bus hang (except by system reset)

The problem is that the interrupt handling sees the next event after the
first repeated start is sent - the IFLG bit is set in the register even
though INTEN is disabled.

Let's fix this by moving all of the message processing into interrupt
context, rather than having it partly in IRQ and partly in process
context.  This allows us to move immediately to the next message in the
interrupt handler and get on with the transfer, rather than incuring a
couple of scheduling switches to get the next message.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-mv64xxx.c