target: make queue_tm_rsp() return void
authorJoern Engel <joern@logfs.org>
Wed, 3 Jul 2013 15:22:17 +0000 (11:22 -0400)
committerNicholas Bellinger <nab@linux-iscsi.org>
Mon, 8 Jul 2013 01:36:53 +0000 (18:36 -0700)
The return value wasn't checked by any of the callers.  Assuming this is
correct behaviour, we can simplify some code by not bothering to
generate it.

nab: Add srpt_queue_data_in() + srpt_queue_tm_rsp() nops around
     srpt_queue_response() void return

Signed-off-by: Joern Engel <joern@logfs.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/infiniband/ulp/srpt/ib_srpt.c
drivers/scsi/qla2xxx/tcm_qla2xxx.c
drivers/target/iscsi/iscsi_target_configfs.c
drivers/target/loopback/tcm_loop.c
drivers/target/sbp/sbp_target.c
drivers/target/tcm_fc/tcm_fc.h
drivers/target/tcm_fc/tfc_cmd.c
drivers/usb/gadget/tcm_usb_gadget.c
drivers/vhost/scsi.c
include/target/target_core_fabric.h

index 3f3f041..653ac6b 100644 (file)
@@ -3011,7 +3011,7 @@ static u8 tcm_to_srp_tsk_mgmt_status(const int tcm_mgmt_status)
  * Callback function called by the TCM core. Must not block since it can be
  * invoked on the context of the IB completion handler.
  */
-static int srpt_queue_response(struct se_cmd *cmd)
+static void srpt_queue_response(struct se_cmd *cmd)
 {
        struct srpt_rdma_ch *ch;
        struct srpt_send_ioctx *ioctx;
@@ -3022,8 +3022,6 @@ static int srpt_queue_response(struct se_cmd *cmd)
        int resp_len;
        u8 srp_tm_status;
 
-       ret = 0;
-
        ioctx = container_of(cmd, struct srpt_send_ioctx, cmd);
        ch = ioctx->ch;
        BUG_ON(!ch);
@@ -3049,7 +3047,7 @@ static int srpt_queue_response(struct se_cmd *cmd)
                     || WARN_ON_ONCE(state == SRPT_STATE_CMD_RSP_SENT))) {
                atomic_inc(&ch->req_lim_delta);
                srpt_abort_cmd(ioctx);
-               goto out;
+               return;
        }
 
        dir = ioctx->cmd.data_direction;
@@ -3061,7 +3059,7 @@ static int srpt_queue_response(struct se_cmd *cmd)
                if (ret) {
                        printk(KERN_ERR "xfer_data failed for tag %llu\n",
                               ioctx->tag);
-                       goto out;
+                       return;
                }
        }
 
@@ -3082,9 +3080,17 @@ static int srpt_queue_response(struct se_cmd *cmd)
                srpt_set_cmd_state(ioctx, SRPT_STATE_DONE);
                target_put_sess_cmd(ioctx->ch->sess, &ioctx->cmd);
        }
+}
 
-out:
-       return ret;
+static int srpt_queue_data_in(struct se_cmd *cmd)
+{
+       srpt_queue_response(cmd);
+       return 0;
+}
+
+static void srpt_queue_tm_rsp(struct se_cmd *cmd)
+{
+       srpt_queue_response(cmd);
 }
 
 static int srpt_queue_status(struct se_cmd *cmd)
@@ -3097,7 +3103,8 @@ static int srpt_queue_status(struct se_cmd *cmd)
            (SCF_TRANSPORT_TASK_SENSE | SCF_EMULATED_TASK_SENSE))
                WARN_ON(cmd->scsi_status != SAM_STAT_CHECK_CONDITION);
        ioctx->queue_status_only = true;
-       return srpt_queue_response(cmd);
+       srpt_queue_response(cmd);
+       return 0;
 }
 
 static void srpt_refresh_port_work(struct work_struct *work)
@@ -3930,9 +3937,9 @@ static struct target_core_fabric_ops srpt_template = {
        .set_default_node_attributes    = srpt_set_default_node_attrs,
        .get_task_tag                   = srpt_get_task_tag,
        .get_cmd_state                  = srpt_get_tcm_cmd_state,
-       .queue_data_in                  = srpt_queue_response,
+       .queue_data_in                  = srpt_queue_data_in,
        .queue_status                   = srpt_queue_status,
-       .queue_tm_rsp                   = srpt_queue_response,
+       .queue_tm_rsp                   = srpt_queue_tm_rsp,
        /*
         * Setup function pointers for generic logic in
         * target_core_fabric_configfs.c
index bb7eb90..75caa39 100644 (file)
@@ -699,7 +699,7 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)
        return qlt_xmit_response(cmd, xmit_type, se_cmd->scsi_status);
 }
 
-static int tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd)
+static void tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd)
 {
        struct se_tmr_req *se_tmr = se_cmd->se_tmr_req;
        struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd,
@@ -731,8 +731,6 @@ static int tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd)
         * CTIO response packet.
         */
        qlt_xmit_tm_rsp(mcmd);
-
-       return 0;
 }
 
 /* Local pointer to allocated TCM configfs fabric module */
index 684d73f..7d4e19f 100644 (file)
@@ -1790,13 +1790,12 @@ static int lio_queue_status(struct se_cmd *se_cmd)
        return 0;
 }
 
-static int lio_queue_tm_rsp(struct se_cmd *se_cmd)
+static void lio_queue_tm_rsp(struct se_cmd *se_cmd)
 {
        struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
 
        cmd->i_state = ISTATE_SEND_TASKMGTRSP;
        iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state);
-       return 0;
 }
 
 static char *lio_tpg_get_endpoint_wwn(struct se_portal_group *se_tpg)
index 7c90814..568ad25 100644 (file)
@@ -786,7 +786,7 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd)
        return 0;
 }
 
-static int tcm_loop_queue_tm_rsp(struct se_cmd *se_cmd)
+static void tcm_loop_queue_tm_rsp(struct se_cmd *se_cmd)
 {
        struct se_tmr_req *se_tmr = se_cmd->se_tmr_req;
        struct tcm_loop_tmr *tl_tmr = se_tmr->fabric_tmr_ptr;
@@ -796,7 +796,6 @@ static int tcm_loop_queue_tm_rsp(struct se_cmd *se_cmd)
         */
        atomic_set(&tl_tmr->tmr_complete, 1);
        wake_up(&tl_tmr->tl_tmr_wait);
-       return 0;
 }
 
 static char *tcm_loop_dump_proto_id(struct tcm_loop_hba *tl_hba)
index d3536f5..e51b09a 100644 (file)
@@ -1842,9 +1842,8 @@ static int sbp_queue_status(struct se_cmd *se_cmd)
        return sbp_send_sense(req);
 }
 
-static int sbp_queue_tm_rsp(struct se_cmd *se_cmd)
+static void sbp_queue_tm_rsp(struct se_cmd *se_cmd)
 {
-       return 0;
 }
 
 static int sbp_check_stop_free(struct se_cmd *se_cmd)
index eea6935..0dd54a4 100644 (file)
@@ -161,7 +161,7 @@ int ft_write_pending(struct se_cmd *);
 int ft_write_pending_status(struct se_cmd *);
 u32 ft_get_task_tag(struct se_cmd *);
 int ft_get_cmd_state(struct se_cmd *);
-int ft_queue_tm_resp(struct se_cmd *);
+void ft_queue_tm_resp(struct se_cmd *);
 
 /*
  * other internal functions.
index 7b6bb72..0e5a1ca 100644 (file)
@@ -394,14 +394,14 @@ static void ft_send_tm(struct ft_cmd *cmd)
 /*
  * Send status from completed task management request.
  */
-int ft_queue_tm_resp(struct se_cmd *se_cmd)
+void ft_queue_tm_resp(struct se_cmd *se_cmd)
 {
        struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd);
        struct se_tmr_req *tmr = se_cmd->se_tmr_req;
        enum fcp_resp_rsp_codes code;
 
        if (cmd->aborted)
-               return 0;
+               return;
        switch (tmr->response) {
        case TMR_FUNCTION_COMPLETE:
                code = FCP_TMF_CMPL;
@@ -421,7 +421,6 @@ int ft_queue_tm_resp(struct se_cmd *se_cmd)
        pr_debug("tmr fn %d resp %d fcp code %d\n",
                  tmr->function, tmr->response, code);
        ft_send_resp_code(cmd, code);
-       return 0;
 }
 
 static void ft_send_work(struct work_struct *work);
index 7cacd6a..0ff3339 100644 (file)
@@ -1467,9 +1467,8 @@ static int usbg_get_cmd_state(struct se_cmd *se_cmd)
        return 0;
 }
 
-static int usbg_queue_tm_rsp(struct se_cmd *se_cmd)
+static void usbg_queue_tm_rsp(struct se_cmd *se_cmd)
 {
-       return 0;
 }
 
 static const char *usbg_check_wwn(const char *name)
index 1e5e820..b351938 100644 (file)
@@ -528,9 +528,9 @@ static int tcm_vhost_queue_status(struct se_cmd *se_cmd)
        return 0;
 }
 
-static int tcm_vhost_queue_tm_rsp(struct se_cmd *se_cmd)
+static void tcm_vhost_queue_tm_rsp(struct se_cmd *se_cmd)
 {
-       return 0;
+       return;
 }
 
 static void tcm_vhost_free_evt(struct vhost_scsi *vs, struct tcm_vhost_evt *evt)
index 1dcce9c..7a16178 100644 (file)
@@ -61,7 +61,7 @@ struct target_core_fabric_ops {
        int (*get_cmd_state)(struct se_cmd *);
        int (*queue_data_in)(struct se_cmd *);
        int (*queue_status)(struct se_cmd *);
-       int (*queue_tm_rsp)(struct se_cmd *);
+       void (*queue_tm_rsp)(struct se_cmd *);
        /*
         * fabric module calls for target_core_fabric_configfs.c
         */