isicom: switch to ->[sg]et_serial()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
a7b06fcf2e
commit
b60f38c664
|
@ -1091,34 +1091,33 @@ static int isicom_tiocmset(struct tty_struct *tty,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int isicom_set_serial_info(struct tty_struct *tty,
|
static int isicom_set_serial_info(struct tty_struct *tty,
|
||||||
struct serial_struct __user *info)
|
struct serial_struct *ss)
|
||||||
{
|
{
|
||||||
struct isi_port *port = tty->driver_data;
|
struct isi_port *port = tty->driver_data;
|
||||||
struct serial_struct newinfo;
|
|
||||||
int reconfig_port;
|
int reconfig_port;
|
||||||
|
|
||||||
if (copy_from_user(&newinfo, info, sizeof(newinfo)))
|
if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
|
||||||
return -EFAULT;
|
return -ENODEV;
|
||||||
|
|
||||||
mutex_lock(&port->port.mutex);
|
mutex_lock(&port->port.mutex);
|
||||||
reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) !=
|
reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) !=
|
||||||
(newinfo.flags & ASYNC_SPD_MASK));
|
(ss->flags & ASYNC_SPD_MASK));
|
||||||
|
|
||||||
if (!capable(CAP_SYS_ADMIN)) {
|
if (!capable(CAP_SYS_ADMIN)) {
|
||||||
if ((newinfo.close_delay != port->port.close_delay) ||
|
if ((ss->close_delay != port->port.close_delay) ||
|
||||||
(newinfo.closing_wait != port->port.closing_wait) ||
|
(ss->closing_wait != port->port.closing_wait) ||
|
||||||
((newinfo.flags & ~ASYNC_USR_MASK) !=
|
((ss->flags & ~ASYNC_USR_MASK) !=
|
||||||
(port->port.flags & ~ASYNC_USR_MASK))) {
|
(port->port.flags & ~ASYNC_USR_MASK))) {
|
||||||
mutex_unlock(&port->port.mutex);
|
mutex_unlock(&port->port.mutex);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
|
port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
|
||||||
(newinfo.flags & ASYNC_USR_MASK));
|
(ss->flags & ASYNC_USR_MASK));
|
||||||
} else {
|
} else {
|
||||||
port->port.close_delay = newinfo.close_delay;
|
port->port.close_delay = ss->close_delay;
|
||||||
port->port.closing_wait = newinfo.closing_wait;
|
port->port.closing_wait = ss->closing_wait;
|
||||||
port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
|
port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
|
||||||
(newinfo.flags & ASYNC_FLAGS));
|
(ss->flags & ASYNC_FLAGS));
|
||||||
}
|
}
|
||||||
if (reconfig_port) {
|
if (reconfig_port) {
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
@ -1130,46 +1129,24 @@ static int isicom_set_serial_info(struct tty_struct *tty,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int isicom_get_serial_info(struct isi_port *port,
|
static int isicom_get_serial_info(struct tty_struct *tty,
|
||||||
struct serial_struct __user *info)
|
struct serial_struct *ss)
|
||||||
{
|
|
||||||
struct serial_struct out_info;
|
|
||||||
|
|
||||||
mutex_lock(&port->port.mutex);
|
|
||||||
memset(&out_info, 0, sizeof(out_info));
|
|
||||||
/* out_info.type = ? */
|
|
||||||
out_info.line = port - isi_ports;
|
|
||||||
out_info.port = port->card->base;
|
|
||||||
out_info.irq = port->card->irq;
|
|
||||||
out_info.flags = port->port.flags;
|
|
||||||
/* out_info.baud_base = ? */
|
|
||||||
out_info.close_delay = port->port.close_delay;
|
|
||||||
out_info.closing_wait = port->port.closing_wait;
|
|
||||||
mutex_unlock(&port->port.mutex);
|
|
||||||
if (copy_to_user(info, &out_info, sizeof(out_info)))
|
|
||||||
return -EFAULT;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int isicom_ioctl(struct tty_struct *tty,
|
|
||||||
unsigned int cmd, unsigned long arg)
|
|
||||||
{
|
{
|
||||||
struct isi_port *port = tty->driver_data;
|
struct isi_port *port = tty->driver_data;
|
||||||
void __user *argp = (void __user *)arg;
|
|
||||||
|
|
||||||
if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
|
if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
switch (cmd) {
|
mutex_lock(&port->port.mutex);
|
||||||
case TIOCGSERIAL:
|
/* ss->type = ? */
|
||||||
return isicom_get_serial_info(port, argp);
|
ss->line = port - isi_ports;
|
||||||
|
ss->port = port->card->base;
|
||||||
case TIOCSSERIAL:
|
ss->irq = port->card->irq;
|
||||||
return isicom_set_serial_info(tty, argp);
|
ss->flags = port->port.flags;
|
||||||
|
/* ss->baud_base = ? */
|
||||||
default:
|
ss->close_delay = port->port.close_delay;
|
||||||
return -ENOIOCTLCMD;
|
ss->closing_wait = port->port.closing_wait;
|
||||||
}
|
mutex_unlock(&port->port.mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1273,7 +1250,6 @@ static const struct tty_operations isicom_ops = {
|
||||||
.flush_chars = isicom_flush_chars,
|
.flush_chars = isicom_flush_chars,
|
||||||
.write_room = isicom_write_room,
|
.write_room = isicom_write_room,
|
||||||
.chars_in_buffer = isicom_chars_in_buffer,
|
.chars_in_buffer = isicom_chars_in_buffer,
|
||||||
.ioctl = isicom_ioctl,
|
|
||||||
.set_termios = isicom_set_termios,
|
.set_termios = isicom_set_termios,
|
||||||
.throttle = isicom_throttle,
|
.throttle = isicom_throttle,
|
||||||
.unthrottle = isicom_unthrottle,
|
.unthrottle = isicom_unthrottle,
|
||||||
|
@ -1284,6 +1260,8 @@ static const struct tty_operations isicom_ops = {
|
||||||
.tiocmget = isicom_tiocmget,
|
.tiocmget = isicom_tiocmget,
|
||||||
.tiocmset = isicom_tiocmset,
|
.tiocmset = isicom_tiocmset,
|
||||||
.break_ctl = isicom_send_break,
|
.break_ctl = isicom_send_break,
|
||||||
|
.get_serial = isicom_get_serial_info,
|
||||||
|
.set_serial = isicom_set_serial_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct tty_port_operations isicom_port_ops = {
|
static const struct tty_port_operations isicom_port_ops = {
|
||||||
|
|
Loading…
Reference in a new issue