Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 25566
b: refs/heads/master
c: abfd1dc
h: refs/heads/master
v: v3
  • Loading branch information
Tilman Schmidt authored and Linus Torvalds committed Apr 11, 2006
1 parent 4c0c80e commit 6585a63
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 39 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 01371500b245ae63f542d74140a3d8ccb74d0318
refs/heads/master: abfd1dc7c18e4be89715071a524324c7b2515565
26 changes: 14 additions & 12 deletions trunk/drivers/isdn/gigaset/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ void gigaset_freecs(struct cardstate *cs)
if (!cs)
return;

down(&cs->sem);
mutex_lock(&cs->mutex);

if (!cs->bcs)
goto f_cs;
Expand Down Expand Up @@ -459,7 +459,7 @@ void gigaset_freecs(struct cardstate *cs)
f_bcs: gig_dbg(DEBUG_INIT, "freeing bcs[]");
kfree(cs->bcs);
f_cs: gig_dbg(DEBUG_INIT, "freeing cs");
up(&cs->sem);
mutex_unlock(&cs->mutex);
free_cs(cs);
}
EXPORT_SYMBOL_GPL(gigaset_freecs);
Expand Down Expand Up @@ -652,7 +652,9 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
spin_lock_init(&cs->ev_lock);
atomic_set(&cs->ev_tail, 0);
atomic_set(&cs->ev_head, 0);
init_MUTEX_LOCKED(&cs->sem);
mutex_init(&cs->mutex);
mutex_lock(&cs->mutex);

tasklet_init(&cs->event_tasklet, &gigaset_handle_event,
(unsigned long) cs);
atomic_set(&cs->commands_pending, 0);
Expand Down Expand Up @@ -729,11 +731,11 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
add_timer(&cs->timer);

gig_dbg(DEBUG_INIT, "cs initialized");
up(&cs->sem);
mutex_unlock(&cs->mutex);
return cs;

error: if (cs)
up(&cs->sem);
mutex_unlock(&cs->mutex);
gig_dbg(DEBUG_INIT, "failed");
gigaset_freecs(cs);
return NULL;
Expand Down Expand Up @@ -831,7 +833,7 @@ static void cleanup_cs(struct cardstate *cs)

int gigaset_start(struct cardstate *cs)
{
if (down_interruptible(&cs->sem))
if (mutex_lock_interruptible(&cs->mutex))
return 0;

atomic_set(&cs->connected, 1);
Expand Down Expand Up @@ -861,18 +863,18 @@ int gigaset_start(struct cardstate *cs)
/* set up device sysfs */
gigaset_init_dev_sysfs(cs);

up(&cs->sem);
mutex_unlock(&cs->mutex);
return 1;

error:
up(&cs->sem);
mutex_unlock(&cs->mutex);
return 0;
}
EXPORT_SYMBOL_GPL(gigaset_start);

void gigaset_shutdown(struct cardstate *cs)
{
down(&cs->sem);
mutex_lock(&cs->mutex);

cs->waiting = 1;

Expand Down Expand Up @@ -902,13 +904,13 @@ void gigaset_shutdown(struct cardstate *cs)
cleanup_cs(cs);

exit:
up(&cs->sem);
mutex_unlock(&cs->mutex);
}
EXPORT_SYMBOL_GPL(gigaset_shutdown);

