Messages in this thread | | | From | John Ogness <> | Subject | Re: [PATCH printk v2 2/8] printk: Provide debug_store() for nbcon debugging | Date | Fri, 28 Jul 2023 11:58:44 +0206 |
| |
On 2023-07-28, John Ogness <john.ogness@linutronix.de> wrote: > +/* > + * Define DEBUG_NBCON to allow for nbcon ownership transitions to be logged > + * to the ringbuffer. The debug_store() macro only logs to the lockless > + * ringbuffer and does not trigger any printing. > + */ > +#undef DEBUG_NBCON > + > +#ifdef DEBUG_NBCON > +/* Only write to ringbuffer. */ > +int __debug_store(const char *fmt, ...) > +{ > + va_list args; > + int r; > + > + va_start(args, fmt); > + r = vprintk_store(2, 7, NULL, fmt, args); > + va_end(args); > + > + return r; > +} > +#define debug_store(cond, fmt, ...) \ > + do { \ > + if (cond) \ > + __debug_store(pr_fmt("DEBUG: " fmt), ##__VA_ARGS__) \
Missing a semi-colon here. Wrapping this with a do-while was a last-minute change requested by checkpatch.pl. Probably nobody would notice because you must manually define DEBUG_NBCON by changing the source code. Fixed for v3 (assuming Petr allows me to keep this debugging code in place).
> + } while (0) > +#else > +#define debug_store(cond, fmt, ...) > +#endif
John
| |