From d79f9c7c02f73fe0d55eb89a34191f67fa13b834 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Nov 2018 16:04:28 +0000 Subject: [PATCH] Merge r7499 from trunk git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@7751 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 7 ++++-- scst/include/scst.h | 56 +++++++++++++++++++++++++++++++++++------ 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index b3af751fb..f322549a9 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -404,7 +404,7 @@ static inline u32 int_sqrt64(u64 x) u32 r = 0, s; int i; - for (i = 8 * sizeof(r) - 2; i >= 0;i --) { + for (i = 8 * sizeof(r) - 2; i >= 0; i--) { s = r + (1 << i); if (1ll * s * s <= x) r = s; @@ -788,7 +788,10 @@ struct t10_pi_tuple { } while (0) #endif -/* See also commit 1d27e3e2252b ("timer: Remove expires and data arguments from DEFINE_TIMER") */ +/* + * See also commit 1d27e3e2252b ("timer: Remove expires and data arguments + * from DEFINE_TIMER"). + */ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) #undef DEFINE_TIMER #define DEFINE_TIMER(_name, _function) \ diff --git a/scst/include/scst.h b/scst/include/scst.h index 78db4aa06..1679a492d 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -71,14 +71,54 @@ #endif #ifdef NOLOCKDEP_SUPPORTED -#define spin_lock_nolockdep(lock) do { current->nolockdep_call = 1; spin_lock(lock); current->nolockdep_call = 0; } while (0) -#define spin_unlock_nolockdep(lock) do { current->nolockdep_call = 1; spin_unlock(lock); current->nolockdep_call = 0; } while (0) -#define mutex_lock_nolockdep(lock) do { current->nolockdep_call = 1; mutex_lock(lock); current->nolockdep_call = 0; } while (0) -#define mutex_unlock_nolockdep(lock) do { current->nolockdep_call = 1; mutex_unlock(lock); current->nolockdep_call = 0; } while (0) -#define down_read_nolockdep(lock) do { current->nolockdep_call = 1; down_read(lock); current->nolockdep_call = 0; } while (0) -#define up_read_nolockdep(lock) do { current->nolockdep_call = 1; up_read(lock); current->nolockdep_call = 0; } while (0) -#define down_write_nolockdep(lock) do { current->nolockdep_call = 1; down_write(lock); current->nolockdep_call = 0; } while (0) -#define up_write_nolockdep(lock) do { current->nolockdep_call = 1; up_write(lock); current->nolockdep_call = 0; } while (0) +#define spin_lock_nolockdep(lock) \ + do { \ + current->nolockdep_call = 1; \ + spin_lock(lock); \ + current->nolockdep_call = 0; \ + } while (0) +#define spin_unlock_nolockdep(lock) \ + do { \ + current->nolockdep_call = 1; \ + spin_unlock(lock); \ + current->nolockdep_call = 0; \ + } while (0) +#define mutex_lock_nolockdep(lock) \ + do { \ + current->nolockdep_call = 1; \ + mutex_lock(lock); \ + current->nolockdep_call = 0; \ + } while (0) +#define mutex_unlock_nolockdep(lock) \ + do { \ + current->nolockdep_call = 1; \ + mutex_unlock(lock); \ + current->nolockdep_call = 0; \ + } while (0) +#define down_read_nolockdep(lock) \ + do { \ + current->nolockdep_call = 1; \ + down_read(lock); \ + current->nolockdep_call = 0; \ + } while (0) +#define up_read_nolockdep(lock) \ + do { \ + current->nolockdep_call = 1; \ + up_read(lock); \ + current->nolockdep_call = 0; \ + } while (0) +#define down_write_nolockdep(lock) \ + do { \ + current->nolockdep_call = 1; \ + down_write(lock); \ + current->nolockdep_call = 0; \ + } while (0) +#define up_write_nolockdep(lock) \ + do { \ + current->nolockdep_call = 1; \ + up_write(lock); \ + current->nolockdep_call = 0; \ + } while (0) #else #define spin_lock_nolockdep spin_lock #define spin_unlock_nolockdep spin_unlock