Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7435f50e1261f569c660efb4ae52e8bc21a92cbd
Commit:     7435f50e1261f569c660efb4ae52e8bc21a92cbd
Parent:     163da958ba5282cbf85e8b3dc08e4f51f8b01c5e
Author:     Tilman Schmidt <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 12 00:52:24 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Feb 12 09:48:29 2007 -0800

    [PATCH] drivers/isdn/gigaset: reduce mutex scope
    
    Do not lock the cardstate structure mutex earlier than necessary.
    
    Signed-off-by: Tilman Schmidt <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/isdn/gigaset/common.c    |    4 +---
 drivers/isdn/gigaset/interface.c |    3 +++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 4f75cce..9d4ae04 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -640,7 +640,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver 
*drv, int channels,
                return NULL;
        }
        mutex_init(&cs->mutex);
-       mutex_lock(&cs->mutex);
 
        gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1);
        cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL);
@@ -738,6 +737,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver 
*drv, int channels,
 
        ++cs->cs_init;
 
+       /* set up character device */
        gigaset_if_init(cs);
 
        /* set up device sysfs */
@@ -753,11 +753,9 @@ struct cardstate *gigaset_initcs(struct gigaset_driver 
*drv, int channels,
        add_timer(&cs->timer);
 
        gig_dbg(DEBUG_INIT, "cs initialized");
-       mutex_unlock(&cs->mutex);
        return cs;
 
 error:
-       mutex_unlock(&cs->mutex);
        gig_dbg(DEBUG_INIT, "failed");
        gigaset_freecs(cs);
        return NULL;
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index f13de20..eb50f3d 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -615,6 +615,8 @@ void gigaset_if_init(struct cardstate *cs)
                return;
 
        tasklet_init(&cs->if_wake_tasklet, &if_wake, (unsigned long) cs);
+
+       mutex_lock(&cs->mutex);
        cs->tty_dev = tty_register_device(drv->tty, cs->minor_index, NULL);
 
        if (!IS_ERR(cs->tty_dev))
@@ -623,6 +625,7 @@ void gigaset_if_init(struct cardstate *cs)
                warn("could not register device to the tty subsystem");
                cs->tty_dev = NULL;
        }
+       mutex_unlock(&cs->mutex);
 }
 
 void gigaset_if_free(struct cardstate *cs)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to