dib8000: make 32 bits read atomic
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Fri, 13 Dec 2013 13:35:03 +0000 (10:35 -0300)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 1 Apr 2014 23:58:39 +0000 (00:58 +0100)
commitc54c36c41b6cd911e5df0e7587451ef1218a2a84
tree43338a5ede7a02007b52d7145805766c23d082d6
parentdc12cd1954a93e996efb15b4d333ab05788d58fa
dib8000: make 32 bits read atomic

commit 5ac64ba12aca3bef18e61c866583155a3bbf81c4 upstream.

As the dvb-frontend kthread can be called anytime, it can race
with some get status ioctl. So, it seems better to avoid one to
race with the other while reading a 32 bits register.
I can't see any other reason for having a mutex there at I2C, except
to provide such kind of protection, as the I2C core already has a
mutex to protect I2C transfers.

Note: instead of this approach, it could eventually remove the dib8000
specific mutex for it, and either group the 4 ops into one xfer or
to manually control the I2C mutex. The main advantage of the current
approach is that the changes are smaller and more puntual.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/media/dvb/frontends/dib8000.c