diff mbox series

[1/2] riscv: Fix implicit declaration of 'page_to_section'

Message ID 20191023032302.160388-1-wangkefeng.wang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [1/2] riscv: Fix implicit declaration of 'page_to_section' | expand

Commit Message

Kefeng Wang Oct. 23, 2019, 3:23 a.m. UTC
With CONFIG_SPARSEMEM and !CONFIG_SPARSEMEM_VMEMMAP,

arch/riscv/include/asm/pgtable.h: In function ‘mk_pte’:
include/asm-generic/memory_model.h:64:14: error: implicit declaration of function ‘page_to_section’; did you mean ‘present_section’? [-Werror=implicit-function-declaration]
  int __sec = page_to_section(__pg);   \
              ^~~~~~~~~~~~~~~

Fixed by changing mk_pte() from inline function to macro.

Cc: Logan Gunthorpe <logang@deltatee.com>
Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem")
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/riscv/include/asm/pgtable.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Logan Gunthorpe Oct. 23, 2019, 3:56 p.m. UTC | #1
On 2019-10-22 9:23 p.m., Kefeng Wang wrote:
> With CONFIG_SPARSEMEM and !CONFIG_SPARSEMEM_VMEMMAP,
> 
> arch/riscv/include/asm/pgtable.h: In function ‘mk_pte’:
> include/asm-generic/memory_model.h:64:14: error: implicit declaration of function ‘page_to_section’; did you mean ‘present_section’? [-Werror=implicit-function-declaration]
>   int __sec = page_to_section(__pg);   \
>               ^~~~~~~~~~~~~~~
> 
> Fixed by changing mk_pte() from inline function to macro.
> 
> Cc: Logan Gunthorpe <logang@deltatee.com>
> Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem")
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

Makes sense.

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

> ---
>  arch/riscv/include/asm/pgtable.h | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
> index 42292d99cc74..1db2144f9221 100644
> --- a/arch/riscv/include/asm/pgtable.h
> +++ b/arch/riscv/include/asm/pgtable.h
> @@ -184,10 +184,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
>  	return __pte((pfn << _PAGE_PFN_SHIFT) | pgprot_val(prot));
>  }
>  
> -static inline pte_t mk_pte(struct page *page, pgprot_t prot)
> -{
> -	return pfn_pte(page_to_pfn(page), prot);
> -}
> +#define mk_pte(page,prot)       pfn_pte(page_to_pfn(page),prot)
>  
>  #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
>  
>
Paul Walmsley Oct. 23, 2019, 6:47 p.m. UTC | #2
On Wed, 23 Oct 2019, Kefeng Wang wrote:

> With CONFIG_SPARSEMEM and !CONFIG_SPARSEMEM_VMEMMAP,
> 
> arch/riscv/include/asm/pgtable.h: In function ‘mk_pte’:
> include/asm-generic/memory_model.h:64:14: error: implicit declaration of function ‘page_to_section’; did you mean ‘present_section’? [-Werror=implicit-function-declaration]
>   int __sec = page_to_section(__pg);   \
>               ^~~~~~~~~~~~~~~
> 
> Fixed by changing mk_pte() from inline function to macro.
> 
> Cc: Logan Gunthorpe <logang@deltatee.com>
> Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem")
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

Thanks for the fix, but this patch adds checkpatch errors:

---
ERROR: space required after that ',' (ctx:VxV)
#37: FILE: arch/riscv/include/asm/pgtable.h:187:
+#define mk_pte(page,prot)       pfn_pte(page_to_pfn(page),prot)
                    ^

ERROR: space required after that ',' (ctx:VxV)
#37: FILE: arch/riscv/include/asm/pgtable.h:187:
+#define mk_pte(page,prot)       pfn_pte(page_to_pfn(page),prot)
                                                          ^

total: 2 errors, 0 warnings, 0 checks, 11 lines checked
---

Please run 'checkpatch.pl --strict' on patches before submitting.  

Anyway, these have been fixed up here and queued for v5.4-rc with Logan's 
Reviewed-by:.


- Paul
Kefeng Wang Oct. 24, 2019, 12:45 a.m. UTC | #3
On 2019/10/24 2:47, Paul Walmsley wrote:
> On Wed, 23 Oct 2019, Kefeng Wang wrote:
> 
>> With CONFIG_SPARSEMEM and !CONFIG_SPARSEMEM_VMEMMAP,
>>
>> arch/riscv/include/asm/pgtable.h: In function ‘mk_pte’:
>> include/asm-generic/memory_model.h:64:14: error: implicit declaration of function ‘page_to_section’; did you mean ‘present_section’? [-Werror=implicit-function-declaration]
>>   int __sec = page_to_section(__pg);   \
>>               ^~~~~~~~~~~~~~~
>>
>> Fixed by changing mk_pte() from inline function to macro.
>>
>> Cc: Logan Gunthorpe <logang@deltatee.com>
>> Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem")
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> 
> Thanks for the fix, but this patch adds checkpatch errors:
> 
> ---
> ERROR: space required after that ',' (ctx:VxV)
> #37: FILE: arch/riscv/include/asm/pgtable.h:187:
> +#define mk_pte(page,prot)       pfn_pte(page_to_pfn(page),prot)
>                     ^
> 
> ERROR: space required after that ',' (ctx:VxV)
> #37: FILE: arch/riscv/include/asm/pgtable.h:187:
> +#define mk_pte(page,prot)       pfn_pte(page_to_pfn(page),prot)
>                                                           ^
> 
> total: 2 errors, 0 warnings, 0 checks, 11 lines checked
> ---
> 

oops.

> Please run 'checkpatch.pl --strict' on patches before submitting.  
> 
Ok, will do next time.

> Anyway, these have been fixed up here and queued for v5.4-rc with Logan's 
> Reviewed-by:.
> 
Thanks.


> 
> - Paul
>
diff mbox series

Patch

diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 42292d99cc74..1db2144f9221 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -184,10 +184,7 @@  static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
 	return __pte((pfn << _PAGE_PFN_SHIFT) | pgprot_val(prot));
 }
 
-static inline pte_t mk_pte(struct page *page, pgprot_t prot)
-{
-	return pfn_pte(page_to_pfn(page), prot);
-}
+#define mk_pte(page,prot)       pfn_pte(page_to_pfn(page),prot)
 
 #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))