Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23064
b: refs/heads/master
c: 81861d7
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Mar 23, 2006
1 parent 8127d4f commit 9fb9138
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 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: 1e7933defd0fce79b2d8ecdbc7ca37fed0c188ed
refs/heads/master: 81861d78c9edf9a9b03a9ba1f5b242d658f16832
14 changes: 7 additions & 7 deletions trunk/drivers/char/generic_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ static int gs_debug;
#define NEW_WRITE_LOCKING 1
#if NEW_WRITE_LOCKING
#define DECL /* Nothing */
#define LOCKIT down (& port->port_write_sem);
#define RELEASEIT up (&port->port_write_sem);
#define LOCKIT mutex_lock(& port->port_write_mutex);
#define RELEASEIT mutex_unlock(&port->port_write_mutex);
#else
#define DECL unsigned long flags;
#define LOCKIT save_flags (flags);cli ()
Expand Down Expand Up @@ -124,14 +124,14 @@ int gs_write(struct tty_struct * tty,
/* get exclusive "write" access to this port (problem 3) */
/* This is not a spinlock because we can have a disk access (page
fault) in copy_from_user */
down (& port->port_write_sem);
mutex_lock(& port->port_write_mutex);

while (1) {

c = count;

/* This is safe because we "OWN" the "head". Noone else can
change the "head": we own the port_write_sem. */
change the "head": we own the port_write_mutex. */
/* Don't overrun the end of the buffer */
t = SERIAL_XMIT_SIZE - port->xmit_head;
if (t < c) c = t;
Expand All @@ -153,7 +153,7 @@ int gs_write(struct tty_struct * tty,
count -= c;
total += c;
}
up (& port->port_write_sem);
mutex_unlock(& port->port_write_mutex);

gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n",
(port->flags & GS_TX_INTEN)?"enabled": "disabled");
Expand Down Expand Up @@ -214,7 +214,7 @@ int gs_write(struct tty_struct * tty,
c = count;

/* This is safe because we "OWN" the "head". Noone else can
change the "head": we own the port_write_sem. */
change the "head": we own the port_write_mutex. */
/* Don't overrun the end of the buffer */
t = SERIAL_XMIT_SIZE - port->xmit_head;
if (t < c) c = t;
Expand Down Expand Up @@ -888,7 +888,7 @@ int gs_init_port(struct gs_port *port)
spin_lock_irqsave (&port->driver_lock, flags);
if (port->tty)
clear_bit(TTY_IO_ERROR, &port->tty->flags);
init_MUTEX(&port->port_write_sem);
mutex_init(&port->port_write_mutex);
port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
spin_unlock_irqrestore(&port->driver_lock, flags);
gs_set_termios(port->tty, NULL);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/char/ser_a2232.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
#include <asm/amigahw.h>
#include <linux/zorro.h>
#include <asm/irq.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>

#include <linux/delay.h>

Expand Down Expand Up @@ -654,7 +654,7 @@ static void a2232_init_portstructs(void)
port->gs.closing_wait = 30 * HZ;
port->gs.rd = &a2232_real_driver;
#ifdef NEW_WRITE_LOCKING
init_MUTEX(&(port->gs.port_write_sem));
init_MUTEX(&(port->gs.port_write_mutex));
#endif
init_waitqueue_head(&port->gs.open_wait);
init_waitqueue_head(&port->gs.close_wait);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/char/sx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2318,7 +2318,7 @@ static int sx_init_portstructs (int nboards, int nports)
port->board = board;
port->gs.rd = &sx_real_driver;
#ifdef NEW_WRITE_LOCKING
port->gs.port_write_sem = MUTEX;
port->gs.port_write_mutex = MUTEX;
#endif
port->gs.driver_lock = SPIN_LOCK_UNLOCKED;
/*
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/char/vme_scc.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static void scc_init_portstructs(void)
port->gs.closing_wait = 30 * HZ;
port->gs.rd = &scc_real_driver;
#ifdef NEW_WRITE_LOCKING
port->gs.port_write_sem = MUTEX;
port->gs.port_write_mutex = MUTEX;
#endif
init_waitqueue_head(&port->gs.open_wait);
init_waitqueue_head(&port->gs.close_wait);
Expand Down
4 changes: 3 additions & 1 deletion trunk/include/linux/generic_serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#ifndef GENERIC_SERIAL_H
#define GENERIC_SERIAL_H

#include <linux/mutex.h>

struct real_driver {
void (*disable_tx_interrupts) (void *);
void (*enable_tx_interrupts) (void *);
Expand All @@ -34,7 +36,7 @@ struct gs_port {
int xmit_head;
int xmit_tail;
int xmit_cnt;
struct semaphore port_write_sem;
struct mutex port_write_mutex;
int flags;
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
Expand Down

0 comments on commit 9fb9138

Please sign in to comment.