qla2x00t: Port to Linux kernel v4.17

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7439 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2018-07-23 04:29:35 +00:00
parent eb2b6f6ccf
commit 1c1693d06b
3 changed files with 42 additions and 5 deletions
+32
View File
@@ -22,6 +22,9 @@
#include <linux/bio.h>
#include <linux/blkdev.h> /* struct request_queue */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
#include <linux/bsg-lib.h> /* struct bsg_job */
#endif
#include <linux/scatterlist.h> /* struct scatterlist */
#include <linux/slab.h> /* kmalloc() */
#include <linux/timer.h>
@@ -29,6 +32,7 @@
#include <linux/writeback.h> /* sync_page_range() */
#include <rdma/ib_verbs.h>
#include <scsi/scsi_cmnd.h> /* struct scsi_cmnd */
#include <scsi/scsi_transport_fc.h> /* struct fc_bsg_job */
/* <asm-generic/barrier.h> */
@@ -90,6 +94,34 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q)
}
#endif
/* <linux/bsg-lib.h> */
/*
* Note: the function bsg_job_sense() exists only in SCST but not in any
* upstream kernel.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) && \
((LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) && \
!defined(CONFIG_SUSE_KERNEL)) || \
(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) && \
defined(CONFIG_SUSE_KERNEL)))
static inline void *bsg_job_sense(struct fc_bsg_job *job)
{
return job->req->sense;
}
#else
static inline void *bsg_job_sense(struct bsg_job *job)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
return job->req->sense;
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
return scsi_req(job->req)->sense;
#else
return scsi_req(blk_mq_rq_from_pdu(job))->sense;
#endif
}
#endif
/* <linux/compiler.h> */
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20)