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

Commit 493516e3 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

USB: cypress_m8: replace custom ioctl operation with tiocmiwait



Replace custom ioctl operation with tiocmiwait.

Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3f550431
Loading
Loading
Loading
Loading
+36 −49
Original line number Original line Diff line number Diff line
@@ -129,13 +129,12 @@ static int cypress_write(struct tty_struct *tty, struct usb_serial_port *port,
			const unsigned char *buf, int count);
			const unsigned char *buf, int count);
static void cypress_send(struct usb_serial_port *port);
static void cypress_send(struct usb_serial_port *port);
static int  cypress_write_room(struct tty_struct *tty);
static int  cypress_write_room(struct tty_struct *tty);
static int  cypress_ioctl(struct tty_struct *tty,
			unsigned int cmd, unsigned long arg);
static void cypress_set_termios(struct tty_struct *tty,
static void cypress_set_termios(struct tty_struct *tty,
			struct usb_serial_port *port, struct ktermios *old);
			struct usb_serial_port *port, struct ktermios *old);
static int  cypress_tiocmget(struct tty_struct *tty);
static int  cypress_tiocmget(struct tty_struct *tty);
static int  cypress_tiocmset(struct tty_struct *tty,
static int  cypress_tiocmset(struct tty_struct *tty,
			unsigned int set, unsigned int clear);
			unsigned int set, unsigned int clear);
static int  cypress_tiocmiwait(struct tty_struct *tty, unsigned long arg);
static int  cypress_chars_in_buffer(struct tty_struct *tty);
static int  cypress_chars_in_buffer(struct tty_struct *tty);
static void cypress_throttle(struct tty_struct *tty);
static void cypress_throttle(struct tty_struct *tty);
static void cypress_unthrottle(struct tty_struct *tty);
static void cypress_unthrottle(struct tty_struct *tty);
@@ -158,10 +157,10 @@ static struct usb_serial_driver cypress_earthmate_device = {
	.dtr_rts =			cypress_dtr_rts,
	.dtr_rts =			cypress_dtr_rts,
	.write =			cypress_write,
	.write =			cypress_write,
	.write_room =			cypress_write_room,
	.write_room =			cypress_write_room,
	.ioctl =			cypress_ioctl,
	.set_termios =			cypress_set_termios,
	.set_termios =			cypress_set_termios,
	.tiocmget =			cypress_tiocmget,
	.tiocmget =			cypress_tiocmget,
	.tiocmset =			cypress_tiocmset,
	.tiocmset =			cypress_tiocmset,
	.tiocmiwait =			cypress_tiocmiwait,
	.chars_in_buffer =		cypress_chars_in_buffer,
	.chars_in_buffer =		cypress_chars_in_buffer,
	.throttle =		 	cypress_throttle,
	.throttle =		 	cypress_throttle,
	.unthrottle =			cypress_unthrottle,
	.unthrottle =			cypress_unthrottle,
@@ -184,10 +183,10 @@ static struct usb_serial_driver cypress_hidcom_device = {
	.dtr_rts =			cypress_dtr_rts,
	.dtr_rts =			cypress_dtr_rts,
	.write =			cypress_write,
	.write =			cypress_write,
	.write_room =			cypress_write_room,
	.write_room =			cypress_write_room,
	.ioctl =			cypress_ioctl,
	.set_termios =			cypress_set_termios,
	.set_termios =			cypress_set_termios,
	.tiocmget =			cypress_tiocmget,
	.tiocmget =			cypress_tiocmget,
	.tiocmset =			cypress_tiocmset,
	.tiocmset =			cypress_tiocmset,
	.tiocmiwait =			cypress_tiocmiwait,
	.chars_in_buffer =		cypress_chars_in_buffer,
	.chars_in_buffer =		cypress_chars_in_buffer,
	.throttle =			cypress_throttle,
	.throttle =			cypress_throttle,
	.unthrottle =			cypress_unthrottle,
	.unthrottle =			cypress_unthrottle,
@@ -210,10 +209,10 @@ static struct usb_serial_driver cypress_ca42v2_device = {
	.dtr_rts =			cypress_dtr_rts,
	.dtr_rts =			cypress_dtr_rts,
	.write =			cypress_write,
	.write =			cypress_write,
	.write_room =			cypress_write_room,
	.write_room =			cypress_write_room,
	.ioctl =			cypress_ioctl,
	.set_termios =			cypress_set_termios,
	.set_termios =			cypress_set_termios,
	.tiocmget =			cypress_tiocmget,
	.tiocmget =			cypress_tiocmget,
	.tiocmset =			cypress_tiocmset,
	.tiocmset =			cypress_tiocmset,
	.tiocmiwait =			cypress_tiocmiwait,
	.chars_in_buffer =		cypress_chars_in_buffer,
	.chars_in_buffer =		cypress_chars_in_buffer,
	.throttle =			cypress_throttle,
	.throttle =			cypress_throttle,
	.unthrottle =			cypress_unthrottle,
	.unthrottle =			cypress_unthrottle,
@@ -855,17 +854,12 @@ static int cypress_tiocmset(struct tty_struct *tty,
}
}




static int cypress_ioctl(struct tty_struct *tty,
static int cypress_tiocmiwait(struct tty_struct *tty, unsigned long arg)
					unsigned int cmd, unsigned long arg)
{
{
	struct usb_serial_port *port = tty->driver_data;
	struct usb_serial_port *port = tty->driver_data;
	struct cypress_private *priv = usb_get_serial_port_data(port);
	struct cypress_private *priv = usb_get_serial_port_data(port);
	char diff;


	dev_dbg(&port->dev, "%s - port %d, cmd 0x%.4x\n", __func__, port->number, cmd);

	switch (cmd) {
	/* This code comes from drivers/char/serial.c and ftdi_sio.c */
	case TIOCMIWAIT:
	for (;;) {
	for (;;) {
		interruptible_sleep_on(&port->delta_msr_wait);
		interruptible_sleep_on(&port->delta_msr_wait);
		/* see if a signal did it */
		/* see if a signal did it */
@@ -875,8 +869,7 @@ static int cypress_ioctl(struct tty_struct *tty,
		if (port->serial->disconnected)
		if (port->serial->disconnected)
			return -EIO;
			return -EIO;


			{
		diff = priv->diff_status;
				char diff = priv->diff_status;
		if (diff == 0)
		if (diff == 0)
			return -EIO; /* no change => error */
			return -EIO; /* no change => error */


@@ -895,15 +888,9 @@ static int cypress_ioctl(struct tty_struct *tty,
		 * more events.
		 * more events.
		 */
		 */
	}
	}
		}

	return 0;
	return 0;
	default:
		break;
}
}
	dev_dbg(&port->dev, "%s - arg not supported - it was 0x%04x - check include/asm/ioctls.h\n", __func__, cmd);
	return -ENOIOCTLCMD;
} /* cypress_ioctl */



static void cypress_set_termios(struct tty_struct *tty,
static void cypress_set_termios(struct tty_struct *tty,
	struct usb_serial_port *port, struct ktermios *old_termios)
	struct usb_serial_port *port, struct ktermios *old_termios)