fwserial: switch to ->[sg]et_serial()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
617a281104
commit
b98e5a6791
|
@ -1209,42 +1209,40 @@ static int wait_msr_change(struct fwtty_port *port, unsigned long mask)
|
||||||
check_msr_delta(port, mask, &prev));
|
check_msr_delta(port, mask, &prev));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_serial_info(struct fwtty_port *port,
|
static int get_serial_info(struct tty_struct *tty,
|
||||||
struct serial_struct __user *info)
|
struct serial_struct *ss)
|
||||||
{
|
{
|
||||||
struct serial_struct tmp;
|
struct fwtty_port *port = tty->driver_data;
|
||||||
|
mutex_lock(&port->port.mutex);
|
||||||
memset(&tmp, 0, sizeof(tmp));
|
ss->type = PORT_UNKNOWN;
|
||||||
|
ss->line = port->port.tty->index;
|
||||||
tmp.type = PORT_UNKNOWN;
|
ss->flags = port->port.flags;
|
||||||
tmp.line = port->port.tty->index;
|
ss->xmit_fifo_size = FWTTY_PORT_TXFIFO_LEN;
|
||||||
tmp.flags = port->port.flags;
|
ss->baud_base = 400000000;
|
||||||
tmp.xmit_fifo_size = FWTTY_PORT_TXFIFO_LEN;
|
ss->close_delay = port->port.close_delay;
|
||||||
tmp.baud_base = 400000000;
|
mutex_unlock(&port->port.mutex);
|
||||||
tmp.close_delay = port->port.close_delay;
|
return 0;
|
||||||
|
|
||||||
return (copy_to_user(info, &tmp, sizeof(*info))) ? -EFAULT : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_serial_info(struct fwtty_port *port,
|
static int set_serial_info(struct tty_struct *tty,
|
||||||
struct serial_struct __user *info)
|
struct serial_struct *ss)
|
||||||
{
|
{
|
||||||
struct serial_struct tmp;
|
struct fwtty_port *port = tty->driver_data;
|
||||||
|
|
||||||
if (copy_from_user(&tmp, info, sizeof(tmp)))
|
if (ss->irq != 0 || ss->port != 0 || ss->custom_divisor != 0 ||
|
||||||
return -EFAULT;
|
ss->baud_base != 400000000)
|
||||||
|
|
||||||
if (tmp.irq != 0 || tmp.port != 0 || tmp.custom_divisor != 0 ||
|
|
||||||
tmp.baud_base != 400000000)
|
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
|
mutex_lock(&port->port.mutex);
|
||||||
if (!capable(CAP_SYS_ADMIN)) {
|
if (!capable(CAP_SYS_ADMIN)) {
|
||||||
if (((tmp.flags & ~ASYNC_USR_MASK) !=
|
if (((ss->flags & ~ASYNC_USR_MASK) !=
|
||||||
(port->port.flags & ~ASYNC_USR_MASK)))
|
(port->port.flags & ~ASYNC_USR_MASK))) {
|
||||||
|
mutex_unlock(&port->port.mutex);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
} else {
|
|
||||||
port->port.close_delay = tmp.close_delay * HZ / 100;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
port->port.close_delay = ss->close_delay * HZ / 100;
|
||||||
|
mutex_unlock(&port->port.mutex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1256,18 +1254,6 @@ static int fwtty_ioctl(struct tty_struct *tty, unsigned int cmd,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case TIOCGSERIAL:
|
|
||||||
mutex_lock(&port->port.mutex);
|
|
||||||
err = get_serial_info(port, (void __user *)arg);
|
|
||||||
mutex_unlock(&port->port.mutex);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TIOCSSERIAL:
|
|
||||||
mutex_lock(&port->port.mutex);
|
|
||||||
err = set_serial_info(port, (void __user *)arg);
|
|
||||||
mutex_unlock(&port->port.mutex);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TIOCMIWAIT:
|
case TIOCMIWAIT:
|
||||||
err = wait_msr_change(port, arg);
|
err = wait_msr_change(port, arg);
|
||||||
break;
|
break;
|
||||||
|
@ -1557,6 +1543,8 @@ static const struct tty_operations fwtty_ops = {
|
||||||
.tiocmget = fwtty_tiocmget,
|
.tiocmget = fwtty_tiocmget,
|
||||||
.tiocmset = fwtty_tiocmset,
|
.tiocmset = fwtty_tiocmset,
|
||||||
.get_icount = fwtty_get_icount,
|
.get_icount = fwtty_get_icount,
|
||||||
|
.set_serial = set_serial_info,
|
||||||
|
.get_serial = get_serial_info,
|
||||||
.proc_show = fwtty_proc_show,
|
.proc_show = fwtty_proc_show,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1578,6 +1566,8 @@ static const struct tty_operations fwloop_ops = {
|
||||||
.tiocmget = fwtty_tiocmget,
|
.tiocmget = fwtty_tiocmget,
|
||||||
.tiocmset = fwtty_tiocmset,
|
.tiocmset = fwtty_tiocmset,
|
||||||
.get_icount = fwtty_get_icount,
|
.get_icount = fwtty_get_icount,
|
||||||
|
.set_serial = set_serial_info,
|
||||||
|
.get_serial = get_serial_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline int mgmt_pkt_expected_len(__be16 code)
|
static inline int mgmt_pkt_expected_len(__be16 code)
|
||||||
|
|
Loading…
Reference in New Issue