Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1305223

[PATCH trivial] include/linux/highmem.h: Cleanup code and comments.

From chengang@emindsoft.com.cn
Newsgroups linux.kernel
Subject [PATCH trivial] include/linux/highmem.h: Cleanup code and comments.
Date 2016-01-09 13:20 +0100
Message-ID <qP0EX-5qr-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Chen Gang <chengang@emindsoft.com.cn>

Notice about 80 columns.

Notice function parameters alignment.

Remove useless lines.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH trivial] include/linux/highmem.h: Cleanup code and comments. chengang@emindsoft.com.cn - 2016-01-09 13:20 +0100

csiph-web