lkml.org 
[lkml]   [2016]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] time: alarmtimer: Add the trcepoints for alarmtimer

* John Stultz <john.stultz@linaro.org> wrote:

> @@ -222,7 +226,7 @@ static int alarmtimer_suspend(struct device *dev)
> ktime_t min, now;
> unsigned long flags;
> struct rtc_device *rtc;
> - int i;
> + int i, type = 0;
> int ret;
>
> spin_lock_irqsave(&freezer_delta_lock, flags);
> @@ -247,8 +251,10 @@ static int alarmtimer_suspend(struct device *dev)
> if (!next)
> continue;
> delta = ktime_sub(next->expires, base->gettime());
> - if (!min.tv64 || (delta.tv64 < min.tv64))
> + if (!min.tv64 || (delta.tv64 < min.tv64)) {
> min = delta;
> + type = i;
> + }
> }
> if (min.tv64 == 0)
> return 0;
> @@ -264,6 +270,8 @@ static int alarmtimer_suspend(struct device *dev)
> now = rtc_tm_to_ktime(tm);
> now = ktime_add(now, min);
>
> + trace_alarmtimer_suspend(now, type);
> +
> /* Set alarm, if in the past reject suspend briefly to handle */
> ret = rtc_timer_start(rtc, &rtctimer, now, ktime_set(0, 0));
> if (ret < 0)

Hm, there's a weirdness here: if freezer_delta != 0 when alarmtimer_suspend() is
called then type might be '0', although it's not alarm_bases[0] this value is
picked up from.

Wouldn't it be better to initialize 'type' to -1 instead? (And rename it to
min_type or so.)

That would disambiguate the freezer_delta special case in the trace.

(Unless I missed something.)

Thanks,

Ingo

\
 
 \ /
  Last update: 2016-11-21 09:13    [W:0.112 / U:0.936 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site