Re: [PATCH v2 2/3] printk: Create helper function to queue deferred console handling

From: Sergey Senozhatsky
Date: Wed Jun 27 2018 - 22:16:14 EST


On (06/27/18 16:08), Petr Mladek wrote:
> -int vprintk_deferred(const char *fmt, va_list args)
> +void defer_console(void)
> {
> - int r;
> -
> - r = vprintk_emit(0, LOGLEVEL_SCHED, NULL, 0, fmt, args);
> -
> preempt_disable();
> __this_cpu_or(printk_pending, PRINTK_PENDING_OUTPUT);
> irq_work_queue(this_cpu_ptr(&wake_up_klogd_work));
> preempt_enable();
> +}
> +
> +int vprintk_deferred(const char *fmt, va_list args)
> +{
> + int r;
> +
> + r = vprintk_emit(0, LOGLEVEL_SCHED, NULL, 0, fmt, args);
> + defer_console();
>
> return r;


You can just call vprintk_emit(LOGLEVEL_SCHED) from vprintk_func(),
then you don't need to factor out vprintk_deferred() and vprintk_emit().
Any reason for that split?

I'd also may be prefer to have a bit different name. I'm talking
about defer_console().

Other than that

Acked-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>

-ss