[PATCH v5 1/9] cpuidle: Add commonly used functionality for consolidation

Turquette, Mike mturquette at ti.com
Mon Feb 27 19:06:30 EST 2012


On Sun, Feb 26, 2012 at 8:47 PM, Robert Lee <rob.lee at linaro.org> wrote:
> +/**
> + * cpuidle_enter_wrap - performing timekeeping and irq around enter function
> + * @dev: pointer to a valid cpuidle_device object
> + * @drv: pointer to a valid cpuidle_driver object
> + * @index: index of the target cpuidle state.
> + */
> +static inline int cpuidle_wrap_enter(struct cpuidle_device *dev,
> +                               struct cpuidle_driver *drv, int index,
> +                               int (*enter)(struct cpuidle_device *dev,
> +                                       struct cpuidle_driver *drv, int index))
> +{
> +       ktime_t time_start, time_end;
> +       s64 diff;
> +
> +       time_start = ktime_get();
> +
> +       index = enter(dev, drv, index);
> +
> +       time_end = ktime_get();
> +
> +       local_irq_enable();
> +
> +       diff = ktime_to_us(ktime_sub(time_end, time_start));
> +       if (diff > INT_MAX)
> +               diff = INT_MAX;
> +
> +       dev->last_residency = (int) diff;
> +
> +       return index;
> +}

Any reason that this code is in the header?  Why not in cpuidle.c?

Regards,
Mike



More information about the linux-arm-kernel mailing list