Re: [PATCH] init: check printed flag to skip printing message

Joe Perches
2012-03-09T00:11:10Z

On Thu, 2012-03-08 at 15:44 -0800, Diwakar Tundlam wrote:
> Otherwise the 'Calibration skipped' message gets printed everytime a CPU is
> hotplugged in, cluttering console for systems that frequently hotplug CPUs.

Perhaps this is more uniform and it saves a few bytes too.

$ size init/calibrate.o*
text data bss dec hex filename
2933 73 521 3527 dc7 init/calibrate.o.new
2957 73 513 3543 dd7 init/calibrate.o.old

init/calibrate.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/init/calibrate.c b/init/calibrate.c
index 5f117ca..4f0af03 100644
--- a/init/calibrate.c
+++ b/init/calibrate.c
@@ -267,31 +267,32 @@ void __cpuinit calibrate_delay(void)

if (per_cpu(cpu_loops_per_jiffy, this_cpu)) {
lpj = per_cpu(cpu_loops_per_jiffy, this_cpu);
- pr_info("Calibrating delay loop (skipped) "
- "already calibrated this CPU");
+ if (!printed)
+ pr_info("Calibrating delay loop%s",
+ " (skipped) already calibrated this CPU");
} else if (preset_lpj) {
lpj = preset_lpj;
if (!printed)
- pr_info("Calibrating delay loop (skipped) "
- "preset value.. ");
+ pr_info("Calibrating delay loop%s",
+ " (skipped) preset value..");
} else if ((!printed) && lpj_fine) {
lpj = lpj_fine;
- pr_info("Calibrating delay loop (skipped), "
- "value calculated using timer frequency.. ");
+ pr_info("Calibrating delay loop%s",
+ " (skipped), value calculated using timer frequency..");
} else if ((lpj = calibrate_delay_is_known())) {
;
} else if ((lpj = calibrate_delay_direct()) != 0) {
if (!printed)
- pr_info("Calibrating delay using timer "
- "specific routine.. ");
+ pr_info("Calibrating delay loop%s",
+ " using timer specific routine..");
} else {
if (!printed)
- pr_info("Calibrating delay loop... ");
+ pr_info("Calibrating delay loop%s", "...");
lpj = calibrate_delay_converge();
}
per_cpu(cpu_loops_per_jiffy, this_cpu) = lpj;
if (!printed)
- pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n",
+ pr_cont(" %lu.%02lu BogoMIPS (lpj=%lu)\n",
lpj/(500000/HZ),
(lpj/(5000/HZ)) % 100, lpj);