Re: [PATCH] usb: roles: Fix a false positive recursive locking complaint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/4/24 3:34 PM, Amit Sunil Dhamne wrote:
However, I have seen almost 30+ instances of the prior
method (https://lore.kernel.org/all/20240822223717.253433-1-amitsd@xxxxxxxxxx/)
of registering lockdep key, which is what I followed.

Many of these examples are for spinlocks. It would be good to have a
variant of spin_lock_init() that does not instantiate a struct
lock_class_key and instead accepts a lock_class_key pointer as argument.

However, if that's is not the right way, it brings into question the purpose
of lockdep_set_class() considering I would always and unconditionally use
__mutex_init()  if I want to manage the lockdep class keys myself or
mutex_init() if I didn't.
What I'm proposing is not a new pattern. There are multiple examples
in the kernel tree of lockdep_register_key() calls followed by a
__mutex_init() call:

$ git grep -wB3 __mutex_init | grep lockdep_register_key | wc -l
5

Thanks,

Bart.





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux