Skip to content

Commit f7fea18

Browse files
msegaudJames Bottomley
authored andcommitted
[SCSI] ch: Convert to use unlocked_ioctl
As of now, compat_ioctl already runs without the BKL, whereas ioctl runs with the BKL. This patch first converts changer_fops to use a .unlocked_ioctl member. It applies the same locking rationale than ch_ioctl_compat() uses to ch_ioctl(). Signed-off-by: Mathieu Segaud <[email protected]> Reviewed-by: Matthew Wilcox <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent eaa3e22 commit f7fea18

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

drivers/scsi/ch.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ static int ch_probe(struct device *);
9292
static int ch_remove(struct device *);
9393
static int ch_open(struct inode * inode, struct file * filp);
9494
static int ch_release(struct inode * inode, struct file * filp);
95-
static int ch_ioctl(struct inode * inode, struct file * filp,
96-
unsigned int cmd, unsigned long arg);
95+
static long ch_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
9796
#ifdef CONFIG_COMPAT
9897
static long ch_ioctl_compat(struct file * filp,
9998
unsigned int cmd, unsigned long arg);
@@ -130,12 +129,12 @@ static struct scsi_driver ch_template =
130129

131130
static const struct file_operations changer_fops =
132131
{
133-
.owner = THIS_MODULE,
134-
.open = ch_open,
135-
.release = ch_release,
136-
.ioctl = ch_ioctl,
132+
.owner = THIS_MODULE,
133+
.open = ch_open,
134+
.release = ch_release,
135+
.unlocked_ioctl = ch_ioctl,
137136
#ifdef CONFIG_COMPAT
138-
.compat_ioctl = ch_ioctl_compat,
137+
.compat_ioctl = ch_ioctl_compat,
139138
#endif
140139
};
141140

@@ -626,7 +625,7 @@ ch_checkrange(scsi_changer *ch, unsigned int type, unsigned int unit)
626625
return 0;
627626
}
628627

629-
static int ch_ioctl(struct inode * inode, struct file * file,
628+
static long ch_ioctl(struct file *file,
630629
unsigned int cmd, unsigned long arg)
631630
{
632631
scsi_changer *ch = file->private_data;
@@ -887,8 +886,7 @@ static long ch_ioctl_compat(struct file * file,
887886
case CHIOINITELEM:
888887
case CHIOSVOLTAG:
889888
/* compatible */
890-
return ch_ioctl(NULL /* inode, unused */,
891-
file, cmd, arg);
889+
return ch_ioctl(file, cmd, arg);
892890
case CHIOGSTATUS32:
893891
{
894892
struct changer_element_status32 ces32;

0 commit comments

Comments
 (0)