From 097560fb1e71e0e10ea19a544a2ef492547d866e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Nov 2018 04:21:29 +0000 Subject: [PATCH] Merge r7437 from trunk git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@7690 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla_bsg.c | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/qla2x00t/qla_bsg.c b/qla2x00t/qla_bsg.c index 06bca9c56..3370dbb1e 100644 --- a/qla2x00t/qla_bsg.c +++ b/qla2x00t/qla_bsg.c @@ -10,6 +10,28 @@ #include #include +/* + * See also commit 17d5363b83f8 ("scsi: introduce a result field in struct + * scsi_request"). See also commit caf7df122721 ("block: remove the errors + * field from struct request"). + */ +#ifndef NEW_LIBFC_API +static inline void set_bsg_result(struct fc_bsg_job *job, int result) +{ + job->req->errors = result; +} +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) +static inline void set_bsg_result(struct bsg_job *job, int result) +{ + job->req->errors = result; +} +#else +static inline void set_bsg_result(struct bsg_job *job, int result) +{ + scsi_req(job->req)->result = result; +} +#endif + /* BSG support for ELS/CT pass through */ void qla2x00_bsg_job_done(void *data, void *ptr, int res) @@ -2193,11 +2215,7 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job) ql_log(ql_log_warn, vha, 0x7089, "mbx abort_command " "failed.\n"); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) - scsi_req(bsg_job->req)->result = -#else - bsg_job->req->errors = -#endif + set_bsg_result(bsg_job, -EIO); #ifndef NEW_LIBFC_API bsg_job->reply->result = -EIO; #else @@ -2207,11 +2225,7 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job) ql_dbg(ql_dbg_user, vha, 0x708a, "mbx abort_command " "success.\n"); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) - scsi_req(bsg_job->req)->result = -#else - bsg_job->req->errors = -#endif + set_bsg_result(bsg_job, 0); #ifndef NEW_LIBFC_API bsg_job->reply->result = 0; #else @@ -2226,14 +2240,10 @@ 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"); + set_bsg_result(bsg_job, -ENXIO); #ifndef NEW_LIBFC_API - bsg_job->req->errors = bsg_job->reply->result = -ENXIO; + bsg_job->reply->result = -ENXIO; #else -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) - scsi_req(bsg_job->req)->result = -#else - bsg_job->req->errors = -#endif bsg_reply->result = -ENXIO; #endif return 0;