Merge tag 'f2fs-for-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeu...
[linux-2.6-block.git] / drivers / scsi / scsi_ioctl.c
index 400df3354cd64733875474d4159688fbf38a44aa..e13fd380deb6fa9252171b6d9bc9a38205498a84 100644 (file)
@@ -408,8 +408,7 @@ static int scsi_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
        return ret;
 }
 
-static int sg_io(struct scsi_device *sdev, struct gendisk *disk,
-               struct sg_io_hdr *hdr, fmode_t mode)
+static int sg_io(struct scsi_device *sdev, struct sg_io_hdr *hdr, fmode_t mode)
 {
        unsigned long start_time;
        ssize_t ret = 0;
@@ -483,7 +482,7 @@ static int sg_io(struct scsi_device *sdev, struct gendisk *disk,
 
        start_time = jiffies;
 
-       blk_execute_rq(disk, rq, at_head);
+       blk_execute_rq(rq, at_head);
 
        hdr->duration = jiffies_to_msecs(jiffies - start_time);
 
@@ -499,19 +498,12 @@ out_put_request:
 /**
  * sg_scsi_ioctl  --  handle deprecated SCSI_IOCTL_SEND_COMMAND ioctl
  * @q:         request queue to send scsi commands down
- * @disk:      gendisk to operate on (option)
  * @mode:      mode used to open the file through which the ioctl has been
  *             submitted
  * @sic:       userspace structure describing the command to perform
  *
  * Send down the scsi command described by @sic to the device below
- * the request queue @q.  If @file is non-NULL it's used to perform
- * fine-grained permission checks that allow users to send down
- * non-destructive SCSI commands.  If the caller has a struct gendisk
- * available it should be passed in as @disk to allow the low level
- * driver to use the information contained in it.  A non-NULL @disk
- * is only allowed if the caller knows that the low level driver doesn't
- * need it (e.g. in the scsi subsystem).
+ * the request queue @q.
  *
  * Notes:
  *   -  This interface is deprecated - users should use the SG_IO
@@ -530,8 +522,8 @@ out_put_request:
  *      Positive numbers returned are the compacted SCSI error codes (4
  *      bytes in one int) where the lowest byte is the SCSI status.
  */
-static int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk,
-               fmode_t mode, struct scsi_ioctl_command __user *sic)
+static int sg_scsi_ioctl(struct request_queue *q, fmode_t mode,
+               struct scsi_ioctl_command __user *sic)
 {
        enum { OMAX_SB_LEN = 16 };      /* For backward compatibility */
        struct request *rq;
@@ -620,7 +612,7 @@ static int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk,
                        goto error;
        }
 
-       blk_execute_rq(disk, rq, 0);
+       blk_execute_rq(rq, false);
 
        err = req->result & 0xff;       /* only 8 bit SCSI status */
        if (err) {
@@ -806,8 +798,8 @@ static int scsi_put_cdrom_generic_arg(const struct cdrom_generic_command *cgc,
        return 0;
 }
 
-static int scsi_cdrom_send_packet(struct scsi_device *sdev, struct gendisk *disk,
-               fmode_t mode, void __user *arg)
+static int scsi_cdrom_send_packet(struct scsi_device *sdev, fmode_t mode,
+               void __user *arg)
 {
        struct cdrom_generic_command cgc;
        struct sg_io_hdr hdr;
@@ -847,7 +839,7 @@ static int scsi_cdrom_send_packet(struct scsi_device *sdev, struct gendisk *disk
        hdr.cmdp = ((struct cdrom_generic_command __user *) arg)->cmd;
        hdr.cmd_len = sizeof(cgc.cmd);
 
-       err = sg_io(sdev, disk, &hdr, mode);
+       err = sg_io(sdev, &hdr, mode);
        if (err == -EFAULT)
                return -EFAULT;
 
@@ -862,8 +854,8 @@ static int scsi_cdrom_send_packet(struct scsi_device *sdev, struct gendisk *disk
        return err;
 }
 
-static int scsi_ioctl_sg_io(struct scsi_device *sdev, struct gendisk *disk,
-               fmode_t mode, void __user *argp)
+static int scsi_ioctl_sg_io(struct scsi_device *sdev, fmode_t mode,
+               void __user *argp)
 {
        struct sg_io_hdr hdr;
        int error;
@@ -871,7 +863,7 @@ static int scsi_ioctl_sg_io(struct scsi_device *sdev, struct gendisk *disk,
        error = get_sg_io_hdr(&hdr, argp);
        if (error)
                return error;
-       error = sg_io(sdev, disk, &hdr, mode);
+       error = sg_io(sdev, &hdr, mode);
        if (error == -EFAULT)
                return error;
        if (put_sg_io_hdr(&hdr, argp))
@@ -882,7 +874,6 @@ static int scsi_ioctl_sg_io(struct scsi_device *sdev, struct gendisk *disk,
 /**
  * scsi_ioctl - Dispatch ioctl to scsi device
  * @sdev: scsi device receiving ioctl
- * @disk: disk receiving the ioctl
  * @mode: mode the block/char device is opened with
  * @cmd: which ioctl is it
  * @arg: data associated with ioctl
@@ -891,8 +882,8 @@ static int scsi_ioctl_sg_io(struct scsi_device *sdev, struct gendisk *disk,
  * does not take a major/minor number as the dev field.  Rather, it takes
  * a pointer to a &struct scsi_device.
  */
-int scsi_ioctl(struct scsi_device *sdev, struct gendisk *disk, fmode_t mode,
-               int cmd, void __user *arg)
+int scsi_ioctl(struct scsi_device *sdev, fmode_t mode, int cmd,
+               void __user *arg)
 {
        struct request_queue *q = sdev->request_queue;
        struct scsi_sense_hdr sense_hdr;
@@ -927,11 +918,11 @@ int scsi_ioctl(struct scsi_device *sdev, struct gendisk *disk, fmode_t mode,
        case SG_EMULATED_HOST:
                return sg_emulated_host(q, arg);
        case SG_IO:
-               return scsi_ioctl_sg_io(sdev, disk, mode, arg);
+               return scsi_ioctl_sg_io(sdev, mode, arg);
        case SCSI_IOCTL_SEND_COMMAND:
-               return sg_scsi_ioctl(q, disk, mode, arg);
+               return sg_scsi_ioctl(q, mode, arg);
        case CDROM_SEND_PACKET:
-               return scsi_cdrom_send_packet(sdev, disk, mode, arg);
+               return scsi_cdrom_send_packet(sdev, mode, arg);
        case CDROMCLOSETRAY:
                return scsi_send_start_stop(sdev, 3);
        case CDROMEJECT: