mirror of https://gitee.com/openkylin/linux.git
timer_list: Use printk format instead of open-coded symbol lookup
Use the "%ps" printk format string to resolve symbol names. This works on all platforms, including ia64, ppc64 and parisc64 on which one needs to dereference pointers to function descriptors instead of function pointers. Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20201104163401.GA3984@ls3530.fritz.box
This commit is contained in:
parent
1a2b85f1e2
commit
da88f9b311
|
@ -42,24 +42,11 @@ static void SEQ_printf(struct seq_file *m, const char *fmt, ...)
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_name_offset(struct seq_file *m, void *sym)
|
|
||||||
{
|
|
||||||
char symname[KSYM_NAME_LEN];
|
|
||||||
|
|
||||||
if (lookup_symbol_name((unsigned long)sym, symname) < 0)
|
|
||||||
SEQ_printf(m, "<%pK>", sym);
|
|
||||||
else
|
|
||||||
SEQ_printf(m, "%s", symname);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_timer(struct seq_file *m, struct hrtimer *taddr, struct hrtimer *timer,
|
print_timer(struct seq_file *m, struct hrtimer *taddr, struct hrtimer *timer,
|
||||||
int idx, u64 now)
|
int idx, u64 now)
|
||||||
{
|
{
|
||||||
SEQ_printf(m, " #%d: ", idx);
|
SEQ_printf(m, " #%d: <%pK>, %ps", idx, taddr, timer->function);
|
||||||
print_name_offset(m, taddr);
|
|
||||||
SEQ_printf(m, ", ");
|
|
||||||
print_name_offset(m, timer->function);
|
|
||||||
SEQ_printf(m, ", S:%02x", timer->state);
|
SEQ_printf(m, ", S:%02x", timer->state);
|
||||||
SEQ_printf(m, "\n");
|
SEQ_printf(m, "\n");
|
||||||
SEQ_printf(m, " # expires at %Lu-%Lu nsecs [in %Ld to %Ld nsecs]\n",
|
SEQ_printf(m, " # expires at %Lu-%Lu nsecs [in %Ld to %Ld nsecs]\n",
|
||||||
|
@ -116,9 +103,7 @@ print_base(struct seq_file *m, struct hrtimer_clock_base *base, u64 now)
|
||||||
|
|
||||||
SEQ_printf(m, " .resolution: %u nsecs\n", hrtimer_resolution);
|
SEQ_printf(m, " .resolution: %u nsecs\n", hrtimer_resolution);
|
||||||
|
|
||||||
SEQ_printf(m, " .get_time: ");
|
SEQ_printf(m, " .get_time: %ps\n", base->get_time);
|
||||||
print_name_offset(m, base->get_time);
|
|
||||||
SEQ_printf(m, "\n");
|
|
||||||
#ifdef CONFIG_HIGH_RES_TIMERS
|
#ifdef CONFIG_HIGH_RES_TIMERS
|
||||||
SEQ_printf(m, " .offset: %Lu nsecs\n",
|
SEQ_printf(m, " .offset: %Lu nsecs\n",
|
||||||
(unsigned long long) ktime_to_ns(base->offset));
|
(unsigned long long) ktime_to_ns(base->offset));
|
||||||
|
@ -218,42 +203,29 @@ print_tickdevice(struct seq_file *m, struct tick_device *td, int cpu)
|
||||||
SEQ_printf(m, " next_event: %Ld nsecs\n",
|
SEQ_printf(m, " next_event: %Ld nsecs\n",
|
||||||
(unsigned long long) ktime_to_ns(dev->next_event));
|
(unsigned long long) ktime_to_ns(dev->next_event));
|
||||||
|
|
||||||
SEQ_printf(m, " set_next_event: ");
|
SEQ_printf(m, " set_next_event: %ps\n", dev->set_next_event);
|
||||||
print_name_offset(m, dev->set_next_event);
|
|
||||||
SEQ_printf(m, "\n");
|
|
||||||
|
|
||||||
if (dev->set_state_shutdown) {
|
if (dev->set_state_shutdown)
|
||||||
SEQ_printf(m, " shutdown: ");
|
SEQ_printf(m, " shutdown: %ps\n",
|
||||||
print_name_offset(m, dev->set_state_shutdown);
|
dev->set_state_shutdown);
|
||||||
SEQ_printf(m, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dev->set_state_periodic) {
|
if (dev->set_state_periodic)
|
||||||
SEQ_printf(m, " periodic: ");
|
SEQ_printf(m, " periodic: %ps\n",
|
||||||
print_name_offset(m, dev->set_state_periodic);
|
dev->set_state_periodic);
|
||||||
SEQ_printf(m, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dev->set_state_oneshot) {
|
if (dev->set_state_oneshot)
|
||||||
SEQ_printf(m, " oneshot: ");
|
SEQ_printf(m, " oneshot: %ps\n",
|
||||||
print_name_offset(m, dev->set_state_oneshot);
|
dev->set_state_oneshot);
|
||||||
SEQ_printf(m, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dev->set_state_oneshot_stopped) {
|
if (dev->set_state_oneshot_stopped)
|
||||||
SEQ_printf(m, " oneshot stopped: ");
|
SEQ_printf(m, " oneshot stopped: %ps\n",
|
||||||
print_name_offset(m, dev->set_state_oneshot_stopped);
|
dev->set_state_oneshot_stopped);
|
||||||
SEQ_printf(m, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dev->tick_resume) {
|
if (dev->tick_resume)
|
||||||
SEQ_printf(m, " resume: ");
|
SEQ_printf(m, " resume: %ps\n",
|
||||||
print_name_offset(m, dev->tick_resume);
|
dev->tick_resume);
|
||||||
SEQ_printf(m, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
SEQ_printf(m, " event_handler: ");
|
SEQ_printf(m, " event_handler: %ps\n", dev->event_handler);
|
||||||
print_name_offset(m, dev->event_handler);
|
|
||||||
SEQ_printf(m, "\n");
|
SEQ_printf(m, "\n");
|
||||||
SEQ_printf(m, " retries: %lu\n", dev->retries);
|
SEQ_printf(m, " retries: %lu\n", dev->retries);
|
||||||
SEQ_printf(m, "\n");
|
SEQ_printf(m, "\n");
|
||||||
|
|
Loading…
Reference in New Issue