Commit 650eec5e authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/home/rmk/linux-2.6-serial

parents 150a631f 7493a314
...@@ -2454,6 +2454,7 @@ static struct platform_driver serial8250_isa_driver = { ...@@ -2454,6 +2454,7 @@ static struct platform_driver serial8250_isa_driver = {
.resume = serial8250_resume, .resume = serial8250_resume,
.driver = { .driver = {
.name = "serial8250", .name = "serial8250",
.owner = THIS_MODULE,
}, },
}; };
...@@ -2594,21 +2595,30 @@ static int __init serial8250_init(void) ...@@ -2594,21 +2595,30 @@ static int __init serial8250_init(void)
if (ret) if (ret)
goto out; goto out;
serial8250_isa_devs = platform_device_register_simple("serial8250", ret = platform_driver_register(&serial8250_isa_driver);
PLAT8250_DEV_LEGACY, NULL, 0); if (ret)
if (IS_ERR(serial8250_isa_devs)) { goto unreg_uart_drv;
ret = PTR_ERR(serial8250_isa_devs);
goto unreg; serial8250_isa_devs = platform_device_alloc("serial8250",
PLAT8250_DEV_LEGACY);
if (!serial8250_isa_devs) {
ret = -ENOMEM;
goto unreg_plat_drv;
} }
ret = platform_device_add(serial8250_isa_devs);
if (ret)
goto put_dev;
serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev);
ret = platform_driver_register(&serial8250_isa_driver);
if (ret == 0)
goto out; goto out;
platform_device_unregister(serial8250_isa_devs); put_dev:
unreg: platform_device_put(serial8250_isa_devs);
unreg_plat_drv:
platform_driver_unregister(&serial8250_isa_driver);
unreg_uart_drv:
uart_unregister_driver(&serial8250_reg); uart_unregister_driver(&serial8250_reg);
out: out:
return ret; return ret;
......
...@@ -847,7 +847,7 @@ config SERIAL_M32R_SIO_CONSOLE ...@@ -847,7 +847,7 @@ config SERIAL_M32R_SIO_CONSOLE
config SERIAL_M32R_PLDSIO config SERIAL_M32R_PLDSIO
bool "M32R SIO I/F on a PLD" bool "M32R SIO I/F on a PLD"
depends on SERIAL_M32R_SIO=y && (PLAT_OPSPUT || PALT_USRV || PLAT_M32700UT) depends on SERIAL_M32R_SIO=y && (PLAT_OPSPUT || PLAT_USRV || PLAT_M32700UT)
default n default n
help help
Say Y here if you want to use the M32R serial controller Say Y here if you want to use the M32R serial controller
......
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
#include <asm/pmac_feature.h> #include <asm/pmac_feature.h>
#include <asm/dbdma.h> #include <asm/dbdma.h>
#include <asm/macio.h> #include <asm/macio.h>
#include <asm/semaphore.h>
#if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ #define SUPPORT_SYSRQ
...@@ -1593,7 +1592,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state) ...@@ -1593,7 +1592,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state)
state = pmz_uart_reg.state + uap->port.line; state = pmz_uart_reg.state + uap->port.line;
mutex_lock(&pmz_irq_mutex); mutex_lock(&pmz_irq_mutex);
down(&state->sem); mutex_lock(&state->mutex);
spin_lock_irqsave(&uap->port.lock, flags); spin_lock_irqsave(&uap->port.lock, flags);
...@@ -1624,7 +1623,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state) ...@@ -1624,7 +1623,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state)
/* Shut the chip down */ /* Shut the chip down */
pmz_set_scc_power(uap, 0); pmz_set_scc_power(uap, 0);
up(&state->sem); mutex_unlock(&state->mutex);
mutex_unlock(&pmz_irq_mutex); mutex_unlock(&pmz_irq_mutex);
pmz_debug("suspend, switching complete\n"); pmz_debug("suspend, switching complete\n");
...@@ -1653,7 +1652,7 @@ static int pmz_resume(struct macio_dev *mdev) ...@@ -1653,7 +1652,7 @@ static int pmz_resume(struct macio_dev *mdev)
state = pmz_uart_reg.state + uap->port.line; state = pmz_uart_reg.state + uap->port.line;
mutex_lock(&pmz_irq_mutex); mutex_lock(&pmz_irq_mutex);
down(&state->sem); mutex_lock(&state->mutex);
spin_lock_irqsave(&uap->port.lock, flags); spin_lock_irqsave(&uap->port.lock, flags);
if (!ZS_IS_OPEN(uap) && !ZS_IS_CONS(uap)) { if (!ZS_IS_OPEN(uap) && !ZS_IS_CONS(uap)) {
...@@ -1685,7 +1684,7 @@ static int pmz_resume(struct macio_dev *mdev) ...@@ -1685,7 +1684,7 @@ static int pmz_resume(struct macio_dev *mdev)
} }
bail: bail:
up(&state->sem); mutex_unlock(&state->mutex);
mutex_unlock(&pmz_irq_mutex); mutex_unlock(&pmz_irq_mutex);
/* Right now, we deal with delay by blocking here, I'll be /* Right now, we deal with delay by blocking here, I'll be
......
...@@ -638,7 +638,7 @@ static int uart_set_info(struct uart_state *state, ...@@ -638,7 +638,7 @@ static int uart_set_info(struct uart_state *state,
* module insertion/removal doesn't change anything * module insertion/removal doesn't change anything
* under us. * under us.
*/ */
down(&state->sem); mutex_lock(&state->mutex);
change_irq = new_serial.irq != port->irq; change_irq = new_serial.irq != port->irq;
...@@ -797,7 +797,7 @@ static int uart_set_info(struct uart_state *state, ...@@ -797,7 +797,7 @@ static int uart_set_info(struct uart_state *state,
} else } else
retval = uart_startup(state, 1); retval = uart_startup(state, 1);
exit: exit:
up(&state->sem); mutex_unlock(&state->mutex);
return retval; return retval;
} }
...@@ -834,7 +834,7 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file) ...@@ -834,7 +834,7 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file)
struct uart_port *port = state->port; struct uart_port *port = state->port;
int result = -EIO; int result = -EIO;
down(&state->sem); mutex_lock(&state->mutex);
if ((!file || !tty_hung_up_p(file)) && if ((!file || !tty_hung_up_p(file)) &&
!(tty->flags & (1 << TTY_IO_ERROR))) { !(tty->flags & (1 << TTY_IO_ERROR))) {
result = port->mctrl; result = port->mctrl;
...@@ -843,7 +843,7 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file) ...@@ -843,7 +843,7 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file)
result |= port->ops->get_mctrl(port); result |= port->ops->get_mctrl(port);
spin_unlock_irq(&port->lock); spin_unlock_irq(&port->lock);
} }
up(&state->sem); mutex_unlock(&state->mutex);
return result; return result;
} }
...@@ -856,13 +856,13 @@ uart_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -856,13 +856,13 @@ uart_tiocmset(struct tty_struct *tty, struct file *file,
struct uart_port *port = state->port; struct uart_port *port = state->port;
int ret = -EIO; int ret = -EIO;
down(&state->sem); mutex_lock(&state->mutex);
if ((!file || !tty_hung_up_p(file)) && if ((!file || !tty_hung_up_p(file)) &&
!(tty->flags & (1 << TTY_IO_ERROR))) { !(tty->flags & (1 << TTY_IO_ERROR))) {
uart_update_mctrl(port, set, clear); uart_update_mctrl(port, set, clear);
ret = 0; ret = 0;
} }
up(&state->sem); mutex_unlock(&state->mutex);
return ret; return ret;
} }
...@@ -873,12 +873,12 @@ static void uart_break_ctl(struct tty_struct *tty, int break_state) ...@@ -873,12 +873,12 @@ static void uart_break_ctl(struct tty_struct *tty, int break_state)
BUG_ON(!kernel_locked()); BUG_ON(!kernel_locked());
down(&state->sem); mutex_lock(&state->mutex);
if (port->type != PORT_UNKNOWN) if (port->type != PORT_UNKNOWN)
port->ops->break_ctl(port, break_state); port->ops->break_ctl(port, break_state);
up(&state->sem); mutex_unlock(&state->mutex);
} }
static int uart_do_autoconfig(struct uart_state *state) static int uart_do_autoconfig(struct uart_state *state)
...@@ -894,7 +894,7 @@ static int uart_do_autoconfig(struct uart_state *state) ...@@ -894,7 +894,7 @@ static int uart_do_autoconfig(struct uart_state *state)
* changing, and hence any extra opens of the port while * changing, and hence any extra opens of the port while
* we're auto-configuring. * we're auto-configuring.
*/ */
if (down_interruptible(&state->sem)) if (mutex_lock_interruptible(&state->mutex))
return -ERESTARTSYS; return -ERESTARTSYS;
ret = -EBUSY; ret = -EBUSY;
...@@ -920,7 +920,7 @@ static int uart_do_autoconfig(struct uart_state *state) ...@@ -920,7 +920,7 @@ static int uart_do_autoconfig(struct uart_state *state)
ret = uart_startup(state, 1); ret = uart_startup(state, 1);
} }
up(&state->sem); mutex_unlock(&state->mutex);
return ret; return ret;
} }
...@@ -1074,7 +1074,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, ...@@ -1074,7 +1074,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
if (ret != -ENOIOCTLCMD) if (ret != -ENOIOCTLCMD)
goto out; goto out;
down(&state->sem); mutex_lock(&state->mutex);
if (tty_hung_up_p(filp)) { if (tty_hung_up_p(filp)) {
ret = -EIO; ret = -EIO;
...@@ -1098,7 +1098,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, ...@@ -1098,7 +1098,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
} }
} }
out_up: out_up:
up(&state->sem); mutex_unlock(&state->mutex);
out: out:
return ret; return ret;
} }
...@@ -1186,7 +1186,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) ...@@ -1186,7 +1186,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
DPRINTK("uart_close(%d) called\n", port->line); DPRINTK("uart_close(%d) called\n", port->line);
down(&state->sem); mutex_lock(&state->mutex);
if (tty_hung_up_p(filp)) if (tty_hung_up_p(filp))
goto done; goto done;
...@@ -1260,7 +1260,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) ...@@ -1260,7 +1260,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
wake_up_interruptible(&state->info->open_wait); wake_up_interruptible(&state->info->open_wait);
done: done:
up(&state->sem); mutex_unlock(&state->mutex);
} }
static void uart_wait_until_sent(struct tty_struct *tty, int timeout) static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
...@@ -1334,7 +1334,7 @@ static void uart_hangup(struct tty_struct *tty) ...@@ -1334,7 +1334,7 @@ static void uart_hangup(struct tty_struct *tty)
BUG_ON(!kernel_locked()); BUG_ON(!kernel_locked());
DPRINTK("uart_hangup(%d)\n", state->port->line); DPRINTK("uart_hangup(%d)\n", state->port->line);
down(&state->sem); mutex_lock(&state->mutex);
if (state->info && state->info->flags & UIF_NORMAL_ACTIVE) { if (state->info && state->info->flags & UIF_NORMAL_ACTIVE) {
uart_flush_buffer(tty); uart_flush_buffer(tty);
uart_shutdown(state); uart_shutdown(state);
...@@ -1344,7 +1344,7 @@ static void uart_hangup(struct tty_struct *tty) ...@@ -1344,7 +1344,7 @@ static void uart_hangup(struct tty_struct *tty)
wake_up_interruptible(&state->info->open_wait); wake_up_interruptible(&state->info->open_wait);
wake_up_interruptible(&state->info->delta_msr_wait); wake_up_interruptible(&state->info->delta_msr_wait);
} }
up(&state->sem); mutex_unlock(&state->mutex);
} }
/* /*
...@@ -1447,9 +1447,9 @@ uart_block_til_ready(struct file *filp, struct uart_state *state) ...@@ -1447,9 +1447,9 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
if (mctrl & TIOCM_CAR) if (mctrl & TIOCM_CAR)
break; break;
up(&state->sem); mutex_unlock(&state->mutex);
schedule(); schedule();
down(&state->sem); mutex_lock(&state->mutex);
if (signal_pending(current)) if (signal_pending(current))
break; break;
...@@ -1475,7 +1475,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line) ...@@ -1475,7 +1475,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
mutex_lock(&port_mutex); mutex_lock(&port_mutex);
state = drv->state + line; state = drv->state + line;
if (down_interruptible(&state->sem)) { if (mutex_lock_interruptible(&state->mutex)) {
state = ERR_PTR(-ERESTARTSYS); state = ERR_PTR(-ERESTARTSYS);
goto out; goto out;
} }
...@@ -1483,7 +1483,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line) ...@@ -1483,7 +1483,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
state->count++; state->count++;
if (!state->port) { if (!state->port) {
state->count--; state->count--;
up(&state->sem); mutex_unlock(&state->mutex);
state = ERR_PTR(-ENXIO); state = ERR_PTR(-ENXIO);
goto out; goto out;
} }
...@@ -1504,7 +1504,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line) ...@@ -1504,7 +1504,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
(unsigned long)state); (unsigned long)state);
} else { } else {
state->count--; state->count--;
up(&state->sem); mutex_unlock(&state->mutex);
state = ERR_PTR(-ENOMEM); state = ERR_PTR(-ENOMEM);
} }
} }
...@@ -1571,7 +1571,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp) ...@@ -1571,7 +1571,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
if (tty_hung_up_p(filp)) { if (tty_hung_up_p(filp)) {
retval = -EAGAIN; retval = -EAGAIN;
state->count--; state->count--;
up(&state->sem); mutex_unlock(&state->mutex);
goto fail; goto fail;
} }
...@@ -1591,7 +1591,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp) ...@@ -1591,7 +1591,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
*/ */
if (retval == 0) if (retval == 0)
retval = uart_block_til_ready(filp, state); retval = uart_block_til_ready(filp, state);
up(&state->sem); mutex_unlock(&state->mutex);
/* /*
* If this is the first open to succeed, adjust things to suit. * If this is the first open to succeed, adjust things to suit.
...@@ -1867,7 +1867,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) ...@@ -1867,7 +1867,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
{ {
struct uart_state *state = drv->state + port->line; struct uart_state *state = drv->state + port->line;
down(&state->sem); mutex_lock(&state->mutex);
if (state->info && state->info->flags & UIF_INITIALIZED) { if (state->info && state->info->flags & UIF_INITIALIZED) {
struct uart_ops *ops = port->ops; struct uart_ops *ops = port->ops;
...@@ -1896,7 +1896,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) ...@@ -1896,7 +1896,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
uart_change_pm(state, 3); uart_change_pm(state, 3);
up(&state->sem); mutex_unlock(&state->mutex);
return 0; return 0;
} }
...@@ -1905,7 +1905,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) ...@@ -1905,7 +1905,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
{ {
struct uart_state *state = drv->state + port->line; struct uart_state *state = drv->state + port->line;
down(&state->sem); mutex_lock(&state->mutex);
uart_change_pm(state, 0); uart_change_pm(state, 0);
...@@ -1954,7 +1954,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) ...@@ -1954,7 +1954,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
} }
} }
up(&state->sem); mutex_unlock(&state->mutex);
return 0; return 0;
} }
...@@ -2049,7 +2049,7 @@ uart_unconfigure_port(struct uart_driver *drv, struct uart_state *state) ...@@ -2049,7 +2049,7 @@ uart_unconfigure_port(struct uart_driver *drv, struct uart_state *state)
if (info && info->tty) if (info && info->tty)
tty_vhangup(info->tty); tty_vhangup(info->tty);
down(&state->sem); mutex_lock(&state->mutex);
state->info = NULL; state->info = NULL;
...@@ -2072,7 +2072,7 @@ uart_unconfigure_port(struct uart_driver *drv, struct uart_state *state) ...@@ -2072,7 +2072,7 @@ uart_unconfigure_port(struct uart_driver *drv, struct uart_state *state)
kfree(info); kfree(info);
} }
up(&state->sem); mutex_unlock(&state->mutex);
} }
static struct tty_operations uart_ops = { static struct tty_operations uart_ops = {
...@@ -2161,7 +2161,7 @@ int uart_register_driver(struct uart_driver *drv) ...@@ -2161,7 +2161,7 @@ int uart_register_driver(struct uart_driver *drv)
state->close_delay = 500; /* .5 seconds */ state->close_delay = 500; /* .5 seconds */
state->closing_wait = 30000; /* 30 seconds */ state->closing_wait = 30000; /* 30 seconds */
init_MUTEX(&state->sem); mutex_init(&state->mutex);
} }
retval = tty_register_driver(normal); retval = tty_register_driver(normal);
......
...@@ -136,6 +136,7 @@ ...@@ -136,6 +136,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/mutex.h>
struct uart_port; struct uart_port;
struct uart_info; struct uart_info;
...@@ -284,7 +285,7 @@ struct uart_state { ...@@ -284,7 +285,7 @@ struct uart_state {
struct uart_info *info; struct uart_info *info;
struct uart_port *port; struct uart_port *port;
struct semaphore sem; struct mutex mutex;
}; };
#define UART_XMIT_SIZE PAGE_SIZE #define UART_XMIT_SIZE PAGE_SIZE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment