diff mbox series

[3/9] powerpc/mm: Remove extern from function definition

Message ID 1540220060-30162-3-git-send-email-leitao@debian.org (mailing list archive)
State Superseded
Headers show
Series [1/9] powerpc/64s: Include cpu header | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success next/apply_patch Successfully applied
snowpatch_ozlabs/checkpatch warning Test checkpatch on branch next

Commit Message

Breno Leitao Oct. 22, 2018, 2:54 p.m. UTC
Function huge_ptep_set_access_flags() has the 'extern' keyword in the
function definition and also in the function declaration. This causes a
warning in 'sparse' since the 'extern' storage class should be used only on
symbol declarations.

	arch/powerpc/mm/pgtable.c:232:12: warning: function 'huge_ptep_set_access_flags' with external linkage has definition

This patch removes the keyword from the definition part, while keeps it in
the declaration part.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 arch/powerpc/mm/pgtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christophe Leroy Oct. 23, 2018, 3:38 p.m. UTC | #1
Breno Leitao <leitao@debian.org> a écrit :

> Function huge_ptep_set_access_flags() has the 'extern' keyword in the
> function definition and also in the function declaration. This causes a
> warning in 'sparse' since the 'extern' storage class should be used only on
> symbol declarations.
>
> 	arch/powerpc/mm/pgtable.c:232:12: warning: function  
> 'huge_ptep_set_access_flags' with external linkage has definition
>
> This patch removes the keyword from the definition part, while keeps it in
> the declaration part.

I think checkpatch also says that extern should be avoided in declarations.
Can you remove both ?

Christophe

