diff mbox series

lib: sbi_timer: Drop unnecessary get_platform_ticks wrapper

Message ID 20220529170048.60646-1-samuel@sholland.org
State Accepted
Headers show
Series lib: sbi_timer: Drop unnecessary get_platform_ticks wrapper | expand

Commit Message

Samuel Holland May 29, 2022, 5 p.m. UTC
The device's timer_value callback is already the right prototype to use
for the get_time_val function pointer.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

 lib/sbi/sbi_timer.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Anup Patel May 30, 2022, 5:18 a.m. UTC | #1
On Sun, May 29, 2022 at 10:31 PM Samuel Holland <samuel@sholland.org> wrote:
>
> The device's timer_value callback is already the right prototype to use
> for the get_time_val function pointer.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

> ---
>
>  lib/sbi/sbi_timer.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/lib/sbi/sbi_timer.c b/lib/sbi/sbi_timer.c
> index 353886f..b0a6e63 100644
> --- a/lib/sbi/sbi_timer.c
> +++ b/lib/sbi/sbi_timer.c
> @@ -44,11 +44,6 @@ static u64 get_ticks(void)
>  }
>  #endif
>
> -static u64 get_platform_ticks(void)
> -{
> -       return timer_dev->timer_value();
> -}
> -
>  static void nop_delay_fn(void *opaque)
>  {
>         cpu_relax();
> @@ -167,7 +162,7 @@ void sbi_timer_set_device(const struct sbi_timer_device *dev)
>
>         timer_dev = dev;
>         if (!get_time_val && timer_dev->timer_value)
> -               get_time_val = get_platform_ticks;
> +               get_time_val = timer_dev->timer_value;
>  }
>
>  int sbi_timer_init(struct sbi_scratch *scratch, bool cold_boot)
> --
> 2.35.1
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
Anup Patel June 1, 2022, 10:51 a.m. UTC | #2
On Mon, May 30, 2022 at 10:48 AM Anup Patel <anup@brainfault.org> wrote:
>
> On Sun, May 29, 2022 at 10:31 PM Samuel Holland <samuel@sholland.org> wrote:
> >
> > The device's timer_value callback is already the right prototype to use
> > for the get_time_val function pointer.
> >
> > Signed-off-by: Samuel Holland <samuel@sholland.org>
>
> Looks good to me.
>
> Reviewed-by: Anup Patel <anup@brainfault.org>

Applied this patch to the riscv/opensbi repo

Thanks,
Anup

>
> Regards,
> Anup
>
> > ---
> >
> >  lib/sbi/sbi_timer.c | 7 +------
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/lib/sbi/sbi_timer.c b/lib/sbi/sbi_timer.c
> > index 353886f..b0a6e63 100644
> > --- a/lib/sbi/sbi_timer.c
> > +++ b/lib/sbi/sbi_timer.c
> > @@ -44,11 +44,6 @@ static u64 get_ticks(void)
> >  }
> >  #endif
> >
> > -static u64 get_platform_ticks(void)
> > -{
> > -       return timer_dev->timer_value();
> > -}
> > -
> >  static void nop_delay_fn(void *opaque)
> >  {
> >         cpu_relax();
> > @@ -167,7 +162,7 @@ void sbi_timer_set_device(const struct sbi_timer_device *dev)
> >
> >         timer_dev = dev;
> >         if (!get_time_val && timer_dev->timer_value)
> > -               get_time_val = get_platform_ticks;
> > +               get_time_val = timer_dev->timer_value;
> >  }
> >
> >  int sbi_timer_init(struct sbi_scratch *scratch, bool cold_boot)
> > --
> > 2.35.1
> >
> >
> > --
> > opensbi mailing list
> > opensbi@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/opensbi
diff mbox series

Patch

diff --git a/lib/sbi/sbi_timer.c b/lib/sbi/sbi_timer.c
index 353886f..b0a6e63 100644
--- a/lib/sbi/sbi_timer.c
+++ b/lib/sbi/sbi_timer.c
@@ -44,11 +44,6 @@  static u64 get_ticks(void)
 }
 #endif
 
-static u64 get_platform_ticks(void)
-{
-	return timer_dev->timer_value();
-}
-
 static void nop_delay_fn(void *opaque)
 {
 	cpu_relax();
@@ -167,7 +162,7 @@  void sbi_timer_set_device(const struct sbi_timer_device *dev)
 
 	timer_dev = dev;
 	if (!get_time_val && timer_dev->timer_value)
-		get_time_val = get_platform_ticks;
+		get_time_val = timer_dev->timer_value;
 }
 
 int sbi_timer_init(struct sbi_scratch *scratch, bool cold_boot)