Replace the BKL calls in the chrdev_{open,release} interfaces with a
simple sleeping mutex.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
static DEFINE_MUTEX(idetape_ref_mutex);
static DEFINE_MUTEX(idetape_ref_mutex);
+static DEFINE_MUTEX(idetape_chrdev_mutex);
+
static struct class *idetape_sysfs_class;
static void ide_tape_release(struct device *);
static struct class *idetape_sysfs_class;
static void ide_tape_release(struct device *);
if (i >= MAX_HWIFS * MAX_DRIVES)
return -ENXIO;
if (i >= MAX_HWIFS * MAX_DRIVES)
return -ENXIO;
+ mutex_lock(&idetape_chrdev_mutex);
+
tape = ide_tape_get(NULL, true, i);
if (!tape) {
tape = ide_tape_get(NULL, true, i);
if (!tape) {
+ mutex_unlock(&idetape_chrdev_mutex);
tape->door_locked = DOOR_LOCKED;
}
}
tape->door_locked = DOOR_LOCKED;
}
}
+ mutex_unlock(&idetape_chrdev_mutex);
+
return 0;
out_put_tape:
ide_tape_put(tape);
return 0;
out_put_tape:
ide_tape_put(tape);
+
+ mutex_unlock(&idetape_chrdev_mutex);
+
ide_drive_t *drive = tape->drive;
unsigned int minor = iminor(inode);
ide_drive_t *drive = tape->drive;
unsigned int minor = iminor(inode);
+ mutex_lock(&idetape_chrdev_mutex);
+
tape = drive->driver_data;
ide_debug_log(IDE_DBG_FUNC, "enter");
tape = drive->driver_data;
ide_debug_log(IDE_DBG_FUNC, "enter");
}
clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags);
ide_tape_put(tape);
}
clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags);
ide_tape_put(tape);
+
+ mutex_unlock(&idetape_chrdev_mutex);
+