[RFC v4 18/22] timer_list: print_tickdevice(): calculate ->*_delta_ns dynamically

From: Nicolai Stange
Date: Mon Aug 22 2016 - 19:35:59 EST


print_tickdevice(), assembling the per-tick device sections in
/proc/timer_list, is the last user of struct clock_event_device's
->min_delta_ns and ->max_delta_ns members.

In order to make these fully obsolete while retaining userspace ABI,
calculate the displayed values of 'min_delta_ns' and 'max_delta_ns'
on the fly from ->min_delta_ticks_adjusted and ->max_delta_ticks
respectively.

Signed-off-by: Nicolai Stange <nicstange@xxxxxxxxx>
---
kernel/time/timer_list.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index ba7d8b2..5fba4f3 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -206,6 +206,10 @@ static void
print_tickdevice(struct seq_file *m, struct tick_device *td, int cpu)
{
struct clock_event_device *dev = td->evtdev;
+ unsigned long long min_delta_ns =
+ clockevent_delta2ns(dev->min_delta_ticks_adjusted, dev);
+ unsigned long long max_delta_ns =
+ clockevent_delta2ns(dev->max_delta_ticks, dev);

SEQ_printf(m, "Tick Device: mode: %d\n", td->mode);
if (cpu < 0)
@@ -219,10 +223,8 @@ print_tickdevice(struct seq_file *m, struct tick_device *td, int cpu)
return;
}
SEQ_printf(m, "%s\n", dev->name);
- SEQ_printf(m, " max_delta_ns: %llu\n",
- (unsigned long long) dev->max_delta_ns);
- SEQ_printf(m, " min_delta_ns: %llu\n",
- (unsigned long long) dev->min_delta_ns);
+ SEQ_printf(m, " max_delta_ns: %llu\n", max_delta_ns);
+ SEQ_printf(m, " min_delta_ns: %llu\n", min_delta_ns);
SEQ_printf(m, " mult: %u\n", dev->mult);
SEQ_printf(m, " shift: %u\n", dev->shift);
SEQ_printf(m, " mode: %d\n", clockevent_get_state(dev));
--
2.9.2