scst: Move kref_get_unless_zero() definition to <scst/backport.h>

This patch is a slightly modified version of a patch supplied by
Israel Rukshin <israelr@mellanox.com>.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6875 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2016-04-26 04:13:42 +00:00
parent 82cff1ba81
commit 5bbc7433dc
2 changed files with 21 additions and 19 deletions
-19
View File
@@ -172,25 +172,6 @@ static u32 ft_sess_hash(u32 port_id)
return hash_32(port_id, FT_SESS_HASH_BITS);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) && \
! (LINUX_VERSION_CODE >> 8 == KERNEL_VERSION(3, 4, 0) >> 8 && \
LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 41)) && \
! (LINUX_VERSION_CODE >> 8 == KERNEL_VERSION(3, 2, 0) >> 8 && \
LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 44)) && \
!defined(CONFIG_SUSE_KERNEL) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6 || \
(RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 < 6))
/*
* See also commit 4b20db3 (kref: Implement kref_get_unless_zero v3 -- v3.8).
* See also commit e3a5505 in branch stable/linux-3.4.y (v3.4.41).
* See also commit 3fa8ee5 in branch stable/linux-3.2.y (v3.2.44).
*/
static inline int __must_check kref_get_unless_zero(struct kref *kref)
{
return atomic_add_unless(&kref->refcount, 1, 0);
}
#endif
/*
* Find session in local port.
* Sessions and hash lists are RCU-protected.
+21
View File
@@ -327,6 +327,27 @@ enum umh_wait {
};
#endif
/* <linux/kref.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) && \
! (LINUX_VERSION_CODE >> 8 == KERNEL_VERSION(3, 4, 0) >> 8 && \
LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 41)) && \
! (LINUX_VERSION_CODE >> 8 == KERNEL_VERSION(3, 2, 0) >> 8 && \
LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 44)) && \
!defined(CONFIG_SUSE_KERNEL) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6 || \
(RHEL_MAJOR -0 == 6 && RHEL_MINOR -0 < 6))
/*
* See also commit 4b20db3 (kref: Implement kref_get_unless_zero v3 -- v3.8).
* See also commit e3a5505 in branch stable/linux-3.4.y (v3.4.41).
* See also commit 3fa8ee5 in branch stable/linux-3.2.y (v3.2.44).
*/
static inline int __must_check kref_get_unless_zero(struct kref *kref)
{
return atomic_add_unless(&kref->refcount, 1, 0);
}
#endif
/* <linux/list.h> */
#ifndef __list_for_each