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

Commit b9db07fb authored by Lonnie Mendez's avatar Lonnie Mendez Committed by Greg Kroah-Hartman
Browse files

[PATCH] USB: whitespace fixes for cypress_m8 driver



Reading this driver I noticed some trailing whitespaces and tabs so I
removed them with some 80th column fitting and a few more similar
things.

From: Carlo Perassi <carlo@linux.it>
Signed-off-by: default avatarLonnie Mendez <dignome@gmail.com>
Signed-off-by: default avatarCarlo Perassi <carlo@linux.it>
Signed-off-by: default avatarDomen Puncer <domen@coderock.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4e149184
Loading
Loading
Loading
Loading
+152 −99
Original line number Original line Diff line number Diff line
@@ -453,7 +453,7 @@ static int generic_startup (struct usb_serial *serial)
	priv->cbr_mask = B300;
	priv->cbr_mask = B300;
	usb_set_serial_port_data(serial->port[0], priv);
	usb_set_serial_port_data(serial->port[0], priv);
	
	
	return (0);	
	return 0;
}
}




@@ -464,14 +464,15 @@ static int cypress_earthmate_startup (struct usb_serial *serial)
	dbg("%s", __FUNCTION__);
	dbg("%s", __FUNCTION__);


	if (generic_startup(serial)) {
	if (generic_startup(serial)) {
		dbg("%s - Failed setting up port %d", __FUNCTION__, serial->port[0]->number);
		dbg("%s - Failed setting up port %d", __FUNCTION__,
				serial->port[0]->number);
		return 1;
		return 1;
	}
	}


	priv = usb_get_serial_port_data(serial->port[0]);
	priv = usb_get_serial_port_data(serial->port[0]);
	priv->chiptype = CT_EARTHMATE;
	priv->chiptype = CT_EARTHMATE;


	return (0);	
	return 0;
} /* cypress_earthmate_startup */
} /* cypress_earthmate_startup */




@@ -482,14 +483,15 @@ static int cypress_hidcom_startup (struct usb_serial *serial)
	dbg("%s", __FUNCTION__);
	dbg("%s", __FUNCTION__);


	if (generic_startup(serial)) {
	if (generic_startup(serial)) {
		dbg("%s - Failed setting up port %d", __FUNCTION__, serial->port[0]->number);
		dbg("%s - Failed setting up port %d", __FUNCTION__,
				serial->port[0]->number);
		return 1;
		return 1;
	}
	}


	priv = usb_get_serial_port_data(serial->port[0]);
	priv = usb_get_serial_port_data(serial->port[0]);
	priv->chiptype = CT_CYPHIDCOM;
	priv->chiptype = CT_CYPHIDCOM;
	
	
	return (0);	
	return 0;
} /* cypress_hidcom_startup */
} /* cypress_hidcom_startup */




@@ -909,7 +911,8 @@ static int cypress_ioctl (struct usb_serial_port *port, struct file * file, unsi
} /* cypress_ioctl */
} /* cypress_ioctl */




