[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1452341373-20747-1-git-send-email-chengang@emindsoft.com.cn>
Date: Sat, 9 Jan 2016 20:09:33 +0800
From: chengang@...ndsoft.com.cn
To: dahi@...ux.vnet.ibm.com, trivial@...nel.org
Cc: akpm@...ux-foundation.org, mingo@...nel.org,
nicolas.pitre@...aro.org, peterz@...radead.org,
linux-kernel@...r.kernel.org,
Chen Gang <chengang@...ndsoft.com.cn>,
Chen Gang <gang.chen.5i5j@...il.com>
Subject: [PATCH trivial] include/linux/highmem.h: Cleanup code and comments.
From: Chen Gang <chengang@...ndsoft.com.cn>
Notice about 80 columns.
Notice function parameters alignment.
Remove useless lines.
Signed-off-by: Chen Gang <gang.chen.5i5j@...il.com>
---
include/linux/highmem.h | 47 ++++++++++++++++++++++-------------------------
1 file changed, 22 insertions(+), 25 deletions(-)
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index bb3f329..4a33c94 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -11,7 +11,8 @@
#include <asm/cacheflush.h>
#ifndef ARCH_HAS_FLUSH_ANON_PAGE
-static inline void flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr)
+static inline void flush_anon_page(struct vm_area_struct *vma,
+ struct page *page, unsigned long vmaddr)
{
}
#endif
@@ -107,9 +108,7 @@ static inline int kmap_atomic_idx(void)
static inline void kmap_atomic_idx_pop(void)
{
#ifdef CONFIG_DEBUG_HIGHMEM
- int idx = __this_cpu_dec_return(__kmap_atomic_idx);
-
- BUG_ON(idx < 0);
+ BUG_ON(__this_cpu_dec_return(__kmap_atomic_idx) < 0);
#else
__this_cpu_dec(__kmap_atomic_idx);
#endif
@@ -127,8 +126,7 @@ do { \
__kunmap_atomic(addr); \
} while (0)
-
-/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
+/* When CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
#ifndef clear_user_highpage
static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
{
@@ -139,9 +137,11 @@ static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
#endif
#ifndef __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
-/**
- * __alloc_zeroed_user_highpage - Allocate a zeroed HIGHMEM page for a VMA with caller-specified movable GFP flags
- * @movableflags: The GFP flags related to the pages future ability to move like __GFP_MOVABLE
+/*
+ * __alloc_zeroed_user_highpage - Allocate a zeroed HIGHMEM page for a VMA with
+ * caller-specified movable GFP flags
+ * @movableflags: The GFP flags related to the pages future ability to move like
+ * __GFP_MOVABLE
* @vma: The VMA the page is to be allocated for
* @vaddr: The virtual address the page will be inserted into
*
@@ -159,7 +159,7 @@ __alloc_zeroed_user_highpage(gfp_t movableflags,
unsigned long vaddr)
{
struct page *page = alloc_page_vma(GFP_HIGHUSER | movableflags,
- vma, vaddr);
+ vma, vaddr);
if (page)
clear_user_highpage(page, vaddr);
@@ -168,8 +168,9 @@ __alloc_zeroed_user_highpage(gfp_t movableflags,
}
#endif
-/**
- * alloc_zeroed_user_highpage_movable - Allocate a zeroed HIGHMEM page for a VMA that the caller knows can move
+/*
+ * alloc_zeroed_user_highpage_movable - Allocate a zeroed HIGHMEM page for a
+ * VMA that the caller knows can move
* @vma: The VMA the page is to be allocated for
* @vaddr: The virtual address the page will be inserted into
*
@@ -191,8 +192,8 @@ static inline void clear_highpage(struct page *page)
}
static inline void zero_user_segments(struct page *page,
- unsigned start1, unsigned end1,
- unsigned start2, unsigned end2)
+ unsigned start1, unsigned end1,
+ unsigned start2, unsigned end2)
{
void *kaddr = kmap_atomic(page);
@@ -209,39 +210,35 @@ static inline void zero_user_segments(struct page *page,
}
static inline void zero_user_segment(struct page *page,
- unsigned start, unsigned end)
+ unsigned start, unsigned end)
{
zero_user_segments(page, start, end, 0, 0);
}
static inline void zero_user(struct page *page,
- unsigned start, unsigned size)
+ unsigned start, unsigned size)
{
zero_user_segments(page, start, start + size, 0, 0);
}
#ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE
-
static inline void copy_user_highpage(struct page *to, struct page *from,
- unsigned long vaddr, struct vm_area_struct *vma)
+ unsigned long vaddr, struct vm_area_struct *vma)
{
- char *vfrom, *vto;
+ char *vfrom = kmap_atomic(from);
+ char *vto = kmap_atomic(to);
- vfrom = kmap_atomic(from);
- vto = kmap_atomic(to);
copy_user_page(vto, vfrom, vaddr, to);
kunmap_atomic(vto);
kunmap_atomic(vfrom);
}
-
#endif
static inline void copy_highpage(struct page *to, struct page *from)
{
- char *vfrom, *vto;
+ char *vfrom = kmap_atomic(from);
+ char *vto = kmap_atomic(to);
- vfrom = kmap_atomic(from);
- vto = kmap_atomic(to);
copy_page(vto, vfrom);
kunmap_atomic(vto);
kunmap_atomic(vfrom);
--
1.9.3
Powered by blists - more mailing lists