#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/pci.h>
+#include <linux/mutex.h>
#include "dvbdev.h"
#include "dvb_demux.h"
struct i2c_adapter adapter;
int i2c_rc;
wait_queue_head_t i2c_wq;
+ struct mutex i2c_lock;
/* DVB stuff */
struct dvb_adapter dvb_adapter;
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]);
if (ret < 0)
return ret;
}
+ mutex_unlock(&mantis->i2c_lock);
return num;
}
{
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);