Skip to content

Commit

Permalink
printk: Make it compile with !CONFIG_PRINTK
Browse files Browse the repository at this point in the history
Commit 3ccf3e8 ("printk/sched: Introduce special
printk_sched() for those awkward moments") overlooked
an #ifdef, so move code around to respect these directives.

Reported-by: Stephen Rothwell <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Cc: Randy Dunlap <[email protected]>
Link: http://lkml.kernel.org/r/1331811337.18960.179.camel@twins
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Mar 15, 2012
1 parent 9993bc6 commit 600e145
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions kernel/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,26 +1222,6 @@ int is_console_locked(void)
static DEFINE_PER_CPU(int, printk_pending);
static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf);

int printk_sched(const char *fmt, ...)
{
unsigned long flags;
va_list args;
char *buf;
int r;

local_irq_save(flags);
buf = __get_cpu_var(printk_sched_buf);

va_start(args, fmt);
r = vsnprintf(buf, PRINTK_BUF_SIZE, fmt, args);
va_end(args);

__this_cpu_or(printk_pending, PRINTK_PENDING_SCHED);
local_irq_restore(flags);

return r;
}

void printk_tick(void)
{
if (__this_cpu_read(printk_pending)) {
Expand Down Expand Up @@ -1658,6 +1638,26 @@ late_initcall(printk_late_init);

#if defined CONFIG_PRINTK

int printk_sched(const char *fmt, ...)
{
unsigned long flags;
va_list args;
char *buf;
int r;

local_irq_save(flags);
buf = __get_cpu_var(printk_sched_buf);

va_start(args, fmt);
r = vsnprintf(buf, PRINTK_BUF_SIZE, fmt, args);
va_end(args);

__this_cpu_or(printk_pending, PRINTK_PENDING_SCHED);
local_irq_restore(flags);

return r;
}

/*
* printk rate limiting, lifted from the networking subsystem.
*
Expand Down

0 comments on commit 600e145

Please sign in to comment.