diff mbox series

riscv: Cleanup sbi function stubs when RISCV_SBI disabled

Message ID 20201126024038.180680-1-wangkefeng.wang@huawei.com (mailing list archive)
State New, archived
Headers show
Series riscv: Cleanup sbi function stubs when RISCV_SBI disabled | expand

Commit Message

Kefeng Wang Nov. 26, 2020, 2:40 a.m. UTC
Fix sbi_init() function declaration mismatch between RISCV_SBI
enable and disable, as it always returned 0, make it void function.

Drop some stubs which won't be used if RISCV_SBI disabled.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/riscv/include/asm/sbi.h | 10 +++-------
 arch/riscv/kernel/sbi.c      |  4 +---
 arch/riscv/kernel/setup.c    |  2 --
 3 files changed, 4 insertions(+), 12 deletions(-)

Comments

Kefeng Wang Dec. 14, 2020, 11:53 a.m. UTC | #1
Hi all,  any comments...

On 2020/11/26 10:40, Kefeng Wang wrote:
> Fix sbi_init() function declaration mismatch between RISCV_SBI
> enable and disable, as it always returned 0, make it void function.
>
> Drop some stubs which won't be used if RISCV_SBI disabled.
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>   arch/riscv/include/asm/sbi.h | 10 +++-------
>   arch/riscv/kernel/sbi.c      |  4 +---
>   arch/riscv/kernel/setup.c    |  2 --
>   3 files changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
> index 653edb25d495..99dc77ba8e43 100644
> --- a/arch/riscv/include/asm/sbi.h
> +++ b/arch/riscv/include/asm/sbi.h
> @@ -89,7 +89,7 @@ struct sbiret {
>   	long value;
>   };
>   
> -int sbi_init(void);
> +void sbi_init(void);
>   struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
>   			unsigned long arg1, unsigned long arg2,
>   			unsigned long arg3, unsigned long arg4,
> @@ -147,11 +147,7 @@ static inline unsigned long sbi_minor_version(void)
>   
>   int sbi_err_map_linux_errno(int err);
>   #else /* CONFIG_RISCV_SBI */
> -/* stubs for code that is only reachable under IS_ENABLED(CONFIG_RISCV_SBI): */
> -void sbi_set_timer(uint64_t stime_value);
> -void sbi_clear_ipi(void);
> -void sbi_send_ipi(const unsigned long *hart_mask);
> -void sbi_remote_fence_i(const unsigned long *hart_mask);
> -void sbi_init(void);
> +static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
> +static inline void sbi_init(void) {}
>   #endif /* CONFIG_RISCV_SBI */
>   #endif /* _ASM_RISCV_SBI_H */
> diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> index 226ccce0f9e0..bae6ffdc6e7b 100644
> --- a/arch/riscv/kernel/sbi.c
> +++ b/arch/riscv/kernel/sbi.c
> @@ -560,7 +560,7 @@ static struct riscv_ipi_ops sbi_ipi_ops = {
>   	.ipi_inject = sbi_send_cpumask_ipi
>   };
>   
> -int __init sbi_init(void)
> +void __init sbi_init(void)
>   {
>   	int ret;
>   
> @@ -600,6 +600,4 @@ int __init sbi_init(void)
>   	}
>   
>   	riscv_set_ipi_ops(&sbi_ipi_ops);
> -
> -	return 0;
>   }
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index 901ac0c680dd..ef4f5c076d61 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -104,9 +104,7 @@ void __init setup_arch(char **cmdline_p)
>   	kasan_init();
>   #endif
>   
> -#if IS_ENABLED(CONFIG_RISCV_SBI)
>   	sbi_init();
> -#endif
>   
>   #ifdef CONFIG_SMP
>   	setup_smp();
Atish Patra Dec. 16, 2020, 1:35 a.m. UTC | #2
On Mon, Dec 14, 2020 at 5:23 AM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
> Hi all,  any comments...
>
> On 2020/11/26 10:40, Kefeng Wang wrote:
> > Fix sbi_init() function declaration mismatch between RISCV_SBI
> > enable and disable, as it always returned 0, make it void function.
> >
> > Drop some stubs which won't be used if RISCV_SBI disabled.
> >
> > Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> > ---
> >   arch/riscv/include/asm/sbi.h | 10 +++-------
> >   arch/riscv/kernel/sbi.c      |  4 +---
> >   arch/riscv/kernel/setup.c    |  2 --
> >   3 files changed, 4 insertions(+), 12 deletions(-)
> >
> > diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
> > index 653edb25d495..99dc77ba8e43 100644
> > --- a/arch/riscv/include/asm/sbi.h
> > +++ b/arch/riscv/include/asm/sbi.h
> > @@ -89,7 +89,7 @@ struct sbiret {
> >       long value;
> >   };
> >
> > -int sbi_init(void);
> > +void sbi_init(void);
> >   struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
> >                       unsigned long arg1, unsigned long arg2,
> >                       unsigned long arg3, unsigned long arg4,
> > @@ -147,11 +147,7 @@ static inline unsigned long sbi_minor_version(void)
> >
> >   int sbi_err_map_linux_errno(int err);
> >   #else /* CONFIG_RISCV_SBI */
> > -/* stubs for code that is only reachable under IS_ENABLED(CONFIG_RISCV_SBI): */
> > -void sbi_set_timer(uint64_t stime_value);
> > -void sbi_clear_ipi(void);
> > -void sbi_send_ipi(const unsigned long *hart_mask);
> > -void sbi_remote_fence_i(const unsigned long *hart_mask);
> > -void sbi_init(void);
> > +static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
> > +static inline void sbi_init(void) {}
> >   #endif /* CONFIG_RISCV_SBI */
> >   #endif /* _ASM_RISCV_SBI_H */
> > diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> > index 226ccce0f9e0..bae6ffdc6e7b 100644
> > --- a/arch/riscv/kernel/sbi.c
> > +++ b/arch/riscv/kernel/sbi.c
> > @@ -560,7 +560,7 @@ static struct riscv_ipi_ops sbi_ipi_ops = {
> >       .ipi_inject = sbi_send_cpumask_ipi
> >   };
> >
> > -int __init sbi_init(void)
> > +void __init sbi_init(void)
> >   {
> >       int ret;
> >
> > @@ -600,6 +600,4 @@ int __init sbi_init(void)
> >       }
> >
> >       riscv_set_ipi_ops(&sbi_ipi_ops);
> > -
> > -     return 0;
> >   }
> > diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> > index 901ac0c680dd..ef4f5c076d61 100644
> > --- a/arch/riscv/kernel/setup.c
> > +++ b/arch/riscv/kernel/setup.c
> > @@ -104,9 +104,7 @@ void __init setup_arch(char **cmdline_p)
> >       kasan_init();
> >   #endif
> >
> > -#if IS_ENABLED(CONFIG_RISCV_SBI)
> >       sbi_init();
> > -#endif
> >
> >   #ifdef CONFIG_SMP
> >       setup_smp();
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

