diff options
author | Manu Abraham <abraham.manu@gmail.com> | 2009-12-03 05:42:10 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-01-17 11:55:29 -0200 |
commit | e2f67e4fb931b975058b3bd48eaac43780c92c88 (patch) | |
tree | 9281b24fa70a0bf53547854b03f260688cea6f14 /drivers/media/dvb/mantis/mantis_i2c.c | |
parent | e4deee04ffda9b44f367a40dbad8306ab88cb321 (diff) | |
download | linux-e2f67e4fb931b975058b3bd48eaac43780c92c88.tar.gz linux-e2f67e4fb931b975058b3bd48eaac43780c92c88.tar.bz2 linux-e2f67e4fb931b975058b3bd48eaac43780c92c88.zip |
V4L/DVB (13712): [Mantis] Add locking for concurrent access
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/mantis/mantis_i2c.c')
-rw-r--r-- | drivers/media/dvb/mantis/mantis_i2c.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/dvb/mantis/mantis_i2c.c b/drivers/media/dvb/mantis/mantis_i2c.c index 53c5f88227be..39fabe572c2e 100644 --- a/drivers/media/dvb/mantis/mantis_i2c.c +++ b/drivers/media/dvb/mantis/mantis_i2c.c @@ -125,6 +125,7 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in struct mantis_pci *mantis; mantis = i2c_get_adapdata(adapter); + mutex_lock(&mantis->i2c_lock); for (i = 0; i < num; i++) { if (msgs[i].flags & I2C_M_RD) ret = mantis_i2c_read(mantis, &msgs[i]); @@ -134,6 +135,7 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in if (ret < 0) return ret; } + mutex_unlock(&mantis->i2c_lock); return num; } @@ -160,6 +162,7 @@ int __devinit mantis_i2c_init(struct mantis_pci *mantis) { u32 intstat, intmask; + mutex_init(&mantis->i2c_lock); memcpy(&mantis->adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter)); i2c_set_adapdata(&mantis->adapter, mantis); mantis->i2c_rc = i2c_add_adapter(&mantis->adapter); |