aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/mantis/mantis_i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/mantis/mantis_i2c.c')
-rw-r--r--drivers/media/dvb/mantis/mantis_i2c.c3
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
125 struct mantis_pci *mantis; 125 struct mantis_pci *mantis;
126 126
127 mantis = i2c_get_adapdata(adapter); 127 mantis = i2c_get_adapdata(adapter);
128 mutex_lock(&mantis->i2c_lock);
128 for (i = 0; i < num; i++) { 129 for (i = 0; i < num; i++) {
129 if (msgs[i].flags & I2C_M_RD) 130 if (msgs[i].flags & I2C_M_RD)
130 ret = mantis_i2c_read(mantis, &msgs[i]); 131 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
134 if (ret < 0) 135 if (ret < 0)
135 return ret; 136 return ret;
136 } 137 }
138 mutex_unlock(&mantis->i2c_lock);
137 139
138 return num; 140 return num;
139} 141}
@@ -160,6 +162,7 @@ int __devinit mantis_i2c_init(struct mantis_pci *mantis)
160{ 162{
161 u32 intstat, intmask; 163 u32 intstat, intmask;
162 164
165 mutex_init(&mantis->i2c_lock);
163 memcpy(&mantis->adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter)); 166 memcpy(&mantis->adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter));
164 i2c_set_adapdata(&mantis->adapter, mantis); 167 i2c_set_adapdata(&mantis->adapter, mantis);
165 mantis->i2c_rc = i2c_add_adapter(&mantis->adapter); 168 mantis->i2c_rc = i2c_add_adapter(&mantis->adapter);