LGTM,

Reviewed-by: Atish Patra <atish.patra@wdc.com>
Palmer Dabbelt Dec. 22, 2020, 2:23 a.m. UTC | #3
On Tue, 15 Dec 2020 17:35:40 PST (-0800), atishp@atishpatra.org wrote:
> On Mon, Dec 14, 2020 at 5:23 AM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>>
>> Hi all,  any comments...
>>
>> On 2020/11/26 10:40, Kefeng Wang wrote:
>> > Fix sbi_init() function declaration mismatch between RISCV_SBI
>> > enable and disable, as it always returned 0, make it void function.
>> >
>> > Drop some stubs which won't be used if RISCV_SBI disabled.
>> >
>> > Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> > ---
>> >   arch/riscv/include/asm/sbi.h | 10 +++-------
>> >   arch/riscv/kernel/sbi.c      |  4 +---
>> >   arch/riscv/kernel/setup.c    |  2 --
>> >   3 files changed, 4 insertions(+), 12 deletions(-)
>> >
>> > diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
>> > index 653edb25d495..99dc77ba8e43 100644
>> > --- a/arch/riscv/include/asm/sbi.h
>> > +++ b/arch/riscv/include/asm/sbi.h
>> > @@ -89,7 +89,7 @@ struct sbiret {
>> >       long value;
>> >   };
>> >
>> > -int sbi_init(void);
>> > +void sbi_init(void);
>> >   struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
>> >                       unsigned long arg1, unsigned long arg2,
>> >                       unsigned long arg3, unsigned long arg4,
>> > @@ -147,11 +147,7 @@ static inline unsigned long sbi_minor_version(void)
>> >
>> >   int sbi_err_map_linux_errno(int err);
>> >   #else /* CONFIG_RISCV_SBI */
>> > -/* stubs for code that is only reachable under IS_ENABLED(CONFIG_RISCV_SBI): */
>> > -void sbi_set_timer(uint64_t stime_value);
>> > -void sbi_clear_ipi(void);
>> > -void sbi_send_ipi(const unsigned long *hart_mask);
>> > -void sbi_remote_fence_i(const unsigned long *hart_mask);
>> > -void sbi_init(void);
>> > +static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
>> > +static inline void sbi_init(void) {}
>> >   #endif /* CONFIG_RISCV_SBI */
>> >   #endif /* _ASM_RISCV_SBI_H */
>> > diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
>> > index 226ccce0f9e0..bae6ffdc6e7b 100644
>> > --- a/arch/riscv/kernel/sbi.c
>> > +++ b/arch/riscv/kernel/sbi.c
>> > @@ -560,7 +560,7 @@ static struct riscv_ipi_ops sbi_ipi_ops = {
>> >       .ipi_inject = sbi_send_cpumask_ipi
>> >   };
>> >
>> > -int __init sbi_init(void)
>> > +void __init sbi_init(void)
>> >   {
>> >       int ret;
>> >
>> > @@ -600,6 +600,4 @@ int __init sbi_init(void)
>> >       }
>> >
>> >       riscv_set_ipi_ops(&sbi_ipi_ops);
>> > -
>> > -     return 0;
>> >   }
>> > diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
>> > index 901ac0c680dd..ef4f5c076d61 100644
>> > --- a/arch/riscv/kernel/setup.c
>> > +++ b/arch/riscv/kernel/setup.c
>> > @@ -104,9 +104,7 @@ void __init setup_arch(char **cmdline_p)
>> >       kasan_init();
>> >   #endif
>> >
>> > -#if IS_ENABLED(CONFIG_RISCV_SBI)
>> >       sbi_init();
>> > -#endif
>> >
>> >   #ifdef CONFIG_SMP
>> >       setup_smp();
>>
>> _______________________________________________
>> linux-riscv mailing list
>> linux-riscv@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-riscv
>
> LGTM,
>
> Reviewed-by: Atish Patra <atish.patra@wdc.com>

