Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88d35cff authored by Peter Hung's avatar Peter Hung Committed by Johan Hovold
Browse files

USB: f81232: clarify f81232_ioctl() and fix



We extract TIOCGSERIAL section in f81232_ioctl() to f81232_get_serial_info()
to make it clarify.

Also we fix device type from 16654 to 16550A, and set it's baud_base
to 115200 (1.8432MHz/16).

Signed-off-by: default avatarPeter Hung <hpeter+linux_kernel@gmail.com>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 8bb4ca6b
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -600,24 +600,32 @@ static int f81232_carrier_raised(struct usb_serial_port *port)
	return 0;
}

static int f81232_ioctl(struct tty_struct *tty,
			unsigned int cmd, unsigned long arg)
static int f81232_get_serial_info(struct usb_serial_port *port,
		unsigned long arg)
{
	struct serial_struct ser;
	struct usb_serial_port *port = tty->driver_data;

	switch (cmd) {
	case TIOCGSERIAL:
		memset(&ser, 0, sizeof ser);
		ser.type = PORT_16654;
	memset(&ser, 0, sizeof(ser));

	ser.type = PORT_16550A;
	ser.line = port->minor;
	ser.port = port->port_number;
		ser.baud_base = 460800;
	ser.baud_base = F81232_MAX_BAUDRATE;

		if (copy_to_user((void __user *)arg, &ser, sizeof ser))
	if (copy_to_user((void __user *)arg, &ser, sizeof(ser)))
		return -EFAULT;

	return 0;
}

static int f81232_ioctl(struct tty_struct *tty,
			unsigned int cmd, unsigned long arg)
{
	struct usb_serial_port *port = tty->driver_data;

	switch (cmd) {
	case TIOCGSERIAL:
		return f81232_get_serial_info(port, arg);
	default:
		break;
	}