* John Stultz <[email protected]> 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

Reply via email to