static void cypress_set_termios (struct usb_serial_port *port, struct termios *old_termios)
static void cypress_set_termios (struct usb_serial_port *port,
		struct termios *old_termios)
{
{
	struct cypress_private *priv = usb_get_serial_port_data(port);
	struct cypress_private *priv = usb_get_serial_port_data(port);
	struct tty_struct *tty;
	struct tty_struct *tty;
@@ -931,10 +934,12 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o
	if (!priv->termios_initialized) {
	if (!priv->termios_initialized) {
		if (priv->chiptype == CT_EARTHMATE) {
		if (priv->chiptype == CT_EARTHMATE) {
			*(tty->termios) = tty_std_termios;
			*(tty->termios) = tty_std_termios;
			tty->termios->c_cflag = B4800 | CS8 | CREAD | HUPCL | CLOCAL;
			tty->termios->c_cflag = B4800 | CS8 | CREAD | HUPCL |
				CLOCAL;
		} else if (priv->chiptype == CT_CYPHIDCOM) {
		} else if (priv->chiptype == CT_CYPHIDCOM) {
			*(tty->termios) = tty_std_termios;
			*(tty->termios) = tty_std_termios;
			tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
			tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL |
				CLOCAL;
		}
		}
		priv->termios_initialized = 1;
		priv->termios_initialized = 1;
	}
	}
@@ -946,9 +951,12 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o
	/* check if there are new settings */
	/* check if there are new settings */
	if (old_termios) {
	if (old_termios) {
		if ((cflag != old_termios->c_cflag) ||
		if ((cflag != old_termios->c_cflag) ||
		    (RELEVANT_IFLAG(iflag) != RELEVANT_IFLAG(old_termios->c_iflag))) {
			(RELEVANT_IFLAG(iflag) !=
			dbg("%s - attempting to set new termios settings", __FUNCTION__);
			 RELEVANT_IFLAG(old_termios->c_iflag))) {
			/* should make a copy of this in case something goes wrong in the function, we can restore it */
			dbg("%s - attempting to set new termios settings",
					__FUNCTION__);
			/* should make a copy of this in case something goes
			 * wrong in the function, we can restore it */
			spin_lock_irqsave(&priv->lock, flags);
			spin_lock_irqsave(&priv->lock, flags);
			priv->tmp_termios = *(tty->termios);
			priv->tmp_termios = *(tty->termios);
			spin_unlock_irqrestore(&priv->lock, flags);
			spin_unlock_irqrestore(&priv->lock, flags);
@@ -962,21 +970,34 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o
	/* set number of data bits, parity, stop bits */
	/* set number of data bits, parity, stop bits */
	/* when parity is disabled the parity type bit is ignored */
	/* when parity is disabled the parity type bit is ignored */


	stop_bits = cflag & CSTOPB ? 1 : 0; /* 1 means 2 stop bits, 0 means 1 stop bit */
	/* 1 means 2 stop bits, 0 means 1 stop bit */
	stop_bits = cflag & CSTOPB ? 1 : 0;


	if (cflag & PARENB) {
	if (cflag & PARENB) {
		parity_enable = 1;
		parity_enable = 1;
		parity_type = cflag & PARODD ? 1 : 0; /* 1 means odd parity, 0 means even parity */
		/* 1 means odd parity, 0 means even parity */
		parity_type = cflag & PARODD ? 1 : 0;
	} else
	} else
		parity_enable = parity_type = 0;
		parity_enable = parity_type = 0;


	if (cflag & CSIZE) {
	if (cflag & CSIZE) {
		switch (cflag & CSIZE) {
		switch (cflag & CSIZE) {
			case CS5: data_bits = 0; break;
			case CS5:
			case CS6: data_bits = 1; break;
				data_bits = 0;
			case CS7: data_bits = 2; break;
				break;
			case CS8: data_bits = 3; break;
			case CS6:
			default: err("%s - CSIZE was set, but not CS5-CS8", __FUNCTION__); data_bits = 3;
				data_bits = 1;
				break;
			case CS7:
				data_bits = 2;
				break;
			case CS8:
				data_bits = 3;
				break;
			default:
				err("%s - CSIZE was set, but not CS5-CS8",
						__FUNCTION__);
				data_bits = 3;
		}
		}
	} else
	} else
		data_bits = 3;
		data_bits = 3;
@@ -991,63 +1012,85 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o
	} else {
	} else {
		baud_mask = (cflag & CBAUD);
		baud_mask = (cflag & CBAUD);
		switch(baud_mask) {
		switch(baud_mask) {
			case B300: dbg("%s - setting baud 300bps", __FUNCTION__); break;
			case B300:
			case B600: dbg("%s - setting baud 600bps", __FUNCTION__); break;
				dbg("%s - setting baud 300bps", __FUNCTION__);
			case B1200: dbg("%s - setting baud 1200bps", __FUNCTION__); break;
				break;
			case B2400: dbg("%s - setting baud 2400bps", __FUNCTION__); break;
			case B600:
			case B4800: dbg("%s - setting baud 4800bps", __FUNCTION__); break;
				dbg("%s - setting baud 600bps", __FUNCTION__);
			case B9600: dbg("%s - setting baud 9600bps", __FUNCTION__); break;
				break;
			case B19200: dbg("%s - setting baud 19200bps", __FUNCTION__); break;
			case B1200:
			case B38400: dbg("%s - setting baud 38400bps", __FUNCTION__); break;
				dbg("%s - setting baud 1200bps", __FUNCTION__);
			case B57600: dbg("%s - setting baud 57600bps", __FUNCTION__); break;
				break;
			case B115200: dbg("%s - setting baud 115200bps", __FUNCTION__); break;
			case B2400:
			default: dbg("%s - unknown masked baud rate", __FUNCTION__);
				dbg("%s - setting baud 2400bps", __FUNCTION__);
				break;
			case B4800:
				dbg("%s - setting baud 4800bps", __FUNCTION__);
				break;
			case B9600:
				dbg("%s - setting baud 9600bps", __FUNCTION__);
				break;
			case B19200:
				dbg("%s - setting baud 19200bps", __FUNCTION__);
				break;
			case B38400:
				dbg("%s - setting baud 38400bps", __FUNCTION__);
				break;
			case B57600:
				dbg("%s - setting baud 57600bps", __FUNCTION__);
				break;
			case B115200:
				dbg("%s - setting baud 115200bps", __FUNCTION__);
				break;
			default:
				dbg("%s - unknown masked baud rate", __FUNCTION__);
		}
		}
		priv->line_control = (CONTROL_DTR | CONTROL_RTS);
		priv->line_control = (CONTROL_DTR | CONTROL_RTS);
	}
	}
	spin_unlock_irqrestore(&priv->lock, flags);
	spin_unlock_irqrestore(&priv->lock, flags);


	dbg("%s - sending %d stop_bits, %d parity_enable, %d parity_type, %d data_bits (+5)", __FUNCTION__,
	dbg("%s - sending %d stop_bits, %d parity_enable, %d parity_type, "
	    stop_bits, parity_enable, parity_type, data_bits);
			"%d data_bits (+5)", __FUNCTION__, stop_bits,
			parity_enable, parity_type, data_bits);


	cypress_serial_control(port, baud_mask, data_bits, stop_bits, parity_enable,
	cypress_serial_control(port, baud_mask, data_bits, stop_bits,
			       parity_type, 0, CYPRESS_SET_CONFIG);
			parity_enable, parity_type, 0, CYPRESS_SET_CONFIG);


	/* we perform a CYPRESS_GET_CONFIG so that the current settings are filled into the private structure
	/* we perform a CYPRESS_GET_CONFIG so that the current settings are
         * this should confirm that all is working if it returns what we just set */
	 * filled into the private structure this should confirm that all is
	 * working if it returns what we just set */
	cypress_serial_control(port, 0, 0, 0, 0, 0, 0, CYPRESS_GET_CONFIG);
	cypress_serial_control(port, 0, 0, 0, 0, 0, 0, CYPRESS_GET_CONFIG);


	/* Here we can define custom tty settings for devices
	/* Here we can define custom tty settings for devices; the main tty
         *
	 * termios flag base comes from empeg.c */
         * the main tty termios flag base comes from empeg.c
         */


	spin_lock_irqsave(&priv->lock, flags);
	spin_lock_irqsave(&priv->lock, flags);
	if ( (priv->chiptype == CT_EARTHMATE) && (priv->baud_rate == 4800) ) {
	if ( (priv->chiptype == CT_EARTHMATE) && (priv->baud_rate == 4800) ) {

		dbg("Using custom termios settings for a baud rate of "
		dbg("Using custom termios settings for a baud rate of 4800bps.");
				"4800bps.");
		/* define custom termios settings for NMEA protocol */
		/* define custom termios settings for NMEA protocol */


		tty->termios->c_iflag /* input modes - */
		tty->termios->c_iflag /* input modes - */
			&= ~(IGNBRK  /* disable ignore break */
			&= ~(IGNBRK  /* disable ignore break */
			| BRKINT     /* disable break causes interrupt */
			| BRKINT     /* disable break causes interrupt */
			| PARMRK     /* disable mark parity errors */
			| PARMRK     /* disable mark parity errors */
			| ISTRIP		/* disable clear high bit of input characters */
			| ISTRIP     /* disable clear high bit of input char */
			| INLCR      /* disable translate NL to CR */
			| INLCR      /* disable translate NL to CR */
			| IGNCR      /* disable ignore CR */
			| IGNCR      /* disable ignore CR */
			| ICRNL      /* disable translate CR to NL */
			| ICRNL      /* disable translate CR to NL */
			| IXON);     /* disable enable XON/XOFF flow control */
			| IXON);     /* disable enable XON/XOFF flow control */


		tty->termios->c_oflag /* output modes */
		tty->termios->c_oflag /* output modes */
			&= ~OPOST;		/* disable postprocess output characters */
			&= ~OPOST;    /* disable postprocess output char */


		tty->termios->c_lflag /* line discipline modes */
		tty->termios->c_lflag /* line discipline modes */
			&= ~(ECHO     /* disable echo input characters */
			&= ~(ECHO     /* disable echo input characters */
			| ECHONL      /* disable echo new line */
			| ECHONL      /* disable echo new line */
			| ICANON		/* disable erase, kill, werase, and rprnt special characters */
			| ICANON      /* disable erase, kill, werase, and rprnt
			| ISIG			/* disable interrupt, quit, and suspend special characters */
					 special characters */
			| ISIG        /* disable interrupt, quit, and suspend
					 special characters */
			| IEXTEN);    /* disable non-POSIX special characters */
			| IEXTEN);    /* disable non-POSIX special characters */

	} /* CT_CYPHIDCOM: Application should handle this for device */
	} /* CT_CYPHIDCOM: Application should handle this for device */


	linechange = (priv->line_control != oldlines);
	linechange = (priv->line_control != oldlines);
@@ -1110,7 +1153,8 @@ static void cypress_unthrottle (struct usb_serial_port *port)


		result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
		result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
		if (result)
		if (result)
			dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result);
			dev_err(&port->dev, "%s - failed submitting read urb, "
					"error %d\n", __FUNCTION__, result);
	}
	}
}
}


