* [PATCH] x86: kernel: fix unused variable warning in vm86_32.c
@ 2017-02-17 1:32 Seunghun Han
0 siblings, 0 replies; 2+ messages in thread
From: Seunghun Han @ 2017-02-17 1:32 UTC (permalink / raw)
To: linux-mm; +Cc: Seunghun Han
If CONFIG_TRANSPARENT_HUGEPAGE is not set in kernel config, a warning is shown
in vm86_32.c.
The warning is as follows:
>arch/x86/kernel/vm86_32.c: In function a??mark_screen_rdonlya??:
>arch/x86/kernel/vm86_32.c:180:26: warning: unused variable a??vmaa?? [-Wunused-variable]
> struct vm_area_struct *vma = find_vma(mm, 0xA0000);
The vma variable is used to call split_huge_pmd() macro function, but
split_huge_pmd() is defined as a null macro when CONFIG_TRANSPARENT_HUGEPAGE is
not set in kernel config. Therefore, the compiler shows an unused variable
warning.
To remove this warning, I change the split_huge_pmd() macro function to static
inline function and static inline null function.
Inline function works like a macro function, therefore there is no impact on
Linux kernel working.
Signed-off-by: Seunghun Han <kkamagui@gmail.com>
---
include/linux/huge_mm.h | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index a3762d4..912a763 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -123,15 +123,12 @@ void deferred_split_huge_page(struct page *page);
void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
unsigned long address, bool freeze, struct page *page);
-#define split_huge_pmd(__vma, __pmd, __address) \
- do { \
- pmd_t *____pmd = (__pmd); \
- if (pmd_trans_huge(*____pmd) \
- || pmd_devmap(*____pmd)) \
- __split_huge_pmd(__vma, __pmd, __address, \
- false, NULL); \
- } while (0)
-
+static inline void split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
+ unsigned long address)
+{
+ if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd))
+ __split_huge_pmd(vma, pmd, address, false, NULL);
+}
void split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address,
bool freeze, struct page *page);
@@ -241,9 +238,8 @@ static inline int split_huge_page(struct page *page)
return 0;
}
static inline void deferred_split_huge_page(struct page *page) {}
-#define split_huge_pmd(__vma, __pmd, __address) \
- do { } while (0)
-
+static inline void split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
+ unsigned long address) {}
static inline void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
unsigned long address, bool freeze, struct page *page) {}
static inline void split_huge_pmd_address(struct vm_area_struct *vma,
--
2.1.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] x86: kernel: fix unused variable warning in vm86_32.c
@ 2017-02-13 6:05 Seunghun Han
0 siblings, 0 replies; 2+ messages in thread
From: Seunghun Han @ 2017-02-13 6:05 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Seunghun Han
If CONFIG_TRANSPARENT_HUGEPAGE is not set in kernel config, a warning is shown
in vm86_32.c.
The warning is as follows:
>arch/x86/kernel/vm86_32.c: In function ‘mark_screen_rdonly’:
>arch/x86/kernel/vm86_32.c:180:26: warning: unused variable ‘vma’ [-Wunused-variable]
> struct vm_area_struct *vma = find_vma(mm, 0xA0000);
The vma variable is used to call split_huge_pmd() macro function, but
split_huge_pmd() is defined as a null macro when CONFIG_TRANSPARENT_HUGEPAGE is
not set in kernel config. Therefore, the compiler shows an unused variable
warning.
To remove this warning, I change the split_huge_pmd() macro function to static
inline function and static inline null function.
Inline function works like a macro function, therefore there is no impact on
Linux kernel working.
Signed-off-by: Seunghun Han <kkamagui@gmail.com>
---
include/linux/huge_mm.h | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index a3762d4..912a763 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -123,15 +123,12 @@ void deferred_split_huge_page(struct page *page);
void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
unsigned long address, bool freeze, struct page *page);
-#define split_huge_pmd(__vma, __pmd, __address) \
- do { \
- pmd_t *____pmd = (__pmd); \
- if (pmd_trans_huge(*____pmd) \
- || pmd_devmap(*____pmd)) \
- __split_huge_pmd(__vma, __pmd, __address, \
- false, NULL); \
- } while (0)
-
+static inline void split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
+ unsigned long address)
+{
+ if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd))
+ __split_huge_pmd(vma, pmd, address, false, NULL);
+}
void split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address,
bool freeze, struct page *page);
@@ -241,9 +238,8 @@ static inline int split_huge_page(struct page *page)
return 0;
}
static inline void deferred_split_huge_page(struct page *page) {}
-#define split_huge_pmd(__vma, __pmd, __address) \
- do { } while (0)
-
+static inline void split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
+ unsigned long address) {}
static inline void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
unsigned long address, bool freeze, struct page *page) {}
static inline void split_huge_pmd_address(struct vm_area_struct *vma,
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-17 1:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17 1:32 [PATCH] x86: kernel: fix unused variable warning in vm86_32.c Seunghun Han
-- strict thread matches above, loose matches on Subject: below --
2017-02-13 6:05 Seunghun Han
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.