>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
>  arch/powerpc/mm/pgtable.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
> index d71c7777669c..213933b78077 100644
> --- a/arch/powerpc/mm/pgtable.c
> +++ b/arch/powerpc/mm/pgtable.c
> @@ -229,7 +229,7 @@ int ptep_set_access_flags(struct vm_area_struct  
> *vma, unsigned long address,
>  }
>
>  #ifdef CONFIG_HUGETLB_PAGE
> -extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
> +int huge_ptep_set_access_flags(struct vm_area_struct *vma,
>  				      unsigned long addr, pte_t *ptep,
>  				      pte_t pte, int dirty)
>  {
> --
> 2.19.0
Breno Leitao Oct. 24, 2018, 2:59 p.m. UTC | #2
hi Christophe,

On 10/23/2018 12:38 PM, LEROY Christophe wrote:
> Breno Leitao <leitao@debian.org> a écrit :
>>
>> This patch removes the keyword from the definition part, while keeps
>> it in
>> the declaration part.
> 
> I think checkpatch also says that extern should be avoided in declarations.

Thanks for the review. I tried to look at this complain, but I didn't see
this behavior on checkpatch.pl from kernel 4.19. I created a commit that adds
a new extern prototype and checked the patch. Take a look:

# git show

	commit 720cd4ee7bf3c0607eaea79e209b719bac79508e
	Author: Breno Leitao <leitao@debian.org>
	Date:   Wed Oct 24 10:31:54 2018 -0400

	powerpc/mm: New test function

	New test function.

	Signed-off-by: Breno Leitao <leitao@debian.org>

	diff --git a/arch/powerpc/include/asm/hugetlb.h
	b/arch/powerpc/include/asm/hugetlb.h
	index 2d00cc530083..4a348e42cab6 100644
	--- a/arch/powerpc/include/asm/hugetlb.h
	+++ b/arch/powerpc/include/asm/hugetlb.h
	@@ -167,6 +167,8 @@ extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
				      unsigned long addr, pte_t *ptep,
				      pte_t pte, int dirty);

	+extern int test(int foo);
	+
	static inline pte_t huge_ptep_get(pte_t *ptep)
	{
		return *ptep;

	diff --git a/mm/hugetlb.c b/mm/hugetlb.c
	index 5c390f5a5207..2e8f5f77f7f6 100644
	--- a/mm/hugetlb.c
	+++ b/mm/hugetlb.c
	@@ -3204,6 +3204,11 @@ static void set_huge_ptep_writable(struct
	vm_area_struct *vma,
		update_mmu_cache(vma, address, ptep);
	}

	+int test(int foo)
	+{
	+	return foo;
	+}
	+
	bool is_hugetlb_entry_migration(pte_t pte)
	{
	swp_entry_t swp;


# scripts/checkpatch.pl -g HEAD

	total: 0 errors, 0 warnings, 19 lines checked

	Commit 720cd4ee7bf3 ("powerpc/mm: New test function") has no obvious
	style problems and is ready for submission.
Christophe Leroy Oct. 24, 2018, 3:12 p.m. UTC | #3
Breno Leitao <leitao@debian.org> a écrit :

> hi Christophe,
>
> On 10/23/2018 12:38 PM, LEROY Christophe wrote:
>> Breno Leitao <leitao@debian.org> a écrit :
>>>
>>> This patch removes the keyword from the definition part, while keeps
>>> it in
>>> the declaration part.
>>
>> I think checkpatch also says that extern should be avoided in declarations.
>
> Thanks for the review. I tried to look at this complain, but I didn't see
> this behavior on checkpatch.pl from kernel 4.19. I created a commit that adds
> a new extern prototype and checked the patch. Take a look:

Use option --strict with checkpatch.pl

Christophe

>
> # git show
>
> 	commit 720cd4ee7bf3c0607eaea79e209b719bac79508e
> 	Author: Breno Leitao <leitao@debian.org>
> 	Date:   Wed Oct 24 10:31:54 2018 -0400
>
> 	powerpc/mm: New test function
>
> 	New test function.
>
> 	Signed-off-by: Breno Leitao <leitao@debian.org>
>
> 	diff --git a/arch/powerpc/include/asm/hugetlb.h
> 	b/arch/powerpc/include/asm/hugetlb.h
> 	index 2d00cc530083..4a348e42cab6 100644
> 	--- a/arch/powerpc/include/asm/hugetlb.h
> 	+++ b/arch/powerpc/include/asm/hugetlb.h
> 	@@ -167,6 +167,8 @@ extern int huge_ptep_set_access_flags(struct  
> vm_area_struct *vma,
> 				      unsigned long addr, pte_t *ptep,
> 				      pte_t pte, int dirty);
>
> 	+extern int test(int foo);
> 	+
> 	static inline pte_t huge_ptep_get(pte_t *ptep)
> 	{
> 		return *ptep;
>
> 	diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> 	index 5c390f5a5207..2e8f5f77f7f6 100644
> 	--- a/mm/hugetlb.c
> 	+++ b/mm/hugetlb.c
> 	@@ -3204,6 +3204,11 @@ static void set_huge_ptep_writable(struct
> 	vm_area_struct *vma,
> 		update_mmu_cache(vma, address, ptep);
> 	}
>
> 	+int test(int foo)
> 	+{
> 	+	return foo;
> 	+}
> 	+
> 	bool is_hugetlb_entry_migration(pte_t pte)
> 	{
> 	swp_entry_t swp;
>
>
> # scripts/checkpatch.pl -g HEAD
>
> 	total: 0 errors, 0 warnings, 19 lines checked
>
> 	Commit 720cd4ee7bf3 ("powerpc/mm: New test function") has no obvious
> 	style problems and is ready for submission.
Breno Leitao Oct. 31, 2018, 2:43 p.m. UTC | #4
Hi Christophe,

On 10/24/18 12:12 PM, LEROY Christophe wrote:
> Breno Leitao <leitao@debian.org> a écrit :
> 
>> hi Christophe,
>>
>> On 10/23/2018 12:38 PM, LEROY Christophe wrote:
>>> Breno Leitao <leitao@debian.org> a écrit :
>>>>
>>>> This patch removes the keyword from the definition part, while keeps
>>>> it in
>>>> the declaration part.
>>>
>>> I think checkpatch also says that extern should be avoided in
>>> declarations.
>>
>> Thanks for the review. I tried to look at this complain, but I didn't see
>> this behavior on checkpatch.pl from kernel 4.19. I created a commit
>> that adds
>> a new extern prototype and checked the patch. Take a look:
> 
> Use option --strict with checkpatch.pl

Thanks. I fixed this patch and resent a v2 with this fix.

Michael,

If you happen to accept this series, please ignore this patch (3/9) and
use a v2 as its replacement:

https://patchwork.ozlabs.org/patch/991444/
diff mbox series

Patch

diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index d71c7777669c..213933b78077 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -229,7 +229,7 @@  int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address,
 }
 
 #ifdef CONFIG_HUGETLB_PAGE
-extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
+int huge_ptep_set_access_flags(struct vm_area_struct *vma,
 				      unsigned long addr, pte_t *ptep,
 				      pte_t pte, int dirty)
 {