[PATCH V2 4/8] dovetail/clock: implement pipeline_timer_name

Philippe Gerum rpm at xenomai.org
Sat Jan 16 13:22:40 CET 2021


hongzha1 via Xenomai <xenomai at xenomai.org> writes:

> to get the name of the current clock event chip, which is the real
> device controlled by the proxy tick device.
>
> Signed-off-by: hongzha1 <hongzhan.chen at intel.com>
>
> diff --git a/include/cobalt/kernel/dovetail/pipeline/clock.h b/include/cobalt/kernel/dovetail/pipeline/clock.h
> index db982d969..d2de1cd34 100644
> --- a/include/cobalt/kernel/dovetail/pipeline/clock.h
> +++ b/include/cobalt/kernel/dovetail/pipeline/clock.h
> @@ -19,16 +19,7 @@ static inline u64 pipeline_read_cycle_counter(void)
>  
>  inline void pipeline_set_timer_shot(unsigned long cycles);
>
> -static inline const char *pipeline_timer_name(void)
> -{
> -	/*
> -	 * Return the name of the current clock event chip, which is
> -	 * the real device controlled by the proxy tick device.
> -	 */
> -	TODO();
> -
> -	return "?";
> -}
> +inline const char *pipeline_timer_name(void);
>  

Since the storage class of pipeline_timer_name() is actually extern, it
will be generated as stand-alone object code in the translation unit for
tick.o, in order for other units to be able to call it (e.g. clock.o),
so "inline" is moot in this particular case.

>  static inline const char *pipeline_clock_name(void)
>  {
> diff --git a/kernel/cobalt/dovetail/tick.c b/kernel/cobalt/dovetail/tick.c
> index 55039f96e..bf267b9d9 100644
> --- a/kernel/cobalt/dovetail/tick.c
> +++ b/kernel/cobalt/dovetail/tick.c
> @@ -16,6 +16,18 @@ extern struct xnintr nktimer;
>  
>  static DEFINE_PER_CPU(struct clock_proxy_device *, proxy_device);
>  
> +inline const char *pipeline_timer_name(void)
> +{
> +	struct clock_proxy_device *dev = __this_cpu_read(proxy_device);
> +	struct clock_event_device *real_dev = dev->real_device;
> +
> +	/*
> +	 * Return the name of the current clock event chip, which is
> +	 * the real device controlled by the proxy tick device.
> +	 */
> +	return real_dev->name;
> +}
> +
>  inline void pipeline_set_timer_shot(unsigned long cycles)
>  {
>  	/*


-- 
Philippe.



More information about the Xenomai mailing list