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

Commit 3ec466b4 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman
Browse files

USB: belkin_sa: clean up for new style termios and speed handling, plus style



A tester with actual hardware would be useful

Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent fcf9e55e
Loading
Loading
Loading
Loading
+16 −21
Original line number Original line Diff line number Diff line
@@ -350,14 +350,12 @@ static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios
	unsigned long control_state;
	unsigned long control_state;
	int bad_flow_control;
	int bad_flow_control;
	speed_t baud;
	speed_t baud;
	struct ktermios *termios = port->tty->termios;
	
	
	if ((!port->tty) || (!port->tty->termios)) {
	iflag = termios->c_iflag;
		dbg ("%s - no tty or termios structure", __FUNCTION__);
	cflag = termios->c_cflag;
		return;
	}


	iflag = port->tty->termios->c_iflag;
	termios->c_cflag &= ~CMSPAR;
	cflag = port->tty->termios->c_cflag;


	/* get a local copy of the current port settings */
	/* get a local copy of the current port settings */
	spin_lock_irqsave(&priv->lock, flags);
	spin_lock_irqsave(&priv->lock, flags);
@@ -383,19 +381,16 @@ static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios
	}
	}


	baud = tty_get_baud_rate(port->tty);
	baud = tty_get_baud_rate(port->tty);
	if (baud == 0) {
	if (baud) {
		dbg("%s - tty_get_baud_rate says 0 baud", __FUNCTION__);
		return;
	}
		urb_value = BELKIN_SA_BAUD(baud);
		urb_value = BELKIN_SA_BAUD(baud);
		/* Clip to maximum speed */
		/* Clip to maximum speed */
		if (urb_value == 0)
		if (urb_value == 0)
			urb_value = 1;
			urb_value = 1;
		/* Turn it back into a resulting real baud rate */
		/* Turn it back into a resulting real baud rate */
		baud = BELKIN_SA_BAUD(urb_value);
		baud = BELKIN_SA_BAUD(urb_value);
	/* FIXME: Once the tty updates are done then push this back to the tty */


	if ((cflag & CBAUD) != B0 ) {
		/* Report the actual baud rate back to the caller */
		tty_encode_baud_rate(port->tty, baud, baud);
		if (BSA_USB_CMD(BELKIN_SA_SET_BAUDRATE_REQUEST, urb_value) < 0)
		if (BSA_USB_CMD(BELKIN_SA_SET_BAUDRATE_REQUEST, urb_value) < 0)
			err("Set baudrate error");
			err("Set baudrate error");
	} else {
	} else {