> I'm trying to implement atomic ops for a CPU which has no inherent > support for Read-Modify-Write Ops. Instead of using a global spin lock > which protects all the atomic APIs, I want to use a spin lock per > instance of atomic_t. This works well when atomic_t is unitary and > statically initialized using ATOMIC_INIT (where I can reset the > spinlock_t as well). However if atomic_t var is embedded within a > bigger struct which is allocated dynamically how to I init the > embedded spin lock. atomic_set ( ) is the closest choice, however I > don't think it's current usage in kernel code qualifies it to be > "initializer only".
A simple way to handle this might be to use a separate array of spinlocks and hash each atomic_t to one entry in the array. You could look in asm-parisc and arch/parisc to see an implementation of this that is already in the kernel. - R. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/