Make better use of static type checking
Subsystems (72)
Bart Van Assche
maintainerPATCH 85/117 qla2xxx: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/qla2xxx/qla_bsg.c | 148 ++++++++++++++++---------------- drivers/scsi/qla2xxx/qla_iocb.c | 4 +- drivers/scsi/qla2xxx/qla_isr.c | 14 +-- drivers/scsi/qla2xxx/qla_mr.c | 6 +- drivers/scsi/qla2xxx/qla_os.c | 26 +++--- 5 files changed, 99 insertions(+), 99 deletions(-)
drivers/scsi/qla2xxx/qla_bsg.c +74 -74
@@ -27,8 +27,8 @@ void qla2x00_bsg_job_done(srb_t *sp, int res) sp->free (sp); - bsg_reply->result = res; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined = res; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); }
@@ -156,10 +156,10 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) ha->fcp_prio_cfg->attributes &= ~FCP_PRIO_ATTR_ENABLE ;qla24xx_update_all_fcp_prio (vha); - bsg_reply->result =DID_OK ; + bsg_reply->status.combined =DID_OK ; }else { ret = -EINVAL ; - bsg_reply->result = (DID_ERROR <<16 ); + bsg_reply->status.combined = (DID_ERROR <<16 ); goto exit_fcp_prio_cfg; }break ;
@@ -171,10 +171,10 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) ha->fcp_prio_cfg->attributes |=FCP_PRIO_ATTR_ENABLE ;qla24xx_update_all_fcp_prio (vha); - bsg_reply->result =DID_OK ; + bsg_reply->status.combined =DID_OK ; }else { ret = -EINVAL ; - bsg_reply->result = (DID_ERROR <<16 ); + bsg_reply->status.combined = (DID_ERROR <<16 ); goto exit_fcp_prio_cfg; } }
@@ -184,11 +184,11 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) len = bsg_job->reply_payload.payload_len;if (!len || len >FCP_PRIO_CFG_SIZE ) { ret = -EINVAL ; - bsg_reply->result = (DID_ERROR <<16 ); + bsg_reply->status.combined = (DID_ERROR <<16 ); goto exit_fcp_prio_cfg; } - bsg_reply->result =DID_OK ; + bsg_reply->status.combined =DID_OK ; bsg_reply->reply_payload_rcv_len = sg_copy_from_buffer( bsg_job->reply_payload.sg_list,
@@ -200,7 +200,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job)case QLFC_FCP_PRIO_SET_CONFIG : len = bsg_job->request_payload.payload_len;if (!len || len >FCP_PRIO_CFG_SIZE ) { - bsg_reply->result = (DID_ERROR <<16 ); + bsg_reply->status.combined = (DID_ERROR <<16 ); ret = -EINVAL ; goto exit_fcp_prio_cfg; }
@@ -211,7 +211,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job)ql_log (ql_log_warn, vha,0x7050 ,"Unable to allocate memory for fcp prio " "config data (%x).\n" ,FCP_PRIO_CFG_SIZE ); - bsg_reply->result = (DID_ERROR <<16 ); + bsg_reply->status.combined = (DID_ERROR <<16 ); ret = -ENOMEM ; goto exit_fcp_prio_cfg; }
@@ -225,7 +225,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job)/* validate fcp priority data */ if (!qla24xx_fcp_prio_cfg_valid (vha, ha->fcp_prio_cfg,1 )) { - bsg_reply->result = (DID_ERROR <<16 ); + bsg_reply->status.combined = (DID_ERROR <<16 ); ret = -EINVAL ;/* If buffer was invalidatic int * fcp_prio_cfg is of no use
@@ -239,7 +239,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job)if (ha->fcp_prio_cfg->attributes &FCP_PRIO_ATTR_ENABLE ) ha->flags.fcp_prio_enabled =1 ;qla24xx_update_all_fcp_prio (vha); - bsg_reply->result =DID_OK ; + bsg_reply->status.combined =DID_OK ;break ;default : ret = -EINVAL ;
@@ -247,7 +247,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) } exit_fcp_prio_cfg:if (!ret) -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return ret; }
@@ -917,12 +917,12 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) "Vendor request %s failed.\n", type); rval =0 ; - bsg_reply->result = (DID_ERROR <<16 ); + bsg_reply->status.combined = (DID_ERROR <<16 ); bsg_reply->reply_payload_rcv_len =0 ; }else {ql_dbg (ql_dbg_user, vha,0x702d ,"Vendor request %s completed.\n" , type); - bsg_reply->result = (DID_OK <<16 ); + bsg_reply->status.combined = (DID_OK <<16 );sg_copy_from_buffer (bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, rsp_data, rsp_data_len);
@@ -951,7 +951,7 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);if (!rval) -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return rval; }
@@ -984,8 +984,8 @@ qla84xx_reset(struct bsg_job *bsg_job) }else {ql_dbg (ql_dbg_user, vha,0x7031 ,"Vendor request 84xx reset completed.\n" ); - bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); }
@@ -1084,7 +1084,7 @@ qla84xx_updatefw(struct bsg_job *bsg_job) "Vendor request 84xx updatefw completed.\n"); bsg_job->reply_len =sizeof (struct fc_bsg_reply ); - bsg_reply->result =DID_OK ; + bsg_reply->status.combined =DID_OK ; }dma_pool_free (ha->s_dma_pool, mn, mn_dma);
@@ -1097,7 +1097,7 @@ qla84xx_updatefw(struct bsg_job *bsg_job) bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);if (!rval) -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return rval; }
@@ -1265,7 +1265,7 @@ qla84xx_mgmt_cmd(struct bsg_job *bsg_job) "Vendor request 84xx mgmt completed.\n"); bsg_job->reply_len =sizeof (struct fc_bsg_reply ); - bsg_reply->result =DID_OK ; + bsg_reply->status.combined =DID_OK ;if ((ql84_mgmt->mgmt.cmd ==QLA84_MGMT_READ_MEM ) || (ql84_mgmt->mgmt.cmd ==QLA84_MGMT_GET_INFO )) {
@@ -1293,7 +1293,7 @@ qla84xx_mgmt_cmd(struct bsg_job *bsg_job)dma_pool_free (ha->s_dma_pool, mn, mn_dma);if (!rval) -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return rval; }
@@ -1379,8 +1379,8 @@ qla24xx_iidma(struct bsg_job *bsg_job) sizeof(struct qla_port_param)); } - bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); }
@@ -1484,12 +1484,12 @@ qla2x00_read_optrom(struct bsg_job *bsg_job) ha->optrom_region_size); bsg_reply->reply_payload_rcv_len = ha->optrom_region_size; - bsg_reply->result =DID_OK ; + bsg_reply->status.combined =DID_OK ;vfree (ha->optrom_buffer); ha->optrom_buffer =NULL ; ha->optrom_state =QLA_SWAITING ;mutex_unlock (&ha->optrom_mutex); -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return rval; }
@@ -1521,16 +1521,16 @@ qla2x00_update_optrom(struct bsg_job *bsg_job) ha->optrom_region_start, ha->optrom_region_size);if (rval) { - bsg_reply->result = -EINVAL ; + bsg_reply->status.combined = -EINVAL ; rval = -EINVAL ; }else { - bsg_reply->result =DID_OK ; + bsg_reply->status.combined =DID_OK ; }vfree (ha->optrom_buffer); ha->optrom_buffer =NULL ; ha->optrom_state =QLA_SWAITING ;mutex_unlock (&ha->optrom_mutex); -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return rval; }
@@ -1581,8 +1581,8 @@ qla2x00_update_fru_versions(struct bsg_job *bsg_job) done: bsg_job->reply_len =sizeof (struct fc_bsg_reply ); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return 0 ;
@@ -1632,8 +1632,8 @@ qla2x00_read_fru_status(struct bsg_job *bsg_job) done: bsg_job->reply_len =sizeof (struct fc_bsg_reply ); bsg_reply->reply_payload_rcv_len =sizeof (*sr); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return 0 ;
@@ -1679,8 +1679,8 @@ qla2x00_write_fru_status(struct bsg_job *bsg_job) done: bsg_job->reply_len =sizeof (struct fc_bsg_reply ); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return 0 ;
@@ -1725,8 +1725,8 @@ qla2x00_write_i2c(struct bsg_job *bsg_job) done: bsg_job->reply_len =sizeof (struct fc_bsg_reply ); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return 0 ;
@@ -1775,8 +1775,8 @@ qla2x00_read_i2c(struct bsg_job *bsg_job) done: bsg_job->reply_len =sizeof (struct fc_bsg_reply ); bsg_reply->reply_payload_rcv_len =sizeof (*i2c); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return 0 ;
@@ -1953,8 +1953,8 @@ qla24xx_process_bidir_cmd(struct bsg_job *bsg_job) bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] = rval; bsg_job->reply_len =sizeof (struct fc_bsg_reply ); bsg_reply->reply_payload_rcv_len =0 ; - bsg_reply->result = (DID_OK ) <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined = (DID_OK ) <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);/* Always return success, vendor rsp carries correct status */ return 0 ;
@@ -2119,8 +2119,8 @@ qla26xx_serdes_op(struct bsg_job *bsg_job) rval ?EXT_STATUS_MAILBOX :0 ; bsg_job->reply_len =sizeof (struct fc_bsg_reply ); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return 0 ; }
@@ -2161,8 +2161,8 @@ qla8044_serdes_op(struct bsg_job *bsg_job) rval ?EXT_STATUS_MAILBOX :0 ; bsg_job->reply_len =sizeof (struct fc_bsg_reply ); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return 0 ; }
@@ -2193,8 +2193,8 @@ qla27xx_get_flash_upd_cap(struct bsg_job *bsg_job)EXT_STATUS_OK ; bsg_job->reply_len =sizeof (struct fc_bsg_reply ); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return 0 ; }
@@ -2239,8 +2239,8 @@ qla27xx_set_flash_upd_cap(struct bsg_job *bsg_job)EXT_STATUS_OK ; bsg_job->reply_len =sizeof (struct fc_bsg_reply ); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return 0 ; }
@@ -2298,8 +2298,8 @@ qla27xx_get_bbcr_data(struct bsg_job *bsg_job) bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] =EXT_STATUS_OK ; bsg_job->reply_len =sizeof (struct fc_bsg_reply ); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return 0 ; }
@@ -2353,8 +2353,8 @@ qla2x00_get_priv_stats(struct bsg_job *bsg_job) rval ?EXT_STATUS_MAILBOX :EXT_STATUS_OK ; bsg_job->reply_len =sizeof (*bsg_reply); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); dma_free_coherent(&ha->pdev->dev, sizeof(*stats),
@@ -2398,8 +2398,8 @@ qla2x00_do_dport_diagnostics(struct bsg_job *bsg_job) rval ?EXT_STATUS_MAILBOX :EXT_STATUS_OK ; bsg_job->reply_len =sizeof (*bsg_reply); - bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);kfree (dd);
@@ -2438,10 +2438,10 @@ qla2x00_get_flash_image_status(struct bsg_job *bsg_job) bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] =EXT_STATUS_OK ; bsg_reply->reply_payload_rcv_len =sizeof (regions); - bsg_reply->result =DID_OK <<16 ; + bsg_reply->status.combined =DID_OK <<16 ; bsg_job->reply_len =sizeof (struct fc_bsg_reply ); -bsg_job_done (bsg_job, bsg_reply->result, - bsg_reply->reply_payload_rcv_len); +bsg_job_done (bsg_job, bsg_reply->status.combined, + bsg_reply->reply_payload_rcv_len);return 0 ; }
@@ -2508,8 +2508,8 @@ qla2x00_manage_host_stats(struct bsg_job *bsg_job) &rsp_data, sizeof(struct ql_vnd_mng_host_stats_resp)); - bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return ret;
@@ -2577,8 +2577,8 @@ qla2x00_get_host_stats(struct bsg_job *bsg_job) bsg_job->reply_payload.sg_cnt, &rsp_data, sizeof(struct ql_vnd_mng_host_stats_resp)); - bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); goto host_stat_out; }
@@ -2598,8 +2598,8 @@ qla2x00_get_host_stats(struct bsg_job *bsg_job) bsg_reply->reply_payload_rcv_len =sg_copy_from_buffer (bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, data, response_len); - bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);kfree (data);
@@ -2675,8 +2675,8 @@ qla2x00_get_tgt_stats(struct bsg_job *bsg_job) bsg_job->reply_payload.sg_cnt, data, sizeof(struct ql_vnd_tgt_stats_resp)); - bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); goto tgt_stat_out; }
@@ -2698,8 +2698,8 @@ qla2x00_get_tgt_stats(struct bsg_job *bsg_job)sg_copy_from_buffer (bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, data, response_len); - bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); tgt_stat_out:
@@ -2760,8 +2760,8 @@ qla2x00_manage_host_port(struct bsg_job *bsg_job)sg_copy_from_buffer (bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, &rsp_data,sizeof (struct ql_vnd_mng_host_port_resp )); - bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->status.combined =DID_OK ; +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return ret;
@@ -2888,7 +2888,7 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) goto skip_chip_chk;if (vha->hw->flags.port_isolated) { - bsg_reply->result =DID_ERROR ; + bsg_reply->status.combined =DID_ERROR ;/* operation not permitted */ return -EPERM ; }
@@ -2956,12 +2956,12 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job)ql_log (ql_log_warn, vha,0x7089 ,"mbx abort_command " "failed.\n" ); - bsg_reply->result = -EIO ; + bsg_reply->status.combined = -EIO ; }else {ql_dbg (ql_dbg_user, vha,0x708a ,"mbx abort_command " "success.\n" ); - bsg_reply->result =0 ; + bsg_reply->status.combined =0 ; }spin_lock_irqsave (&ha->hardware_lock, flags); goto done;
@@ -2971,7 +2971,7 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job) }spin_unlock_irqrestore (&ha->hardware_lock, flags);ql_log (ql_log_info, vha,0x708b ,"SRB not found to abort.\n" ); - bsg_reply->result = -ENXIO ; + bsg_reply->status.combined = -ENXIO ;return 0 ; done:
drivers/scsi/qla2xxx/qla_iocb.c +2 -2
@@ -2123,13 +2123,13 @@ qla2xxx_dif_start_scsi_mq(srb_t *sp)/* Check for host side state */ if (!qpair->online) { - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ;return QLA_INTERFACE_ERROR ; }if (!qpair->difdix_supported &&scsi_get_prot_op (cmd) !=SCSI_PROT_NORMAL ) { - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ;return QLA_INTERFACE_ERROR ; }
drivers/scsi/qla2xxx/qla_isr.c +7 -7
@@ -2578,7 +2578,7 @@ qla2x00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t par_sense_len,if (track_sense_len !=0 ) { rsp->status_srb = sp; - cp->result = res; + cp->status.combined = res; }if (sense_len) {
@@ -2653,7 +2653,7 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) cmd->device->sector_size);scsi_set_resid (cmd, resid); - cmd->result =DID_OK <<16 ; + cmd->status.combined =DID_OK <<16 ;/* Update protection tag */ if (scsi_prot_sg_count (cmd)) {
@@ -2698,7 +2698,7 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) 0x10, 0x1);set_driver_byte (cmd,DRIVER_SENSE );set_host_byte (cmd,DID_ABORT ); - cmd->result |=SAM_STAT_CHECK_CONDITION ; + cmd->status.combined |=SAM_STAT_CHECK_CONDITION ;return 1 ; }
@@ -2708,7 +2708,7 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) 0x10, 0x3);set_driver_byte (cmd,DRIVER_SENSE );set_host_byte (cmd,DID_ABORT ); - cmd->result |=SAM_STAT_CHECK_CONDITION ; + cmd->status.combined |=SAM_STAT_CHECK_CONDITION ;return 1 ; }
@@ -2718,7 +2718,7 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) 0x10, 0x2);set_driver_byte (cmd,DRIVER_SENSE );set_host_byte (cmd,DID_ABORT ); - cmd->result |=SAM_STAT_CHECK_CONDITION ; + cmd->status.combined |=SAM_STAT_CHECK_CONDITION ;return 1 ; }
@@ -3216,7 +3216,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)case CS_DIF_ERROR : logit =qla2x00_handle_dif_error (sp, sts24); - res = cp->result; + res = cp->status.combined;break ;case CS_TRANSPORT :
@@ -3317,7 +3317,7 @@ qla2x00_status_cont_entry(struct rsp_que *rsp, sts_cont_entry_t *pkt)/* Place command on done queue. */ if (sense_len ==0 ) { rsp->status_srb =NULL ; - sp->done (sp, cp->result); + sp->done (sp, cp->status.combined); } }
drivers/scsi/qla2xxx/qla_mr.c +3 -3
@@ -2154,7 +2154,7 @@ qlafx00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t par_sense_len, sense_len, par_sense_len, track_sense_len);if (GET_FW_SENSE_LEN (sp) >0 ) { rsp->status_srb = sp; - cp->result = res; + cp->status.combined = res; }if (sense_len) {
@@ -2255,7 +2255,7 @@ qlafx00_ioctl_iosb_entry(scsi_qla_host_t *vha, struct req_que *req, sp->vha,0x5074 , fw_sts_ptr, sizeof(fstatus)); - res = bsg_reply->result =DID_OK <<16 ; + res = bsg_reply->status.combined =DID_OK <<16 ; bsg_reply->reply_payload_rcv_len = bsg_job->reply_payload.payload_len; }
@@ -2612,7 +2612,7 @@ qlafx00_status_cont_entry(struct rsp_que *rsp, sts_cont_entry_t *pkt)/* Place command on done queue. */ if (sense_len ==0 ) { rsp->status_srb =NULL ; - sp->done (sp, cp->result); + sp->done (sp, cp->status.combined); }else {WARN_ON_ONCE (true); }
drivers/scsi/qla2xxx/qla_os.c +13 -13
@@ -729,7 +729,7 @@ void qla2x00_sp_compl(srb_t *sp, int res)struct completion *comp = sp->comp; sp->free (sp); - cmd->result = res; + cmd->status.combined = res;CMD_SP (cmd) =NULL ; cmd->scsi_done (cmd);if (comp)
@@ -820,7 +820,7 @@ void qla2xxx_qpair_sp_compl(srb_t *sp, int res)struct completion *comp = sp->comp; sp->free (sp); - cmd->result = res; + cmd->status.combined = res;CMD_SP (cmd) =NULL ; cmd->scsi_done (cmd);if (comp)
@@ -840,7 +840,7 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)if (unlikely (test_bit (UNLOADING , &base_vha->dpc_flags)) ||WARN_ON_ONCE (!rport)) { - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ; goto qc24_fail_command; }
@@ -862,18 +862,18 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)ql_dbg (ql_dbg_aer, vha,0x9010 ,"PCI Channel IO permanent failure, exiting " "cmd=%p.\n" , cmd); - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ; }else {ql_dbg (ql_dbg_aer, vha,0x9011 ,"EEH_Busy, Requeuing the cmd=%p.\n" , cmd); - cmd->result =DID_REQUEUE <<16 ; + cmd->status.combined =DID_REQUEUE <<16 ; } goto qc24_fail_command; } rval =fc_remote_port_chkready (rport);if (rval) { - cmd->result = rval; + cmd->status.combined = rval;ql_dbg (ql_dbg_io + ql_dbg_verbose, vha,0x3003 ,"fc_remote_port_chkready failed for cmd=%p, rval=0x%x.\n" , cmd, rval);
@@ -885,12 +885,12 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)ql_dbg (ql_dbg_io, vha,0x3004 ,"DIF Cap not reg, fail DIF capable cmd's:%p.\n" , cmd); - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ; goto qc24_fail_command; }if (!fcport || fcport->deleted) { - cmd->result =DID_IMM_RETRY <<16 ; + cmd->status.combined =DID_IMM_RETRY <<16 ; goto qc24_fail_command; }
@@ -901,7 +901,7 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)"Returning DNC, fcport_state=%d loop_state=%d.\n" ,atomic_read (&fcport->state), atomic_read(&base_vha->loop_state)); - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ; goto qc24_fail_command; } goto qc24_target_busy;
@@ -964,7 +964,7 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd, rval = rport ?fc_remote_port_chkready (rport) : (DID_NO_CONNECT <<16 );if (rval) { - cmd->result = rval; + cmd->status.combined = rval;ql_dbg (ql_dbg_io + ql_dbg_verbose, vha,0x3076 ,"fc_remote_port_chkready failed for cmd=%p, rval=0x%x.\n" , cmd, rval);
@@ -974,12 +974,12 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd,if (!qpair->online) {ql_dbg (ql_dbg_io, vha,0x3077 ,"qpair not online. eeh_busy=%d.\n" , ha->flags.eeh_busy); - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ; goto qc24_fail_command; }if (!fcport || fcport->deleted) { - cmd->result =DID_IMM_RETRY <<16 ; + cmd->status.combined =DID_IMM_RETRY <<16 ; goto qc24_fail_command; }
@@ -990,7 +990,7 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd,"Returning DNC, fcport_state=%d loop_state=%d.\n" ,atomic_read (&fcport->state), atomic_read(&base_vha->loop_state)); - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ; goto qc24_fail_command; } goto qc24_target_busy;
Bart Van Assche
maintainerPATCH 86/117 qla4xxx: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/qla4xxx/ql4_bsg.c | 76 +++++++++++++++++----------------- drivers/scsi/qla4xxx/ql4_isr.c | 32 +++++++------- drivers/scsi/qla4xxx/ql4_os.c | 14 +++---- 3 files changed, 61 insertions(+), 61 deletions(-)
drivers/scsi/qla4xxx/ql4_bsg.c +38 -38
@@ -55,17 +55,17 @@ qla4xxx_read_flash(struct bsg_job *bsg_job) rval =qla4xxx_get_flash (ha, flash_dma, offset, length);if (rval) {ql4_printk (KERN_ERR , ha,"%s: get flash failed\n" , __func__); - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; rval = -EIO ; }else { bsg_reply->reply_payload_rcv_len =sg_copy_from_buffer (bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, flash, length); - bsg_reply->result =DID_OK <<16 ; + bsg_reply->status.combined =DID_OK <<16 ; } -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);dma_free_coherent (&ha->pdev->dev, length, flash, flash_dma); leave:
@@ -125,12 +125,12 @@ qla4xxx_update_flash(struct bsg_job *bsg_job) rval =qla4xxx_set_flash (ha, flash_dma, offset, length, options);if (rval) {ql4_printk (KERN_ERR , ha,"%s: set flash failed\n" , __func__); - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; rval = -EIO ; }else - bsg_reply->result =DID_OK <<16 ; + bsg_reply->status.combined =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);dma_free_coherent (&ha->pdev->dev, length, flash, flash_dma); leave:
@@ -179,17 +179,17 @@ qla4xxx_get_acb_state(struct bsg_job *bsg_job)if (rval) {ql4_printk (KERN_ERR , ha,"%s: get ip state failed\n" , __func__); - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; rval = -EIO ; }else { bsg_reply->reply_payload_rcv_len =sg_copy_from_buffer (bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, status,sizeof (status)); - bsg_reply->result =DID_OK <<16 ; + bsg_reply->status.combined =DID_OK <<16 ; } -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); leave:return rval;
@@ -250,17 +250,17 @@ qla4xxx_read_nvram(struct bsg_job *bsg_job) rval =qla4xxx_get_nvram (ha, nvram_dma, offset, len);if (rval) {ql4_printk (KERN_ERR , ha,"%s: get nvram failed\n" , __func__); - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; rval = -EIO ; }else { bsg_reply->reply_payload_rcv_len =sg_copy_from_buffer (bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, nvram, len); - bsg_reply->result =DID_OK <<16 ; + bsg_reply->status.combined =DID_OK <<16 ; } -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);dma_free_coherent (&ha->pdev->dev, len, nvram, nvram_dma); leave:
@@ -324,12 +324,12 @@ qla4xxx_update_nvram(struct bsg_job *bsg_job) rval =qla4xxx_set_nvram (ha, nvram_dma, offset, len);if (rval) {ql4_printk (KERN_ERR , ha,"%s: set nvram failed\n" , __func__); - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; rval = -EIO ; }else - bsg_reply->result =DID_OK <<16 ; + bsg_reply->status.combined =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);dma_free_coherent (&ha->pdev->dev, len, nvram, nvram_dma); leave:
@@ -369,12 +369,12 @@ qla4xxx_restore_defaults(struct bsg_job *bsg_job) rval =qla4xxx_restore_factory_defaults (ha, region, field0, field1);if (rval) {ql4_printk (KERN_ERR , ha,"%s: set nvram failed\n" , __func__); - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; rval = -EIO ; }else - bsg_reply->result =DID_OK <<16 ; + bsg_reply->status.combined =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); leave:return rval;
@@ -428,17 +428,17 @@ qla4xxx_bsg_get_acb(struct bsg_job *bsg_job) rval =qla4xxx_get_acb (ha, acb_dma, acb_type, len);if (rval) {ql4_printk (KERN_ERR , ha,"%s: get acb failed\n" , __func__); - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; rval = -EIO ; }else { bsg_reply->reply_payload_rcv_len =sg_copy_from_buffer (bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, acb, len); - bsg_reply->result =DID_OK <<16 ; + bsg_reply->status.combined =DID_OK <<16 ; } -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);dma_free_coherent (&ha->pdev->dev, len, acb, acb_dma); leave:
@@ -461,7 +461,7 @@ static void ql4xxx_execute_diag_cmd(struct bsg_job *bsg_job)if (test_bit (DPC_RESET_HA , &ha->dpc_flags)) {ql4_printk (KERN_INFO , ha,"%s: Adapter reset in progress. Invalid Request\n" , __func__); - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; goto exit_diag_mem_test; }
@@ -485,9 +485,9 @@ static void ql4xxx_execute_diag_cmd(struct bsg_job *bsg_job) mbox_sts[7]));if (status ==QLA_SUCCESS ) - bsg_reply->result =DID_OK <<16 ; + bsg_reply->status.combined =DID_OK <<16 ;else - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ;/* Send mbox_sts to application */ bsg_job->reply_len =sizeof (struct iscsi_bsg_reply ) +sizeof (mbox_sts);
@@ -497,9 +497,9 @@ static void ql4xxx_execute_diag_cmd(struct bsg_job *bsg_job) exit_diag_mem_test:DEBUG2 (ql4_printk (KERN_INFO , ha,"%s: bsg_reply->result = x%x, status = %s\n" , - __func__, bsg_reply->result,STATUS (status))); + __func__, bsg_reply->status.combined,STATUS (status))); -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); }
@@ -668,14 +668,14 @@ static void qla4xxx_execute_diag_loopback_cmd(struct bsg_job *bsg_job)if (test_bit (AF_LOOPBACK , &ha->flags)) {ql4_printk (KERN_INFO , ha,"%s: Loopback Diagnostics already in progress. Invalid Request\n" , __func__); - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; goto exit_loopback_cmd; }if (test_bit (DPC_RESET_HA , &ha->dpc_flags)) {ql4_printk (KERN_INFO , ha,"%s: Adapter reset in progress. Invalid Request\n" , __func__); - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; goto exit_loopback_cmd; }
@@ -685,14 +685,14 @@ static void qla4xxx_execute_diag_loopback_cmd(struct bsg_job *bsg_job)if (is_qla8032 (ha) ||is_qla8042 (ha)) { status =qla4_83xx_pre_loopback_config (ha, mbox_cmd);if (status !=QLA_SUCCESS ) { - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; goto exit_loopback_cmd; } status =qla4_83xx_wait_for_loopback_config_comp (ha, wait_for_link);if (status !=QLA_SUCCESS ) { - bsg_reply->result =DID_TIME_OUT <<16 ; + bsg_reply->status.combined =DID_TIME_OUT <<16 ; goto restore; } }
@@ -707,9 +707,9 @@ static void qla4xxx_execute_diag_loopback_cmd(struct bsg_job *bsg_job) &mbox_sts[0]);if (status ==QLA_SUCCESS ) - bsg_reply->result =DID_OK <<16 ; + bsg_reply->status.combined =DID_OK <<16 ;else - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; DEBUG2(ql4_printk(KERN_INFO, ha, "%s: mbox_sts: %08X %08X %08X %08X %08X %08X %08X %08X\n",
@@ -725,7 +725,7 @@ static void qla4xxx_execute_diag_loopback_cmd(struct bsg_job *bsg_job)if (is_qla8032 (ha) ||is_qla8042 (ha)) { status =qla4_83xx_post_loopback_config (ha, mbox_cmd);if (status !=QLA_SUCCESS ) { - bsg_reply->result =DID_ERROR <<16 ; + bsg_reply->status.combined =DID_ERROR <<16 ; goto exit_loopback_cmd; }
@@ -737,15 +737,15 @@ static void qla4xxx_execute_diag_loopback_cmd(struct bsg_job *bsg_job) status =qla4_83xx_wait_for_loopback_config_comp (ha, wait_for_link);if (status !=QLA_SUCCESS ) { - bsg_reply->result =DID_TIME_OUT <<16 ; + bsg_reply->status.combined =DID_TIME_OUT <<16 ; goto exit_loopback_cmd; } } exit_loopback_cmd:DEBUG2 (ql4_printk (KERN_INFO , ha,"%s: bsg_reply->result = x%x, status = %s\n" , - __func__, bsg_reply->result,STATUS (status))); -bsg_job_done (bsg_job, bsg_reply->result, + __func__, bsg_reply->status.combined,STATUS (status))); +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); }
@@ -841,9 +841,9 @@ int qla4xxx_process_vendor_specific(struct bsg_job *bsg_job)default :ql4_printk (KERN_ERR , ha,"%s: invalid BSG vendor command: " "0x%x\n" , __func__, bsg_req->msgcode); - bsg_reply->result = (DID_ERROR <<16 ); + bsg_reply->status.combined = (DID_ERROR <<16 ); bsg_reply->reply_payload_rcv_len =0 ; -bsg_job_done (bsg_job, bsg_reply->result, +bsg_job_done (bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len);return -ENOSYS ; }
drivers/scsi/qla4xxx/ql4_isr.c +16 -16
@@ -145,7 +145,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, ddb_entry = srb->ddb;if (ddb_entry ==NULL ) { - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ; goto status_entry_exit; }
@@ -157,7 +157,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,case SCS_COMPLETE :if (sts_entry->iscsiFlags &ISCSI_FLAG_RESIDUAL_OVER ) { - cmd->result =DID_ERROR <<16 ; + cmd->status.combined =DID_ERROR <<16 ;break ; }
@@ -166,7 +166,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,if (!scsi_status && ((scsi_bufflen (cmd) - residual) < cmd->underflow)) { - cmd->result =DID_ERROR <<16 ; + cmd->status.combined =DID_ERROR <<16 ; DEBUG2(printk("scsi%ld:%d:%d:%llu: %s: " "Mid-layer Data underrun0, "
@@ -180,7 +180,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, } } - cmd->result =DID_OK <<16 | scsi_status; + cmd->status.combined =DID_OK <<16 | scsi_status;if (scsi_status !=SAM_STAT_CHECK_CONDITION )break ;
@@ -192,7 +192,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,case SCS_INCOMPLETE :/* Always set the status to DID_ERROR, since * all conditions result in that status anyway */ - cmd->result =DID_ERROR <<16 ; + cmd->status.combined =DID_ERROR <<16 ;break ;case SCS_RESET_OCCURRED :
@@ -200,7 +200,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, ha->host_no, cmd->device->channel, cmd->device->id, cmd->device->lun, __func__)); - cmd->result =DID_RESET <<16 ; + cmd->status.combined =DID_RESET <<16 ;break ;case SCS_ABORTED :
@@ -208,7 +208,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, ha->host_no, cmd->device->channel, cmd->device->id, cmd->device->lun, __func__)); - cmd->result =DID_RESET <<16 ; + cmd->status.combined =DID_RESET <<16 ;break ;case SCS_TIMEOUT :
@@ -216,7 +216,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, ha->host_no, cmd->device->channel, cmd->device->id, cmd->device->lun)); - cmd->result =DID_TRANSPORT_DISRUPTED <<16 ; + cmd->status.combined =DID_TRANSPORT_DISRUPTED <<16 ;/* * Mark device missing so that we won't continue to send
@@ -236,7 +236,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, cmd->device->channel, cmd->device->id, cmd->device->lun, __func__)); - cmd->result =DID_ERROR <<16 ; + cmd->status.combined =DID_ERROR <<16 ;break ; }
@@ -266,7 +266,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,scsi_bufflen (cmd), residual)); - cmd->result =DID_ERROR <<16 ; + cmd->status.combined =DID_ERROR <<16 ;break ; }
@@ -298,11 +298,11 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, residual, scsi_bufflen(cmd))); - cmd->result =DID_ERROR <<16 | scsi_status; + cmd->status.combined =DID_ERROR <<16 | scsi_status; goto check_scsi_status; } - cmd->result =DID_OK <<16 | scsi_status; + cmd->status.combined =DID_OK <<16 | scsi_status; check_scsi_status:if (scsi_status ==SAM_STAT_CHECK_CONDITION )
@@ -324,14 +324,14 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,if (iscsi_is_session_online (ddb_entry->sess))qla4xxx_mark_device_missing (ddb_entry->sess); - cmd->result =DID_TRANSPORT_DISRUPTED <<16 ; + cmd->status.combined =DID_TRANSPORT_DISRUPTED <<16 ;break ;case SCS_QUEUE_FULL :/* * SCSI Mid-Layer handles device queue full */ - cmd->result =DID_OK <<16 | sts_entry->scsiStatus; + cmd->status.combined =DID_OK <<16 | sts_entry->scsiStatus; DEBUG2(printk("scsi%ld:%d:%llu: %s: QUEUE FULL detected " "compl=%02x, scsi=%02x, state=%02x, iFlags=%02x," " iResp=%02x\n", ha->host_no, cmd->device->id,
@@ -343,7 +343,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,break ;default : - cmd->result =DID_ERROR <<16 ; + cmd->status.combined =DID_ERROR <<16 ;break ; }
@@ -529,7 +529,7 @@ void qla4xxx_process_response_queue(struct scsi_qla_host *ha)/* ETRY normally by sending it back with * DID_BUS_BUSY */ - srb->cmd->result =DID_BUS_BUSY <<16 ; + srb->cmd->status.combined =DID_BUS_BUSY <<16 ;kref_put (&srb->srb_ref, qla4xxx_srb_compl);break ;
drivers/scsi/qla4xxx/ql4_os.c +7 -7
@@ -4106,20 +4106,20 @@ static int qla4xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)if (test_bit (AF_EEH_BUSY , &ha->flags)) {if (test_bit (AF_PCI_CHANNEL_IO_PERM_FAILURE , &ha->flags)) - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ;else - cmd->result =DID_REQUEUE <<16 ; + cmd->status.combined =DID_REQUEUE <<16 ; goto qc_fail_command; }if (!sess) { - cmd->result =DID_IMM_RETRY <<16 ; + cmd->status.combined =DID_IMM_RETRY <<16 ; goto qc_fail_command; } rval =iscsi_session_chkready (sess);if (rval) { - cmd->result = rval; + cmd->status.combined = rval; goto qc_fail_command; }
@@ -4802,7 +4802,7 @@ static void qla4xxx_abort_active_cmds(struct scsi_qla_host *ha, int res)for (i =0 ; i < ha->host->can_queue; i++) { srb =qla4xxx_del_from_active_array (ha, i);if (srb !=NULL ) { - srb->cmd->result = res; + srb->cmd->status.combined = res;kref_put (&srb->srb_ref, qla4xxx_srb_compl); } }
@@ -9283,7 +9283,7 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)"scsi%ld: DEVICE_RESET cmd=%p jiffies = 0x%lx, to=%x," "dpc_flags=%lx, status=%x allowed=%d\n" , ha->host_no, cmd, jiffies, cmd->request->timeout /HZ , - ha->dpc_flags, cmd->result, cmd->allowed)); + ha->dpc_flags, cmd->status.combined, cmd->allowed)); rval =qla4xxx_isp_check_reg (ha);if (rval !=QLA_SUCCESS ) {
@@ -9350,7 +9350,7 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd)"scsi%ld: TARGET_DEVICE_RESET cmd=%p jiffies = 0x%lx, " "to=%x,dpc_flags=%lx, status=%x allowed=%d\n" , ha->host_no, cmd, jiffies, cmd->request->timeout /HZ , - ha->dpc_flags, cmd->result, cmd->allowed)); + ha->dpc_flags, cmd->status.combined, cmd->allowed)); rval =qla4xxx_isp_check_reg (ha);if (rval !=QLA_SUCCESS ) {
Bart Van Assche
maintainerPATCH 87/117 qlogicfas408: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/qlogicfas408.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qlogicfas408.c +2 -2
@@ -415,7 +415,7 @@ static void ql_ihandl(void *dev_id)return ; } icmd = priv->qlcmd; - icmd->result =ql_pcmd (icmd); + icmd->status.combined =ql_pcmd (icmd); priv->qlcmd =NULL ;/* * If result is CHECK CONDITION done calls qcommand to request
@@ -444,7 +444,7 @@ static int qlogicfas408_queuecommand_lck(struct scsi_cmnd *cmd, {struct qlogicfas408_priv *priv =get_priv_by_cmd (cmd);if (scmd_id (cmd) == priv->qinitid) { - cmd->result =DID_BAD_TARGET <<16 ; + cmd->status.combined =DID_BAD_TARGET <<16 ;done (cmd);return 0 ; }
Bart Van Assche
maintainerPATCH 88/117 qlogicpti: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/qlogicpti.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/qlogicpti.c +3 -3
@@ -1057,7 +1057,7 @@ static int qlogicpti_queuecommand_lck(struct scsi_cmnd *Cmnd, void (*done)(struc* we don't, the midlayer will ignore the return value, * which is insane. We pick up the pieces like this. */ - Cmnd->result =DID_BUS_BUSY ; + Cmnd->status.combined =DID_BUS_BUSY ;done (Cmnd);return 1 ; }
@@ -1180,10 +1180,10 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti) SCSI_SENSE_BUFFERSIZE);if (sts->hdr.entry_type ==ENTRY_STATUS ) - Cmnd->result = + Cmnd->status.combined =qlogicpti_return_status (sts, qpti->qpti_id);else - Cmnd->result =DID_ERROR <<16 ; + Cmnd->status.combined =DID_ERROR <<16 ;if (scsi_bufflen (Cmnd)) dma_unmap_sg(&qpti->op->dev,
Bart Van Assche
maintainerPATCH 89/117 s390/zfcp: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/s390/scsi/zfcp_dbf.c | 2 +- drivers/s390/scsi/zfcp_dbf.h | 2 +- drivers/s390/scsi/zfcp_fc.c | 4 ++-- drivers/s390/scsi/zfcp_fc.h | 2 +- drivers/s390/scsi/zfcp_scsi.c | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-)
drivers/s390/scsi/zfcp_dbf.c +1 -1
@@ -643,7 +643,7 @@ void zfcp_dbf_scsi_common(char *tag, int level, struct scsi_device *sdev,memcpy (rec->tag, tag,ZFCP_DBF_TAG_LEN ); rec->id =ZFCP_DBF_SCSI_CMND ;if (sc) { - rec->scsi_result = sc->result; + rec->scsi_result = sc->status.combined; rec->scsi_retries = sc->retries; rec->scsi_allowed = sc->allowed; rec->scsi_id = sc->device->id;
drivers/s390/scsi/zfcp_dbf.h +1 -1
@@ -402,7 +402,7 @@ void _zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *scmd,static inline void zfcp_dbf_scsi_result (struct scsi_cmnd *scmd,struct zfcp_fsf_req *req) { -if (scmd->result !=0 ) +if (scmd->status.combined !=0 )_zfcp_dbf_scsi ("rsl_err" ,3 , scmd, req);else if (scmd->retries >0 )_zfcp_dbf_scsi ("rsl_ret" ,4 , scmd, req);
drivers/s390/scsi/zfcp_fc.c +2 -2
@@ -951,8 +951,8 @@ static void zfcp_fc_ct_els_job_handler(void *data) jr->reply_payload_rcv_len = job->reply_payload.payload_len; jr->reply_data.ctels_reply.status =FC_CTELS_STATUS_OK ; - jr->result = zfcp_ct_els->status ? -EIO :0 ; -bsg_job_done (job, jr->result, jr->reply_payload_rcv_len); + jr->status.combined = zfcp_ct_els->status ? -EIO :0 ; +bsg_job_done (job, jr->status.combined, jr->reply_payload_rcv_len); }static struct zfcp_fc_wka_port *zfcp_fc_job_wka_port (struct bsg_job *job)
drivers/s390/scsi/zfcp_fc.h +1 -1
@@ -275,7 +275,7 @@ void zfcp_fc_eval_fcp_rsp(struct fcp_resp_with_ext *fcp_rsp,u32 sense_len, resid;u8 rsp_flags; - scsi->result |= fcp_rsp->resp.fr_status; + scsi->status.combined |= fcp_rsp->resp.fr_status; rsp_flags = fcp_rsp->resp.fr_flags;
drivers/s390/scsi/zfcp_scsi.c +3 -3
@@ -71,12 +71,12 @@ int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt)int status, scsi_result, ret;/* reset the status for this request */ - scpnt->result =0 ; + scpnt->status.combined =0 ; scpnt->host_scribble =NULL ; scsi_result =fc_remote_port_chkready (rport);if (unlikely (scsi_result)) { - scpnt->result = scsi_result; + scpnt->status.combined = scsi_result;zfcp_dbf_scsi_fail_send (scpnt); scpnt->scsi_done (scpnt);return 0 ;
@@ -859,7 +859,7 @@ void zfcp_scsi_dif_sense_error(struct scsi_cmnd *scmd, int ascq)scsi_build_sense_buffer (1 , scmd->sense_buffer,ILLEGAL_REQUEST ,0x10 , ascq);set_driver_byte (scmd,DRIVER_SENSE ); - scmd->result |=SAM_STAT_CHECK_CONDITION ; + scmd->status.combined |=SAM_STAT_CHECK_CONDITION ;set_host_byte (scmd,DID_SOFT_ERROR ); }
Bart Van Assche
maintainerPATCH 90/117 scsi_debug: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/scsi_debug.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/scsi/scsi_debug.c +13 -13
@@ -5458,24 +5458,24 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, ns_from_boot =ktime_get_boottime_ns ();/* one of the resp_*() response functions is called here */ - cmnd->result = pfp ?pfp (cmnd, devip) :0 ; -if (cmnd->result &SDEG_RES_IMMED_MASK ) { - cmnd->result &= ~SDEG_RES_IMMED_MASK ; + cmnd->status.combined = pfp ?pfp (cmnd, devip) :0 ; +if (cmnd->status.combined &SDEG_RES_IMMED_MASK ) { + cmnd->status.combined &= ~SDEG_RES_IMMED_MASK ; delta_jiff = ndelay =0 ; } -if (cmnd->result ==0 && scsi_result !=0 ) - cmnd->result = scsi_result; -if (cmnd->result ==0 &&unlikely (sdebug_opts &SDEBUG_OPT_TRANSPORT_ERR )) { +if (cmnd->status.combined ==0 && scsi_result !=0 ) + cmnd->status.combined = scsi_result; +if (cmnd->status.combined ==0 &&unlikely (sdebug_opts &SDEBUG_OPT_TRANSPORT_ERR )) {if (atomic_read (&sdeb_inject_pending)) {mk_sense_buffer (cmnd,ABORTED_COMMAND ,TRANSPORT_PROBLEM ,ACK_NAK_TO );atomic_set (&sdeb_inject_pending,0 ); - cmnd->result = check_condition_result; + cmnd->status.combined = check_condition_result; } } -if (unlikely (sdebug_verbose && cmnd->result)) +if (unlikely (sdebug_verbose && cmnd->status.combined))sdev_printk (KERN_INFO , sdp,"%s: non-zero result=0x%x\n" , - __func__, cmnd->result); + __func__, cmnd->status.combined);if (delta_jiff >0 || ndelay >0 ) {ktime_t kt;
@@ -5582,10 +5582,10 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,return 0 ; respond_in_thread:/* call back to mid-layer using invocation thread */ - cmnd->result = pfp !=NULL ?pfp (cmnd, devip) :0 ; - cmnd->result &= ~SDEG_RES_IMMED_MASK ; -if (cmnd->result ==0 && scsi_result !=0 ) - cmnd->result = scsi_result; + cmnd->status.combined = pfp !=NULL ?pfp (cmnd, devip) :0 ; + cmnd->status.combined &= ~SDEG_RES_IMMED_MASK ; +if (cmnd->status.combined ==0 && scsi_result !=0 ) + cmnd->status.combined = scsi_result; cmnd->scsi_done (cmnd);return 0 ; }
Bart Van Assche
maintainerPATCH 91/117 smartpqi: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/smartpqi/smartpqi_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/smartpqi/smartpqi_init.c +6 -6
@@ -3001,7 +3001,7 @@ static void pqi_process_raid_io_error(struct pqi_io_request *io_request) sense_data_length); } - scmd->result = scsi_status; + scmd->status.combined = scsi_status;set_host_byte (scmd, host_byte); }
@@ -3091,7 +3091,7 @@ static void pqi_process_aio_io_error(struct pqi_io_request *io_request)scsi_build_sense_buffer (0 , scmd->sense_buffer,HARDWARE_ERROR ,0x3e ,0x1 ); - scmd->result = scsi_status; + scmd->status.combined = scsi_status;set_host_byte (scmd, host_byte); }
@@ -3188,7 +3188,7 @@ static int pqi_process_io_intr(struct pqi_ctrl_info *ctrl_info, struct pqi_queuecase PQI_RESPONSE_IU_RAID_PATH_IO_SUCCESS :case PQI_RESPONSE_IU_AIO_PATH_IO_SUCCESS :if (io_request->scmd) - io_request->scmd->result =0 ; + io_request->scmd->status.combined =0 ; fallthrough;case PQI_RESPONSE_IU_GENERAL_MANAGEMENT :break ;
@@ -5333,9 +5333,9 @@ static bool pqi_raid_bypass_retry_needed(struct pqi_io_request *io_request)return false; scmd = io_request->scmd; -if ((scmd->result &0xff ) ==SAM_STAT_GOOD ) +if ((scmd->status.combined &0xff ) ==SAM_STAT_GOOD )return false; -if (host_byte (scmd->result) ==DID_NO_CONNECT ) +if (host_byte (scmd->status) ==DID_NO_CONNECT )return false; device = scmd->device->hostdata;
@@ -5719,7 +5719,7 @@ static int pqi_scsi_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scm* This is necessary because the SML doesn't zero out this field during * error recovery. */ - scmd->result =0 ; + scmd->status.combined =0 ; hw_queue =pqi_get_hw_queue (ctrl_info, scmd); queue_group = &ctrl_info->queue_groups[hw_queue];
Bart Van Assche
maintainerPATCH 92/117 snic: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/snic/snic_scsi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/scsi/snic/snic_scsi.c +7 -7
@@ -341,7 +341,7 @@ snic_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc)if (ret) {SNIC_HOST_ERR (shost,"Tgt %p id %d Not Ready.\n" , tgt, tgt->id);atomic64_inc (&snic->s_stats.misc.tgt_not_rdy); - sc->result = ret; + sc->status.combined = ret; sc->scsi_done (sc);return 0 ;
@@ -475,7 +475,7 @@ snic_process_io_failed_state(struct snic *snic, snic_io_status_to_str(cmpl_stat), CMD_FLAGS(sc));/* Set sc->result */ - sc->result = (res <<16 ) | icmnd_cmpl->scsi_status; + sc->status.combined = (res <<16 ) | icmnd_cmpl->scsi_status; }/* end of snic_process_io_failed_state */ /*
@@ -508,7 +508,7 @@ snic_process_icmnd_cmpl_status(struct snic *snic,CMD_STATE (sc) =SNIC_IOREQ_COMPLETE ;if (likely (cmpl_stat ==SNIC_STAT_IO_SUCCESS )) { - sc->result = (DID_OK <<16 ) | scsi_stat; + sc->status.combined = (DID_OK <<16 ) | scsi_stat; xfer_len =scsi_bufflen (sc);
@@ -846,7 +846,7 @@ snic_process_itmf_cmpl(struct snic *snic, }CMD_SP (sc) =NULL ; - sc->result = (DID_ERROR <<16 ); + sc->status.combined = (DID_ERROR <<16 );SNIC_SCSI_DBG (snic->shost,"itmf_cmpl: Completing IO. sc %p flags 0x%llx\n" , sc,CMD_FLAGS (sc));
@@ -1474,7 +1474,7 @@ snic_abort_finish(struct snic *snic, struct scsi_cmnd *sc)* the # IO timeouts == 2, will cause the LUN offline. * Call scsi_done to complete the IO. */ - sc->result = (DID_ERROR <<16 ); + sc->status.combined = (DID_ERROR <<16 ); sc->scsi_done (sc);break ;
@@ -1854,7 +1854,7 @@ snic_dr_clean_single_req(struct snic *snic,snic_release_req_buf (snic, rqi, sc); - sc->result = (DID_ERROR <<16 ); + sc->status.combined = (DID_ERROR <<16 ); sc->scsi_done (sc); ret =0 ;
@@ -2491,7 +2491,7 @@ snic_scsi_cleanup(struct snic *snic, int ex_tag)snic_release_req_buf (snic, rqi, sc); cleanup: - sc->result =DID_TRANSPORT_DISRUPTED <<16 ; + sc->status.combined =DID_TRANSPORT_DISRUPTED <<16 ; SNIC_HOST_INFO(snic->shost, "sc_clean: DID_TRANSPORT_DISRUPTED for sc %p, Tag %d flags 0x%llx rqi %p duration %u msecs\n", sc, sc->request->tag, CMD_FLAGS(sc), rqi,
Bart Van Assche
maintainerPATCH 93/117 staging: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/staging/rts5208/rtsx.c | 14 +++++++------- drivers/staging/rts5208/rtsx_transport.c | 8 ++++---- drivers/staging/unisys/include/iochannel.h | 3 ++- drivers/staging/unisys/visorhba/visorhba_main.c | 12 ++++++------ 4 files changed, 19 insertions(+), 18 deletions(-)
drivers/staging/rts5208/rtsx.c +7 -7
@@ -134,7 +134,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb,/* fail the command if we are disconnecting */ if (rtsx_chk_stat (chip,RTSX_STAT_DISCONNECT )) {dev_info (&dev->pci->dev,"Fail command during disconnect\n" ); - srb->result =DID_NO_CONNECT <<16 ; + srb->status.combined =DID_NO_CONNECT <<16 ;done (srb);return 0 ; }
@@ -377,7 +377,7 @@ static int rtsx_control_thread(void *__dev)/* has the command aborted ? */ if (rtsx_chk_stat (chip,RTSX_STAT_ABORT )) { - chip->srb->result =DID_ABORT <<16 ; + chip->srb->status.combined =DID_ABORT <<16 ; goto skip_for_abort; }
@@ -388,7 +388,7 @@ static int rtsx_control_thread(void *__dev)*/ if (chip->srb->sc_data_direction ==DMA_BIDIRECTIONAL ) {dev_err (&dev->pci->dev,"UNKNOWN data direction\n" ); - chip->srb->result =DID_ERROR <<16 ; + chip->srb->status.combined =DID_ERROR <<16 ; }/* reject if target != 0 or if LUN is higher than
@@ -398,14 +398,14 @@ static int rtsx_control_thread(void *__dev)dev_err (&dev->pci->dev,"Bad target number (%d:%d)\n" , chip->srb->device->id, (u8 )chip->srb->device->lun); - chip->srb->result =DID_BAD_TARGET <<16 ; + chip->srb->status.combined =DID_BAD_TARGET <<16 ; }else if (chip->srb->device->lun > chip->max_lun) {dev_err (&dev->pci->dev,"Bad LUN (%d:%d)\n" , chip->srb->device->id, (u8 )chip->srb->device->lun); - chip->srb->result =DID_BAD_TARGET <<16 ; + chip->srb->status.combined =DID_BAD_TARGET <<16 ; }/* we've got a command, let's do it! */
@@ -422,7 +422,7 @@ static int rtsx_control_thread(void *__dev) ;/* nothing to do */ /* indicate that the command is done */ - else if (chip->srb->result != DID_ABORT << 16) { + else if (chip->srb->status.combined != DID_ABORT << 16) { chip->srb->scsi_done (chip->srb); } else { skip_for_abort:
@@ -633,7 +633,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)*/ mutex_lock (&dev->dev_mutex);if (chip->srb) { - chip->srb->result =DID_NO_CONNECT <<16 ; + chip->srb->status.combined =DID_NO_CONNECT <<16 ;scsi_lock (host); chip->srb->scsi_done (dev->chip->srb); chip->srb =NULL ;
drivers/staging/rts5208/rtsx_transport.c +4 -4
@@ -160,18 +160,18 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)*/ if (rtsx_chk_stat (chip,RTSX_STAT_ABORT )) {dev_dbg (rtsx_dev (chip),"-- command was aborted\n" ); - srb->result =DID_ABORT <<16 ; + srb->status.combined =DID_ABORT <<16 ; goto handle_errors; }/* if there is a transport error, reset and don't auto-sense */ if (result ==TRANSPORT_ERROR ) {dev_dbg (rtsx_dev (chip),"-- transport indicates error, resetting\n" ); - srb->result =DID_ERROR <<16 ; + srb->status.combined =DID_ERROR <<16 ; goto handle_errors; } - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ;/* * If we have a failure, we're going to do a REQUEST_SENSE
@@ -180,7 +180,7 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)*/ if (result ==TRANSPORT_FAILED ) {/* set the result so the higher layers expect this data */ - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ;memcpy (srb->sense_buffer, (unsigned char *)&chip->sense_buffer[SCSI_LUN (srb)],sizeof (struct sense_data_t ));
drivers/staging/unisys/include/iochannel.h +2 -1
@@ -34,6 +34,7 @@#include <linux/uuid.h> #include <linux/skbuff.h> #include <linux/visorbus.h> +#include <scsi/scsi_status.h> /* * Must increment these whenever you insert or delete fields within this channel
@@ -217,7 +218,7 @@ struct uiscmdrsp_scsi {u32 data_dir;struct uisscsi_dest vdest;/* Needed to queue the rsp back to cmd originator. */ -int linuxstat; +union scsi_status linuxstat;u8 scsistat;u8 addlstat;#define ADDL_SEL_TIMEOUT 4
drivers/staging/unisys/visorhba/visorhba_main.c +6 -6
@@ -343,7 +343,7 @@ static int visorhba_abort_handler(struct scsi_cmnd *scsicmd)atomic_set (&vdisk->ios_threshold,IOS_ERROR_THRESHOLD ); rtn =forward_taskmgmt_command (TASK_MGMT_ABORT_TASK , scsidev);if (rtn ==SUCCESS ) { - scsicmd->result =DID_ABORT <<16 ; + scsicmd->status.combined =DID_ABORT <<16 ; scsicmd->scsi_done (scsicmd); }return rtn;
@@ -370,7 +370,7 @@ static int visorhba_device_reset_handler(struct scsi_cmnd *scsicmd)atomic_set (&vdisk->ios_threshold,IOS_ERROR_THRESHOLD ); rtn =forward_taskmgmt_command (TASK_MGMT_LUN_RESET , scsidev);if (rtn ==SUCCESS ) { - scsicmd->result =DID_RESET <<16 ; + scsicmd->status.combined =DID_RESET <<16 ; scsicmd->scsi_done (scsicmd); }return rtn;
@@ -399,7 +399,7 @@ static int visorhba_bus_reset_handler(struct scsi_cmnd *scsicmd) } rtn =forward_taskmgmt_command (TASK_MGMT_BUS_RESET , scsidev);if (rtn ==SUCCESS ) { - scsicmd->result =DID_RESET <<16 ; + scsicmd->status.combined =DID_RESET <<16 ; scsicmd->scsi_done (scsicmd); }return rtn;
@@ -702,7 +702,7 @@ static void visorhba_serverdown_complete(struct visorhba_devdata *devdata)switch (pendingdel->cmdtype) {case CMD_SCSI_TYPE : scsicmd = pendingdel->sent; - scsicmd->result =DID_RESET <<16 ; + scsicmd->status.combined =DID_RESET <<16 ;if (scsicmd->scsi_done) scsicmd->scsi_done (scsicmd);break ;
@@ -864,8 +864,8 @@ static void complete_scsi_command(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) {/* take what we need out of cmdrsp and complete the scsicmd */ - scsicmd->result = cmdrsp->scsi.linuxstat; -if (cmdrsp->scsi.linuxstat) + scsicmd->status = cmdrsp->scsi.linuxstat; +if (cmdrsp->scsi.linuxstat.combined)do_scsi_linuxstat (cmdrsp, scsicmd);else do_scsi_nolinuxstat (cmdrsp, scsicmd);
Greg Kroah-Hartman
maintainerRe: [PATCH 093/117] staging: Convert to the scsi_status union
Quoted 2 lines · Bart Van Assche
An explanation of the purpose of this patch is available in the patch "scsi: Introduce the
scsi_statusunion".
Where is that at?
As a stand-alone-patch, this is not ok in a changelog text at all, sorry, and I can not take this.
greg k-h
Bart Van Assche
maintainerRe: [PATCH 093/117] staging: Convert to the scsi_status union
Quoted 8 lines · Greg Kroah-Hartman
Quoted 2 lines · Bart Van Assche
An explanation of the purpose of this patch is available in the patch "scsi: Introduce the
scsi_statusunion".Where is that at?
As a stand-alone-patch, this is not ok in a changelog text at all, sorry, and I can not take this.
Hi Greg,
That is a reference to an earlier patch in this series. I plan to replace the above text with the more elaborate description when I repost this patch series. For the current version of this patch series, please take a look at
https://lore.kernel.org/linux-scsi/[email protected]/T/#u
Thanks,
Bart.
Greg Kroah-Hartman
maintainerRe: [PATCH 093/117] staging: Convert to the scsi_status union
Quoted 10 lines · Bart Van Assche
Quoted 8 lines · Greg Kroah-Hartman
Quoted 2 lines · Bart Van Assche
An explanation of the purpose of this patch is available in the patch "scsi: Introduce the
scsi_statusunion".Where is that at?
As a stand-alone-patch, this is not ok in a changelog text at all, sorry, and I can not take this.
Quoted 7 lines
Hi Greg,
That is a reference to an earlier patch in this series. I plan to replace the above text with the more elaborate description when I repost this patch series. For the current version of this patch series, please take a look at
https://lore.kernel.org/linux-scsi/[email protected]/T/#u
You should have pointed to the lore.kernel.org link in the commit logs then, otherwise we have no way of knowing this when I get copied on patch 93 of a 117 patch series :(
greg k-h
Bart Van Assche
maintainerPATCH 94/117 stex: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/stex.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/scsi/stex.c +10 -10
@@ -398,7 +398,7 @@ static struct status_msg *stex_get_status(struct st_hba *hba)static void stex_invalid_field (struct scsi_cmnd *cmd,void (*done)(struct scsi_cmnd *)) { - cmd->result = (DRIVER_SENSE <<24 ) |SAM_STAT_CHECK_CONDITION ; + cmd->status.combined = (DRIVER_SENSE <<24 ) |SAM_STAT_CHECK_CONDITION ;/* "Invalid field in cdb" */ scsi_build_sense_buffer(0, cmd->sense_buffer, ILLEGAL_REQUEST, 0x24,
@@ -576,7 +576,7 @@ static void return_abnormal_state(struct st_hba *hba, int status) ccb->req =NULL ;if (ccb->cmd) {scsi_dma_unmap (ccb->cmd); - ccb->cmd->result = status <<16 ; + ccb->cmd->status.combined = status <<16 ; ccb->cmd->scsi_done (ccb->cmd); ccb->cmd =NULL ; }
@@ -607,7 +607,7 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) lun = cmd->device->lun; hba = (struct st_hba *) &host->hostdata[0 ];if (hba->mu_status ==MU_STATE_NOCONNECT ) { - cmd->result =DID_NO_CONNECT ; + cmd->status.combined =DID_NO_CONNECT ;done (cmd);return 0 ; }
@@ -625,7 +625,7 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))if (page ==0x8 || page ==0x3f ) {scsi_sg_copy_from_buffer (cmd, ms10_caching_page,sizeof (ms10_caching_page)); - cmd->result =DID_OK <<16 ; + cmd->status.combined =DID_OK <<16 ;done (cmd); }else stex_invalid_field (cmd, done);
@@ -644,14 +644,14 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))break ;case TEST_UNIT_READY :if (id == host->max_id -1 ) { - cmd->result =DID_OK <<16 ; + cmd->status.combined =DID_OK <<16 ;done (cmd);return 0 ; }break ;case INQUIRY :if (lun >= host->max_lun) { - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ;done (cmd);return 0 ; }
@@ -661,7 +661,7 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) (cmd->cmnd[1] & INQUIRY_EVPD) == 0) {scsi_sg_copy_from_buffer (cmd, (void *)console_inq_page,sizeof (console_inq_page)); - cmd->result =DID_OK <<16 ; + cmd->status.combined =DID_OK <<16 ;done (cmd); } elsestex_invalid_field (cmd ,done );
@@ -680,9 +680,9 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) ver.host_no = hba->host->host_no; cp_len =scsi_sg_copy_from_buffer (cmd, &ver, cp_len);if (sizeof (ver) == cp_len) - cmd->result =DID_OK <<16 ; + cmd->status.combined =DID_OK <<16 ;else - cmd->result =DID_ERROR <<16 ; + cmd->status.combined =DID_ERROR <<16 ;done (cmd);return 0 ; }
@@ -766,7 +766,7 @@ static void stex_scsi_done(struct st_ccb *ccb)break ; } - cmd->result = result; + cmd->status.combined = result; cmd->scsi_done (cmd); }
Bart Van Assche
maintainerPATCH 95/117 storvsc: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/storvsc_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/storvsc_drv.c +3 -3
@@ -1096,9 +1096,9 @@ static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request, vm_srb = &cmd_request->vstor_packet.vm_srb; data_transfer_length = vm_srb->data_transfer_length; - scmnd->result = vm_srb->scsi_status; + scmnd->status.combined = vm_srb->scsi_status; -if (scmnd->result) { +if (scmnd->status.combined) { if (scsi_normalize_sense(scmnd->sense_buffer, SCSI_SENSE_BUFFERSIZE, &sense_hdr) && !(sense_hdr.sense_key == NOT_READY &&
@@ -1675,7 +1675,7 @@ static bool storvsc_scsi_cmd_ok(struct scsi_cmnd *scmnd)* this. So, don't send it. */ case SET_WINDOW : - scmnd->result =DID_ERROR <<16 ; + scmnd->status.combined =DID_ERROR <<16 ; allowed = false;break ;default :
Re: [PATCH 095/117] storvsc: Convert to the scsi_status union
Quoted 8 lines · Bart Van Assche
An explanation of the purpose of this patch is available in the patch "scsi: Introduce the
scsi_statusunion".Cc "K. Y. Srinivasan" <[email protected]>Cc Haiyang Zhang <[email protected]>Cc Stephen Hemminger <[email protected]>Cc Wei Liu <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
If this is ever needed:
Bart Van Assche
maintainerPATCH 96/117 sym53c8xx_2: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/sym53c8xx_2/sym_glue.c | 2 +- drivers/scsi/sym53c8xx_2/sym_glue.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/scsi/sym53c8xx_2/sym_glue.c +1 -1
@@ -235,7 +235,7 @@ void sym_set_cam_result_error(struct sym_hcb *np, struct sym_ccb *cp, int resid) cam_status =sym_xerr_cam_status (DID_ERROR , cp->xerr_status); }scsi_set_resid (cmd, resid); - cmd->result = (drv_status <<24 ) | (cam_status <<16 ) | scsi_status; + cmd->status.combined = (drv_status <<24 ) | (cam_status <<16 ) | scsi_status; }static int sym_scatter (struct sym_hcb *np,struct sym_ccb *cp,struct scsi_cmnd *cmd)
drivers/scsi/sym53c8xx_2/sym_glue.h +4 -4
@@ -224,8 +224,8 @@ static inline struct sym_hcb * sym_get_hcb(struct Scsi_Host *host)static inline void sym_set_cam_status (struct scsi_cmnd *cmd,int status) { - cmd->result &= ~(0xff <<16 ); - cmd->result |= (status <<16 ); + cmd->status.combined &= ~(0xff <<16 ); + cmd->status.combined |= (status <<16 ); }/*
@@ -234,7 +234,7 @@ sym_set_cam_status(struct scsi_cmnd *cmd, int status)static inline int sym_get_cam_status (struct scsi_cmnd *cmd) { -return host_byte (cmd->result); +return host_byte (cmd->status); }/*
@@ -243,7 +243,7 @@ sym_get_cam_status(struct scsi_cmnd *cmd)static inline void sym_set_cam_result_ok (struct sym_ccb *cp,struct scsi_cmnd *cmd,int resid) {scsi_set_resid (cmd, resid); - cmd->result = (DID_OK <<16 ) | (cp->ssss_status &0x7f ); + cmd->status.combined = (DID_OK <<16 ) | (cp->ssss_status &0x7f ); }void sym_set_cam_result_error (struct sym_hcb *np,struct sym_ccb *cp,int resid);
Bart Van Assche
maintainerPATCH 97/117 target: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/target/loopback/tcm_loop.c | 4 ++-- drivers/target/target_core_pscsi.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/target/loopback/tcm_loop.c +2 -2
@@ -565,10 +565,10 @@ static int tcm_loop_queue_data_or_status(const char *func,memcpy (sc->sense_buffer, se_cmd->sense_buffer,SCSI_SENSE_BUFFERSIZE ); - sc->result =SAM_STAT_CHECK_CONDITION ; + sc->status.combined =SAM_STAT_CHECK_CONDITION ;set_driver_byte (sc,DRIVER_SENSE ); }else - sc->result = scsi_status; + sc->status.combined = scsi_status;set_host_byte (sc,DID_OK ); if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) ||
drivers/target/target_core_pscsi.c +3 -3
@@ -1043,13 +1043,13 @@ static void pscsi_req_done(struct request *req, blk_status_t status) {struct se_cmd *cmd = req->end_io_data;struct pscsi_plugin_task *pt = cmd->priv; -int result =scsi_req (req)->result; +union scsi_status result =scsi_req (req)->status;enum sam_status scsi_status =status_byte (result) <<1 ;if (scsi_status !=SAM_STAT_GOOD ) {pr_debug ("PSCSI Status Byte exception at cmd: %p CDB:" " 0x%02x Result: 0x%08x\n" , cmd, pt->pscsi_cdb[0 ], - result); + result.combined); }pscsi_complete_cmd (cmd, scsi_status,scsi_req (req)->sense);
@@ -1062,7 +1062,7 @@ static void pscsi_req_done(struct request *req, blk_status_t status)default :pr_debug ("PSCSI Host Byte exception at cmd: %p CDB:" " 0x%02x Result: 0x%08x\n" , cmd, pt->pscsi_cdb[0 ], - result); + result.combined);target_complete_cmd (cmd,SAM_STAT_CHECK_CONDITION );break ; }
Bart Van Assche
maintainerPATCH 98/117 ufs: Remove an unused structure member
In reply to Bart Van AsscheThe 'scsi_status' member is present since the introduction of the UFS driver but has never been used. Hence remove it.
--- drivers/scsi/ufs/ufshcd.h | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/ufs/ufshcd.h +0 -1
@@ -211,7 +211,6 @@ struct ufshcd_lrb {struct scsi_cmnd *cmd;u8 *sense_buffer;unsigned int sense_bufflen; -int scsi_status;int command_type;int task_tag;
Re: [PATCH 098/117] ufs: Remove an unused structure member
Quoted 18 lines · Bart Van Assche
The '
scsi_status' member is present since the introduction of the UFS driver but has never been used. Hence remove it.Cc Can Guo <[email protected]>Cc Avri Altman <[email protected]>Cc Bean Huo <[email protected]>Cc Alim Akhtar <[email protected]>Cc Asutosh Das <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ufs/ufshcd.h | 1 - 1 file changed, 1 deletion(-)drivers/scsi/ufs/ufshcd.h +0
-0
drivers/scsi/ufs/ufshcd.h struct ufshcd_lrb { · line 216
Quoted 7 lines
drivers/scsi/ufs/ufshcd.h +0
-1@@ -211,7 +211,6 @@ struct ufshcd_lrb {struct scsi_cmnd *cmd;u8 *sense_buffer;unsigned int sense_bufflen; -int scsi_status;int command_type;int task_tag;
Bart Van Assche
maintainerPATCH 99/117 ufs: Remove a local variable
In reply to Bart Van AsscheA later patch will introduce a type with the name 'scsi_status'. Remove a local variable with the same name to prevent confusion. This patch does not change any functionality.
--- drivers/scsi/ufs/ufshcd.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/scsi/ufs/ufshcd.c +4 -13
@@ -4934,7 +4934,6 @@ static inline int ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) { int result = 0; -int scsi_status;int ocs;/* overall command status of utrd */
@@ -4952,18 +4951,10 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) hba->ufs_stats.last_hibern8_exit_tstamp =ktime_set (0 ,0 );switch (result) {case UPIU_TRANSACTION_RESPONSE : -/* -* get the response UPIU result to extract -* the SCSI command status -*/ - result =ufshcd_get_rsp_upiu_result (lrbp->ucd_rsp_ptr); - -/* -* get the result based on SCSI status response -* to notify the SCSI midlayer of the command status -*/ - scsi_status = result &MASK_SCSI_STATUS ; - result =ufshcd_scsi_cmd_status (lrbp, scsi_status); +/* Propagate the SCSI status to the SCSI midlayer. */ + result =ufshcd_scsi_cmd_status (lrbp, +ufshcd_get_rsp_upiu_result (lrbp->ucd_rsp_ptr) & +MASK_SCSI_STATUS );/* * Currently we are only supporting BKOPs exception
Re: [PATCH 099/117] ufs: Remove a local variable
Quoted 50 lines · Bart Van Assche
A later patch will introduce a type with the name '
scsi_status'. Remove a local variable with the same name to prevent confusion. This patch does not change any functionality.Cc Can Guo <[email protected]>Cc Avri Altman <[email protected]>Cc Bean Huo <[email protected]>Cc Alim Akhtar <[email protected]>Cc Asutosh Das <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)drivers/scsi/ufs/ufshcd.c +0
-1@@ -4934,7 +4934,6 @@ static inline int ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) { int result = 0; -int scsi_status;int ocs;drivers/scsi/ufs/ufshcd.c +4
-12/* overall command status of utrd */ @@ -4952,18 +4951,10 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) hba->ufs_stats.last_hibern8_exit_tstamp =ktime_set (0 ,0 );switch (result) {case UPIU_TRANSACTION_RESPONSE : -/* -* get the response UPIU result to extract -* the SCSI command status -*/ - result =ufshcd_get_rsp_upiu_result (lrbp->ucd_rsp_ptr); - -/* -* get the result based on SCSI status response -* to notify the SCSI midlayer of the command status -*/ - scsi_status = result &MASK_SCSI_STATUS ; - result =ufshcd_scsi_cmd_status (lrbp, scsi_status); +/* Propagate the SCSI status to the SCSI midlayer. */ + result =ufshcd_scsi_cmd_status (lrbp, +ufshcd_get_rsp_upiu_result (lrbp->ucd_rsp_ptr) & +MASK_SCSI_STATUS );/*
Quoted 1 line
* Currently we are only supporting BKOPs exception
Bart Van Assche
maintainerPATCH 100/117 ufs: Use enum sam_status where appropriate
In reply to Bart Van AsscheMake it explicit that the second ufshcd_scsi_cmd_status() argument is a SAM status code.
--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +1 -1
@@ -4898,7 +4898,7 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev)* Returns value base on SCSI command status */ static inline int -ufshcd_scsi_cmd_status (struct ufshcd_lrb *lrbp,int scsi_status) +ufshcd_scsi_cmd_status (struct ufshcd_lrb *lrbp,enum sam_status scsi_status) {int result =0 ;
Re: [PATCH 100/117] ufs: Use enum sam_status where appropriate
Quoted 26 lines · Bart Van Assche
Make it explicit that the second
ufshcd_scsi_cmd_status()argument is a SAM status code.Cc Can Guo <[email protected]>Cc Avri Altman <[email protected]>Cc Bean Huo <[email protected]>Cc Alim Akhtar <[email protected]>Cc Asutosh Das <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/ufs/ufshcd.c +1
-1@@ -4898,7 +4898,7 @@ static void ufshcd_slave_destroy(structscsi_device *sdev) * Returns value base on SCSI command status */ static inline int -ufshcd_scsi_cmd_status (struct ufshcd_lrb *lrbp,int scsi_status) +ufshcd_scsi_cmd_status (struct ufshcd_lrb *lrbp,enum sam_status scsi_status) {
Quoted 1 line
int result = 0;
Re: [PATCH 100/117] ufs: Use enum sam_status where appropriate
In reply to Bart Van AsscheQuoted 26 lines · Bart Van Assche
Make it explicit that the second
ufshcd_scsi_cmd_status()argument is a SAM status code.Cc Can Guo <[email protected]>Cc Avri Altman <[email protected]>Cc Bean Huo <[email protected]>Cc Alim Akhtar <[email protected]>Cc Asutosh Das <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/ufs/ufshcd.c +1
-1@@ -4898,7 +4898,7 @@ static void ufshcd_slave_destroy(structscsi_device *sdev) * Returns value base on SCSI command status */ static inline int -ufshcd_scsi_cmd_status (struct ufshcd_lrb *lrbp,int scsi_status) +ufshcd_scsi_cmd_status (struct ufshcd_lrb *lrbp,enum sam_status scsi_status) {
Quoted 1 line
int result = 0;
Bart Van Assche
maintainerPATCH 101/117 ufs: Remove an assignment from ufshcd_transfer_rsp_status()
In reply to Bart Van AsscheSince a later patch will change the type of the 'result' variable, use this variable only for one purpose.
--- drivers/scsi/ufs/ufshcd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +1 -2
@@ -4947,9 +4947,8 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)switch (ocs) {case OCS_SUCCESS : - result =ufshcd_get_req_rsp (lrbp->ucd_rsp_ptr); hba->ufs_stats.last_hibern8_exit_tstamp =ktime_set (0 ,0 ); -switch (result) { +switch (ufshcd_get_req_rsp (lrbp->ucd_rsp_ptr)) {case UPIU_TRANSACTION_RESPONSE :/* Propagate the SCSI status to the SCSI midlayer. */ result = ufshcd_scsi_cmd_status(lrbp,
Re: [PATCH 101/117] ufs: Remove an assignment from ufshcd_transfer_rsp_status()
Quoted 28 lines · Bart Van Assche
Since a later patch will change the type of the 'result' variable, use this variable only for one purpose.
Cc Can Guo <[email protected]>Cc Avri Altman <[email protected]>Cc Bean Huo <[email protected]>Cc Alim Akhtar <[email protected]>Cc Asutosh Das <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/scsi/ufs/ufshcd.c +1
-2@@ -4947,9 +4947,8 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) switch (ocs) {case OCS_SUCCESS : - result =ufshcd_get_req_rsp (lrbp->ucd_rsp_ptr); hba->ufs_stats.last_hibern8_exit_tstamp =ktime_set (0 ,0 ); -switch (result) { +switch (ufshcd_get_req_rsp (lrbp->ucd_rsp_ptr)) {case UPIU_TRANSACTION_RESPONSE :/* Propagate the SCSI status to the SCSI midlayer. */
Quoted 1 line
result = ufshcd_scsi_cmd_status(lrbp,
Bart Van Assche
maintainerPATCH 102/117 ufs: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/ufs/ufs_bsg.c | 2 +- drivers/scsi/ufs/ufshcd.c | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-)
drivers/scsi/ufs/ufs_bsg.c +1 -1
@@ -152,7 +152,7 @@ static int ufs_bsg_request(struct bsg_job *job)kfree (desc_buff); out: - bsg_reply->result = ret; + bsg_reply->status.combined = ret; job->reply_len =sizeof (struct ufs_bsg_reply );/* complete the job here only if no error */ if (ret ==0 )
drivers/scsi/ufs/ufshcd.c +15 -12
@@ -4933,7 +4933,7 @@ ufshcd_scsi_cmd_status(struct ufshcd_lrb *lrbp, enum sam_status scsi_status)static inline int ufshcd_transfer_rsp_status (struct ufs_hba *hba,struct ufshcd_lrb *lrbp) { -int result =0 ; +union scsi_status result;int ocs;/* overall command status of utrd */
@@ -4951,7 +4951,7 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)switch (ufshcd_get_req_rsp (lrbp->ucd_rsp_ptr)) {case UPIU_TRANSACTION_RESPONSE :/* Propagate the SCSI status to the SCSI midlayer. */ - result =ufshcd_scsi_cmd_status (lrbp, + result.combined =ufshcd_scsi_cmd_status (lrbp,ufshcd_get_rsp_upiu_result (lrbp->ucd_rsp_ptr) &MASK_SCSI_STATUS );
@@ -4981,23 +4981,23 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)break ;case UPIU_TRANSACTION_REJECT_UPIU :/* TODO: handle Reject UPIU Response */ - result =DID_ERROR <<16 ; + result.combined =DID_ERROR <<16 ;dev_err (hba->dev,"Reject UPIU not fully implemented\n" );break ;default :dev_err (hba->dev,"Unexpected request response code = %x\n" , - result); - result =DID_ERROR <<16 ; + result.combined); + result.combined =DID_ERROR <<16 ;break ; }break ;case OCS_ABORTED : - result |=DID_ABORT <<16 ; + result.combined |=DID_ABORT <<16 ;break ;case OCS_INVALID_COMMAND_STATUS : - result |=DID_REQUEUE <<16 ; + result.combined |=DID_REQUEUE <<16 ;break ;case OCS_INVALID_CMD_TABLE_ATTR :case OCS_INVALID_PRDT_ATTR :
@@ -5009,7 +5009,7 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)case OCS_INVALID_CRYPTO_CONFIG :case OCS_GENERAL_CRYPTO_ERROR :default : - result |=DID_ERROR <<16 ; + result.combined |=DID_ERROR <<16 ;dev_err (hba->dev,"OCS error from controller = %x for tag %d\n" , ocs, lrbp->task_tag);
@@ -5021,7 +5021,7 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)if ((host_byte (result) !=DID_OK ) && (host_byte (result) !=DID_REQUEUE ) && !hba->silence_err_logs)ufshcd_print_trs (hba,1 << lrbp->task_tag, true); -return result; +return result.combined; }/**
@@ -5083,7 +5083,7 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,ufshcd_add_command_trace (hba, index,UFS_CMD_COMP ); result =ufshcd_transfer_rsp_status (hba, lrbp);scsi_dma_unmap (cmd); - cmd->result = result; + cmd->status.combined = result;/* Mark completed command as NULL in LRB */ lrbp->cmd =NULL ;/* Do not touch lrbp after scsi done */
@@ -8437,6 +8437,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,struct scsi_sense_hdr sshdr;struct scsi_device *sdp;unsigned long flags; +union scsi_status start_stop_res;int ret;spin_lock_irqsave (hba->host->host_lock, flags);
@@ -8471,13 +8472,15 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,* callbacks hence set the RQF_PM flag so that it doesn't resume the * already suspended childs. */ - ret =scsi_execute (sdp, cmd,DMA_NONE ,NULL ,0 ,NULL , &sshdr, + start_stop_res.combined = +scsi_execute (sdp, cmd,DMA_NONE ,NULL ,0 ,NULL , &sshdr,START_STOP_TIMEOUT ,0 ,0 ,RQF_PM ,NULL ); + ret = start_stop_res.combined;if (ret) {sdev_printk (KERN_WARNING , sdp,"START_STOP failed for power mode: %d, result %x\n" , pwr_mode, ret); -if (driver_byte (ret) ==DRIVER_SENSE ) +if (driver_byte (start_stop_res) ==DRIVER_SENSE )scsi_print_sense_hdr (sdp,NULL , &sshdr); }
Re: [PATCH 102/117] ufs: Convert to the scsi_status union
Hi Bart,
Quoted 126 lines · Bart Van Assche
An explanation of the purpose of this patch is available in the patch "scsi: Introduce the
scsi_statusunion".Cc Can Guo <[email protected]>Cc Yue Hu <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ufs/ufs_bsg.c | 2 +- drivers/scsi/ufs/ufshcd.c | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-)drivers/scsi/ufs/ufs_bsg.c +1
-1@@ -152,7 +152,7 @@ static int ufs_bsg_request(struct bsg_job *job)kfree (desc_buff); out: - bsg_reply->result = ret; + bsg_reply->status.combined = ret; job->reply_len =sizeof (struct ufs_bsg_reply );/* complete the job here only if no error */ if (ret ==0 )drivers/scsi/ufs/ufshcd.c +1
-1@@ -4933,7 +4933,7 @@ ufshcd_scsi_cmd_status(struct ufshcd_lrb *lrbp, enum sam_status scsi_status)static inline int ufshcd_transfer_rsp_status (struct ufs_hba *hba,struct ufshcd_lrb *lrbp) { -int result =0 ; +union scsi_status result;int ocs;drivers/scsi/ufs/ufshcd.c +6
-6/* overall command status of utrd */ @@ -4951,7 +4951,7 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)switch (ufshcd_get_req_rsp (lrbp->ucd_rsp_ptr)) {case UPIU_TRANSACTION_RESPONSE :/* Propagate the SCSI status to the SCSI midlayer. */ - result =ufshcd_scsi_cmd_status (lrbp, + result.combined =ufshcd_scsi_cmd_status (lrbp,ufshcd_get_rsp_upiu_result (lrbp->ucd_rsp_ptr) &MASK_SCSI_STATUS );@@ -4981,23 +4981,23 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)break ;case UPIU_TRANSACTION_REJECT_UPIU :/* TODO: handle Reject UPIU Response */ - result =DID_ERROR <<16 ; + result.combined =DID_ERROR <<16 ;dev_err (hba->dev,"Reject UPIU not fully implemented\n" );break ;default :dev_err (hba->dev,"Unexpected request response code = %x\n" , - result); - result =DID_ERROR <<16 ; + result.combined); + result.combined =DID_ERROR <<16 ;break ; }break ;case OCS_ABORTED : - result |=DID_ABORT <<16 ; + result.combined |=DID_ABORT <<16 ;break ;case OCS_INVALID_COMMAND_STATUS : - result |=DID_REQUEUE <<16 ; + result.combined |=DID_REQUEUE <<16 ;break ;case OCS_INVALID_CMD_TABLE_ATTR :drivers/scsi/ufs/ufshcd.c +1
-1case OCS_INVALID_PRDT_ATTR :@@ -5009,7 +5009,7 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)case OCS_INVALID_CRYPTO_CONFIG :case OCS_GENERAL_CRYPTO_ERROR :default : - result |=DID_ERROR <<16 ; + result.combined |=DID_ERROR <<16 ; dev_err(hba->dev, "OCS error from controller = %x for tag %d\n",drivers/scsi/ufs/ufshcd.c +1
-1ocs, lrbp->task_tag);@@ -5021,7 +5021,7 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)if ((host_byte (result) !=DID_OK ) && (host_byte (result) !=DID_REQUEUE ) && !hba->silence_err_logs)ufshcd_print_trs (hba,1 << lrbp->task_tag, true); -return result; +return result.combined; }/**
drivers/scsi/ufs/ufshcd.c +1
-1@@ -5083,7 +5083,7 @@ static void __ufshcd_transfer_req_compl(structufs_hba *hba,ufshcd_add_command_trace (hba ,index ,UFS_CMD_COMP ); result =ufshcd_transfer_rsp_status (hba, lrbp);scsi_dma_unmap (cmd); - cmd->result = result; + cmd->status.combined = result;/* Mark completed command as NULL in LRB */ lrbp->cmd =NULL ;drivers/scsi/ufs/ufshcd.c +1
-0/* Do not touch lrbp after scsi done */ @@ -8437,6 +8437,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, struct scsi_sense_hdr sshdr;struct scsi_device *sdp;unsigned long flags; +union scsi_status start_stop_res;int ret;drivers/scsi/ufs/ufshcd.c +2
-1spin_lock_irqsave (hba->host->host_lock, flags);@@ -8471,13 +8472,15 @@ static int ufshcd_set_dev_pwr_mode(structufs_hba *hba, * callbacks hence set the RQF_PM flag so that it doesn't resume the * already suspended childs. */ - ret = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, + start_stop_res.combined = + scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr,
drivers/scsi/ufs/ufshcd.c static int ufshcd_set_dev_pwr_mode(struct · line 8486
Quoted 10 lines
drivers/scsi/ufs/ufshcd.c +2
-1START_STOP_TIMEOUT, 0, 0, RQF_PM, NULL); + ret = start_stop_res.combined;if (ret) {sdev_printk (KERN_WARNING , sdp,"START_STOP failed for power mode: %d, result %x\n" , pwr_mode, ret); -if (driver_byte (ret) ==DRIVER_SENSE ) +if (driver_byte (start_stop_res) ==DRIVER_SENSE )scsi_print_sense_hdr (sdp,NULL , &sshdr); }
Thanks for the change, do you miss ufshcd_send_request_sense()?
Regards,
Can Guo.
Bart Van Assche
maintainerRe: [PATCH 102/117] ufs: Convert to the scsi_status union
Quoted 1 line · Can Guo
Thanks for the change, do you miss
ufshcd_send_request_sense()?
Hi Can,
That's a good question. I can change the type of the ufshcd_send_request_sense() return value but I'm not sure whether it's worth it since that function only has one caller and that caller does not care about the subcomponents of the SCSI status value. All it cares about is whether or not ufshcd_send_request_sense() returns 0.
Thanks,
Bart.
Can Guo
Reviewed-byRe: [PATCH 102/117] ufs: Convert to the scsi_status union
Hi Bart,
Quoted 11 lines · Bart Van Assche
Quoted 1 line · Can Guo
Thanks for the change, do you miss
ufshcd_send_request_sense()?Hi Can,
That's a good question. I can change the type of the
ufshcd_send_request_sense()return value but I'm not sure whether it's worth it since that function only has one caller and that caller does not care about the subcomponents of the SCSI status value. All it cares about is whether or notufshcd_send_request_sense()returns 0.
Quoted 3 lines
Thanks,
Bart.
I agree.
Bart Van Assche
maintainerPATCH 103/117 usb: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/usb/image/microtek.c | 4 ++-- drivers/usb/storage/cypress_atacb.c | 12 +++++----- drivers/usb/storage/datafab.c | 4 ++-- drivers/usb/storage/isd200.c | 34 ++++++++++++++--------------- drivers/usb/storage/jumpshot.c | 4 ++-- drivers/usb/storage/realtek_cr.c | 10 ++++----- drivers/usb/storage/scsiglue.c | 4 ++-- drivers/usb/storage/transport.c | 30 ++++++++++++------------- drivers/usb/storage/uas.c | 8 +++---- drivers/usb/storage/usb.c | 14 ++++++------ 10 files changed, 62 insertions(+), 62 deletions(-)
drivers/usb/image/microtek.c +2 -2
@@ -408,8 +408,8 @@ static void mts_transfer_done( struct urb *transfer ) {MTS_INT_INIT (); - context->srb->result &=MTS_SCSI_ERR_MASK ; - context->srb->result |= (unsigned )(*context->scsi_status)<<1 ; + context->srb->status.combined &=MTS_SCSI_ERR_MASK ; + context->srb->status.combined |= (unsigned )(*context->scsi_status)<<1 ;mts_transfer_cleanup (transfer); }
drivers/usb/storage/cypress_atacb.c +6 -6
@@ -148,7 +148,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)usb_stor_transparent_scsi_command (srb, us);/* if the device doesn't support ATACB */ -if (srb->result ==SAM_STAT_CHECK_CONDITION && +if (srb->status.combined ==SAM_STAT_CHECK_CONDITION &&memcmp (srb->sense_buffer, usb_stor_sense_invalidCDB,sizeof (usb_stor_sense_invalidCDB)) ==0 ) {usb_stor_dbg (us,"cypress atacb not supported ???\n" );
@@ -159,8 +159,8 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)* if ck_cond flags is set, and there wasn't critical error, * build the special sense */ -if ((srb->result != (DID_ERROR <<16 ) && - srb->result != (DID_ABORT <<16 )) && +if ((srb->status.combined != (DID_ERROR <<16 ) && + srb->status.combined != (DID_ABORT <<16 )) && save_cmnd[2 ] &0x20 ) {struct scsi_eh_save ses;unsigned char regs[8 ];
@@ -182,7 +182,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)usb_stor_transparent_scsi_command (srb, us);memcpy (regs, srb->sense_buffer,sizeof (regs)); - tmp_result = srb->result; + tmp_result = srb->status.combined;scsi_eh_restore_cmnd (srb, &ses);/* we fail to get registers, report invalid command */ if (tmp_result !=SAM_STAT_GOOD )
@@ -221,11 +221,11 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) desc[12 ] = regs[6 ];/* device */ desc[13 ] = regs[7 ];/* command */ - srb->result = (DRIVER_SENSE <<24 ) |SAM_STAT_CHECK_CONDITION ; + srb->status.combined = (DRIVER_SENSE <<24 ) |SAM_STAT_CHECK_CONDITION ; } goto end; invalid_fld: - srb->result = (DRIVER_SENSE <<24 ) |SAM_STAT_CHECK_CONDITION ; + srb->status.combined = (DRIVER_SENSE <<24 ) |SAM_STAT_CHECK_CONDITION ; memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB,
drivers/usb/storage/datafab.c +2 -2
@@ -702,10 +702,10 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) rc =datafab_id_device (us, info);if (rc ==USB_STOR_TRANSPORT_GOOD ) { info->sense_key =NO_SENSE ; - srb->result =SUCCESS ; + srb->status.combined =SUCCESS ; }else { info->sense_key =UNIT_ATTENTION ; - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ; }return rc; }
drivers/usb/storage/isd200.c +17 -17
@@ -630,12 +630,12 @@ static void isd200_invoke_transport( struct us_data *us,case USB_STOR_TRANSPORT_GOOD :/* Indicate a good result */ - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ;break ;case USB_STOR_TRANSPORT_NO_SENSE :usb_stor_dbg (us,"-- transport indicates protocol failure\n" ); - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ;return ;case USB_STOR_TRANSPORT_FAILED :
@@ -645,13 +645,13 @@ static void isd200_invoke_transport( struct us_data *us,case USB_STOR_TRANSPORT_ERROR :usb_stor_dbg (us,"-- transport indicates transport error\n" ); - srb->result =DID_ERROR <<16 ; + srb->status.combined =DID_ERROR <<16 ;/* Need reset here */ return ;default :usb_stor_dbg (us,"-- transport indicates unknown error\n" ); - srb->result =DID_ERROR <<16 ; + srb->status.combined =DID_ERROR <<16 ;/* Need reset here */ return ; }
@@ -674,13 +674,13 @@ static void isd200_invoke_transport( struct us_data *us, }if (result ==ISD200_GOOD ) {isd200_build_sense (us, srb); - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ;/* If things are really okay, then let's show that */ if ((srb->sense_buffer[2 ] &0xf ) ==0x0 ) - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ; }else { - srb->result =DID_ERROR <<16 ; + srb->status.combined =DID_ERROR <<16 ;/* Need reset here */ } }
@@ -690,7 +690,7 @@ static void isd200_invoke_transport( struct us_data *us,* condition, show that in the result code */ if (transferStatus ==USB_STOR_TRANSPORT_FAILED ) - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ;return ;/*
@@ -698,7 +698,7 @@ static void isd200_invoke_transport( struct us_data *us,* following an abort */ Handle_Abort: - srb->result =DID_ABORT <<16 ; + srb->status.combined =DID_ABORT <<16 ;/* permit the reset transfer to take place */ clear_bit (US_FLIDX_ABORTING , &us->dflags);
@@ -1238,7 +1238,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,/* copy InquiryData */ usb_stor_set_xfer_buf ((unsigned char *) &info->InquiryData,sizeof (info->InquiryData), srb); - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ; sendToTransport =0 ;break ;
@@ -1258,7 +1258,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,isd200_srb_set_bufflen (srb,0 ); }else {usb_stor_dbg (us," Media Status not supported, just report okay\n" ); - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ; sendToTransport =0 ; }break ;
@@ -1276,7 +1276,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,isd200_srb_set_bufflen (srb,0 ); }else {usb_stor_dbg (us," Media Status not supported, just report okay\n" ); - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ; sendToTransport =0 ; }break ;
@@ -1299,7 +1299,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,usb_stor_set_xfer_buf ((unsigned char *) &readCapacityData,sizeof (readCapacityData), srb); - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ; sendToTransport =0 ; }break ;
@@ -1384,7 +1384,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,isd200_srb_set_bufflen (srb,0 ); }else {usb_stor_dbg (us," Not removable media, just report okay\n" ); - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ; sendToTransport =0 ; }break ;
@@ -1410,7 +1410,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,isd200_srb_set_bufflen (srb,0 ); }else {usb_stor_dbg (us," Nothing to do, just report okay\n" ); - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ; sendToTransport =0 ; }break ;
@@ -1418,7 +1418,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,default :usb_stor_dbg (us,"Unsupported SCSI command - 0x%X\n" , srb->cmnd[0 ]); - srb->result =DID_ERROR <<16 ; + srb->status.combined =DID_ERROR <<16 ; sendToTransport =0 ;break ; }
@@ -1519,7 +1519,7 @@ static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us)if (us->extra ==NULL ) {usb_stor_dbg (us,"ERROR Driver not initialized\n" ); - srb->result =DID_ERROR <<16 ; + srb->status.combined =DID_ERROR <<16 ;return ; }
drivers/usb/storage/jumpshot.c +2 -2
@@ -627,10 +627,10 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) rc =jumpshot_id_device (us, info);if (rc ==USB_STOR_TRANSPORT_GOOD ) { info->sense_key =NO_SENSE ; - srb->result =SUCCESS ; + srb->status.combined =SUCCESS ; }else { info->sense_key =UNIT_ATTENTION ; - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ; }return rc; }
drivers/usb/storage/realtek_cr.c +5 -5
@@ -822,9 +822,9 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)if ((srb->cmnd[0 ] ==TEST_UNIT_READY ) && (chip->pwr_state ==US_SUSPEND )) {if (TST_LUN_READY (chip, srb->device->lun)) { - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ; }else { - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ;memcpy (srb->sense_buffer, media_not_present,US_SENSE_SIZE );
@@ -835,12 +835,12 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)if (srb->cmnd[0 ] ==ALLOW_MEDIUM_REMOVAL ) {int prevent = srb->cmnd[4 ] &0x1 ;if (prevent) { - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ;memcpy (srb->sense_buffer, invalid_cmd_field,US_SENSE_SIZE ); }else { - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ; }usb_stor_dbg (us,"ALLOW_MEDIUM_REMOVAL\n" ); goto out;
@@ -850,7 +850,7 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) chip->proto_handler_backup (srb, us);/* Check whether card is plugged in */ if (srb->cmnd[0 ] ==TEST_UNIT_READY ) { -if (srb->result ==SAM_STAT_GOOD ) { +if (srb->status.combined ==SAM_STAT_GOOD ) {SET_LUN_READY (chip, srb->device->lun);if (card_first_show) { card_first_show =0 ;
drivers/usb/storage/scsiglue.c +2 -2
@@ -378,7 +378,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb,/* fail the command if we are disconnecting */ if (test_bit (US_FLIDX_DISCONNECTING , &us->dflags)) {usb_stor_dbg (us,"Fail command during disconnect\n" ); - srb->result =DID_NO_CONNECT <<16 ; + srb->status.combined =DID_NO_CONNECT <<16 ;done (srb);return 0 ; }
@@ -387,7 +387,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb, (srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) {memcpy (srb->sense_buffer, usb_stor_sense_invalidCDB,sizeof (usb_stor_sense_invalidCDB)); - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ;done (srb);return 0 ; }
drivers/usb/storage/transport.c +15 -15
@@ -560,7 +560,7 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb)if (sector +1 != sdkp->capacity) goto done; -if (srb->result ==SAM_STAT_GOOD &&scsi_get_resid (srb) ==0 ) { +if (srb->status.combined ==SAM_STAT_GOOD &&scsi_get_resid (srb) ==0 ) {/* * The command succeeded. We know this device doesn't
@@ -580,7 +580,7 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb)*/ if (++us->last_sector_retries <3 )return ; - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ;memcpy (srb->sense_buffer, record_not_found,sizeof (record_not_found)); }
@@ -616,25 +616,25 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)*/ if (test_bit (US_FLIDX_TIMED_OUT , &us->dflags)) {usb_stor_dbg (us,"-- command was aborted\n" ); - srb->result =DID_ABORT <<16 ; + srb->status.combined =DID_ABORT <<16 ; goto Handle_Errors; }/* if there is a transport error, reset and don't auto-sense */ if (result ==USB_STOR_TRANSPORT_ERROR ) {usb_stor_dbg (us,"-- transport indicates error, resetting\n" ); - srb->result =DID_ERROR <<16 ; + srb->status.combined =DID_ERROR <<16 ; goto Handle_Errors; }/* if the transport provided its own sense data, don't auto-sense */ if (result ==USB_STOR_TRANSPORT_NO_SENSE ) { - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ;last_sector_hacks (us, srb);return ; } - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ;/* * Determine if we need to auto-sense
@@ -727,7 +727,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)if (test_bit (US_FLIDX_TIMED_OUT , &us->dflags)) {usb_stor_dbg (us,"-- auto-sense aborted\n" ); - srb->result =DID_ABORT <<16 ; + srb->status.combined =DID_ABORT <<16 ;/* If SANE_SENSE caused this problem, disable it */ if (sense_size !=US_SENSE_SIZE ) {
@@ -761,7 +761,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)* multi-target device, since failure of an * auto-sense is perfectly valid */ - srb->result =DID_ERROR <<16 ; + srb->status.combined =DID_ERROR <<16 ;if (!(us->fflags &US_FL_SCM_MULT_TARG )) goto Handle_Errors;return ;
@@ -802,7 +802,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)#endif /* set the result so the higher layers expect this data */ - srb->result =SAM_STAT_CHECK_CONDITION ; + srb->status.combined =SAM_STAT_CHECK_CONDITION ; scdd =scsi_sense_desc_find (srb->sense_buffer,SCSI_SENSE_BUFFERSIZE ,4 );
@@ -821,7 +821,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)* won't realize we did an unsolicited auto-sense. */ if (result ==USB_STOR_TRANSPORT_GOOD ) { - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ; srb->sense_buffer[0 ] =0x0 ; }
@@ -842,7 +842,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)* entering an infinite retry loop. */ else { - srb->result =DID_ERROR <<16 ; + srb->status.combined =DID_ERROR <<16 ;if ((sshdr.response_code &0x72 ) ==0x72 ) srb->sense_buffer[1 ] =HARDWARE_ERROR ;else
@@ -861,7 +861,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)*/ if (unlikely ((us->fflags &US_FL_INITIAL_READ10 ) && srb->cmnd[0 ] ==READ_10 )) { -if (srb->result ==SAM_STAT_GOOD ) { +if (srb->status.combined ==SAM_STAT_GOOD ) {set_bit (US_FLIDX_READ10_WORKED , &us->dflags); }else if (test_bit (US_FLIDX_READ10_WORKED , &us->dflags)) {clear_bit (US_FLIDX_READ10_WORKED , &us->dflags);
@@ -875,15 +875,15 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)*/ if (test_bit (US_FLIDX_REDO_READ10 , &us->dflags)) {clear_bit (US_FLIDX_REDO_READ10 , &us->dflags); - srb->result =DID_IMM_RETRY <<16 ; + srb->status.combined =DID_IMM_RETRY <<16 ; srb->sense_buffer[0 ] =0 ; } }/* Did we transfer less than the minimum amount required? */ -if ((srb->result ==SAM_STAT_GOOD || srb->sense_buffer[2 ] ==0 ) && +if ((srb->status.combined ==SAM_STAT_GOOD || srb->sense_buffer[2 ] ==0 ) &&scsi_bufflen (srb) -scsi_get_resid (srb) < srb->underflow) - srb->result =DID_ERROR <<16 ; + srb->status.combined =DID_ERROR <<16 ;last_sector_hacks (us, srb);return ;
drivers/usb/storage/uas.c +4 -4
@@ -167,7 +167,7 @@ static void uas_zap_pending(struct uas_dev_info *devinfo, int result)uas_log_cmd_state (cmnd, __func__,0 );/* Sense urbs were killed, clear COMMAND_INFLIGHT manually */ cmdinfo->state &= ~COMMAND_INFLIGHT ; - cmnd->result = result <<16 ; + cmnd->status.combined = result <<16 ; err =uas_try_complete (cmnd, __func__);WARN_ON (err !=0 ); }
@@ -194,7 +194,7 @@ static void uas_sense(struct urb *urb, struct scsi_cmnd *cmnd)memcpy (cmnd->sense_buffer, sense_iu->sense, len); } - cmnd->result = sense_iu->status; + cmnd->status.combined = sense_iu->status; } static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix,
@@ -339,7 +339,7 @@ static void uas_stat_cmplt(struct urb *urb)switch (iu->iu_id) {case IU_ID_STATUS :uas_sense (urb, cmnd); -if (cmnd->result !=0 ) { +if (cmnd->status.combined !=0 ) {/* cancel data transfers on error */ data_in_urb =usb_get_urb (cmdinfo->data_in_urb); data_out_urb =usb_get_urb (cmdinfo->data_out_urb);
@@ -652,7 +652,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd, (cmnd->cmnd[0] == ATA_12 || cmnd->cmnd[0] == ATA_16)) {memcpy (cmnd->sense_buffer, usb_stor_sense_invalidCDB,sizeof (usb_stor_sense_invalidCDB)); - cmnd->result =SAM_STAT_CHECK_CONDITION ; + cmnd->status.combined =SAM_STAT_CHECK_CONDITION ; cmnd->scsi_done (cmnd);return 0 ; }
drivers/usb/storage/usb.c +7 -7
@@ -325,7 +325,7 @@ static int usb_stor_control_thread(void * __us)/* has the command timed out *already* ? */ if (test_bit (US_FLIDX_TIMED_OUT , &us->dflags)) { - srb->result =DID_ABORT <<16 ; + srb->status.combined =DID_ABORT <<16 ; goto SkipForAbort; }
@@ -337,7 +337,7 @@ static int usb_stor_control_thread(void * __us)*/ if (srb->sc_data_direction ==DMA_BIDIRECTIONAL ) {usb_stor_dbg (us,"UNKNOWN data direction\n" ); - srb->result =DID_ERROR <<16 ; + srb->status.combined =DID_ERROR <<16 ; }/*
@@ -349,14 +349,14 @@ static int usb_stor_control_thread(void * __us)usb_stor_dbg (us,"Bad target number (%d:%llu)\n" , srb->device->id, srb->device->lun); - srb->result =DID_BAD_TARGET <<16 ; + srb->status.combined =DID_BAD_TARGET <<16 ; }else if (srb->device->lun > us->max_lun) {usb_stor_dbg (us,"Bad LUN (%d:%llu)\n" , srb->device->id, srb->device->lun); - srb->result =DID_BAD_TARGET <<16 ; + srb->status.combined =DID_BAD_TARGET <<16 ; }/*
@@ -371,7 +371,7 @@ static int usb_stor_control_thread(void * __us)usb_stor_dbg (us,"Faking INQUIRY command\n" );fill_inquiry_response (us, data_ptr,36 ); - srb->result =SAM_STAT_GOOD ; + srb->status.combined =SAM_STAT_GOOD ; }/* we've got a command, let's do it! */
@@ -385,7 +385,7 @@ static int usb_stor_control_thread(void * __us)scsi_lock (host);/* was the command aborted? */ -if (srb->result ==DID_ABORT <<16 ) { +if (srb->status.combined ==DID_ABORT <<16 ) { SkipForAbort:usb_stor_dbg (us,"scsi command aborted\n" ); srb =NULL ;/* Don't call srb->scsi_done() */
@@ -416,7 +416,7 @@ static int usb_stor_control_thread(void * __us)/* now that the locks are released, notify the SCSI core */ if (srb) {usb_stor_dbg (us,"scsi cmd done, result=0x%x\n" , - srb->result); + srb->status.combined); srb->scsi_done (srb); } }/* for (;;) */
Bart Van Assche
maintainerPATCH 104/117 virtio-scsi: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/virtio_scsi.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/scsi/virtio_scsi.c +6 -4
@@ -115,7 +115,7 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)"cmd %p response %u status %#02x sense_len %u\n" , sc, resp->response, resp->status, resp->sense_len); - sc->result = resp->status; + sc->status.combined = resp->status;virtscsi_compute_resid (sc,virtio32_to_cpu (vscsi->vdev, resp->resid));switch (resp->response) {case VIRTIO_SCSI_S_OK :
@@ -336,7 +336,8 @@ static void virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi)struct scsi_device *sdev;struct Scsi_Host *shost =virtio_scsi_host (vscsi->vdev);unsigned char scsi_cmd[MAX_COMMAND_SIZE ]; -int result, inquiry_len, inq_result_len =256 ; +int inquiry_len, inq_result_len =256 ; +union scsi_status result;char *inq_result =kmalloc (inq_result_len,GFP_KERNEL );shost_for_each_device (sdev, shost) {
@@ -348,11 +349,12 @@ static void virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi)memset (inq_result,0 , inq_result_len); - result =scsi_execute_req (sdev, scsi_cmd,DMA_FROM_DEVICE , + result.combined = +scsi_execute_req (sdev, scsi_cmd,DMA_FROM_DEVICE , inq_result, inquiry_len,NULL ,SD_TIMEOUT ,SD_MAX_RETRIES ,NULL ); -if (result ==0 && inq_result[0 ] >>5 ) { +if (result.combined ==0 && inq_result[0 ] >>5 ) {/* PQ indicates the LUN is not attached */ scsi_remove_device (sdev); }else if (host_byte (result) ==DID_BAD_TARGET ) {
Bart Van Assche
maintainerPATCH 105/117 vmw_pvscsi: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/vmw_pvscsi.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/scsi/vmw_pvscsi.c +16 -16
@@ -567,18 +567,18 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,return ; } - cmd->result =0 ; + cmd->status.combined =0 ;if (sdstat !=SAM_STAT_GOOD && (btstat ==BTSTAT_SUCCESS || btstat ==BTSTAT_LINKED_COMMAND_COMPLETED || btstat ==BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG )) {if (sdstat ==SAM_STAT_COMMAND_TERMINATED ) { - cmd->result = (DID_RESET <<16 ); + cmd->status.combined = (DID_RESET <<16 ); }else { - cmd->result = (DID_OK <<16 ) | sdstat; + cmd->status.combined = (DID_OK <<16 ) | sdstat;if (sdstat ==SAM_STAT_CHECK_CONDITION && cmd->sense_buffer) - cmd->result |= (DRIVER_SENSE <<24 ); + cmd->status.combined |= (DRIVER_SENSE <<24 ); } }else switch (btstat) {
@@ -586,25 +586,25 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,case BTSTAT_LINKED_COMMAND_COMPLETED :case BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG :/* If everything went fine, let's move on.. */ - cmd->result = (DID_OK <<16 ); + cmd->status.combined = (DID_OK <<16 );break ;case BTSTAT_DATARUN :case BTSTAT_DATA_UNDERRUN :/* Report residual data in underruns */ scsi_set_resid (cmd,scsi_bufflen (cmd) - e->dataLen); - cmd->result = (DID_ERROR <<16 ); + cmd->status.combined = (DID_ERROR <<16 );break ;case BTSTAT_SELTIMEO :/* Our emulation returns this for non-connected devs */ - cmd->result = (DID_BAD_TARGET <<16 ); + cmd->status.combined = (DID_BAD_TARGET <<16 );break ;case BTSTAT_LUNMISMATCH :case BTSTAT_TAGREJECT :case BTSTAT_BADMSG : - cmd->result = (DRIVER_INVALID <<24 ); + cmd->status.combined = (DRIVER_INVALID <<24 ); fallthrough;case BTSTAT_HAHARDWARE :
@@ -615,25 +615,25 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,case BTSTAT_HASOFTWARE :case BTSTAT_BUSFREE :case BTSTAT_SENSFAILED : - cmd->result |= (DID_ERROR <<16 ); + cmd->status.combined |= (DID_ERROR <<16 );break ;case BTSTAT_SENTRST :case BTSTAT_RECVRST :case BTSTAT_BUSRESET : - cmd->result = (DID_RESET <<16 ); + cmd->status.combined = (DID_RESET <<16 );break ;case BTSTAT_ABORTQUEUE : - cmd->result = (DID_BUS_BUSY <<16 ); + cmd->status.combined = (DID_BUS_BUSY <<16 );break ;case BTSTAT_SCSIPARITY : - cmd->result = (DID_PARITY <<16 ); + cmd->status.combined = (DID_PARITY <<16 );break ;default : - cmd->result = (DID_ERROR <<16 ); + cmd->status.combined = (DID_ERROR <<16 );scmd_printk (KERN_DEBUG , cmd,"Unknown completion status: 0x%x\n" , btstat);
@@ -641,7 +641,7 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,dev_dbg (&cmd->device->sdev_gendev,"cmd=%p %x ctx=%p result=0x%x status=0x%x,%x\n" , - cmd, cmd->cmnd[0 ], ctx, cmd->result, btstat, sdstat); + cmd, cmd->cmnd[0 ], ctx, cmd->status.combined, btstat, sdstat); cmd->scsi_done (cmd); }
@@ -859,7 +859,7 @@ static int pvscsi_abort(struct scsi_cmnd *cmd)/* * Successfully aborted the command. */ - cmd->result = (DID_ABORT <<16 ); + cmd->status.combined = (DID_ABORT <<16 ); cmd->scsi_done (cmd); out:
@@ -886,7 +886,7 @@ static void pvscsi_reset_all(struct pvscsi_adapter *adapter)pvscsi_unmap_buffers (adapter, ctx);pvscsi_patch_sense (cmd);pvscsi_release_context (adapter, ctx); - cmd->result = (DID_RESET <<16 ); + cmd->status.combined = (DID_RESET <<16 ); cmd->scsi_done (cmd); } }
Bart Van Assche
maintainerPATCH 106/117 wd33c93: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/wd33c93.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
drivers/scsi/wd33c93.c +14 -16
@@ -381,7 +381,7 @@ wd33c93_queuecommand_lck(struct scsi_cmnd *cmd,*/ cmd->host_scribble =NULL ; cmd->scsi_done = done; - cmd->result =0 ; + cmd->status.combined =0 ;/* We use the Scsi_Pointer structure that's included with each command * as a scratchpad (as it's intended to be used!). The handy thing about
@@ -853,7 +853,7 @@ wd33c93_intr(struct Scsi_Host *instance) hostdata->selecting =NULL ; } - cmd->result =DID_NO_CONNECT <<16 ; + cmd->status.combined =DID_NO_CONNECT <<16 ; hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun &0xff )); hostdata->state =S_UNCONNECTED ; cmd->scsi_done (cmd);
@@ -1177,11 +1177,10 @@ wd33c93_intr(struct Scsi_Host *instance) cmd->SCp.Status = lun;if (cmd->cmnd[0 ] ==REQUEST_SENSE && cmd->SCp.Status !=SAM_STAT_GOOD ) - cmd->result = - (cmd-> - result &0x00ffff ) | (DID_ERROR <<16 ); + cmd->status.combined = + (cmd->status.combined &0x00ffff ) | (DID_ERROR <<16 );else - cmd->result = + cmd->status.combined = cmd->SCp.Status | (cmd->SCp.Message <<8 ); cmd->scsi_done (cmd);
@@ -1263,10 +1262,10 @@ wd33c93_intr(struct Scsi_Host *instance) hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun &0xff )); hostdata->state =S_UNCONNECTED ;if (cmd->cmnd[0 ] ==REQUEST_SENSE && cmd->SCp.Status !=SAM_STAT_GOOD ) - cmd->result = - (cmd->result &0x00ffff ) | (DID_ERROR <<16 ); + cmd->status.combined = + (cmd->status.combined &0x00ffff ) | (DID_ERROR <<16 );else - cmd->result = cmd->SCp.Status | (cmd->SCp.Message <<8 ); + cmd->status.combined = cmd->SCp.Status | (cmd->SCp.Message <<8 ); cmd->scsi_done (cmd);/* We are no longer connected to a target - check to see if
@@ -1297,11 +1296,10 @@ wd33c93_intr(struct Scsi_Host *instance) DB(DB_INTR, printk(":%d", cmd->SCp.Status))if (cmd->cmnd[0 ] ==REQUEST_SENSE && cmd->SCp.Status !=SAM_STAT_GOOD ) - cmd->result = - (cmd-> - result &0x00ffff ) | (DID_ERROR <<16 ); + cmd->status.combined = + (cmd->status.combined &0x00ffff ) | (DID_ERROR <<16 );else - cmd->result = + cmd->status.combined = cmd->SCp.Status | (cmd->SCp.Message <<8 ); cmd->scsi_done (cmd);break ;
@@ -1593,7 +1591,7 @@ wd33c93_host_reset(struct scsi_cmnd * SCpnt) hostdata->outgoing_len =0 ;reset_wd33c93 (instance); - SCpnt->result =DID_RESET <<16 ; + SCpnt->status.combined =DID_RESET <<16 ;enable_irq (instance->irq);spin_unlock_irq (instance->host_lock);return SUCCESS ;
@@ -1628,7 +1626,7 @@ wd33c93_abort(struct scsi_cmnd * cmd) hostdata->input_Q = (struct scsi_cmnd *) cmd->host_scribble; cmd->host_scribble =NULL ; - cmd->result =DID_ABORT <<16 ; + cmd->status.combined =DID_ABORT <<16 ;printk ("scsi%d: Abort - removing command from input_Q. " , instance->host_no);
@@ -1702,7 +1700,7 @@ wd33c93_abort(struct scsi_cmnd * cmd) hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun &0xff )); hostdata->connected =NULL ; hostdata->state =S_UNCONNECTED ; - cmd->result =DID_ABORT <<16 ; + cmd->status.combined =DID_ABORT <<16 ;/* sti();*/ wd33c93_execute (instance);
Bart Van Assche
maintainerPATCH 107/117 wd719x: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/wd719x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/wd719x.c +2 -2
@@ -199,7 +199,7 @@ static void wd719x_finish_cmd(struct wd719x_scb *scb, int result)dma_unmap_single (&wd->pdev->dev, cmd->SCp.dma_handle,SCSI_SENSE_BUFFERSIZE ,DMA_FROM_DEVICE ); - cmd->result = result <<16 ; + cmd->status.combined = result <<16 ; cmd->scsi_done (cmd); }
@@ -294,7 +294,7 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)dma_unmap_single (&wd->pdev->dev, scb->phys,sizeof (*scb),DMA_BIDIRECTIONAL ); out_error: - cmd->result =DID_ERROR <<16 ; + cmd->status.combined =DID_ERROR <<16 ; cmd->scsi_done (cmd);return 0 ; }
Bart Van Assche
maintainerPATCH 108/117 xen-scsiback: Pass union status to the {status,msg,host,driver}_byte() macros
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/xen/xen-scsiback.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/xen/xen-scsiback.c +6 -5
@@ -217,7 +217,7 @@ static unsigned long vaddr(struct vscsibk_pend *req, int seg)return vaddr_page (req->pages[seg]); } -static void scsiback_print_status (char *sense_buffer,int errors, +static void scsiback_print_status (char *sense_buffer,union scsi_status errors,struct vscsibk_pend *pending_req) {struct scsiback_tpg *tpg = pending_req->v2p->tpg;
@@ -336,17 +336,18 @@ static void scsiback_cmd_done(struct vscsibk_pend *pending_req)struct vscsibk_info *info = pending_req->info;unsigned char *sense_buffer;unsigned int resid; -int errors; +union scsi_status errors; sense_buffer = pending_req->sense_buffer; resid = pending_req->se_cmd.residual_count; - errors = pending_req->result; + errors.combined = pending_req->result; -if (errors && log_print_stat) +if (errors.combined && log_print_stat)scsiback_print_status (sense_buffer, errors, pending_req);scsiback_fast_flush_area (pending_req); -scsiback_do_resp_with_sense (sense_buffer, errors, resid, pending_req); +scsiback_do_resp_with_sense (sense_buffer, errors.combined, resid, + pending_req);scsiback_put (info);/* * Drop the extra KREF_ACK reference taken by target_submit_cmd_map_sgls()
Bart Van Assche
maintainerPATCH 109/117 xen-scsifront: Convert to the scsi_status union
In reply to Bart Van AsscheAn explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union".
--- drivers/scsi/xen-scsifront.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/xen-scsifront.c +3 -3
@@ -261,7 +261,7 @@ static void scsifront_cdb_cmd_done(struct vscsifrnt_info *info,scsifront_gnttab_done (info, shadow);scsifront_put_rqid (info, id); - sc->result = ring_rsp->rslt; + sc->status.combined = ring_rsp->rslt;scsi_set_resid (sc, ring_rsp->residual_len); sense_len = min_t(uint8_t, VSCSIIF_SENSE_BUFFERSIZE,
@@ -533,7 +533,7 @@ static int scsifront_queuecommand(struct Scsi_Host *shost,unsigned long flags;int err; - sc->result =0 ; + sc->status.combined =0 ; shadow->sc = sc; shadow->act =VSCSIIF_ACT_SCSI_CDB ;
@@ -551,7 +551,7 @@ static int scsifront_queuecommand(struct Scsi_Host *shost,spin_unlock_irqrestore (shost->host_lock, flags);if (err == -ENOMEM )return SCSI_MLQUEUE_HOST_BUSY ; - sc->result =DID_ERROR <<16 ; + sc->status.combined =DID_ERROR <<16 ; sc->scsi_done (sc);return 0 ; }
Bart Van Assche
maintainerPATCH 110/117 Finalize the switch from 'int' to 'union scsi_status'
In reply to Bart Van AsscheA previous patch changed 'int result;' into a union and introduced the scsi_status member in that union. Now that the conversion from type 'int' into 'union scsi_status' is complete, remove the 'result' member.
--- include/linux/bsg-lib.h | 5 +---- include/scsi/scsi_bsg_iscsi.h | 7 ++----- include/scsi/scsi_cmnd.h | 5 +---- include/scsi/scsi_eh.h | 5 +---- include/scsi/scsi_request.h | 5 +---- include/uapi/scsi/scsi_bsg_fc.h | 5 +---- include/uapi/scsi/scsi_bsg_ufs.h | 7 ++----- 7 files changed, 9 insertions(+), 30 deletions(-)
include/linux/bsg-lib.h +1 -4
@@ -53,10 +53,7 @@ struct bsg_job {struct bsg_buffer request_payload;struct bsg_buffer reply_payload; -union { -int result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;unsigned int reply_payload_rcv_len;/* BIDI support */
include/scsi/scsi_bsg_iscsi.h +2 -5
@@ -76,17 +76,14 @@ struct iscsi_bsg_request {/* response (request sense data) structure of the sg_io_v4 */ struct iscsi_bsg_reply {/* -* The completion result. Result exists in two forms: +* The completion status. Result exists in two forms: * if negative, it is an -Exxx system errno value. There will * be no further reply information supplied. * else, it's the 4-byte scsi error result, with driver, host, * msg and status fields. The per-msgcode reply structure * will contain valid data. */ -union { -uint32_t result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;/* If there was reply_payload, how much was recevied ? */ uint32_t reply_payload_rcv_len;
include/scsi/scsi_cmnd.h +1 -4
@@ -141,10 +141,7 @@ struct scsi_cmnd {* to be at an address < 16Mb). */ /* Status code from lower level driver */ -union { -int result;/* do not use in new code. */ -union scsi_status status; - }; +union scsi_status status;int flags;/* Command flags */ unsigned long state;/* Command completion state */
include/scsi/scsi_eh.h +1 -4
@@ -33,10 +33,7 @@ extern int scsi_ioctl_reset(struct scsi_device *, int __user *);struct scsi_eh_save {/* saved state */ -union { -int result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;unsigned int resid_len;int eh_eflags;enum dma_data_direction data_direction;
include/scsi/scsi_request.h +1 -4
@@ -11,10 +11,7 @@ struct scsi_request {unsigned char __cmd[BLK_MAX_CDB ];unsigned char *cmd;unsigned short cmd_len; -union { -int result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;unsigned int sense_len;unsigned int resid_len;/* residual count */ int retries;
include/uapi/scsi/scsi_bsg_fc.h +1 -4
@@ -295,10 +295,7 @@ struct fc_bsg_reply {* will contain valid data. */ #ifdef __KERNEL__ -union { -__u32 result;/* do not use in new kernel code */ -union scsi_status status; - }; +union scsi_status status;#else __u32 result;#endif
include/uapi/scsi/scsi_bsg_ufs.h +2 -5
@@ -92,7 +92,7 @@ struct ufs_bsg_request {/* response (request sense data) structure of the sg_io_v4 */ struct ufs_bsg_reply {/* -* The completion result. Result exists in two forms: +* The completion status. Exists in two forms: * if negative, it is an -Exxx system errno value. There will * be no further reply information supplied. * else, it's the 4-byte scsi error result, with driver, host,
@@ -100,10 +100,7 @@ struct ufs_bsg_reply {* will contain valid data. */ #ifdef __KERNEL__ -union { -__u32 result;/* do not use in new kernel code */ -union scsi_status status; - }; +union scsi_status status;#else __u32 result;#endif
Re: [PATCH 110/117] Finalize the switch from 'int' to 'union scsi_status'
Quoted 141 lines · Bart Van Assche
A previous patch changed 'int result;' into a union and introduced the
scsi_statusmember in that union. Now that the conversion from type 'int' into 'unionscsi_status' is complete, remove the 'result' member.Cc Christoph Hellwig <[email protected]>Cc Ming Lei <[email protected]>Cc Hannes Reinecke <[email protected]>Cc John Garry <[email protected]>Cc Lee Duncan <[email protected]>Cc Can Guo <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- include/linux/bsg-lib.h | 5 +---- include/scsi/scsi_bsg_iscsi.h | 7 ++----- include/scsi/scsi_cmnd.h | 5 +---- include/scsi/scsi_eh.h | 5 +---- include/scsi/scsi_request.h | 5 +---- include/uapi/scsi/scsi_bsg_fc.h | 5 +---- include/uapi/scsi/scsi_bsg_ufs.h | 7 ++----- 7 files changed, 9 insertions(+), 30 deletions(-)include/linux/bsg-lib.h +1
-4@@ -53,10 +53,7 @@ struct bsg_job {struct bsg_buffer request_payload;struct bsg_buffer reply_payload; -union { -int result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;unsigned int reply_payload_rcv_len;/* BIDI support */ include/scsi/scsi_bsg_iscsi.h +2
-5@@ -76,17 +76,14 @@ struct iscsi_bsg_request {/* response (request sense data) structure of the sg_io_v4 */ struct iscsi_bsg_reply {/* -* The completion result. Result exists in two forms: +* The completion status. Result exists in two forms: * if negative, it is an -Exxx system errno value. There will * be no further reply information supplied. * else, it's the 4-byte scsi error result, with driver, host, * msg and status fields. The per-msgcode reply structure * will contain valid data. */ -union { -uint32_t result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;/* If there was reply_payload, how much was recevied ? */ uint32_t reply_payload_rcv_len;include/scsi/scsi_cmnd.h +1
-4@@ -141,10 +141,7 @@ struct scsi_cmnd {* to be at an address < 16Mb). */ /* Status code from lower level driver */ -union { -int result;/* do not use in new code. */ -union scsi_status status; - }; +union scsi_status status;int flags;/* Command flags */ unsigned long state;/* Command completion state */ include/scsi/scsi_eh.h +1
-4@@ -33,10 +33,7 @@ extern int scsi_ioctl_reset(struct scsi_device *, int __user *);struct scsi_eh_save {/* saved state */ -union { -int result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;unsigned int resid_len;int eh_eflags;enum dma_data_direction data_direction;include/scsi/scsi_request.h +1
-4@@ -11,10 +11,7 @@ struct scsi_request {unsigned char __cmd[BLK_MAX_CDB ];unsigned char *cmd;unsigned short cmd_len; -union { -int result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;unsigned int sense_len;unsigned int resid_len;/* residual count */ int retries;include/uapi/scsi/scsi_bsg_fc.h +1
-4@@ -295,10 +295,7 @@ struct fc_bsg_reply {* will contain valid data. */ #ifdef __KERNEL__ -union { -__u32 result;/* do not use in new kernel code */ -union scsi_status status; - }; +union scsi_status status;#else __u32 result;#endif include/uapi/scsi/scsi_bsg_ufs.h +1
-1@@ -92,7 +92,7 @@ struct ufs_bsg_request {/* response (request sense data) structure of the sg_io_v4 */ struct ufs_bsg_reply {/* -* The completion result. Result exists in two forms: +* The completion status. Exists in two forms: * if negative, it is an -Exxx system errno value. There will * be no further reply information supplied. * else, it's the 4-byte scsi error result, with driver, host, @@ -100,10 +100,7 @@ struct ufs_bsg_reply {* will contain valid data.
include/uapi/scsi/scsi_bsg_ufs.h struct ufs_bsg_reply { · line 106
Quoted 10 lines
include/uapi/scsi/scsi_bsg_ufs.h +1
-4*/ #ifdef __KERNEL__ -union { -__u32 result;/* do not use in new kernel code */ -union scsi_status status; - }; +union scsi_status status;#else __u32 result;#endif
Re: [PATCH 110/117] Finalize the switch from 'int' to 'union scsi_status'
In reply to Bart Van AsscheQuoted 141 lines · Bart Van Assche
A previous patch changed 'int result;' into a union and introduced the
scsi_statusmember in that union. Now that the conversion from type 'int' into 'unionscsi_status' is complete, remove the 'result' member.Cc Christoph Hellwig <[email protected]>Cc Ming Lei <[email protected]>Cc Hannes Reinecke <[email protected]>Cc John Garry <[email protected]>Cc Lee Duncan <[email protected]>Cc Can Guo <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- include/linux/bsg-lib.h | 5 +---- include/scsi/scsi_bsg_iscsi.h | 7 ++----- include/scsi/scsi_cmnd.h | 5 +---- include/scsi/scsi_eh.h | 5 +---- include/scsi/scsi_request.h | 5 +---- include/uapi/scsi/scsi_bsg_fc.h | 5 +---- include/uapi/scsi/scsi_bsg_ufs.h | 7 ++----- 7 files changed, 9 insertions(+), 30 deletions(-)include/linux/bsg-lib.h +1
-4@@ -53,10 +53,7 @@ struct bsg_job {struct bsg_buffer request_payload;struct bsg_buffer reply_payload; -union { -int result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;unsigned int reply_payload_rcv_len;/* BIDI support */ include/scsi/scsi_bsg_iscsi.h +2
-5@@ -76,17 +76,14 @@ struct iscsi_bsg_request {/* response (request sense data) structure of the sg_io_v4 */ struct iscsi_bsg_reply {/* -* The completion result. Result exists in two forms: +* The completion status. Result exists in two forms: * if negative, it is an -Exxx system errno value. There will * be no further reply information supplied. * else, it's the 4-byte scsi error result, with driver, host, * msg and status fields. The per-msgcode reply structure * will contain valid data. */ -union { -uint32_t result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;/* If there was reply_payload, how much was recevied ? */ uint32_t reply_payload_rcv_len;include/scsi/scsi_cmnd.h +1
-4@@ -141,10 +141,7 @@ struct scsi_cmnd {* to be at an address < 16Mb). */ /* Status code from lower level driver */ -union { -int result;/* do not use in new code. */ -union scsi_status status; - }; +union scsi_status status;int flags;/* Command flags */ unsigned long state;/* Command completion state */ include/scsi/scsi_eh.h +1
-4@@ -33,10 +33,7 @@ extern int scsi_ioctl_reset(struct scsi_device *, int __user *);struct scsi_eh_save {/* saved state */ -union { -int result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;unsigned int resid_len;int eh_eflags;include/scsi/scsi_eh.h +0
-0enum dma_data_direction data_direction;include/scsi/scsi_request.h +1
-4@@ -11,10 +11,7 @@ struct scsi_request {unsigned char __cmd[BLK_MAX_CDB ];unsigned char *cmd;unsigned short cmd_len; -union { -int result;/* do not use in new code */ -union scsi_status status; - }; +union scsi_status status;unsigned int sense_len;unsigned int resid_len;/* residual count */ int retries;include/uapi/scsi/scsi_bsg_fc.h +1
-4@@ -295,10 +295,7 @@ struct fc_bsg_reply {* will contain valid data. */ #ifdef __KERNEL__ -union { -__u32 result;/* do not use in new kernel code */ -union scsi_status status; - }; +union scsi_status status;#else __u32 result;#endif include/uapi/scsi/scsi_bsg_ufs.h +1
-1@@ -92,7 +92,7 @@ struct ufs_bsg_request {/* response (request sense data) structure of the sg_io_v4 */ struct ufs_bsg_reply {/* -* The completion result. Result exists in two forms: +* The completion status. Exists in two forms: * if negative, it is an -Exxx system errno value. There will * be no further reply information supplied. * else, it's the 4-byte scsi error result, with driver, host, @@ -100,10 +100,7 @@ struct ufs_bsg_reply {* will contain valid data.
include/uapi/scsi/scsi_bsg_ufs.h struct ufs_bsg_reply { · line 106
Quoted 10 lines
include/uapi/scsi/scsi_bsg_ufs.h +1
-4*/ #ifdef __KERNEL__ -union { -__u32 result;/* do not use in new kernel code */ -union scsi_status status; - }; +union scsi_status status;#else __u32 result;#endif
Bart Van Assche
maintainerPATCH 111/117 Use the scsi_status union more widely
In reply to Bart Van AsscheChange the type of the SCSI status argument of the following functions from int into union scsi_status:
* scsi_status_is_good();
* status_byte();
* msg_byte();
* host_byte();
* driver_byte();
* scsi_hostbyte_string();
* scsi_driverbyte_string().
Make all callers of these functions pass a union scsi_result as argument.
Remove the scsi_status_to_int() macro.
--- drivers/scsi/constants.c | 8 ++++---- drivers/scsi/scsi_logging.c | 4 ++-- drivers/scsi/sd.c | 4 ++-- include/scsi/scsi.h | 28 +++++++--------------------- include/scsi/scsi_dbg.h | 10 ++++++---- 5 files changed, 21 insertions(+), 33 deletions(-)
drivers/scsi/constants.c +4 -4
@@ -410,10 +410,10 @@ static const char * const driverbyte_table[]={"DRIVER_OK" ,"DRIVER_BUSY" ,"DRIVER_SOFT" ,"DRIVER_MEDIA" ,"DRIVER_ERROR" , "DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"}; -const char *scsi_hostbyte_string (int result) +const char *scsi_hostbyte_string (union scsi_status result) {const char *hb_string =NULL ; -int hb =host_byte (result); +enum host_status hb =host_byte (result);if (hb <ARRAY_SIZE (hostbyte_table)) hb_string = hostbyte_table[hb];
@@ -421,10 +421,10 @@ const char *scsi_hostbyte_string(int result) }EXPORT_SYMBOL (scsi_hostbyte_string); -const char *scsi_driverbyte_string (int result) +const char *scsi_driverbyte_string (union scsi_status result) {const char *db_string =NULL ; -int db =driver_byte (result); +enum driver_status db =driver_byte (result);if (db <ARRAY_SIZE (driverbyte_table)) db_string = driverbyte_table[db];
drivers/scsi/scsi_logging.c +2 -2
@@ -384,8 +384,8 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg,char *logbuf;size_t off, logbuf_len;const char *mlret_string =scsi_mlreturn_string (disposition); -const char *hb_string =scsi_hostbyte_string (cmd->status.combined); -const char *db_string =scsi_driverbyte_string (cmd->status.combined); +const char *hb_string =scsi_hostbyte_string (cmd->status); +const char *db_string =scsi_driverbyte_string (cmd->status);unsigned long cmd_age = (jiffies - cmd->jiffies_at_alloc) /HZ ; logbuf =scsi_log_reserve_buffer (&logbuf_len);
drivers/scsi/sd.c +2 -2
@@ -3812,8 +3812,8 @@ void sd_print_sense_hdr(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)void sd_print_result (const struct scsi_disk *sdkp,const char *msg,union scsi_status result) { -const char *hb_string =scsi_hostbyte_string (result.combined); -const char *db_string =scsi_driverbyte_string (result.combined); +const char *hb_string =scsi_hostbyte_string (result); +const char *db_string =scsi_driverbyte_string (result);if (hb_string || db_string) sd_printk(KERN_INFO, sdkp,
include/scsi/scsi.h +7 -21
@@ -33,20 +33,20 @@ enum scsi_timeouts {/** scsi_status_is_good - check the status return. * -* @status: the status passed up from the driver (including host and +* @scsi_status: the status passed up from the driver (including host and * driver components) * * This returns true for known good conditions that may be treated as * command completed normally */ -static inline bool __scsi_status_is_good (int status) +static inline bool scsi_status_is_good (union scsi_status scsi_status) {/* * FIXME: bit0 is listed as reserved in SCSI-2, but is * significant in SCSI-3. For now, we follow the SCSI-2 * behaviour and ignore reserved bits. */ - status &=0xfe ; +const u8 status = scsi_status.combined &0xfe ; return ((status == SAM_STAT_GOOD) || (status == SAM_STAT_CONDITION_MET) ||/* Next two "intermediate" statuses are obsolete in SAM-4 */
@@ -56,20 +56,6 @@ static inline bool __scsi_status_is_good(int status) (status == SAM_STAT_COMMAND_TERMINATED)); } -/* -* If the 'status' argument has type int, unsigned int or union scsi_status, -* return the combined SCSI status. If the 'status' argument has another type, -* trigger a compiler error by passing a struct to a context where an integer -* is expected. -*/ -#define scsi_status_to_int (status) \ - __builtin_choose_expr(sizeof(status) == 4, \ - *(int32_t *)&(status), \ - (union scsi_status){}) - -#define scsi_status_is_good (status) \ - __scsi_status_is_good(scsi_status_to_int(status)) -/* * standard mode-select header prepended to all mode-select commands
@@ -148,10 +134,10 @@ enum scsi_disposition {* driver_byte = set by mid-level. */ #define status_byte (result) ((enum sam_status_divided_by_two) \ - ((scsi_status_to_int((result)) >> 1) & 0x7f)) -#define msg_byte (result) ((scsi_status_to_int((result)) >> 8) & 0xff) -#define host_byte (result) ((scsi_status_to_int((result)) >> 16) & 0xff) -#define driver_byte (result) ((scsi_status_to_int((result)) >> 24) & 0xff) + ((result).b.status >> 1)) +#define msg_byte (result) ((result).b.msg) +#define host_byte (result) ((result).b.host) +#define driver_byte (result) ((result).b.driver)#define sense_class (sense) (((sense) >> 4) & 0x7)#define sense_error (sense) ((sense) & 0xf)
include/scsi/scsi_dbg.h +6 -4
@@ -2,6 +2,8 @@#ifndef _SCSI_SCSI_DBG_H#define _SCSI_SCSI_DBG_H +#include <scsi/scsi_status.h> +struct scsi_cmnd ;struct scsi_device ;struct scsi_sense_hdr ;
@@ -23,8 +25,8 @@ extern const char *scsi_sense_key_string(unsigned char);extern const char *scsi_extd_sense_format (unsigned char ,unsigned char ,const char **);extern const char *scsi_mlreturn_string (int ); -extern const char *scsi_hostbyte_string (int ); -extern const char *scsi_driverbyte_string (int ); +extern const char *scsi_hostbyte_string (union scsi_status result); +extern const char *scsi_driverbyte_string (union scsi_status result);#else static inline bool scsi_opcode_sa_name(int cmd, int sa,
@@ -71,13 +73,13 @@ scsi_mlreturn_string(int result) }static inline const char * -scsi_hostbyte_string (int result) +scsi_hostbyte_string (union scsi_status result) {return NULL ; }static inline const char * -scsi_driverbyte_string (int result) +scsi_driverbyte_string (union scsi_status result) {return NULL ; }
Bart Van Assche
maintainerPATCH 112/117 Change the return type of scsi_execute() into union scsi_status
In reply to Bart Van AsscheMake it explicit that scsi_execute() returns a four-byte SCSI status code.
--- drivers/ata/libata-scsi.c | 4 ++-- drivers/scsi/cxlflash/superpipe.c | 2 +- drivers/scsi/cxlflash/vlun.c | 8 ++++---- drivers/scsi/device_handler/scsi_dh_alua.c | 14 +++++++------- drivers/scsi/device_handler/scsi_dh_emc.c | 7 ++++--- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 12 +++++++----- drivers/scsi/device_handler/scsi_dh_rdac.c | 2 +- drivers/scsi/scsi_lib.c | 7 ++++--- drivers/scsi/scsi_transport_spi.c | 3 +-- drivers/scsi/sd.c | 8 ++++---- drivers/scsi/sr_ioctl.c | 2 +- drivers/scsi/ufs/ufshcd.c | 4 ++-- include/scsi/scsi_device.h | 5 +++-- 13 files changed, 41 insertions(+), 37 deletions(-)
drivers/ata/libata-scsi.c +2 -2
@@ -407,7 +407,7 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)/* Good values for timeout and retries? Values below from scsi_ioctl_send_command() for default case... */ - cmd_result.combined =scsi_execute (scsidev, scsi_cmd, data_dir, argbuf, argsize, + cmd_result =scsi_execute (scsidev, scsi_cmd, data_dir, argbuf, argsize, sensebuf, &sshdr, (10 *HZ ),5 ,0 ,0 ,NULL );if (driver_byte (cmd_result) ==DRIVER_SENSE ) {/* sense data available */
@@ -488,7 +488,7 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)/* Good values for timeout and retries? Values below from scsi_ioctl_send_command() for default case... */ - cmd_result.combined =scsi_execute (scsidev, scsi_cmd,DMA_NONE ,NULL ,0 , + cmd_result =scsi_execute (scsidev, scsi_cmd,DMA_NONE ,NULL ,0 , sensebuf, &sshdr, (10 *HZ ),5 ,0 ,0 ,NULL );if (driver_byte (cmd_result) ==DRIVER_SENSE ) {/* sense data available */
drivers/scsi/cxlflash/superpipe.c +1 -1
@@ -357,7 +357,7 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli)/* Drop the ioctl read semahpore across lengthy call */ up_read (&cfg->ioctl_rwsem); - result.combined =scsi_execute (sdev, scsi_cmd,DMA_FROM_DEVICE , cmd_buf, + result =scsi_execute (sdev, scsi_cmd,DMA_FROM_DEVICE , cmd_buf,CMD_BUFSIZE ,NULL , &sshdr, to,CMD_RETRIES ,0 ,0 ,NULL );down_read (&cfg->ioctl_rwsem);
drivers/scsi/cxlflash/vlun.c +4 -4
@@ -423,7 +423,7 @@ static int write_same16(struct scsi_device *sdev,u8 *cmd_buf =NULL ;u8 *scsi_cmd =NULL ;int rc =0 ; -int result =0 ; +union scsi_status result = { };u64 offset = lba;int left = nblks;struct cxlflash_cfg *cfg =shost_priv (sdev->host);
@@ -457,15 +457,15 @@ static int write_same16(struct scsi_device *sdev, rc =check_state (cfg);if (rc) {dev_err (dev,"%s: Failed state result=%08x\n" , - __func__, result); + __func__, result.combined); rc = -ENODEV ; goto out; } -if (result) { +if (result.combined) {dev_err_ratelimited (dev,"%s: command failed for " "offset=%lld result=%08x\n" , - __func__, offset, result); + __func__, offset, result.combined); rc = -EIO ; goto out; }
drivers/scsi/device_handler/scsi_dh_alua.c +7 -7
@@ -122,8 +122,9 @@ static void release_port_group(struct kref *kref)* submit_rtpg - Issue a REPORT TARGET GROUP STATES command * @sdev: sdev the command should be sent to */ -static int submit_rtpg (struct scsi_device *sdev,unsigned char *buff, -int bufflen,struct scsi_sense_hdr *sshdr,int flags) +static union scsi_status submit_rtpg (struct scsi_device *sdev, +unsigned char *buff,int bufflen, +struct scsi_sense_hdr *sshdr,int flags) {u8 cdb[MAX_COMMAND_SIZE ]; int req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
@@ -150,8 +151,8 @@ static int submit_rtpg(struct scsi_device *sdev, unsigned char *buff,* to 'active/optimized' and let the array firmware figure out * the states of the remaining groups. */ -static int submit_stpg (struct scsi_device *sdev,int group_id, -struct scsi_sense_hdr *sshdr) +static union scsi_status submit_stpg (struct scsi_device *sdev,int group_id, +struct scsi_sense_hdr *sshdr) {u8 cdb[MAX_COMMAND_SIZE ];unsigned char stpg_data[8 ];
@@ -544,8 +545,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) retry: err =0 ; - retval.combined =submit_rtpg (sdev, buff, bufflen, &sense_hdr, - pg->flags); + retval =submit_rtpg (sdev, buff, bufflen, &sense_hdr, pg->flags);if (retval.combined) {/*
@@ -790,7 +790,7 @@ static unsigned alua_stpg(struct scsi_device *sdev, struct alua_port_group *pg) ALUA_DH_NAME, pg->state);return SCSI_DH_NOSYS ; } - retval.combined =submit_stpg (sdev, pg->group_id, &sense_hdr); + retval =submit_stpg (sdev, pg->group_id, &sense_hdr);if (retval.combined) {if (!scsi_sense_valid (&sense_hdr)) {
drivers/scsi/device_handler/scsi_dh_emc.c +4 -3
@@ -237,7 +237,8 @@ static int send_trespass_cmd(struct scsi_device *sdev, {unsigned char *page22;unsigned char cdb[MAX_COMMAND_SIZE ]; -int err, res =SCSI_DH_OK , len; +int res =SCSI_DH_OK , len; +union scsi_status err;struct scsi_sense_hdr sshdr;u64 req_flags =REQ_FAILFAST_DEV |REQ_FAILFAST_TRANSPORT |REQ_FAILFAST_DRIVER ;
@@ -266,13 +267,13 @@ static int send_trespass_cmd(struct scsi_device *sdev, err =scsi_execute (sdev, cdb,DMA_TO_DEVICE , csdev->buffer, len,NULL , &sshdr,CLARIION_TIMEOUT *HZ ,CLARIION_RETRIES , req_flags,0 ,NULL ); -if (err) { +if (err.combined) {if (scsi_sense_valid (&sshdr)) res =trespass_endio (sdev, &sshdr);else {sdev_printk (KERN_INFO , sdev,"%s: failed to send MODE SELECT: %x\n" , -CLARIION_NAME , err); +CLARIION_NAME , err.combined); res =SCSI_DH_IO ; } }
drivers/scsi/device_handler/scsi_dh_hp_sw.c +7 -5
@@ -82,20 +82,21 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) {unsigned char cmd[6 ] = {TEST_UNIT_READY };struct scsi_sense_hdr sshdr; -int ret =SCSI_DH_OK , res; +int ret =SCSI_DH_OK ; +union scsi_status res;u64 req_flags =REQ_FAILFAST_DEV |REQ_FAILFAST_TRANSPORT |REQ_FAILFAST_DRIVER ; retry: res =scsi_execute (sdev, cmd,DMA_NONE ,NULL ,0 ,NULL , &sshdr,HP_SW_TIMEOUT ,HP_SW_RETRIES , req_flags,0 ,NULL ); -if (res) { +if (res.combined) {if (scsi_sense_valid (&sshdr)) ret =tur_done (sdev, h, &sshdr);else {sdev_printk (KERN_WARNING , sdev,"%s: sending tur failed with %x\n" , -HP_SW_NAME , res); +HP_SW_NAME , res.combined); ret =SCSI_DH_IO ; } }else {
@@ -119,7 +120,8 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h)unsigned char cmd[6 ] = {START_STOP ,0 ,0 ,0 ,1 ,0 };struct scsi_sense_hdr sshdr;struct scsi_device *sdev = h->sdev; -int res, rc =SCSI_DH_OK ; +int rc =SCSI_DH_OK ; +union scsi_status res;int retry_cnt =HP_SW_RETRIES ;u64 req_flags =REQ_FAILFAST_DEV |REQ_FAILFAST_TRANSPORT |REQ_FAILFAST_DRIVER ;
@@ -127,7 +129,7 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) retry: res =scsi_execute (sdev, cmd,DMA_NONE ,NULL ,0 ,NULL , &sshdr,HP_SW_TIMEOUT ,HP_SW_RETRIES , req_flags,0 ,NULL ); -if (res) { +if (res.combined) {if (!scsi_sense_valid (&sshdr)) {sdev_printk (KERN_WARNING , sdev, "%s: sending start_stop_unit failed, "
drivers/scsi/device_handler/scsi_dh_rdac.c +1 -1
@@ -557,7 +557,7 @@ static void send_mode_select(struct work_struct *work)if (scsi_execute (sdev, cdb,DMA_TO_DEVICE , &h->ctlr->mode_select, data_size,NULL , &sshdr,RDAC_TIMEOUT *HZ , -RDAC_RETRIES , req_flags,0 ,NULL )) { +RDAC_RETRIES , req_flags,0 ,NULL ).combined) { err =mode_select_handle_sense (sdev, &sshdr);if (err ==SCSI_DH_RETRY && retry_cnt--) goto retry;
drivers/scsi/scsi_lib.c +4 -3
@@ -237,7 +237,8 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason)* Returns the scsi_cmnd result field if a command was executed, or a negative * Linux error code if we didn't get that far. */ -int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, +union scsi_status +__scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, struct scsi_sense_hdr *sshdr, int timeout, int retries, u64 flags, req_flags_t rq_flags,
@@ -245,7 +246,7 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, {struct request *req;struct scsi_request *rq; -int ret =DRIVER_ERROR <<24 ; +union scsi_status ret = { .b.driver =DRIVER_ERROR }; req = blk_get_request(sdev->request_queue, data_direction == DMA_TO_DEVICE ?
@@ -286,7 +287,7 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,memcpy (sense, rq->sense,SCSI_SENSE_BUFFERSIZE );if (sshdr)scsi_normalize_sense (rq->sense, rq->sense_len, sshdr); - ret = rq->status.combined; + ret = rq->status; out:blk_put_request (req);
drivers/scsi/scsi_transport_spi.c +1 -2
@@ -122,8 +122,7 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd,* The purpose of the RQF_PM flag below is to bypass the * SDEV_QUIESCE state. */ - result.combined = - scsi_execute(sdev, cmd, dir, buffer, bufflen, sense, + result = scsi_execute(sdev, cmd, dir, buffer, bufflen, sense, sshdr, DV_TIMEOUT, /* retries */ 1, REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
drivers/scsi/sd.c +4 -4
@@ -700,7 +700,7 @@ static int sd_sec_submit(void *data, u16 spsp, u8 secp, void *buffer,struct scsi_disk *sdkp = data;struct scsi_device *sdev = sdkp->device;u8 cdb[12 ] = {0 , }; -int ret; +union scsi_status ret; cdb[0 ] = send ?SECURITY_PROTOCOL_OUT :SECURITY_PROTOCOL_IN ; cdb[1 ] = secp;
@@ -710,7 +710,7 @@ static int sd_sec_submit(void *data, u16 spsp, u8 secp, void *buffer, ret =scsi_execute (sdev, cdb, send ?DMA_TO_DEVICE :DMA_FROM_DEVICE , buffer, len,NULL ,NULL ,SD_TIMEOUT , sdkp->max_retries,0 ,RQF_PM ,NULL ); - return ret <= 0 ? ret : -EIO; + return ret.combined <= 0 ? ret.combined : -EIO; }#endif /* CONFIG_BLK_SED_OPAL */
@@ -1712,7 +1712,7 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)* Leave the rest of the command zero to indicate * flush everything. */ - res.combined =scsi_execute (sdp, cmd,DMA_NONE ,NULL ,0 ,NULL , sshdr, + res =scsi_execute (sdp, cmd,DMA_NONE ,NULL ,0 ,NULL , sshdr, timeout, sdkp->max_retries,0 ,RQF_PM ,NULL );if (res.combined ==0 )break ;
@@ -3593,7 +3593,7 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)if (!scsi_device_online (sdp))return -ENODEV ; - res.combined =scsi_execute (sdp, cmd,DMA_NONE ,NULL ,0 ,NULL , &sshdr, + res =scsi_execute (sdp, cmd,DMA_NONE ,NULL ,0 ,NULL , &sshdr,SD_TIMEOUT , sdkp->max_retries,0 ,RQF_PM ,NULL );if (res.combined) {sd_print_result (sdkp,"Start/Stop Unit failed" , res);
drivers/scsi/sr_ioctl.c +1 -1
@@ -201,7 +201,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc) goto out; } - result.combined =scsi_execute (SDev, cgc->cmd, cgc->data_direction, + result =scsi_execute (SDev, cgc->cmd, cgc->data_direction, cgc->buffer, cgc->buflen,NULL , sshdr, cgc->timeout,IOCTL_RETRIES ,0 ,0 ,NULL );
drivers/scsi/ufs/ufshcd.c +2 -2
@@ -8412,7 +8412,7 @@ ufshcd_send_request_sense(struct ufs_hba *hba, struct scsi_device *sdp) ret =scsi_execute (sdp, cmd,DMA_FROM_DEVICE , buffer,UFS_SENSE_SIZE ,NULL ,NULL , -msecs_to_jiffies (1000 ),3 ,0 ,RQF_PM ,NULL ); +msecs_to_jiffies (1000 ),3 ,0 ,RQF_PM ,NULL ).combined;if (ret)pr_err ("%s: failed with err %d\n" , __func__, ret);
@@ -8472,7 +8472,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,* callbacks hence set the RQF_PM flag so that it doesn't resume the * already suspended childs. */ - start_stop_res.combined = + start_stop_res =scsi_execute (sdp, cmd,DMA_NONE ,NULL ,0 ,NULL , &sshdr,START_STOP_TIMEOUT ,0 ,0 ,RQF_PM ,NULL ); ret = start_stop_res.combined;
include/scsi/scsi_device.h +3 -2
@@ -439,7 +439,8 @@ extern const char *scsi_device_state_name(enum scsi_device_state);extern int scsi_is_sdev_device (const struct device *);extern int scsi_is_target_device (const struct device *);extern void scsi_sanitize_inquiry_string (unsigned char *s,int len); -extern int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, +extern union scsi_status +__scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, struct scsi_sense_hdr *sshdr, int timeout, int retries, u64 flags,
@@ -460,7 +461,7 @@ static inline int scsi_execute_req(struct scsi_device *sdev, int retries, int *resid) { return scsi_execute(sdev, cmd, data_direction, buffer, - bufflen, NULL, sshdr, timeout, retries, 0, 0, resid); + bufflen, NULL, sshdr, timeout, retries, 0, 0, resid).combined; }extern void sdev_disable_disk_events (struct scsi_device *sdev);extern void sdev_enable_disk_events (struct scsi_device *sdev);
Bart Van Assche
maintainerPATCH 113/117 Change the return type of scsi_execute_req() into union scsi_status
In reply to Bart Van AsscheMake it explicit that scsi_execute_req() returns a SCSI status.
--- drivers/hwmon/drivetemp.c | 2 +- drivers/scsi/ch.c | 2 +- drivers/scsi/scsi.c | 8 ++++---- drivers/scsi/scsi_ioctl.c | 2 +- drivers/scsi/scsi_lib.c | 8 ++++---- drivers/scsi/scsi_scan.c | 13 ++++++------- drivers/scsi/sd.c | 9 ++++----- drivers/scsi/sd_zbc.c | 2 +- drivers/scsi/ses.c | 4 ++-- drivers/scsi/sr.c | 6 +++--- drivers/scsi/virtio_scsi.c | 4 ++-- drivers/target/target_core_pscsi.c | 6 +++--- include/scsi/scsi_device.h | 4 ++-- 13 files changed, 34 insertions(+), 36 deletions(-)
drivers/hwmon/drivetemp.c +1 -1
@@ -194,7 +194,7 @@ static int drivetemp_scsi_command(struct drivetemp_data *st,return scsi_execute_req (st->sdev, scsi_cmd, data_dir, st->smartdata,ATA_SECT_SIZE ,NULL ,HZ ,5 , -NULL ); +NULL ).combined; } static int drivetemp_ata_command(struct drivetemp_data *st, u8 feature,
drivers/scsi/ch.c +1 -1
@@ -196,7 +196,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, retry: errno =0 ; - result.combined =scsi_execute_req (ch->device, cmd, direction, buffer, + result =scsi_execute_req (ch->device, cmd, direction, buffer, buflength, &sshdr, timeout *HZ ,MAX_RETRIES ,NULL );
drivers/scsi/scsi.c +4 -4
@@ -308,7 +308,7 @@ EXPORT_SYMBOL(scsi_track_queue_full);static int scsi_vpd_inquiry (struct scsi_device *sdev,unsigned char *buffer,u8 page,unsigned len) { -int result; +union scsi_status result;unsigned char cmd[16 ];if (len <4 )
@@ -327,7 +327,7 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,*/ result =scsi_execute_req (sdev, cmd,DMA_FROM_DEVICE , buffer, len,NULL ,30 *HZ ,3 ,NULL ); -if (result) +if (result.combined)return -EIO ;/* Sanity check that we got the page back that we asked for */
@@ -492,7 +492,7 @@ int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, {unsigned char cmd[16 ];struct scsi_sense_hdr sshdr; -int result; +union scsi_status result;if (sdev->no_report_opcodes || sdev->scsi_level <SCSI_SPC_3 )return -EINVAL ;
@@ -508,7 +508,7 @@ int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, result =scsi_execute_req (sdev, cmd,DMA_FROM_DEVICE , buffer, len, &sshdr,30 *HZ ,3 ,NULL ); -if (result &&scsi_sense_valid (&sshdr) && +if (result.combined &&scsi_sense_valid (&sshdr) && sshdr.sense_key ==ILLEGAL_REQUEST && (sshdr.asc ==0x20 || sshdr.asc ==0x24 ) && sshdr.ascq ==0x00 )return -EINVAL ;
drivers/scsi/scsi_ioctl.c +1 -1
@@ -95,7 +95,7 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,SCSI_LOG_IOCTL (1 ,sdev_printk (KERN_INFO , sdev,"Trying ioctl with scsi command %d\n" , *cmd)); - result.combined =scsi_execute_req (sdev, cmd,DMA_NONE ,NULL ,0 , + result =scsi_execute_req (sdev, cmd,DMA_NONE ,NULL ,0 , &sshdr, timeout, retries,NULL ); SCSI_LOG_IOCTL(2, sdev_printk(KERN_INFO, sdev,
drivers/scsi/scsi_lib.c +4 -4
@@ -2121,7 +2121,7 @@ scsi_mode_select(struct scsi_device *sdev, int pf, int sp, int modepage, } ret =scsi_execute_req (sdev, cmd,DMA_TO_DEVICE , real_buffer, len, - sshdr, timeout, retries,NULL ); + sshdr, timeout, retries,NULL ).combined;kfree (real_buffer);return ret; }
@@ -2188,7 +2188,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,memset (buffer,0 , len); - result.combined =scsi_execute_req (sdev, cmd,DMA_FROM_DEVICE , buffer, + result =scsi_execute_req (sdev, cmd,DMA_FROM_DEVICE , buffer, len, sshdr, timeout, retries,NULL );/* This code looks awful: what it's doing is making sure an
@@ -2262,7 +2262,7 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries,char cmd[] = {TEST_UNIT_READY ,0 ,0 ,0 ,0 ,0 , }; -int result; +union scsi_status result;/* try to eat the UNIT_ATTENTION if there are enough retries */ do {
@@ -2274,7 +2274,7 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, }while (scsi_sense_valid (sshdr) && sshdr->sense_key ==UNIT_ATTENTION && --retries); -return result; +return result.combined; }EXPORT_SYMBOL (scsi_test_unit_ready);
drivers/scsi/scsi_scan.c +6 -7
@@ -608,8 +608,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,memset (inq_result,0 , try_inquiry_len); - result.combined = -scsi_execute_req (sdev, scsi_cmd,DMA_FROM_DEVICE , + result =scsi_execute_req (sdev, scsi_cmd,DMA_FROM_DEVICE , inq_result, try_inquiry_len, &sshdr,HZ /2 +HZ * scsi_inq_timeout,3 , &resid);
@@ -1315,7 +1314,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflagu64 lun;unsigned int num_luns;unsigned int retries; -int result; +union scsi_status result;struct scsi_lun *lunp, *lun_data;struct scsi_sense_hdr sshdr;struct scsi_device *sdev;
@@ -1402,9 +1401,9 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflagSCSI_LOG_SCAN_BUS (3 ,sdev_printk (KERN_INFO , sdev,"scsi scan: REPORT LUNS" " %s (try %d) result 0x%x\n" , - result ?"failed" :"successful" , - retries, result)); -if (result ==0 ) + result.combined ?"failed" :"successful" , + retries, result.combined)); +if (result.combined ==0 )break ;else if (scsi_sense_valid (&sshdr)) {if (sshdr.sense_key !=UNIT_ATTENTION )
@@ -1412,7 +1411,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag } } -if (result) { +if (result.combined) {/* * The device probably does not support a REPORT LUN command */
drivers/scsi/sd.c +4 -5
@@ -1824,8 +1824,7 @@ static int sd_pr_command(struct block_device *bdev, u8 sa,put_unaligned_be64 (sa_key, &data[8 ]); data[20 ] = flags; - result.combined = -scsi_execute_req (sdev, cmd,DMA_TO_DEVICE , &data,sizeof (data), + result =scsi_execute_req (sdev, cmd,DMA_TO_DEVICE , &data,sizeof (data), &sshdr,SD_TIMEOUT , sdkp->max_retries,NULL ); if (driver_byte(result) == DRIVER_SENSE &&
@@ -2160,7 +2159,7 @@ sd_spinup_disk(struct scsi_disk *sdkp) cmd[0 ] =TEST_UNIT_READY ;memset ((void *) &cmd[1 ],0 ,9 ); - the_result.combined =scsi_execute_req (sdkp->device, cmd, + the_result =scsi_execute_req (sdkp->device, cmd,DMA_NONE ,NULL ,0 , &sshdr,SD_TIMEOUT , sdkp->max_retries,NULL );
@@ -2359,7 +2358,7 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, cmd[13 ] =RC16_LEN ;memset (buffer,0 ,RC16_LEN ); - the_result.combined =scsi_execute_req (sdp, cmd,DMA_FROM_DEVICE , + the_result =scsi_execute_req (sdp, cmd,DMA_FROM_DEVICE , buffer,RC16_LEN , &sshdr,SD_TIMEOUT , sdkp->max_retries,NULL );
@@ -2444,7 +2443,7 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,memset (&cmd[1 ],0 ,9 );memset (buffer,0 ,8 ); - the_result.combined =scsi_execute_req (sdp, cmd,DMA_FROM_DEVICE , + the_result =scsi_execute_req (sdp, cmd,DMA_FROM_DEVICE , buffer,8 , &sshdr,SD_TIMEOUT , sdkp->max_retries,NULL );
drivers/scsi/sd_zbc.c +1 -1
@@ -109,7 +109,7 @@ static int sd_zbc_do_report_zones(struct scsi_disk *sdkp, unsigned char *buf,if (partial) cmd[14 ] =ZBC_REPORT_ZONE_PARTIAL ; - result.combined =scsi_execute_req (sdp, cmd,DMA_FROM_DEVICE , + result =scsi_execute_req (sdp, cmd,DMA_FROM_DEVICE , buf, buflen, &sshdr, timeout,SD_MAX_RETRIES ,NULL );if (result.combined) {
drivers/scsi/ses.c +2 -2
@@ -89,7 +89,7 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code,unsigned char recv_page_code; ret =scsi_execute_req (sdev, cmd,DMA_FROM_DEVICE , buf, bufflen, -NULL ,SES_TIMEOUT ,SES_RETRIES ,NULL ); +NULL ,SES_TIMEOUT ,SES_RETRIES ,NULL ).combined;if (unlikely (ret))return ret;
@@ -123,7 +123,7 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, }; result =scsi_execute_req (sdev, cmd,DMA_TO_DEVICE , buf, bufflen, -NULL ,SES_TIMEOUT ,SES_RETRIES ,NULL ); +NULL ,SES_TIMEOUT ,SES_RETRIES ,NULL ).combined;if (result)sdev_printk (KERN_ERR , sdev,"SEND DIAGNOSTIC result: %8x\n" , result);
drivers/scsi/sr.c +3 -3
@@ -206,7 +206,7 @@ static unsigned int sr_get_events(struct scsi_device *sdev)int result; result =scsi_execute_req (sdev, cmd,DMA_FROM_DEVICE , buf,sizeof (buf), - &sshdr,SR_TIMEOUT ,MAX_RETRIES ,NULL ); + &sshdr,SR_TIMEOUT ,MAX_RETRIES ,NULL ).combined;if (scsi_sense_valid (&sshdr) && sshdr.sense_key ==UNIT_ATTENTION )return DISK_EVENT_MEDIA_CHANGE ;
@@ -813,8 +813,8 @@ static void get_sectorsize(struct scsi_cd *cd)/* Do the command and wait.. */ the_result =scsi_execute_req (cd->device, cmd,DMA_FROM_DEVICE , - buffer,sizeof (buffer),NULL , -SR_TIMEOUT ,MAX_RETRIES ,NULL ); + buffer,sizeof (buffer),NULL , +SR_TIMEOUT ,MAX_RETRIES ,NULL ).combined; retries--;
drivers/scsi/virtio_scsi.c +2 -2
@@ -351,8 +351,8 @@ static void virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi) result.combined =scsi_execute_req (sdev, scsi_cmd,DMA_FROM_DEVICE , - inq_result, inquiry_len,NULL , -SD_TIMEOUT ,SD_MAX_RETRIES ,NULL ); + inq_result, inquiry_len,NULL , +SD_TIMEOUT ,SD_MAX_RETRIES ,NULL ).combined;if (result.combined ==0 && inq_result[0 ] >>5 ) {/* PQ indicates the LUN is not attached */
drivers/target/target_core_pscsi.c +3 -3
@@ -146,7 +146,7 @@ static void pscsi_tape_read_blocksize(struct se_device *dev, cdb[4 ] =0x0c ;/* 12 bytes */ ret =scsi_execute_req (sdev, cdb,DMA_FROM_DEVICE , buf,12 ,NULL , -HZ ,1 ,NULL ); +HZ ,1 ,NULL ).combined;if (ret) goto out_free;
@@ -197,7 +197,7 @@ pscsi_get_inquiry_vpd_serial(struct scsi_device *sdev, struct t10_wwn *wwn)put_unaligned_be16 (INQUIRY_VPD_SERIAL_LEN , &cdb[3 ]); ret =scsi_execute_req (sdev, cdb,DMA_FROM_DEVICE , buf, -INQUIRY_VPD_SERIAL_LEN ,NULL ,HZ ,1 ,NULL ); +INQUIRY_VPD_SERIAL_LEN ,NULL ,HZ ,1 ,NULL ).combined;if (ret) goto out_free;
@@ -233,7 +233,7 @@ pscsi_get_inquiry_vpd_device_ident(struct scsi_device *sdev, ret =scsi_execute_req (sdev, cdb,DMA_FROM_DEVICE , buf,INQUIRY_VPD_DEVICE_IDENTIFIER_LEN , -NULL ,HZ ,1 ,NULL ); +NULL ,HZ ,1 ,NULL ).combined;if (ret) goto out;
include/scsi/scsi_device.h +2 -2
@@ -455,13 +455,13 @@ __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, sense, sshdr, timeout, retries, flags, rq_flags, \ resid); \ }) -static inline int scsi_execute_req (struct scsi_device *sdev, +static inline union scsi_status scsi_execute_req (struct scsi_device *sdev,const unsigned char *cmd,int data_direction,void *buffer,unsigned bufflen,struct scsi_sense_hdr *sshdr,int timeout,int retries,int *resid) {return scsi_execute (sdev, cmd, data_direction, buffer, - bufflen,NULL , sshdr, timeout, retries,0 ,0 , resid).combined; + bufflen,NULL , sshdr, timeout, retries,0 ,0 , resid); }extern void sdev_disable_disk_events (struct scsi_device *sdev);extern void sdev_enable_disk_events (struct scsi_device *sdev);
Bart Van Assche
maintainerPATCH 114/117 Change the return type of scsi_test_unit_ready() into union scsi_status
In reply to Bart Van AsscheMake it explicit that scsi_test_unit_ready() returns a SCSI status.
--- drivers/scsi/device_handler/scsi_dh_alua.c | 4 ++-- drivers/scsi/scsi_ioctl.c | 2 +- drivers/scsi/scsi_lib.c | 4 ++-- drivers/scsi/sd.c | 5 ++--- drivers/scsi/sr.c | 6 +++--- drivers/scsi/sr_ioctl.c | 3 ++- include/scsi/scsi_device.h | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-)
drivers/scsi/device_handler/scsi_dh_alua.c +2 -2
@@ -490,14 +490,14 @@ static enum scsi_disposition alua_check_sense(struct scsi_device *sdev,static int alua_tur (struct scsi_device *sdev) {struct scsi_sense_hdr sense_hdr; -int retval; +union scsi_status retval; retval =scsi_test_unit_ready (sdev,ALUA_FAILOVER_TIMEOUT *HZ ,ALUA_FAILOVER_RETRIES , &sense_hdr);if (sense_hdr.sense_key ==NOT_READY && sense_hdr.asc ==0x04 && sense_hdr.ascq ==0x0a )return SCSI_DH_RETRY ; -else if (retval) +else if (retval.combined)return SCSI_DH_IO ;else return SCSI_DH_OK ;
drivers/scsi/scsi_ioctl.c +1 -1
@@ -237,7 +237,7 @@ static int scsi_ioctl_common(struct scsi_device *sdev, int cmd, void __user *argreturn scsi_set_medium_removal (sdev,SCSI_REMOVAL_ALLOW );case SCSI_IOCTL_TEST_UNIT_READY :return scsi_test_unit_ready (sdev,IOCTL_NORMAL_TIMEOUT , -NORMAL_RETRIES , &sense_hdr); +NORMAL_RETRIES , &sense_hdr).combined;case SCSI_IOCTL_START_UNIT : scsi_cmd[0 ] =START_STOP ; scsi_cmd[1 ] =0 ;
drivers/scsi/scsi_lib.c +2 -2
@@ -2255,7 +2255,7 @@ EXPORT_SYMBOL(scsi_mode_sense);* Returns zero if unsuccessful or an error if TUR failed. For * removable media, UNIT_ATTENTION sets ->changed flag. **/ -int +union scsi_status scsi_test_unit_ready (struct scsi_device *sdev,int timeout,int retries,struct scsi_sense_hdr *sshdr) {
@@ -2274,7 +2274,7 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, }while (scsi_sense_valid (sshdr) && sshdr->sense_key ==UNIT_ATTENTION && --retries); -return result.combined; +return result; }EXPORT_SYMBOL (scsi_test_unit_ready);
drivers/scsi/sd.c +2 -3
@@ -1654,9 +1654,8 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing)if (scsi_block_when_processing_errors (sdp)) {struct scsi_sense_hdr sshdr = {0 , }; - retval.combined = -scsi_test_unit_ready (sdp,SD_TIMEOUT , sdkp->max_retries, - &sshdr); + retval =scsi_test_unit_ready (sdp,SD_TIMEOUT , + sdkp->max_retries, &sshdr);/* failed to execute TUR, assume media not present */ if (host_byte (retval)) {
drivers/scsi/sr.c +3 -3
@@ -273,8 +273,7 @@ static unsigned int sr_check_events(struct cdrom_device_info *cdi, do_tur:/* let's see whether the media is there with TUR */ last_present = cd->media_present; - ret.combined =scsi_test_unit_ready (cd->device,SR_TIMEOUT ,MAX_RETRIES , - &sshdr); + ret =scsi_test_unit_ready (cd->device,SR_TIMEOUT ,MAX_RETRIES , &sshdr);/* * Media is considered to be present if TUR succeeds or fails with
@@ -508,7 +507,8 @@ static void sr_revalidate_disk(struct scsi_cd *cd)struct scsi_sense_hdr sshdr;/* if the unit is not ready, nothing more to do */ -if (scsi_test_unit_ready (cd->device,SR_TIMEOUT ,MAX_RETRIES , &sshdr)) +if (scsi_test_unit_ready (cd->device,SR_TIMEOUT ,MAX_RETRIES , &sshdr) + .combined)return ;sr_cd_check (&cd->cdi);get_sectorsize (cd);
drivers/scsi/sr_ioctl.c +2 -1
@@ -292,7 +292,8 @@ int sr_drive_status(struct cdrom_device_info *cdi, int slot)/* we have no changer support */ return -EINVAL ; } -if (!scsi_test_unit_ready (cd->device,SR_TIMEOUT ,MAX_RETRIES , &sshdr)) +if (!scsi_test_unit_ready (cd->device,SR_TIMEOUT ,MAX_RETRIES , &sshdr) + .combined)return CDS_DISC_OK ;/* SK/ASC/ASCQ of 2/4/1 means "unit is becoming ready" */
include/scsi/scsi_device.h +2 -2
@@ -411,8 +411,8 @@ extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp, int timeout, int retries, struct scsi_mode_data *data, struct scsi_sense_hdr *); -extern int scsi_test_unit_ready (struct scsi_device *sdev,int timeout, -int retries,struct scsi_sense_hdr *sshdr); +extern union scsi_status scsi_test_unit_ready (struct scsi_device *sdev, +int timeout,int retries,struct scsi_sense_hdr *sshdr);extern int scsi_get_vpd_page (struct scsi_device *,u8 page,unsigned char *buf,int buf_len); extern int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer,
Bart Van Assche
maintainerPATCH 115/117 Change the return types of scsi_mode_sense() and sd_do_mode_sense()
In reply to Bart Van AsscheMake it explicit that scsi_mode_sense() and sd_do_mode_sense() return a SCSI status.
--- drivers/scsi/scsi_lib.c | 4 ++-- drivers/scsi/scsi_transport_sas.c | 4 ++-- drivers/scsi/sd.c | 18 +++++++++--------- drivers/scsi/sr.c | 2 +- include/scsi/scsi_device.h | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-)
drivers/scsi/scsi_lib.c +2 -2
@@ -2144,7 +2144,7 @@ EXPORT_SYMBOL_GPL(scsi_mode_select);* or 8 depending on whether a six or ten byte command was * issued) if successful. */ -int +union scsi_status scsi_mode_sense (struct scsi_device *sdev,int dbd,int modepage,unsigned char *buffer,int len,int timeout,int retries,struct scsi_mode_data *data,struct scsi_sense_hdr *sshdr)
@@ -2241,7 +2241,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, goto retry; } -return result.combined; +return result; }EXPORT_SYMBOL (scsi_mode_sense);
drivers/scsi/scsi_transport_sas.c +2 -2
@@ -1235,8 +1235,8 @@ int sas_read_port_mode_page(struct scsi_device *sdev)if (!buffer)return -ENOMEM ; - res.combined =scsi_mode_sense (sdev,1 ,0x19 , buffer,BUF_SIZE ,30 *HZ , -3 , &mode_data,NULL ); + res =scsi_mode_sense (sdev,1 ,0x19 , buffer,BUF_SIZE ,30 *HZ ,3 , + &mode_data,NULL ); error = -EINVAL ;if (!scsi_status_is_good (res))
drivers/scsi/sd.c +9 -9
@@ -194,7 +194,7 @@ cache_type_store(struct device *dev, struct device_attribute *attr, }if (scsi_mode_sense (sdp,0x08 ,8 , buffer,sizeof (buffer),SD_TIMEOUT , - sdkp->max_retries, &data,NULL )) + sdkp->max_retries, &data,NULL ).combined)return -EINVAL ; len =min_t (size_t,sizeof (buffer), data.length - data.header_length - data.block_descriptor_length);
@@ -2628,7 +2628,7 @@ sd_print_capacity(struct scsi_disk *sdkp, }/* called with buffer of length 512 */ -static inline int +static inline union scsi_status sd_do_mode_sense (struct scsi_disk *sdkp,int dbd,int modepage,unsigned char *buffer,int len,struct scsi_mode_data *data,struct scsi_sense_hdr *sshdr)
@@ -2657,14 +2657,14 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) }if (sdp->use_192_bytes_for_3f) { - res.combined =sd_do_mode_sense (sdkp,0 ,0x3F , buffer,192 , &data,NULL ); + res =sd_do_mode_sense (sdkp,0 ,0x3F , buffer,192 , &data,NULL ); }else {/* * First attempt: ask for all pages (0x3F), but only 4 bytes. * We have to start carefully: some devices hang if we ask * for more than is available. */ - res.combined =sd_do_mode_sense (sdkp,0 ,0x3F , buffer,4 , &data,NULL ); + res =sd_do_mode_sense (sdkp,0 ,0x3F , buffer,4 , &data,NULL );/* * Second attempt: ask for page 0 When only page 0 is
@@ -2673,13 +2673,13 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)* CDB. */ if (!scsi_status_is_good (res)) - res.combined =sd_do_mode_sense (sdkp,0 ,0 , buffer,4 , &data,NULL ); + res =sd_do_mode_sense (sdkp,0 ,0 , buffer,4 , &data,NULL );/* * Third attempt: ask 255 bytes, as we did earlier. */ if (!scsi_status_is_good (res)) - res.combined =sd_do_mode_sense (sdkp,0 ,0x3F , buffer,255 , + res =sd_do_mode_sense (sdkp,0 ,0x3F , buffer,255 , &data,NULL ); }
@@ -2742,7 +2742,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) }/* cautiously ask */ - res.combined =sd_do_mode_sense (sdkp, dbd, modepage, buffer, first_len, + res =sd_do_mode_sense (sdkp, dbd, modepage, buffer, first_len, &data, &sshdr);if (!scsi_status_is_good (res))
@@ -2774,7 +2774,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)/* Get the data */ if (len > first_len) - res.combined =sd_do_mode_sense (sdkp, dbd, modepage, buffer, len, + res =sd_do_mode_sense (sdkp, dbd, modepage, buffer, len, &data, &sshdr);if (scsi_status_is_good (res)) {
@@ -2893,7 +2893,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer)if (sdkp->protection_type ==0 )return ; - res.combined =scsi_mode_sense (sdp,1 ,0x0a , buffer,36 ,SD_TIMEOUT , + res =scsi_mode_sense (sdp,1 ,0x0a , buffer,36 ,SD_TIMEOUT , sdkp->max_retries, &data, &sshdr); if (!scsi_status_is_good(res) || !data.header_length ||
drivers/scsi/sr.c +1 -1
@@ -910,7 +910,7 @@ static void get_capabilities(struct scsi_cd *cd)scsi_test_unit_ready (cd->device,SR_TIMEOUT ,MAX_RETRIES , &sshdr);/* ask for mode page 0x2a */ - rc.combined =scsi_mode_sense (cd->device,0 ,0x2a , buffer, ms_len, + rc =scsi_mode_sense (cd->device,0 ,0x2a , buffer, ms_len,SR_TIMEOUT ,3 , &data,NULL ); if (!scsi_status_is_good(rc) || data.length > ms_len ||
include/scsi/scsi_device.h +4 -4
@@ -402,10 +402,10 @@ extern int scsi_track_queue_full(struct scsi_device *, int);extern int scsi_set_medium_removal (struct scsi_device *,char ); -extern int scsi_mode_sense (struct scsi_device *sdev,int dbd,int modepage, -unsigned char *buffer,int len,int timeout, -int retries,struct scsi_mode_data *data, -struct scsi_sense_hdr *); +extern union scsi_status scsi_mode_sense (struct scsi_device *sdev,int dbd, +int modepage,unsigned char *buffer,int len, +int timeout,int retries,struct scsi_mode_data *data, +struct scsi_sense_hdr *); extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp, int modepage, unsigned char *buffer, int len, int timeout, int retries,
Bart Van Assche
maintainerPATCH 116/117 Change the return type of scsi_mode_select() into union scsi_status
In reply to Bart Van AsscheMake it explicit that scsi_mode_select() returns a SCSI status.
--- drivers/scsi/scsi_lib.c | 18 +++++++++++------- drivers/scsi/sd.c | 2 +- include/scsi/scsi_device.h | 9 ++++----- 3 files changed, 16 insertions(+), 13 deletions(-)
drivers/scsi/scsi_lib.c +11 -7
@@ -2069,24 +2069,26 @@ void scsi_exit_queue(void)* status on error * */ -int +union scsi_status scsi_mode_select (struct scsi_device *sdev,int pf,int sp,int modepage,unsigned char *buffer,int len,int timeout,int retries,struct scsi_mode_data *data,struct scsi_sense_hdr *sshdr) {unsigned char cmd[10 ];unsigned char *real_buffer; -int ret; +union scsi_status ret;memset (cmd,0 ,sizeof (cmd)); cmd[1 ] = (pf ?0x10 :0 ) | (sp ?0x01 :0 );if (sdev->use_10_for_ms) { + ret.combined = -EINVAL ;if (len >65535 ) -return -EINVAL ; +return ret; + ret.combined = -ENOMEM ; real_buffer =kmalloc (8 + len,GFP_KERNEL );if (!real_buffer) -return -ENOMEM ; +return ret;memcpy (real_buffer +8 , buffer, len); len +=8 ; real_buffer[0 ] =0 ;
@@ -2102,13 +2104,15 @@ scsi_mode_select(struct scsi_device *sdev, int pf, int sp, int modepage, cmd[7 ] = len >>8 ; cmd[8 ] = len; }else { + ret.combined = -EINVAL ;if (len >255 || data->block_descriptor_length >255 || data->longlba) -return -EINVAL ; +return ret; + ret.combined = -ENOMEM ; real_buffer =kmalloc (4 + len,GFP_KERNEL );if (!real_buffer) -return -ENOMEM ; +return ret;memcpy (real_buffer +4 , buffer, len); len +=4 ; real_buffer[0 ] =0 ;
@@ -2121,7 +2125,7 @@ scsi_mode_select(struct scsi_device *sdev, int pf, int sp, int modepage, } ret =scsi_execute_req (sdev, cmd,DMA_TO_DEVICE , real_buffer, len, - sshdr, timeout, retries,NULL ).combined; + sshdr, timeout, retries,NULL );kfree (real_buffer);return ret; }
drivers/scsi/sd.c +1 -1
@@ -212,7 +212,7 @@ cache_type_store(struct device *dev, struct device_attribute *attr, data.device_specific =0 ;if (scsi_mode_select (sdp,1 , sp,8 , buffer_data, len,SD_TIMEOUT , - sdkp->max_retries, &data, &sshdr)) { + sdkp->max_retries, &data, &sshdr).combined) {if (scsi_sense_valid (&sshdr))sd_print_sense_hdr (sdkp, &sshdr);return -EINVAL ;
include/scsi/scsi_device.h +4 -5
@@ -406,11 +406,10 @@ extern union scsi_status scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, unsigned char *buffer, int len, int timeout, int retries, struct scsi_mode_data *data, struct scsi_sense_hdr *); -extern int scsi_mode_select (struct scsi_device *sdev,int pf,int sp, -int modepage,unsigned char *buffer,int len, -int timeout,int retries, -struct scsi_mode_data *data, -struct scsi_sense_hdr *); +extern union scsi_status scsi_mode_select (struct scsi_device *sdev,int pf, +int sp,int modepage,unsigned char *buffer,int len, +int timeout,int retries,struct scsi_mode_data *data, +struct scsi_sense_hdr *);extern union scsi_status scsi_test_unit_ready (struct scsi_device *sdev,int timeout,int retries,struct scsi_sense_hdr *sshdr); extern int scsi_get_vpd_page(struct scsi_device *, u8 page, unsigned char *buf,
Bart Van Assche
maintainerPATCH 117/117 Change the return type of ioctl_internal_command() into union scsi_status
In reply to Bart Van AsscheMake it explicit that ioctl_internal_command() returns a SCSI status.
--- drivers/scsi/scsi_ioctl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/scsi/scsi_ioctl.c +8 -8
@@ -86,8 +86,8 @@ static int ioctl_probe(struct Scsi_Host *host, void __user *buffer)* The output area is then filled in starting from the command byte. */ -static int ioctl_internal_command (struct scsi_device *sdev,char *cmd, -int timeout,int retries) +static union scsi_status ioctl_internal_command (struct scsi_device *sdev, +char *cmd,int timeout,int retries) {union scsi_status result;struct scsi_sense_hdr sshdr;
@@ -136,13 +136,13 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,SCSI_LOG_IOCTL (2 ,sdev_printk (KERN_INFO , sdev,"IOCTL Releasing command\n" )); -return result.combined; +return result; }int scsi_set_medium_removal (struct scsi_device *sdev,char state) {char scsi_cmd[MAX_COMMAND_SIZE ]; -int ret; +union scsi_status ret;if (!sdev->removable || !sdev->lockable)return 0 ;
@@ -156,9 +156,9 @@ int scsi_set_medium_removal(struct scsi_device *sdev, char state) ret =ioctl_internal_command (sdev, scsi_cmd,IOCTL_NORMAL_TIMEOUT ,NORMAL_RETRIES ); -if (ret ==0 ) +if (ret.combined ==0 ) sdev->locked = (state ==SCSI_REMOVAL_PREVENT ); -return ret; +return ret.combined; }EXPORT_SYMBOL (scsi_set_medium_removal);
@@ -244,14 +244,14 @@ static int scsi_ioctl_common(struct scsi_device *sdev, int cmd, void __user *arg scsi_cmd[2 ] = scsi_cmd[3 ] = scsi_cmd[5 ] =0 ; scsi_cmd[4 ] =1 ;return ioctl_internal_command (sdev, scsi_cmd, -START_STOP_TIMEOUT ,NORMAL_RETRIES ); +START_STOP_TIMEOUT ,NORMAL_RETRIES ).combined;case SCSI_IOCTL_STOP_UNIT : scsi_cmd[0 ] =START_STOP ; scsi_cmd[1 ] =0 ; scsi_cmd[2 ] = scsi_cmd[3 ] = scsi_cmd[5 ] =0 ; scsi_cmd[4 ] =0 ;return ioctl_internal_command (sdev, scsi_cmd, -START_STOP_TIMEOUT ,NORMAL_RETRIES ); +START_STOP_TIMEOUT ,NORMAL_RETRIES ).combined;case SCSI_IOCTL_GET_PCI :return scsi_ioctl_get_pci (sdev, arg);case SG_SCSI_RESET :
Hannes Reinecke
maintainerQuoted 11 lines · Bart Van Assche
Hi Martin,
This patch series improves static checking inside the SCSI subsystem as follows:
- Introduce enumeration types for the SCSI status, message, host and driver bytes.
- Change 'int' into 'unionscsi_status' in case of SCSI results. This helps the compiler and humans to tell the difference between a scalar and a SCSI result.
Quoted 9 lines
This patch series is long because it touches all SCSI drivers and because it has been split into one patch per SCSI driver.
This patch series introduces a backwards-incompatible change in the API between SCSI core and drivers. A possible strategy is to postpone the patch that removes backwards compatibility to a later kernel version.
Please consider this patch series for kernel version v5.14.
I'd rather not go this way.
We should not try to preserve the split SCSI result value with its four distinct fields.
I'd rather have the message byte handling moved into the SCSI parallel drivers (where really it should've been in the first place).
The driver byte can go entirely as the DRIVER_SENSE flag can be replaced
with a check for valid sense code, DRIVER_TIMEOUT is pretty much identical to DID_TIMEOUT (with the semantic difference _who_ set the timeout), and DRIVER_ERROR can be folded back into the caller. All other values are unused, allowing us to drop driver error completely.
With that we're only having two fields (host byte and status byte) left, which should be treated as two distinct values.
As it so happens I do have a patchset for this; guess I'll be posting it to demonstrate the idea.
Bart, I would very much prefer if we could work on this together so as to avoid duplicate work.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Bart Van Assche
maintainerQuoted 2 lines · Hannes Reinecke
We should not try to preserve the split SCSI result value with its four distinct fields.
I don't think that we have the freedom to drop the four byte SCSI result entirely since multiple user space APIs use that data structure. The four-byte SCSI result value is embedded in the following user space API data structures (there may be others):
* struct sg_io_v4, the SG_IO header includes the driver_status (driver_byte()), transport_status (host_byte()) and device_status (scsi_status & 0xff) (the message byte is not included).
* struct fc_bsg_reply.
* struct iscsi_bsg_reply.
* struct ufs_bsg_reply.
Quoted 8 lines
I'd rather have the message byte handling moved into the SCSI parallel drivers (where really it should've been in the first place). The driver byte can go entirely as the
DRIVER_SENSEflag can be replaced with a check for valid sense code,DRIVER_TIMEOUTis pretty much identical toDID_TIMEOUT(with the semantic difference _who_ set the timeout), andDRIVER_ERRORcan be folded back into the caller. All other values are unused, allowing us to drop driver error completely.
Quoted 5 lines
With that we're only having two fields (host byte and status byte) left, which should be treated as two distinct values.
As it so happens I do have a patchset for this; guess I'll be posting it to demonstrate the idea.
This patch series does not prevent the conversion described above. Although I think that the changes described above would help, I have a few concerns:
- Some drivers use the result member of struct scsi_cmnd for another purpose than storing SCSI result values. See e.g. the CAM_* values defined in drivers/scsi/aic7xxx/cam.h and the use of these values in drivers/scsi/aic7xxx/aic79xx_osm.c. From the master branch:
[ ... ]
cmd->scsi_done = scsi_done;
cmd->result = CAM_REQ_INPROG << 16;
rtn = ahd_linux_run_command(ahd, dev, cmd);
[ ... ]
[ ... ]
if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) {
cmd->result &= ~(CAM_DEV_QFRZN << 16);
dev->qfrozen--;
}
[ ... ]Converting this driver could be challenging and may end up in rewriting this driver.
- The SCSI drivers that do something meaningful with the message byte are parallel SCSI drivers. Parallel SCSI is a technology that was popular 20-30 years ago but that is no longer popular today. Finding test hardware may be a big challenge.
- The parallel SCSI technology is no longer commercially relevant. It may be challenging to motivate people (including yourself) to convert a significant number of parallel SCSI drivers that each have a small user base.
Although I appreciate it that you have shared this proposal and also that you have proposed to lead this effort, I'm not convinced that this proposal will be implemented soon. So I propose to proceed with this patch series.
Thanks,
Bart.
Hannes Reinecke
maintainerQuoted 4 lines · Bart Van Assche
Quoted 2 lines · Hannes Reinecke
We should not try to preserve the split SCSI result value with its four distinct fields.
Quoted 11 lines
I don't think that we have the freedom to drop the four byte SCSI result entirely since multiple user space APIs use that data structure. The four-byte SCSI result value is embedded in the following user space API data structures (there may be others):
* structsg_io_v4, theSG_IOheader includes thedriver_status(driver_byte()),transport_status(host_byte()) anddevice_status(scsi_status&0xff) (the message byte is not included).
* structfc_bsg_reply.
* structiscsi_bsg_reply.
* structufs_bsg_reply.
Yes, I know. But that's the user-space API; there is nothing forcing us to continue using it internally as long as we keep the userspace API intact.
Quoted 35 lines
Quoted 8 lines
I'd rather have the message byte handling moved into the SCSI parallel drivers (where really it should've been in the first place). The driver byte can go entirely as the
DRIVER_SENSEflag can be replaced with a check for valid sense code,DRIVER_TIMEOUTis pretty much identical toDID_TIMEOUT(with the semantic difference _who_ set the timeout), andDRIVER_ERRORcan be folded back into the caller. All other values are unused, allowing us to drop driver error completely.Quoted 5 lines
With that we're only having two fields (host byte and status byte) left, which should be treated as two distinct values.
As it so happens I do have a patchset for this; guess I'll be posting it to demonstrate the idea.
This patch series does not prevent the conversion described above. Although I think that the changes described above would help, I have a few concerns:
- Some drivers use the result member of structscsi_cmndfor another purpose than storing SCSI result values. See e.g. the CAM_* values defined indrivers/scsi/aic7xxx/cam.hand the use of these values indrivers/scsi/aic7xxx/aic79xx_osm.c. From the master branch:[ ... ] cmd->scsi_done = scsi_done; cmd->result = CAM_REQ_INPROG << 16; rtn = ahd_linux_run_command(ahd, dev, cmd); [ ... ] [ ... ] if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) { cmd->result &= ~(CAM_DEV_QFRZN << 16); dev->qfrozen--; } [ ... ]
Quoted 2 lines
Converting this driver could be challenging and may end up in rewriting this driver.
No, not really. I've got a patch for that; we should have separated the CAM values from the SAM status values a long time ago.
Quoted 4 lines
- The SCSI drivers that do something meaningful with the message byte are parallel SCSI drivers. Parallel SCSI is a technology that was popular 20-30 years ago but that is no longer popular today. Finding test hardware may be a big challenge.
Indeed, the _drivers_ do.
But the SCSI midlayer does not; is just checks for a non-zero value here.
So we can easily map a non-zero message byte to DID_ERROR before calling ->scsi_done(), allowing us to keep the message byte handling within the SCSI parallel drivers.
I got patches for that ...
Quoted 5 lines
- The parallel SCSI technology is no longer commercially relevant. It may be challenging to motivate people (including yourself) to convert a significant number of parallel SCSI drivers that each have a small user base.
... true, but then your patchset suffers from the same issue, no?
Quoted 5 lines
Although I appreciate it that you have shared this proposal and also that you have proposed to lead this effort, I'm not convinced that this proposal will be implemented soon. So I propose to proceed with this patch series.
I'm currently porting the patchset to 5.13/scsi-queue, and hope to have it published soon.
Don't get me wrong; I like your idea with introducing enums for stricter type-checking in the SCSI stack.
My point is simply that if we were converting the SCSI result (for whatever reason) we should drop those bits which are pointless (like DRIVER_SENSE), or never have been used at all (like DRIVER_HARD).
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Bart Van Assche
maintainerQuoted 7 lines · Hannes Reinecke
Quoted 4 lines · Bart Van Assche
- The parallel SCSI technology is no longer commercially relevant. It may be challenging to motivate people (including yourself) to convert a significant number of parallel SCSI drivers that each have a small user base.
... true, but then your patchset suffers from the same issue, no?
My patch series should not change the behavior of any SCSI LLD. Additionally, most changes have been generated with the help of Coccinelle. I think the risk of such changes is lower than modifying SCSI LLDs such that the message byte is handled inside the LLD.
Thanks,
Bart.
Douglas Gilbert
maintainerQuoted 11 lines · Bart Van Assche
Quoted 2 lines · Hannes Reinecke
We should not try to preserve the split SCSI result value with its four distinct fields.
I don't think that we have the freedom to drop the four byte SCSI result entirely since multiple user space APIs use that data structure. The four-byte SCSI result value is embedded in the following user space API data structures (there may be others):
* structsg_io_v4, theSG_IOheader includes thedriver_status(driver_byte()),transport_status(host_byte()) anddevice_status(scsi_status&0xff) (the message byte is not included).
The sg_io_v4 interface was specifically designed to _decouple_ the user visible API from the kernel's 4-bytes-in-1-int representation. So there are 4 levels of error reporting supported:
1) from the kernel front-end: yield an errno
2) from the driver (LLD): set driver_status
3) from the transport: set transport status
4) from the device (target or LU): set device_status
Those distinctions aren't that strict, there is some overlap (e.g. timeouts). The sg version 3 interface (struct sg_io_hdr) is similar but the names are less generic.
Can't remember if anyone every complained to me about not having access to the message byte from SPI.
Doug Gilbert