Re: [PATCH printk v2 33/38] printk: introduce console_list_lock

From: John Ogness
Date: Mon Nov 07 2022 - 05:11:10 EST


On 2022-10-27, "Paul E. McKenney" <paulmck@xxxxxxxxxx> wrote:
> One way to save a line is as follows:
>
> WARN_ON_ONCE(IS_ENABLED(CONFIG_DEBUG_LOCK_ALLOC) &&
> debug_lockdep_rcu_enabled() &&
> srcu_read_lock_held(&console_srcu));

Unfortunately this suggestion does not work because
debug_lockdep_rcu_enabled() only exists if CONFIG_DEBUG_LOCK_ALLOC is
enabled. Would you be interested in having an empty implementation?
Then my check would not need to be concerned about
CONFIG_DEBUG_LOCK_ALLOC at all. It would become:

WARN_ON_ONCE(debug_lockdep_rcu_enabled() &&
srcu_read_lock_held(&console_srcu));

The patch below could be used to achieve that.

John

--------8<-------------