Commit 77ad1af8 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.5-serial

into home.transmeta.com:/home/torvalds/v2.5/linux
parents e4a874f0 3bbb0896
...@@ -1683,6 +1683,55 @@ static int send_break(struct tty_struct *tty, int duration) ...@@ -1683,6 +1683,55 @@ static int send_break(struct tty_struct *tty, int duration)
return 0; return 0;
} }
static int
tty_tiocmget(struct tty_struct *tty, struct file *file, unsigned long arg)
{
int retval = -EINVAL;
if (tty->driver.tiocmget) {
retval = tty->driver.tiocmget(tty, file);
if (retval >= 0)
retval = put_user(retval, (int *)arg);
}
return retval;
}
static int
tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd,
unsigned long arg)
{
int retval = -EINVAL;
if (tty->driver.tiocmset) {
unsigned int set, clear, val;
retval = get_user(val, (unsigned int *)arg);
if (retval)
return retval;
set = clear = 0;
switch (cmd) {
case TIOCMBIS:
set = val;
break;
case TIOCMBIC:
clear = val;
break;
case TIOCMSET:
set = val;
clear = ~val;
break;
}
set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2;
clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2;
retval = tty->driver.tiocmset(tty, file, set, clear);
}
return retval;
}
/* /*
* Split this up, as gcc can choke on it otherwise.. * Split this up, as gcc can choke on it otherwise..
*/ */
...@@ -1808,6 +1857,14 @@ int tty_ioctl(struct inode * inode, struct file * file, ...@@ -1808,6 +1857,14 @@ int tty_ioctl(struct inode * inode, struct file * file,
return 0; return 0;
case TCSBRKP: /* support for POSIX tcsendbreak() */ case TCSBRKP: /* support for POSIX tcsendbreak() */
return send_break(tty, arg ? arg*(HZ/10) : HZ/4); return send_break(tty, arg ? arg*(HZ/10) : HZ/4);
case TIOCMGET:
return tty_tiocmget(tty, file, arg);
case TIOCMSET:
case TIOCMBIC:
case TIOCMBIS:
return tty_tiocmset(tty, file, cmd, arg);
} }
if (tty->driver.ioctl) { if (tty->driver.ioctl) {
int retval = (tty->driver.ioctl)(tty, file, cmd, arg); int retval = (tty->driver.ioctl)(tty, file, cmd, arg);
......
...@@ -180,32 +180,29 @@ static int irtty_change_speed(struct sir_dev *dev, unsigned speed) ...@@ -180,32 +180,29 @@ static int irtty_change_speed(struct sir_dev *dev, unsigned speed)
static int irtty_set_dtr_rts(struct sir_dev *dev, int dtr, int rts) static int irtty_set_dtr_rts(struct sir_dev *dev, int dtr, int rts)
{ {
struct sirtty_cb *priv = dev->priv; struct sirtty_cb *priv = dev->priv;
int arg = 0; int set = 0;
int clear = 0;
ASSERT(priv != NULL, return -1;); ASSERT(priv != NULL, return -1;);
ASSERT(priv->magic == IRTTY_MAGIC, return -1;); ASSERT(priv->magic == IRTTY_MAGIC, return -1;);
#ifdef TIOCM_OUT2 /* Not defined for ARM */
arg = TIOCM_OUT2;
#endif
if (rts) if (rts)
arg |= TIOCM_RTS; set |= TIOCM_RTS;
else
clear |= TIOCM_RTS;
if (dtr) if (dtr)
arg |= TIOCM_DTR; set |= TIOCM_DTR;
else
clear |= TIOCM_DTR;
/* /*
* The ioctl() function, or actually set_modem_info() in serial.c * We can't use ioctl() because it expects a non-null file structure,
* expects a pointer to the argument in user space. This is working * and we don't have that here.
* here because we are always called from the kIrDAd thread which * This function is not yet defined for all tty driver, so
* has set_fs(KERNEL_DS) permanently set. Therefore copy_from_user() * let's be careful... Jean II
* is happy with our arg-parameter being local here in kernel space.
*/ */
ASSERT(priv->tty->driver.tiocmset != NULL, return -1;);
lock_kernel(); priv->tty->driver.tiocmset(priv->tty, NULL, set, clear);
if (priv->tty->driver.ioctl(priv->tty, NULL, TIOCMSET, (unsigned long) &arg)) {
IRDA_DEBUG(2, "%s(), error doing ioctl!\n", __FUNCTION__);
}
unlock_kernel();
return 0; return 0;
} }
......
...@@ -1691,9 +1691,10 @@ static struct console m68328_driver = { ...@@ -1691,9 +1691,10 @@ static struct console m68328_driver = {
}; };
static void __init m68328_console_init(void) static int __init m68328_console_init(void)
{ {
register_console(&m68328_driver); register_console(&m68328_driver);
return 0;
} }
console_initcall(m68328_console_init); console_initcall(m68328_console_init);
...@@ -1808,13 +1808,6 @@ static struct pci_device_id serial_pci_tbl[] __devinitdata = { ...@@ -1808,13 +1808,6 @@ static struct pci_device_id serial_pci_tbl[] __devinitdata = {
PCI_ANY_ID, PCI_ANY_ID, 0, 0, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
pbn_b1_1_115200 }, pbn_b1_1_115200 },
/*
* 3Com US Robotics 56k Voice Internal PCI model 5610
*/
{ PCI_VENDOR_ID_USR, 0x1008,
PCI_ANY_ID, PCI_ANY_ID, 0, 0,
pbn_b0_1_115200 },
/* /*
* Titan Electronic cards * Titan Electronic cards
* The 400L and 800L have a custom setup quirk. * The 400L and 800L have a custom setup quirk.
......
...@@ -705,9 +705,10 @@ static struct console amba_console = { ...@@ -705,9 +705,10 @@ static struct console amba_console = {
.index = -1, .index = -1,
}; };
static void __init ambauart_console_init(void) static int __init ambauart_console_init(void)
{ {
register_console(&amba_console); register_console(&amba_console);
return 0;
} }
console_initcall(ambauart_console_init); console_initcall(ambauart_console_init);
......
...@@ -502,10 +502,10 @@ static struct console anakin_console = { ...@@ -502,10 +502,10 @@ static struct console anakin_console = {
.index = -1, .index = -1,
}; };
static void __init static int __init anakin_console_init(void)
anakin_console_init(void)
{ {
register_console(&anakin_console); register_console(&anakin_console);
return 0;
} }
console_initcall(anakin_console_init); console_initcall(anakin_console_init);
......
...@@ -567,9 +567,10 @@ static struct console clps711x_console = { ...@@ -567,9 +567,10 @@ static struct console clps711x_console = {
.index = -1, .index = -1,
}; };
static void __init clps711xuart_console_init(void) static int __init clps711xuart_console_init(void)
{ {
register_console(&clps711x_console); register_console(&clps711x_console);
return 0;
} }
console_initcall(clps711xuart_console_init); console_initcall(clps711xuart_console_init);
......
...@@ -873,45 +873,38 @@ static int uart_get_lsr_info(struct uart_state *state, unsigned int *value) ...@@ -873,45 +873,38 @@ static int uart_get_lsr_info(struct uart_state *state, unsigned int *value)
return put_user(result, value); return put_user(result, value);
} }
static int uart_get_modem_info(struct uart_port *port, unsigned int *value) static int uart_tiocmget(struct tty_struct *tty, struct file *file)
{ {
unsigned int result = port->mctrl; struct uart_state *state = tty->driver_data;
struct uart_port *port = state->port;
int result = -EIO;
down(&state->sem);
if ((!file || !tty_hung_up_p(file)) &&
!(tty->flags & (1 << TTY_IO_ERROR))) {
result = port->mctrl;
result |= port->ops->get_mctrl(port); result |= port->ops->get_mctrl(port);
}
up(&state->sem);
return put_user(result, value); return result;
} }
static int static int
uart_set_modem_info(struct uart_port *port, unsigned int cmd, uart_tiocmset(struct tty_struct *tty, struct file *file,
unsigned int *value) unsigned int set, unsigned int clear)
{ {
unsigned int arg, set, clear; struct uart_state *state = tty->driver_data;
int ret = 0; struct uart_port *port = state->port;
int ret = -EIO;
if (get_user(arg, value))
return -EFAULT;
arg &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2;
set = clear = 0; down(&state->sem);
switch (cmd) { if ((!file || !tty_hung_up_p(file)) &&
case TIOCMBIS: !(tty->flags & (1 << TTY_IO_ERROR))) {
set = arg;
break;
case TIOCMBIC:
clear = arg;
break;
case TIOCMSET:
set = arg;
clear = ~arg;
break;
default:
ret = -EINVAL;
break;
}
if (ret == 0)
uart_update_mctrl(port, set, clear); uart_update_mctrl(port, set, clear);
ret = 0;
}
up(&state->sem);
return ret; return ret;
} }
...@@ -922,8 +915,12 @@ static void uart_break_ctl(struct tty_struct *tty, int break_state) ...@@ -922,8 +915,12 @@ static void uart_break_ctl(struct tty_struct *tty, int break_state)
BUG_ON(!kernel_locked()); BUG_ON(!kernel_locked());
down(&state->sem);
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);
} }
static int uart_do_autoconfig(struct uart_state *state) static int uart_do_autoconfig(struct uart_state *state)
...@@ -1130,17 +1127,6 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, ...@@ -1130,17 +1127,6 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
* protected against the tty being hung up. * protected against the tty being hung up.
*/ */
switch (cmd) { switch (cmd) {
case TIOCMGET:
ret = uart_get_modem_info(state->port, (unsigned int *)arg);
break;
case TIOCMBIS:
case TIOCMBIC:
case TIOCMSET:
ret = uart_set_modem_info(state->port, cmd,
(unsigned int *)arg);
break;
case TIOCSERGETLSR: /* Get line status register */ case TIOCSERGETLSR: /* Get line status register */
ret = uart_get_lsr_info(state, (unsigned int *)arg); ret = uart_get_lsr_info(state, (unsigned int *)arg);
break; break;
...@@ -2162,6 +2148,8 @@ int uart_register_driver(struct uart_driver *drv) ...@@ -2162,6 +2148,8 @@ int uart_register_driver(struct uart_driver *drv)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
normal->read_proc = uart_read_proc; normal->read_proc = uart_read_proc;
#endif #endif
normal->tiocmget = uart_tiocmget;
normal->tiocmset = uart_tiocmset;
/* /*
* Initialise the UART state(s). * Initialise the UART state(s).
......
...@@ -1853,9 +1853,10 @@ struct console mcfrs_console = { ...@@ -1853,9 +1853,10 @@ struct console mcfrs_console = {
.index = -1, .index = -1,
}; };
static void __init mcfrs_console_init(void) static int __init mcfrs_console_init(void)
{ {
register_console(&mcfrs_console); register_console(&mcfrs_console);
return 0;
} }
console_initcall(mcfrs_console_init); console_initcall(mcfrs_console_init);
......
...@@ -836,10 +836,11 @@ static struct console sa1100_console = { ...@@ -836,10 +836,11 @@ static struct console sa1100_console = {
.index = -1, .index = -1,
}; };
static void __init sa1100_rs_console_init(void) static int __init sa1100_rs_console_init(void)
{ {
sa1100_init_ports(); sa1100_init_ports();
register_console(&sa1100_console); register_console(&sa1100_console);
return 0;
} }
console_initcall(sa1100_rs_console_init); console_initcall(sa1100_rs_console_init);
......
...@@ -645,9 +645,10 @@ static struct console uart00_console = { ...@@ -645,9 +645,10 @@ static struct console uart00_console = {
.index = 0, .index = 0,
}; };
static void __init uart00_console_init(void) static int __init uart00_console_init(void)
{ {
register_console(&uart00_console); register_console(&uart00_console);
return 0;
} }
console_initcall(uart00_console_init); console_initcall(uart00_console_init);
......
...@@ -172,6 +172,9 @@ struct tty_driver { ...@@ -172,6 +172,9 @@ struct tty_driver {
int count, int *eof, void *data); int count, int *eof, void *data);
int (*write_proc)(struct file *file, const char *buffer, int (*write_proc)(struct file *file, const char *buffer,
unsigned long count, void *data); unsigned long count, void *data);
int (*tiocmget)(struct tty_struct *tty, struct file *file);
int (*tiocmset)(struct tty_struct *tty, struct file *file,
unsigned int set, unsigned int clear);
struct list_head tty_drivers; struct list_head tty_drivers;
}; };
......
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