block: change request end_io handler to pass back a return value
[platform/kernel/linux-starfive.git] / drivers / scsi / sg.c
index 340b050..94c5e9a 100644 (file)
@@ -177,7 +177,7 @@ typedef struct sg_device { /* holds the state of each scsi generic device */
 } Sg_device;
 
 /* tasklet or soft irq callback */
-static void sg_rq_end_io(struct request *rq, blk_status_t status);
+static enum rq_end_io_ret sg_rq_end_io(struct request *rq, blk_status_t status);
 static int sg_start_req(Sg_request *srp, unsigned char *cmd);
 static int sg_finish_rem_req(Sg_request * srp);
 static int sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size);
@@ -1311,7 +1311,7 @@ sg_rq_end_io_usercontext(struct work_struct *work)
  * This function is a "bottom half" handler that is called by the mid
  * level when a command is completed (or has failed).
  */
-static void
+static enum rq_end_io_ret
 sg_rq_end_io(struct request *rq, blk_status_t status)
 {
        struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq);
@@ -1324,11 +1324,11 @@ sg_rq_end_io(struct request *rq, blk_status_t status)
        int result, resid, done = 1;
 
        if (WARN_ON(srp->done != 0))
-               return;
+               return RQ_END_IO_NONE;
 
        sfp = srp->parentfp;
        if (WARN_ON(sfp == NULL))
-               return;
+               return RQ_END_IO_NONE;
 
        sdp = sfp->parentdp;
        if (unlikely(atomic_read(&sdp->detaching)))
@@ -1406,6 +1406,7 @@ sg_rq_end_io(struct request *rq, blk_status_t status)
                INIT_WORK(&srp->ew.work, sg_rq_end_io_usercontext);
                schedule_work(&srp->ew.work);
        }
+       return RQ_END_IO_NONE;
 }
 
 static const struct file_operations sg_fops = {