[PATCH 03/11] soc: ti: knav_qmss: Inline lockdep condition in for_each_handle_rcu

Andrew Davis afd at ti.com
Fri May 8 10:05:50 PDT 2026


On 5/8/26 10:32 AM, Nishanth Menon wrote:
> knav_dev_lock_held() is a single-use wrapper around
> lockdep_is_held(&knav_dev_lock), used only as the lockdep condition
> in for_each_handle_rcu. When CONFIG_LOCKDEP is disabled,

Is it when CONFIG_LOCKDEP is disabled, or is it when CONFIG_PROVE_RCU_LIST
is disabled the condition argument is ignored?

Anyway, good to zap this single-use macro, so

Reviewed-by: Andrew Davis <afd at ti.com>

> list_for_each_entry_rcu() elides the condition argument entirely,
> causing clang to report the macro as unused with W=2:
> 
>    knav_qmss_queue.c:30:9: warning: macro is not used [-Wunused-macros]
>    30 | #define knav_dev_lock_held() \
> 
> Remove the intermediate macro and open-code lockdep_is_held() directly
> in the for_each_handle_rcu definition.
> 
> Signed-off-by: Nishanth Menon <nm at ti.com>
> ---
>   drivers/soc/ti/knav_qmss_queue.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
> index 2c103bb6edef..f65658014b05 100644
> --- a/drivers/soc/ti/knav_qmss_queue.c
> +++ b/drivers/soc/ti/knav_qmss_queue.c
> @@ -27,9 +27,6 @@
>   
>   static struct knav_device *knav_qdev;
>   static DEFINE_MUTEX(knav_dev_lock);
> -#define knav_dev_lock_held() \
> -	lockdep_is_held(&knav_dev_lock)
> -
>   /* Queue manager register indices in DTS */
>   #define KNAV_QUEUE_PEEK_REG_INDEX	0
>   #define KNAV_QUEUE_STATUS_REG_INDEX	1
> @@ -58,7 +55,7 @@ static DEFINE_MUTEX(knav_dev_lock);
>   
>   #define for_each_handle_rcu(qh, inst)				\
>   	list_for_each_entry_rcu(qh, &inst->handles, list,	\
> -				knav_dev_lock_held())
> +				lockdep_is_held(&knav_dev_lock))
>   
>   #define for_each_instance(idx, inst, kdev)		\
>   	for (idx = 0, inst = kdev->instances;		\




More information about the linux-arm-kernel mailing list