void gigaset_stop(struct cardstate *cs)
{
down(&cs->sem);
mutex_lock(&cs->mutex);

/* clear device sysfs */
gigaset_free_dev_sysfs(cs);
Expand Down Expand Up @@ -936,7 +938,7 @@ void gigaset_stop(struct cardstate *cs)
cleanup_cs(cs);

exit:
up(&cs->sem);
mutex_unlock(&cs->mutex);
}
EXPORT_SYMBOL_GPL(gigaset_stop);

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/isdn/gigaset/gigaset.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ struct cardstate {
int cs_init;
int ignoreframes; /* frames to ignore after setting up the
B channel */
struct semaphore sem; /* locks this structure:
struct mutex mutex; /* locks this structure:
* connected is not changed,
* hardware_up is not changed,
* MState is not changed to or from
Expand Down
44 changes: 22 additions & 22 deletions trunk/drivers/isdn/gigaset/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static int if_open(struct tty_struct *tty, struct file *filp)
if (!cs)
return -ENODEV;

if (down_interruptible(&cs->sem))
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?
tty->driver_data = cs;

Expand All @@ -173,7 +173,7 @@ static int if_open(struct tty_struct *tty, struct file *filp)
tty->low_latency = 1; //FIXME test
}

up(&cs->sem);
mutex_unlock(&cs->mutex);
return 0;
}

Expand All @@ -190,7 +190,7 @@ static void if_close(struct tty_struct *tty, struct file *filp)

gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);

down(&cs->sem);
mutex_lock(&cs->mutex);

if (!cs->open_count)
warn("%s: device not opened", __func__);
Expand All @@ -202,7 +202,7 @@ static void if_close(struct tty_struct *tty, struct file *filp)
}
}

up(&cs->sem);
mutex_unlock(&cs->mutex);
}

static int if_ioctl(struct tty_struct *tty, struct file *file,
Expand All @@ -222,7 +222,7 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,

gig_dbg(DEBUG_IF, "%u: %s(0x%x)", cs->minor_index, __func__, cmd);

if (down_interruptible(&cs->sem))
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?

if (!cs->open_count)
Expand Down Expand Up @@ -279,7 +279,7 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
}
}

up(&cs->sem);
mutex_unlock(&cs->mutex);

return retval;
}
Expand All @@ -297,13 +297,13 @@ static int if_tiocmget(struct tty_struct *tty, struct file *file)

gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);

if (down_interruptible(&cs->sem))
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?

// FIXME read from device?
retval = cs->control_state & (TIOCM_RTS|TIOCM_DTR);

up(&cs->sem);
mutex_unlock(&cs->mutex);

return retval;
}
Expand All @@ -324,7 +324,7 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file,
gig_dbg(DEBUG_IF, "%u: %s(0x%x, 0x%x)",
cs->minor_index, __func__, set, clear);

if (down_interruptible(&cs->sem))
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?

if (!atomic_read(&cs->connected)) {
Expand All @@ -336,7 +336,7 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file,
cs->control_state = mc;
}

up(&cs->sem);
mutex_unlock(&cs->mutex);

return retval;
}
Expand All @@ -354,7 +354,7 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)

gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);

if (down_interruptible(&cs->sem))
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?

if (!cs->open_count)
Expand All @@ -370,7 +370,7 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)
&cs->if_wake_tasklet);
}

up(&cs->sem);
mutex_unlock(&cs->mutex);

return retval;
}
Expand All @@ -388,7 +388,7 @@ static int if_write_room(struct tty_struct *tty)

gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);

if (down_interruptible(&cs->sem))
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?

if (!cs->open_count)
Expand All @@ -402,7 +402,7 @@ static int if_write_room(struct tty_struct *tty)
} else
retval = cs->ops->write_room(cs);

up(&cs->sem);
mutex_unlock(&cs->mutex);

return retval;
}
Expand All @@ -420,7 +420,7 @@ static int if_chars_in_buffer(struct tty_struct *tty)

gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);

if (down_interruptible(&cs->sem))
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?

if (!cs->open_count)
Expand All @@ -434,7 +434,7 @@ static int if_chars_in_buffer(struct tty_struct *tty)
} else
retval = cs->ops->chars_in_buffer(cs);

up(&cs->sem);
mutex_unlock(&cs->mutex);

return retval;
}
Expand All @@ -451,15 +451,15 @@ static void if_throttle(struct tty_struct *tty)

gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);

down(&cs->sem);
mutex_lock(&cs->mutex);

if (!cs->open_count)
warn("%s: device not opened", __func__);
else {
//FIXME
}

up(&cs->sem);
mutex_unlock(&cs->mutex);
}

static void if_unthrottle(struct tty_struct *tty)
Expand All @@ -474,15 +474,15 @@ static void if_unthrottle(struct tty_struct *tty)

gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);

down(&cs->sem);
mutex_lock(&cs->mutex);

if (!cs->open_count)
warn("%s: device not opened", __func__);
else {
//FIXME
}

up(&cs->sem);
mutex_unlock(&cs->mutex);
}

static void if_set_termios(struct tty_struct *tty, struct termios *old)
Expand All @@ -501,7 +501,7 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)

gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);

down(&cs->sem);
mutex_lock(&cs->mutex);

if (!cs->open_count) {
warn("%s: device not opened", __func__);
Expand Down Expand Up @@ -586,7 +586,7 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
cs->control_state = control_state;

out:
up(&cs->sem);
mutex_unlock(&cs->mutex);
}


Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/isdn/gigaset/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr,
if (value < 0 || value > 1)
return -EINVAL;

if (down_interruptible(&cs->sem))
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?

cs->waiting = 1;
if (!gigaset_add_event(cs, &cs->at_state, EV_PROC_CIDMODE,
NULL, value, NULL)) {
cs->waiting = 0;
up(&cs->sem);
mutex_unlock(&cs->mutex);
return -ENOMEM;
}

Expand All @@ -53,7 +53,7 @@ static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr,

wait_event(cs->waitqueue, !cs->waiting);

up(&cs->sem);
mutex_unlock(&cs->mutex);

return count;
}
Expand Down

0 comments on commit 6585a63

Please sign in to comment.