diff --git a/qla2x00t/qla_attr.c b/qla2x00t/qla_attr.c index df4b0c7c1..99ca9e2af 100644 --- a/qla2x00t/qla_attr.c +++ b/qla2x00t/qla_attr.c @@ -419,7 +419,7 @@ qla2x00_update_portdb(struct device *dev, printk(KERN_INFO "Reconfiguring fabric on %ld\n", vha->host_no); qla2x00_configure_fabric(vha); - /* fall through */ + fallthrough; default: printk(KERN_INFO "Resyncing loop on %ld\n", diff --git a/qla2x00t/qla_bsg.c b/qla2x00t/qla_bsg.c index 3239e77a7..284747c54 100644 --- a/qla2x00t/qla_bsg.c +++ b/qla2x00t/qla_bsg.c @@ -308,7 +308,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) srb_t *sp; const char *type; int req_sg_cnt, rsp_sg_cnt; - int rval = (DRIVER_ERROR << 16); + int rval = DID_ERROR << 16; uint16_t nextlid = 0; #ifdef __COVERITY__ @@ -495,7 +495,7 @@ qla2x00_process_ct(struct bsg_job *bsg_job) struct fc_bsg_request *bsg_request = bsg_job->request; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; - int rval = (DRIVER_ERROR << 16); + int rval = DID_ERROR << 16; int req_sg_cnt, rsp_sg_cnt; uint16_t loop_id; struct fc_port *fcport; diff --git a/qla2x00t/qla_isr.c b/qla2x00t/qla_isr.c index bc5b4bf0e..f591b0efa 100644 --- a/qla2x00t/qla_isr.c +++ b/qla2x00t/qla_isr.c @@ -885,7 +885,7 @@ skip_rio: case MBA_CHG_IN_CONNECTION: /* Change in connection mode */ if (IS_QLA2100(ha)) break; - /* fall through */ + fallthrough; case MBA_RESET: /* Reset */ case MBA_SYSTEM_ERR: /* System Error */ case MBA_REQ_TRANSFER_ERR: /* Request Transfer Error */ @@ -1667,31 +1667,22 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) /* check guard */ if (e_guard != a_guard) { - scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, - 0x10, 0x1); - set_driver_byte(cmd, DRIVER_SENSE); + scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x1); set_host_byte(cmd, DID_ABORT); - cmd->result |= SAM_STAT_CHECK_CONDITION << 1; return 1; } /* check ref tag */ if (e_ref_tag != a_ref_tag) { - scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, - 0x10, 0x3); - set_driver_byte(cmd, DRIVER_SENSE); + scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x3); set_host_byte(cmd, DID_ABORT); - cmd->result |= SAM_STAT_CHECK_CONDITION << 1; return 1; } /* check appl tag */ if (e_app_tag != a_app_tag) { - scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, - 0x10, 0x2); - set_driver_byte(cmd, DRIVER_SENSE); + scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x2); set_host_byte(cmd, DID_ABORT); - cmd->result |= SAM_STAT_CHECK_CONDITION << 1; return 1; } @@ -2251,7 +2242,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, case ABTS_RECV_24XX: /* ensure that the ATIO queue is empty */ qla24xx_process_atio_queue(vha); - /* fall through */ + fallthrough; case ABTS_RESP_24XX: case CTIO_TYPE7: case NOTIFY_ACK_TYPE: diff --git a/qla2x00t/qla_sup.c b/qla2x00t/qla_sup.c index 18b745ee1..cadecdb75 100644 --- a/qla2x00t/qla_sup.c +++ b/qla2x00t/qla_sup.c @@ -2329,8 +2329,7 @@ qla2x00_write_optrom_data(struct scsi_qla_host *vha, uint8_t *buf, sec_mask = 0x10000; break; } - /* Fall through... */ - + fallthrough; case 0x1f: /* Atmel flash. */ /* 512k sector size. */ if (flash_id == 0x13) { @@ -2338,8 +2337,7 @@ qla2x00_write_optrom_data(struct scsi_qla_host *vha, uint8_t *buf, sec_mask = 0x80000000; break; } - /* Fall through... */ - + fallthrough; case 0x01: /* AMD flash. */ if (flash_id == 0x38 || flash_id == 0x40 || flash_id == 0x4f) { @@ -2371,7 +2369,7 @@ qla2x00_write_optrom_data(struct scsi_qla_host *vha, uint8_t *buf, sec_mask = 0x1e000; break; } - /* Fall through... */ + fallthrough; default: /* Default to 16 kb sector size. */ rest_addr = 0x3fff; diff --git a/scst/include/backport.h b/scst/include/backport.h index a8850f665..353d975be 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -2145,6 +2145,41 @@ static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd) } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) +/* + * See also commit f2b1e9c6f867 ("scsi: core: Introduce scsi_build_sense()"; + * v5.14-rc1). + */ +static inline void scsi_build_sense(struct scsi_cmnd *scmd, int desc, + u8 key, u8 asc, u8 ascq) +{ + scsi_build_sense_buffer(desc, scmd->sense_buffer, key, asc, ascq); + scmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) +/* + * See also 51f3a4788928 ("scsi: core: Introduce the scsi_cmd_to_rq() + * function"). + */ +static inline struct request *scsi_cmd_to_rq(struct scsi_cmnd *scmd) +{ + return blk_mq_rq_from_pdu(scmd); +} + +/* + * See also commit 7ba46799d346 ("scsi: core: Add scsi_prot_ref_tag() + * helper"). + */ +static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd) +{ + struct request *rq = blk_mq_rq_from_pdu(scmd); + + return t10_pi_ref_tag(rq); +} +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 34d9727e8..0eda086a2 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -1653,7 +1653,14 @@ out: return ret; } -static int scst_local_driver_remove(struct device *dev) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) +/* See also commit fc7a6209d571 ("bus: Make remove callback return void") */ +#define DRIVER_REMOVE_RET int +#else +#define DRIVER_REMOVE_RET void +#endif + +static DRIVER_REMOVE_RET scst_local_driver_remove(struct device *dev) { struct scst_local_sess *sess; struct Scsi_Host *shost = NULL; @@ -1670,7 +1677,7 @@ static int scst_local_driver_remove(struct device *dev) scsi_host_put(shost); TRACE_EXIT(); - return 0; + return (DRIVER_REMOVE_RET)0; } static int scst_local_bus_match(struct device *dev,