Im working with scx200_gpio driver, and extending it to operate
gpio pins on pc87366 chip, present on the soekris net-4801
the chip has many functional-units, some of which are driven by
i2c/chips/pc87360.c
both drivers have keep their own locks, which prevent other
uses of the same driver from corrupting operations,
but these offer no protection from interference from the other driver.
Is that correct ?
And if so, how do I resolve it ?
1. 3rd module, which exports a single lock
first 2 modules would use that lock instead,
thus depend upon and autoload the 3rd module.
this feels a bit overkill, with too much overhead, but
it doesnt require any large modifications, rearchitecture,
and is the 1 obvious easy way to do it.
Where would this module belong anyway ? drivers/char ??
THE REST IS HIGHLY SPECULATIVE...
2. 3rd module,
which exports:
use_spinlock_named("your_lock_var");
lock-users say:
// note the *, intent is to create a pointer.
static DEFINE_SPINLOCK(*mylock);
// then in __init code presumably
*mylock = use_spinlock_named("common_gpio_lock");
// when u lock
spin_lock_irqsave(mylock, flags)
3. mods to include/linux/spinlock.h
a new macro, DEFINE_SPINLOCK_REF, to support the above
mylock definition, which doesnt compile
597 <http://lxr.linux.no/source/include/linux/spinlock.h#L597> #define
DEFINE_SPINLOCK <http://lxr.linux.no/ident?i=DEFINE_SPINLOCK>(x
<http://lxr.linux.no/ident?i=x>) spinlock_t
<http://lxr.linux.no/ident?i=spinlock_t> x
<http://lxr.linux.no/ident?i=x> = SPIN_LOCK_UNLOCKED
<http://lxr.linux.no/ident?i=SPIN_LOCK_UNLOCKED>
598 <http://lxr.linux.no/source/include/linux/spinlock.h#L598> #define DEFINE_RWLOCK <http://lxr.linux.no/ident?i=DEFINE_RWLOCK>(x <http://lxr.linux.no/ident?i=x>) rwlock_t <http://lxr.linux.no/ident?i=rwlock_t> x <http://lxr.linux.no/ident?i=x> = RW_LOCK_UNLOCKED <http://lxr.linux.no/ident?i=RW_LOCK_UNLOCKED>
I really dont know what Im talking about here, so
feel free to make observations here.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/