summaryrefslogtreecommitdiffstats
path: root/kernel/kcsan/encoding.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-11-20 10:41:43 +0100
committerIngo Molnar <mingo@kernel.org>2019-11-20 10:47:23 +0100
commit5cbaefe9743bf14c9d3106db0cc19f8cb0a3ca22 (patch)
treeb89923344fb8eab289073d904d64e29f51723e88 /kernel/kcsan/encoding.h
parentMerge branch 'for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/pau... (diff)
downloadlinux-5cbaefe9743bf14c9d3106db0cc19f8cb0a3ca22.tar.xz
linux-5cbaefe9743bf14c9d3106db0cc19f8cb0a3ca22.zip
kcsan: Improve various small stylistic details
Tidy up a few bits: - Fix typos and grammar, improve wording. - Remove spurious newlines that are col80 warning artifacts where the resulting line-break is worse than the disease it's curing. - Use core kernel coding style to improve readability and reduce spurious code pattern variations. - Use better vertical alignment for structure definitions and initialization sequences. - Misc other small details. No change in functionality intended. Cc: linux-kernel@vger.kernel.org Cc: Marco Elver <elver@google.com> Cc: Paul E. McKenney <paulmck@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Paul E. McKenney <paulmck@kernel.org> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/kcsan/encoding.h')
-rw-r--r--kernel/kcsan/encoding.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/kernel/kcsan/encoding.h b/kernel/kcsan/encoding.h
index e17bdac0e54b..b63890e86449 100644
--- a/kernel/kcsan/encoding.h
+++ b/kernel/kcsan/encoding.h
@@ -10,7 +10,8 @@
#include "kcsan.h"
#define SLOT_RANGE PAGE_SIZE
-#define INVALID_WATCHPOINT 0
+
+#define INVALID_WATCHPOINT 0
#define CONSUMED_WATCHPOINT 1
/*
@@ -34,24 +35,24 @@
* Both these are assumed to be very unlikely. However, in case it still happens
* happens, the report logic will filter out the false positive (see report.c).
*/
-#define WATCHPOINT_ADDR_BITS (BITS_PER_LONG - 1 - WATCHPOINT_SIZE_BITS)
+#define WATCHPOINT_ADDR_BITS (BITS_PER_LONG-1 - WATCHPOINT_SIZE_BITS)
/*
* Masks to set/retrieve the encoded data.
*/
-#define WATCHPOINT_WRITE_MASK BIT(BITS_PER_LONG - 1)
+#define WATCHPOINT_WRITE_MASK BIT(BITS_PER_LONG-1)
#define WATCHPOINT_SIZE_MASK \
- GENMASK(BITS_PER_LONG - 2, BITS_PER_LONG - 2 - WATCHPOINT_SIZE_BITS)
+ GENMASK(BITS_PER_LONG-2, BITS_PER_LONG-2 - WATCHPOINT_SIZE_BITS)
#define WATCHPOINT_ADDR_MASK \
- GENMASK(BITS_PER_LONG - 3 - WATCHPOINT_SIZE_BITS, 0)
+ GENMASK(BITS_PER_LONG-3 - WATCHPOINT_SIZE_BITS, 0)
static inline bool check_encodable(unsigned long addr, size_t size)
{
return size <= MAX_ENCODABLE_SIZE;
}
-static inline long encode_watchpoint(unsigned long addr, size_t size,
- bool is_write)
+static inline long
+encode_watchpoint(unsigned long addr, size_t size, bool is_write)
{
return (long)((is_write ? WATCHPOINT_WRITE_MASK : 0) |
(size << WATCHPOINT_ADDR_BITS) |
@@ -59,17 +60,17 @@ static inline long encode_watchpoint(unsigned long addr, size_t size,
}
static inline bool decode_watchpoint(long watchpoint,
- unsigned long *addr_masked, size_t *size,
+ unsigned long *addr_masked,
+ size_t *size,
bool *is_write)
{
if (watchpoint == INVALID_WATCHPOINT ||
watchpoint == CONSUMED_WATCHPOINT)
return false;
- *addr_masked = (unsigned long)watchpoint & WATCHPOINT_ADDR_MASK;
- *size = ((unsigned long)watchpoint & WATCHPOINT_SIZE_MASK) >>
- WATCHPOINT_ADDR_BITS;
- *is_write = !!((unsigned long)watchpoint & WATCHPOINT_WRITE_MASK);
+ *addr_masked = (unsigned long)watchpoint & WATCHPOINT_ADDR_MASK;
+ *size = ((unsigned long)watchpoint & WATCHPOINT_SIZE_MASK) >> WATCHPOINT_ADDR_BITS;
+ *is_write = !!((unsigned long)watchpoint & WATCHPOINT_WRITE_MASK);
return true;
}