diff options
author | Jan Kiszka <jan.kiszka@web.de> | 2010-02-08 11:12:14 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-17 01:01:22 +0100 |
commit | 0ca3a017a7373a4545dd7b345a8a0cecc16bc7e2 (patch) | |
tree | a739bfb8ddd0c7fcfdcd40ab6fcd990570c716bf /drivers/isdn/capi/kcapi_proc.c | |
parent | CAPI: Rework controller state notifier (diff) | |
download | linux-0ca3a017a7373a4545dd7b345a8a0cecc16bc7e2.tar.xz linux-0ca3a017a7373a4545dd7b345a8a0cecc16bc7e2.zip |
CAPI: Rework locking of controller data structures
This patch applies the mutex so far only protecting the controller list
to (almost) all accesses of controller data structures. It also reworks
waiting on state changes in old_capi_manufacturer so that it no longer
poll and holds a module reference to the controller owner while waiting
(the latter was partly done already). Modification and checking of the
blocked state remains racy by design, the caller is responsible for
dealing with this.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/capi/kcapi_proc.c')
-rw-r--r-- | drivers/isdn/capi/kcapi_proc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/isdn/capi/kcapi_proc.c b/drivers/isdn/capi/kcapi_proc.c index 71b07610ff31..3e6e17a24389 100644 --- a/drivers/isdn/capi/kcapi_proc.c +++ b/drivers/isdn/capi/kcapi_proc.c @@ -35,7 +35,10 @@ static char *state2str(unsigned short state) // --------------------------------------------------------------------------- static void *controller_start(struct seq_file *seq, loff_t *pos) + __acquires(capi_controller_lock) { + mutex_lock(&capi_controller_lock); + if (*pos < CAPI_MAXCONTR) return &capi_controller[*pos]; @@ -52,7 +55,9 @@ static void *controller_next(struct seq_file *seq, void *v, loff_t *pos) } static void controller_stop(struct seq_file *seq, void *v) + __releases(capi_controller_lock) { + mutex_unlock(&capi_controller_lock); } static int controller_show(struct seq_file *seq, void *v) |