From a0d4136e5ce110c351da7aa28c6e8504b468da15 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 29 Mar 2019 01:41:49 +0000 Subject: [PATCH] qla2x00t-32gbit: Backport to kernel v4.10 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8104 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_os.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 31e4fe280..e289d6e52 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -14,7 +14,9 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) #include +#endif #include #include @@ -1289,11 +1291,18 @@ qla2x00_wait_for_chip_reset(scsi_qla_host_t *vha) static int sp_get(struct srb *sp) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + if (!atomic_inc_not_zero(&sp->ref_count)) + return ENXIO; + else + return 0; +#else if (!refcount_inc_not_zero((refcount_t*)&sp->ref_count)) /* kref get fail */ return ENXIO; else return 0; +#endif } #define ISP_REG_DISCONNECT 0xffffffffU