struct device *hardware_device;
};
-static DEFINE_SPINLOCK(comedi_file_info_table_lock);
+static DEFINE_MUTEX(comedi_file_info_table_lock);
static struct comedi_file_info *comedi_file_info_table[COMEDI_NUM_MINORS];
static struct class *comedi_class;
{
struct comedi_file_info *info;
- spin_lock(&comedi_file_info_table_lock);
+ mutex_lock(&comedi_file_info_table_lock);
info = comedi_file_info_table[minor];
comedi_file_info_table[minor] = NULL;
- spin_unlock(&comedi_file_info_table_lock);
+ mutex_unlock(&comedi_file_info_table_lock);
return info;
}
struct comedi_file_info *info;
BUG_ON(minor >= COMEDI_NUM_MINORS);
- spin_lock(&comedi_file_info_table_lock);
+ mutex_lock(&comedi_file_info_table_lock);
info = comedi_file_info_table[minor];
- spin_unlock(&comedi_file_info_table_lock);
+ mutex_unlock(&comedi_file_info_table_lock);
return info;
}
comedi_device_init(dev);
comedi_set_hw_dev(dev, hardware_device);
mutex_lock(&dev->mutex);
- spin_lock(&comedi_file_info_table_lock);
+ mutex_lock(&comedi_file_info_table_lock);
for (i = hardware_device ? comedi_num_legacy_minors : 0;
i < COMEDI_NUM_BOARD_MINORS; ++i) {
if (comedi_file_info_table[i] == NULL) {
break;
}
}
- spin_unlock(&comedi_file_info_table_lock);
+ mutex_unlock(&comedi_file_info_table_lock);
if (i == COMEDI_NUM_BOARD_MINORS) {
mutex_unlock(&dev->mutex);
comedi_device_cleanup(dev);
for (minor = comedi_num_legacy_minors; minor < COMEDI_NUM_BOARD_MINORS;
minor++) {
- spin_lock(&comedi_file_info_table_lock);
+ mutex_lock(&comedi_file_info_table_lock);
info = comedi_file_info_table[minor];
if (info && info->hardware_device == hardware_device) {
comedi_file_info_table[minor] = NULL;
- spin_unlock(&comedi_file_info_table_lock);
+ mutex_unlock(&comedi_file_info_table_lock);
comedi_free_board_file_info(info);
break;
}
- spin_unlock(&comedi_file_info_table_lock);
+ mutex_unlock(&comedi_file_info_table_lock);
}
}
info->read_subdevice = s;
if (s->subdev_flags & SDF_CMD_WRITE)
info->write_subdevice = s;
- spin_lock(&comedi_file_info_table_lock);
+ mutex_lock(&comedi_file_info_table_lock);
for (i = COMEDI_FIRST_SUBDEVICE_MINOR; i < COMEDI_NUM_MINORS; ++i) {
if (comedi_file_info_table[i] == NULL) {
comedi_file_info_table[i] = info;
break;
}
}
- spin_unlock(&comedi_file_info_table_lock);
+ mutex_unlock(&comedi_file_info_table_lock);
if (i == COMEDI_NUM_MINORS) {
kfree(info);
pr_err("comedi: error: ran out of minor numbers for subdevice files.\n");