@@ -1131,7 +1175,8 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs)
	dbg("%s - port %d", __FUNCTION__, port->number);
	dbg("%s - port %d", __FUNCTION__, port->number);


	if (urb->status) {
	if (urb->status) {
		dbg("%s - nonzero read status received: %d", __FUNCTION__, urb->status);
		dbg("%s - nonzero read status received: %d", __FUNCTION__,
				urb->status);
		return;
		return;
	}
	}


@@ -1169,37 +1214,41 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs)
				havedata = 1;
				havedata = 1;
			break;
			break;
		default:
		default:
			dbg("%s - wrong packet size - received %d bytes", __FUNCTION__, urb->actual_length);
			dbg("%s - wrong packet size - received %d bytes",
					__FUNCTION__, urb->actual_length);
			spin_unlock_irqrestore(&priv->lock, flags);
			spin_unlock_irqrestore(&priv->lock, flags);
			goto continue_read;
			goto continue_read;
	}
	}
	spin_unlock_irqrestore(&priv->lock, flags);
	spin_unlock_irqrestore(&priv->lock, flags);


	usb_serial_debug_data (debug, &port->dev, __FUNCTION__, urb->actual_length, data);
	usb_serial_debug_data (debug, &port->dev, __FUNCTION__,
			urb->actual_length, data);


	spin_lock_irqsave(&priv->lock, flags);
	spin_lock_irqsave(&priv->lock, flags);
	/* check to see if status has changed */
	/* check to see if status has changed */
	if (priv != NULL) {
	if (priv != NULL) {
		if (priv->current_status != priv->prev_status) {
		if (priv->current_status != priv->prev_status) {
			priv->diff_status |= priv->current_status ^ priv->prev_status;
			priv->diff_status |= priv->current_status ^
				priv->prev_status;
			wake_up_interruptible(&priv->delta_msr_wait);
			wake_up_interruptible(&priv->delta_msr_wait);
			priv->prev_status = priv->current_status;
			priv->prev_status = priv->current_status;
		}
		}
	}
	}
	spin_unlock_irqrestore(&priv->lock, flags);
	spin_unlock_irqrestore(&priv->lock, flags);


	/* hangup, as defined in acm.c... this might be a bad place for it though */
	/* hangup, as defined in acm.c... this might be a bad place for it
	if (tty && !(tty->termios->c_cflag & CLOCAL) && !(priv->current_status & UART_CD)) {
	 * though */
	if (tty && !(tty->termios->c_cflag & CLOCAL) &&
			!(priv->current_status & UART_CD)) {
		dbg("%s - calling hangup", __FUNCTION__);
		dbg("%s - calling hangup", __FUNCTION__);
		tty_hangup(tty);
		tty_hangup(tty);
		goto continue_read;
		goto continue_read;
	}
	}


	/* There is one error bit... I'm assuming it is a parity error indicator
	/* There is one error bit... I'm assuming it is a parity error
	 * as the generic firmware will set this bit to 1 if a parity error occurs.
	 * indicator as the generic firmware will set this bit to 1 if a
	 * I can not find reference to any other error events.
	 * parity error occurs.
	 *
	 * I can not find reference to any other error events. */
	 */
	spin_lock_irqsave(&priv->lock, flags);
	spin_lock_irqsave(&priv->lock, flags);
	if (priv->current_status & CYP_ERROR) {
	if (priv->current_status & CYP_ERROR) {
		spin_unlock_irqrestore(&priv->lock, flags);
		spin_unlock_irqrestore(&priv->lock, flags);
@@ -1211,7 +1260,8 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs)
	/* process read if there is data other than line status */
	/* process read if there is data other than line status */
	if (tty && (bytes > i)) {
	if (tty && (bytes > i)) {
		for (; i < bytes ; ++i) {
		for (; i < bytes ; ++i) {
			dbg("pushing byte number %d - %d - %c",i,data[i],data[i]);
			dbg("pushing byte number %d - %d - %c", i, data[i],
					data[i]);
			if(tty->flip.count >= TTY_FLIPBUF_SIZE) {
			if(tty->flip.count >= TTY_FLIPBUF_SIZE) {
				tty_flip_buffer_push(tty);
				tty_flip_buffer_push(tty);
			}
			}
@@ -1221,7 +1271,8 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs)
	}
	}


	spin_lock_irqsave(&priv->lock, flags);
	spin_lock_irqsave(&priv->lock, flags);
	priv->bytes_in += bytes;  /* control and status byte(s) are also counted */
	/* control and status byte(s) are also counted */
	priv->bytes_in += bytes;
	spin_unlock_irqrestore(&priv->lock, flags);
	spin_unlock_irqrestore(&priv->lock, flags);


continue_read:
continue_read:
@@ -1230,14 +1281,16 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs)


	if (port->open_count > 0) {
	if (port->open_count > 0) {
		usb_fill_int_urb(port->interrupt_in_urb, port->serial->dev,
		usb_fill_int_urb(port->interrupt_in_urb, port->serial->dev,
		usb_rcvintpipe(port->serial->dev, port->interrupt_in_endpointAddress),
				usb_rcvintpipe(port->serial->dev,
					port->interrupt_in_endpointAddress),
				port->interrupt_in_urb->transfer_buffer,
				port->interrupt_in_urb->transfer_buffer,
				port->interrupt_in_urb->transfer_buffer_length,
				port->interrupt_in_urb->transfer_buffer_length,
		cypress_read_int_callback, port,
				cypress_read_int_callback, port, interval);
		interval);
		result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
		result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
		if (result)
		if (result)
		dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
			dev_err(&urb->dev->dev, "%s - failed resubmitting "
					"read urb, error %d\n", __FUNCTION__,
					result);
	}
	}


	return;
	return;