Thanks.  This will be on for-next when the merge window closes.
diff mbox series

Patch

diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
index 653edb25d495..99dc77ba8e43 100644
--- a/arch/riscv/include/asm/sbi.h
+++ b/arch/riscv/include/asm/sbi.h
@@ -89,7 +89,7 @@  struct sbiret {
 	long value;
 };
 
-int sbi_init(void);
+void sbi_init(void);
 struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
 			unsigned long arg1, unsigned long arg2,
 			unsigned long arg3, unsigned long arg4,
@@ -147,11 +147,7 @@  static inline unsigned long sbi_minor_version(void)
 
 int sbi_err_map_linux_errno(int err);
 #else /* CONFIG_RISCV_SBI */
-/* stubs for code that is only reachable under IS_ENABLED(CONFIG_RISCV_SBI): */
-void sbi_set_timer(uint64_t stime_value);
-void sbi_clear_ipi(void);
-void sbi_send_ipi(const unsigned long *hart_mask);
-void sbi_remote_fence_i(const unsigned long *hart_mask);
-void sbi_init(void);
+static inline void sbi_remote_fence_i(const unsigned long *hart_mask) {}
+static inline void sbi_init(void) {}
 #endif /* CONFIG_RISCV_SBI */
 #endif /* _ASM_RISCV_SBI_H */
diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
index 226ccce0f9e0..bae6ffdc6e7b 100644
--- a/arch/riscv/kernel/sbi.c
+++ b/arch/riscv/kernel/sbi.c
@@ -560,7 +560,7 @@  static struct riscv_ipi_ops sbi_ipi_ops = {
 	.ipi_inject = sbi_send_cpumask_ipi
 };
 
-int __init sbi_init(void)
+void __init sbi_init(void)
 {
 	int ret;
 
@@ -600,6 +600,4 @@  int __init sbi_init(void)
 	}
 
 	riscv_set_ipi_ops(&sbi_ipi_ops);
-
-	return 0;
 }
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 901ac0c680dd..ef4f5c076d61 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -104,9 +104,7 @@  void __init setup_arch(char **cmdline_p)
 	kasan_init();
 #endif
 
-#if IS_ENABLED(CONFIG_RISCV_SBI)
 	sbi_init();
-#endif
 
 #ifdef CONFIG_SMP
 	setup_smp();