Skip to content

Commit 7435f50

Browse files
tilmanschmidtLinus Torvalds
authored andcommitted
[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]>
1 parent 163da95 commit 7435f50

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

drivers/isdn/gigaset/common.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
640640
return NULL;
641641
}
642642
mutex_init(&cs->mutex);
643-
mutex_lock(&cs->mutex);
644643

645644
gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1);
646645
cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL);
@@ -738,6 +737,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
738737

739738
++cs->cs_init;
740739

740+
/* set up character device */
741741
gigaset_if_init(cs);
742742

743743
/* set up device sysfs */
@@ -753,11 +753,9 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
753753
add_timer(&cs->timer);
754754

755755
gig_dbg(DEBUG_INIT, "cs initialized");
756-
mutex_unlock(&cs->mutex);
757756
return cs;
758757

759758
error:
760-
mutex_unlock(&cs->mutex);
761759
gig_dbg(DEBUG_INIT, "failed");
762760
gigaset_freecs(cs);
763761
return NULL;

drivers/isdn/gigaset/interface.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,8 @@ void gigaset_if_init(struct cardstate *cs)
615615
return;
616616

617617
tasklet_init(&cs->if_wake_tasklet, &if_wake, (unsigned long) cs);
618+
619+
mutex_lock(&cs->mutex);
618620
cs->tty_dev = tty_register_device(drv->tty, cs->minor_index, NULL);
619621

620622
if (!IS_ERR(cs->tty_dev))
@@ -623,6 +625,7 @@ void gigaset_if_init(struct cardstate *cs)
623625
warn("could not register device to the tty subsystem");
624626
cs->tty_dev = NULL;
625627
}
628+
mutex_unlock(&cs->mutex);
626629
}
627630

628631
void gigaset_if_free(struct cardstate *cs)

0 commit comments

Comments
 (0)