lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 17 Jul 2015 03:03:24 +0000
From:	Craig Inches <craig.inches@...to.net>
To:	lidza.louina@...il.com
Cc:	markh@...pro.net, gregkh@...uxfoundation.org,
	driverdev-devel@...uxdriverproject.org, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org, Craig Inches <craig.inches@...to.net>
Subject: [PATCH v2] Drivers: Staging: dgnc: Fix Style Issues

Fixed multiple instances of:

CHECK: Alignment should match open parenthesis
CHECK: Blank lines aren't necessary before a close brace '}'
CHECK: Please don't use multiple blank lines
CHECK: Blank lines aren't necessary after an open brace '{'
WARNING: line over 80 characters

Signed-off-by: Craig Inches <craig.inches@...to.net>
---
 drivers/staging/dgnc/dgnc_tty.c | 261 +++++++++++++++++++---------------------
 1 file changed, 126 insertions(+), 135 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index fbfe79a..f3c544c 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -63,7 +63,6 @@ static struct digi_t dgnc_digi_init = {
 	.digi_term =	"ansi"		/* default terminal type	*/
 };
 
-
 /*
  * Define a local default termios struct. All ports will be created
  * with this termios initially.
@@ -80,14 +79,17 @@ static struct ktermios DgncDefaultTermios = {
 	.c_line =	0,
 };
 
-
 /* Our function prototypes */
 static int dgnc_tty_open(struct tty_struct *tty, struct file *file);
 static void dgnc_tty_close(struct tty_struct *tty, struct file *file);
-static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, struct channel_t *ch);
-static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
-static int dgnc_tty_digigeta(struct tty_struct *tty, struct digi_t __user *retinfo);
-static int dgnc_tty_digiseta(struct tty_struct *tty, struct digi_t __user *new_info);
+static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file,
+				struct channel_t *ch);
+static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
+			  unsigned long arg);
+static int dgnc_tty_digigeta(struct tty_struct *tty,
+			     struct digi_t __user *retinfo);
+static int dgnc_tty_digiseta(struct tty_struct *tty,
+			     struct digi_t __user *new_info);
 static int dgnc_tty_write_room(struct tty_struct *tty);
 static int dgnc_tty_put_char(struct tty_struct *tty, unsigned char c);
 static int dgnc_tty_chars_in_buffer(struct tty_struct *tty);
@@ -98,17 +100,21 @@ static void dgnc_tty_unthrottle(struct tty_struct *tty);
 static void dgnc_tty_flush_chars(struct tty_struct *tty);
 static void dgnc_tty_flush_buffer(struct tty_struct *tty);
 static void dgnc_tty_hangup(struct tty_struct *tty);
-static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command, unsigned int __user *value);
-static int dgnc_get_modem_info(struct channel_t *ch, unsigned int __user *value);
+static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command,
+			       unsigned int __user *value);
+static int dgnc_get_modem_info(struct channel_t *ch,
+			       unsigned int __user *value);
 static int dgnc_tty_tiocmget(struct tty_struct *tty);
-static int dgnc_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear);
+static int dgnc_tty_tiocmset(struct tty_struct *tty, unsigned int set,
+			     unsigned int clear);
 static int dgnc_tty_send_break(struct tty_struct *tty, int msec);
 static void dgnc_tty_wait_until_sent(struct tty_struct *tty, int timeout);
-static int dgnc_tty_write(struct tty_struct *tty, const unsigned char *buf, int count);
-static void dgnc_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios);
+static int dgnc_tty_write(struct tty_struct *tty, const unsigned char *buf,
+			  int count);
+static void dgnc_tty_set_termios(struct tty_struct *tty,
+				 struct ktermios *old_termios);
 static void dgnc_tty_send_xchar(struct tty_struct *tty, char ch);
 
-
 static const struct tty_operations dgnc_tty_ops = {
 	.open = dgnc_tty_open,
 	.close = dgnc_tty_close,
@@ -163,7 +169,6 @@ int dgnc_tty_preinit(void)
 	return 0;
 }
 
-
 /*
  * dgnc_tty_register()
  *
@@ -186,18 +191,23 @@ int dgnc_tty_register(struct dgnc_board *brd)
 	brd->SerialDriver.subtype = SERIAL_TYPE_NORMAL;
 	brd->SerialDriver.init_termios = DgncDefaultTermios;
 	brd->SerialDriver.driver_name = DRVSTR;
-	brd->SerialDriver.flags = (TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_HARDWARE_BREAK);
+	brd->SerialDriver.flags = (TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV
+				  | TTY_DRIVER_HARDWARE_BREAK);
 
 	/*
 	 * The kernel wants space to store pointers to
 	 * tty_struct's and termios's.
 	 */
-	brd->SerialDriver.ttys = kcalloc(brd->maxports, sizeof(*brd->SerialDriver.ttys), GFP_KERNEL);
+	brd->SerialDriver.ttys = kcalloc(brd->maxports,
+					 sizeof(*brd->SerialDriver.ttys),
+					 GFP_KERNEL);
 	if (!brd->SerialDriver.ttys)
 		return -ENOMEM;
 
 	kref_init(&brd->SerialDriver.kref);
-	brd->SerialDriver.termios = kcalloc(brd->maxports, sizeof(*brd->SerialDriver.termios), GFP_KERNEL);
+	brd->SerialDriver.termios = kcalloc(brd->maxports,
+					    sizeof(*brd->SerialDriver.termios),
+					    GFP_KERNEL);
 	if (!brd->SerialDriver.termios)
 		return -ENOMEM;
 
@@ -235,18 +245,23 @@ int dgnc_tty_register(struct dgnc_board *brd)
 	brd->PrintDriver.subtype = SERIAL_TYPE_NORMAL;
 	brd->PrintDriver.init_termios = DgncDefaultTermios;
 	brd->PrintDriver.driver_name = DRVSTR;
-	brd->PrintDriver.flags = (TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_HARDWARE_BREAK);
+	brd->PrintDriver.flags = (TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV
+				  | TTY_DRIVER_HARDWARE_BREAK);
 
 	/*
 	 * The kernel wants space to store pointers to
 	 * tty_struct's and termios's.  Must be separated from
 	 * the Serial Driver so we don't get confused
 	 */
-	brd->PrintDriver.ttys = kcalloc(brd->maxports, sizeof(*brd->PrintDriver.ttys), GFP_KERNEL);
+	brd->PrintDriver.ttys = kcalloc(brd->maxports,
+					sizeof(*brd->PrintDriver.ttys),
+					GFP_KERNEL);
 	if (!brd->PrintDriver.ttys)
 		return -ENOMEM;
 	kref_init(&brd->PrintDriver.kref);
-	brd->PrintDriver.termios = kcalloc(brd->maxports, sizeof(*brd->PrintDriver.termios), GFP_KERNEL);
+	brd->PrintDriver.termios = kcalloc(brd->maxports,
+			sizeof(*brd->PrintDriver.termios),
+			GFP_KERNEL);
 	if (!brd->PrintDriver.termios)
 		return -ENOMEM;
 
@@ -275,7 +290,6 @@ int dgnc_tty_register(struct dgnc_board *brd)
 	return rc;
 }
 
-
 /*
  * dgnc_tty_init()
  *
@@ -349,16 +363,15 @@ int dgnc_tty_init(struct dgnc_board *brd)
 			struct device *classp;
 
 			classp = tty_register_device(&brd->SerialDriver, i,
-				&(ch->ch_bd->pdev->dev));
+						     &(ch->ch_bd->pdev->dev));
 			ch->ch_tun.un_sysfs = classp;
 			dgnc_create_tty_sysfs(&ch->ch_tun, classp);
 
 			classp = tty_register_device(&brd->PrintDriver, i,
-				&(ch->ch_bd->pdev->dev));
+						     &(ch->ch_bd->pdev->dev));
 			ch->ch_pun.un_sysfs = classp;
 			dgnc_create_tty_sysfs(&ch->ch_pun, classp);
 		}
-
 	}
 
 	return 0;
@@ -371,7 +384,6 @@ err_free_channels:
 	return -ENOMEM;
 }
 
-
 /*
  * dgnc_tty_post_uninit()
  *
@@ -383,7 +395,6 @@ void dgnc_tty_post_uninit(void)
 	dgnc_TmpWriteBuf = NULL;
 }
 
-
 /*
  * dgnc_tty_uninit()
  *
@@ -476,9 +487,6 @@ static void dgnc_wmove(struct channel_t *ch, char *buf, uint n)
 	ch->ch_w_head = head;
 }
 
-
-
-
 /*=======================================================================
  *
  *      dgnc_input - Process received data.
@@ -529,9 +537,10 @@ void dgnc_input(struct channel_t *ch)
 	 * If the device is not open, or CREAD is off,
 	 * flush input data and return immediately.
 	 */
-	if (!tp || (tp->magic != TTY_MAGIC) || !(ch->ch_tun.un_flags & UN_ISOPEN) ||
-	    !(tp->termios.c_cflag & CREAD) || (ch->ch_tun.un_flags & UN_CLOSING)) {
-
+	if (!tp || (tp->magic != TTY_MAGIC) ||
+	    !(ch->ch_tun.un_flags & UN_ISOPEN) ||
+	    !(tp->termios.c_cflag & CREAD) ||
+	    (ch->ch_tun.un_flags & UN_CLOSING)) {
 		ch->ch_r_head = tail;
 
 		/* Force queue flow control to be released, if needed */
@@ -614,16 +623,25 @@ void dgnc_input(struct channel_t *ch)
 		if (I_PARMRK(tp) || I_BRKINT(tp) || I_INPCK(tp)) {
 			for (i = 0; i < s; i++) {
 				if (*(ch->ch_equeue + tail + i) & UART_LSR_BI)
-					tty_insert_flip_char(tp->port, *(ch->ch_rqueue + tail + i), TTY_BREAK);
+					tty_insert_flip_char(tp->port,
+							     *(ch->ch_rqueue + tail + i),
+							     TTY_BREAK);
 				else if (*(ch->ch_equeue + tail + i) & UART_LSR_PE)
-					tty_insert_flip_char(tp->port, *(ch->ch_rqueue + tail + i), TTY_PARITY);
+					tty_insert_flip_char(tp->port,
+							     *(ch->ch_rqueue + tail + i),
+							     TTY_PARITY);
 				else if (*(ch->ch_equeue + tail + i) & UART_LSR_FE)
-					tty_insert_flip_char(tp->port, *(ch->ch_rqueue + tail + i), TTY_FRAME);
+					tty_insert_flip_char(tp->port,
+							     *(ch->ch_rqueue + tail + i),
+							     TTY_FRAME);
 				else
-					tty_insert_flip_char(tp->port, *(ch->ch_rqueue + tail + i), TTY_NORMAL);
+					tty_insert_flip_char(tp->port,
+							     *(ch->ch_rqueue + tail + i),
+							     TTY_NORMAL);
 			}
 		} else {
-			tty_insert_flip_string(tp->port, ch->ch_rqueue + tail, s);
+			tty_insert_flip_string(tp->port,
+					       ch->ch_rqueue + tail, s);
 		}
 
 		tail += s;
@@ -650,7 +668,6 @@ exit_unlock:
 		tty_ldisc_deref(ld);
 }
 
-
 /************************************************************************
  * Determines when CARRIER changes state and takes appropriate
  * action.
@@ -683,7 +700,6 @@ void dgnc_carrier(struct channel_t *ch)
 	 * Test for a VIRTUAL carrier transition to HIGH.
 	 */
 	if (((ch->ch_flags & CH_FCAR) == 0) && (virt_carrier == 1)) {
-
 		/*
 		 * When carrier rises, wake any threads waiting
 		 * for carrier in the open routine.
@@ -697,7 +713,6 @@ void dgnc_carrier(struct channel_t *ch)
 	 * Test for a PHYSICAL carrier transition to HIGH.
 	 */
 	if (((ch->ch_flags & CH_CD) == 0) && (phys_carrier == 1)) {
-
 		/*
 		 * When carrier rises, wake any threads waiting
 		 * for carrier in the open routine.
@@ -718,7 +733,6 @@ void dgnc_carrier(struct channel_t *ch)
 	 */
 	if ((virt_carrier == 0) && ((ch->ch_flags & CH_CD) != 0) &&
 	    (phys_carrier == 0)) {
-
 		/*
 		 *   When carrier drops:
 		 *
@@ -801,8 +815,8 @@ static void dgnc_set_custom_speed(struct channel_t *ch, uint newrate)
 		 */
 		if (testrate_high != newrate) {
 			/*
-			 *  Otherwise, pick the rate that is closer (i.e. whichever rate
-			 *  has a smaller delta).
+			 *  Otherwise, pick the rate that is closer
+			 *  (i.e. whichever rate has a smaller delta).
 			 */
 			deltahigh = testrate_high - newrate;
 			deltalow = newrate - testrate_low;
@@ -817,7 +831,6 @@ static void dgnc_set_custom_speed(struct channel_t *ch, uint newrate)
 	ch->ch_custom_speed = newrate;
 }
 
-
 void dgnc_check_queue_flow_control(struct channel_t *ch)
 {
 	int qleft = 0;
@@ -890,7 +903,6 @@ void dgnc_check_queue_flow_control(struct channel_t *ch)
 	}
 }
 
-
 void dgnc_wakeup_writes(struct channel_t *ch)
 {
 	int qlen = 0;
@@ -915,10 +927,11 @@ void dgnc_wakeup_writes(struct channel_t *ch)
 
 	if (ch->ch_tun.un_flags & UN_ISOPEN) {
 		if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
-			ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
-			spin_unlock_irqrestore(&ch->ch_lock, flags);
-			(ch->ch_tun.un_tty->ldisc->ops->write_wakeup)(ch->ch_tun.un_tty);
-			spin_lock_irqsave(&ch->ch_lock, flags);
+		    ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
+		    spin_unlock_irqrestore(&ch->ch_lock, flags);
+		    (ch->ch_tun.un_tty->ldisc->ops->write_wakeup)
+		    (ch->ch_tun.un_tty);
+		    spin_lock_irqsave(&ch->ch_lock, flags);
 		}
 
 		wake_up_interruptible(&ch->ch_tun.un_tty->write_wait);
@@ -928,7 +941,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
 		 * the queue AND FIFO are both empty.
 		 */
 		if (ch->ch_tun.un_flags & UN_EMPTY) {
-			if ((qlen == 0) && (ch->ch_bd->bd_ops->get_uart_bytes_left(ch) == 0)) {
+			if ((qlen == 0) &&
+			    (ch->ch_bd->bd_ops->get_uart_bytes_left(ch) == 0)) {
 				ch->ch_tun.un_flags &= ~(UN_EMPTY);
 
 				/*
@@ -969,7 +983,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
 		 * the queue AND FIFO are both empty.
 		 */
 		if (ch->ch_pun.un_flags & UN_EMPTY) {
-			if ((qlen == 0) && (ch->ch_bd->bd_ops->get_uart_bytes_left(ch) == 0))
+			if ((qlen == 0) &&
+			    (ch->ch_bd->bd_ops->get_uart_bytes_left(ch) == 0))
 				ch->ch_pun.un_flags &= ~(UN_EMPTY);
 		}
 
@@ -979,8 +994,6 @@ void dgnc_wakeup_writes(struct channel_t *ch)
 	spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
-
-
 /************************************************************************
  *
  * TTY Entry points and helper functions
@@ -1019,7 +1032,7 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
 	 * sleep waiting for it to happen or they cancel the open.
 	 */
 	rc = wait_event_interruptible(brd->state_wait,
-		(brd->state & BOARD_READY));
+				      (brd->state & BOARD_READY));
 
 	if (rc)
 		return rc;
@@ -1063,7 +1076,8 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
 	 */
 	spin_unlock_irqrestore(&ch->ch_lock, flags);
 
-	rc = wait_event_interruptible(ch->ch_flags_wait, ((ch->ch_flags & CH_OPENING) == 0));
+	rc = wait_event_interruptible(ch->ch_flags_wait,
+				      ((ch->ch_flags & CH_OPENING) == 0));
 
 	/* If ret is non-zero, user ctrl-c'ed us */
 	if (rc)
@@ -1077,7 +1091,9 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
 	 * ch_flags_wait to wake us back up.
 	 */
 	rc = wait_event_interruptible(ch->ch_flags_wait,
-		(((ch->ch_tun.un_flags | ch->ch_pun.un_flags) & UN_CLOSING) == 0));
+				      (((ch->ch_tun.un_flags |
+					 ch->ch_pun.un_flags)
+				       & UN_CLOSING) == 0));
 
 	/* If ret is non-zero, user ctrl-c'ed us */
 	if (rc)
@@ -1085,11 +1101,9 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
 
 	spin_lock_irqsave(&ch->ch_lock, flags);
 
-
 	/* Store our unit into driver_data, so we always have it available. */
 	tty->driver_data = un;
 
-
 	/*
 	 * Initialize tty's
 	 */
@@ -1100,7 +1114,6 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
 		/* Maybe do something here to the TTY struct as well? */
 	}
 
-
 	/*
 	 * Allocate channel buffers for read/write/error.
 	 * Set flag, so we don't get trounced on.
@@ -1126,7 +1139,6 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
 	 * Initialize if neither terminal or printer is open.
 	 */
 	if (!((ch->ch_tun.un_flags | ch->ch_pun.un_flags) & UN_ISOPEN)) {
-
 		/*
 		 * Flush input queues.
 		 */
@@ -1190,13 +1202,13 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
 	return rc;
 }
 
-
 /*
  * dgnc_block_til_ready()
  *
  * Wait for DCD, if needed.
  */
-static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, struct channel_t *ch)
+static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file,
+				struct channel_t *ch)
 {
 	int retval = 0;
 	struct un_t *un = NULL;
@@ -1204,7 +1216,8 @@ static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, struc
 	uint	old_flags = 0;
 	int	sleep_on_un_flags = 0;
 
-	if (!tty || tty->magic != TTY_MAGIC || !file || !ch || ch->magic != DGNC_CHANNEL_MAGIC)
+	if (!tty || tty->magic != TTY_MAGIC || !file || !ch ||
+	    ch->magic != DGNC_CHANNEL_MAGIC)
 		return -ENXIO;
 
 	un = tty->driver_data;
@@ -1217,11 +1230,11 @@ static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, struc
 
 	/* Loop forever */
 	while (1) {
-
 		sleep_on_un_flags = 0;
 
 		/*
-		 * If board has failed somehow during our sleep, bail with error.
+		 * If board has failed somehow during our sleep,
+		 * bail with error.
 		 */
 		if (ch->ch_bd->state == BOARD_FAILED) {
 			retval = -ENXIO;
@@ -1242,7 +1255,6 @@ static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, struc
 		 * ch_wait_flags to wake us back up.
 		 */
 		if (!((ch->ch_tun.un_flags | ch->ch_pun.un_flags) & UN_CLOSING)) {
-
 			/*
 			 * Our conditions to leave cleanly and happily:
 			 * 1) NONBLOCKING on the tty is set.
@@ -1294,15 +1306,18 @@ static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, struc
 		spin_unlock_irqrestore(&ch->ch_lock, flags);
 
 		/*
-		 * Wait for something in the flags to change from the current value.
+		 * Wait for something in the flags to
+		 * change from the current value.
 		 */
 		if (sleep_on_un_flags)
 			retval = wait_event_interruptible(un->un_flags_wait,
-				(old_flags != (ch->ch_tun.un_flags | ch->ch_pun.un_flags)));
+							  (old_flags !=
+							   (ch->ch_tun.un_flags
+							   | ch->ch_pun.un_flags)));
 		else
 			retval = wait_event_interruptible(ch->ch_flags_wait,
-				(old_flags != ch->ch_flags));
-
+							  (old_flags !=
+							   ch->ch_flags));
 		/*
 		 * We got woken up for some reason.
 		 * Before looping around, grab our channel lock.
@@ -1320,7 +1335,6 @@ static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, struc
 	return 0;
 }
 
-
 /*
  * dgnc_tty_hangup()
  *
@@ -1339,10 +1353,8 @@ static void dgnc_tty_hangup(struct tty_struct *tty)
 
 	/* flush the transmit queues */
 	dgnc_tty_flush_buffer(tty);
-
 }
 
-
 /*
  * dgnc_tty_close()
  *
@@ -1412,13 +1424,12 @@ static void dgnc_tty_close(struct tty_struct *tty, struct file *file)
 
 	tty->closing = 1;
 
-
 	/*
 	 * Only officially close channel if count is 0 and
 	 * DIGI_PRINTER bit is not set.
 	 */
-	if ((ch->ch_open_count == 0) && !(ch->ch_digi.digi_flags & DIGI_PRINTER)) {
-
+	if ((ch->ch_open_count == 0) &&
+	    !(ch->ch_digi.digi_flags & DIGI_PRINTER)) {
 		ch->ch_flags &= ~(CH_STOPI | CH_FORCED_STOPI);
 
 		/*
@@ -1426,8 +1437,8 @@ static void dgnc_tty_close(struct tty_struct *tty, struct file *file)
 		 */
 		if ((un->un_type == DGNC_PRINT) && (ch->ch_flags & CH_PRON)) {
 			dgnc_wmove(ch, ch->ch_digi.digi_offstr,
-				(int) ch->ch_digi.digi_offlen);
-			ch->ch_flags &= ~CH_PRON;
+				   (int) ch->ch_digi.digi_offlen);
+				   ch->ch_flags &= ~CH_PRON;
 		}
 
 		spin_unlock_irqrestore(&ch->ch_lock, flags);
@@ -1447,7 +1458,6 @@ static void dgnc_tty_close(struct tty_struct *tty, struct file *file)
 		 * If we have HUPCL set, lower DTR and RTS
 		 */
 		if (ch->ch_c_cflag & HUPCL) {
-
 			/* Drop RTS/DTR */
 			ch->ch_mostat &= ~(UART_MCR_DTR | UART_MCR_RTS);
 			bd->bd_ops->assert_modem_signals(ch);
@@ -1474,8 +1484,8 @@ static void dgnc_tty_close(struct tty_struct *tty, struct file *file)
 		 */
 		if ((un->un_type == DGNC_PRINT) && (ch->ch_flags & CH_PRON)) {
 			dgnc_wmove(ch, ch->ch_digi.digi_offstr,
-				(int) ch->ch_digi.digi_offlen);
-			ch->ch_flags &= ~CH_PRON;
+				   (int) ch->ch_digi.digi_offlen);
+				   ch->ch_flags &= ~CH_PRON;
 		}
 	}
 
@@ -1488,7 +1498,6 @@ static void dgnc_tty_close(struct tty_struct *tty, struct file *file)
 	spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
-
 /*
  * dgnc_tty_chars_in_buffer()
  *
@@ -1538,7 +1547,6 @@ static int dgnc_tty_chars_in_buffer(struct tty_struct *tty)
 	return chars;
 }
 
-
 /*
  * dgnc_maxcps_room
  *
@@ -1574,15 +1582,17 @@ static int dgnc_maxcps_room(struct tty_struct *tty, int bytes_available)
 		int cps_limit = 0;
 		unsigned long current_time = jiffies;
 		unsigned long buffer_time = current_time +
-			(HZ * ch->ch_digi.digi_bufsize) / ch->ch_digi.digi_maxcps;
+			(HZ * ch->ch_digi.digi_bufsize) /
+			ch->ch_digi.digi_maxcps;
 
 		if (ch->ch_cpstime < current_time) {
 			/* buffer is empty */
-			ch->ch_cpstime = current_time;	    /* reset ch_cpstime */
+			ch->ch_cpstime = current_time;	  /* reset ch_cpstime */
 			cps_limit = ch->ch_digi.digi_bufsize;
 		} else if (ch->ch_cpstime < buffer_time) {
 			/* still room in the buffer */
-			cps_limit = ((buffer_time - ch->ch_cpstime) * ch->ch_digi.digi_maxcps) / HZ;
+			cps_limit = ((buffer_time - ch->ch_cpstime)
+				      * ch->ch_digi.digi_maxcps) / HZ;
 		} else {
 			/* no room in the buffer */
 			cps_limit = 0;
@@ -1594,7 +1604,6 @@ static int dgnc_maxcps_room(struct tty_struct *tty, int bytes_available)
 	return bytes_available;
 }
 
-
 /*
  * dgnc_tty_write_room()
  *
@@ -1655,7 +1664,6 @@ static int dgnc_tty_write_room(struct tty_struct *tty)
 	return ret;
 }
 
-
 /*
  * dgnc_tty_put_char()
  *
@@ -1672,7 +1680,6 @@ static int dgnc_tty_put_char(struct tty_struct *tty, unsigned char c)
 	return 1;
 }
 
-
 /*
  * dgnc_tty_write()
  *
@@ -1680,7 +1687,7 @@ static int dgnc_tty_put_char(struct tty_struct *tty, unsigned char c)
  * In here exists all the Transparent Print magic as well.
  */
 static int dgnc_tty_write(struct tty_struct *tty,
-		const unsigned char *buf, int count)
+			  const unsigned char *buf, int count)
 {
 	struct channel_t *ch = NULL;
 	struct un_t *un = NULL;
@@ -1748,7 +1755,7 @@ static int dgnc_tty_write(struct tty_struct *tty,
 	 */
 	if ((un->un_type == DGNC_PRINT) && !(ch->ch_flags & CH_PRON)) {
 		dgnc_wmove(ch, ch->ch_digi.digi_onstr,
-		    (int) ch->ch_digi.digi_onlen);
+			   (int) ch->ch_digi.digi_onlen);
 		head = (ch->ch_w_head) & tmask;
 		ch->ch_flags |= CH_PRON;
 	}
@@ -1759,7 +1766,7 @@ static int dgnc_tty_write(struct tty_struct *tty,
 	 */
 	if ((un->un_type != DGNC_PRINT) && (ch->ch_flags & CH_PRON)) {
 		dgnc_wmove(ch, ch->ch_digi.digi_offstr,
-			(int) ch->ch_digi.digi_offlen);
+			   (int) ch->ch_digi.digi_offlen);
 		head = (ch->ch_w_head) & tmask;
 		ch->ch_flags &= ~CH_PRON;
 	}
@@ -1818,7 +1825,6 @@ exit_retry:
 	return 0;
 }
 
-
 /*
  * Return modem signals to ld.
  */
@@ -1866,7 +1872,6 @@ static int dgnc_tty_tiocmget(struct tty_struct *tty)
 	return result;
 }
 
-
 /*
  * dgnc_tty_tiocmset()
  *
@@ -1874,7 +1879,7 @@ static int dgnc_tty_tiocmget(struct tty_struct *tty)
  */
 
 static int dgnc_tty_tiocmset(struct tty_struct *tty,
-		unsigned int set, unsigned int clear)
+			     unsigned int set, unsigned int clear)
 {
 	struct dgnc_board *bd;
 	struct channel_t *ch;
@@ -1918,7 +1923,6 @@ static int dgnc_tty_tiocmset(struct tty_struct *tty,
 	return 0;
 }
 
-
 /*
  * dgnc_tty_send_break()
  *
@@ -1965,10 +1969,8 @@ static int dgnc_tty_send_break(struct tty_struct *tty, int msec)
 	spin_unlock_irqrestore(&ch->ch_lock, flags);
 
 	return 0;
-
 }
 
-
 /*
  * dgnc_tty_wait_until_sent()
  *
@@ -1999,7 +2001,6 @@ static void dgnc_tty_wait_until_sent(struct tty_struct *tty, int timeout)
 	rc = bd->bd_ops->drain(tty, 0);
 }
 
-
 /*
  * dgnc_send_xchar()
  *
@@ -2036,9 +2037,6 @@ static void dgnc_tty_send_xchar(struct tty_struct *tty, char c)
 	dev_dbg(tty->dev, "dgnc_tty_send_xchar finish\n");
 }
 
-
-
-
 /*
  * Return modem signals to ld.
  */
@@ -2075,12 +2073,11 @@ static inline int dgnc_get_mstat(struct channel_t *ch)
 	return result;
 }
 
-
-
 /*
  * Return modem signals to ld.
  */
-static int dgnc_get_modem_info(struct channel_t *ch, unsigned int  __user *value)
+static int dgnc_get_modem_info(struct channel_t *ch,
+			       unsigned int  __user *value)
 {
 	int result;
 
@@ -2095,13 +2092,13 @@ static int dgnc_get_modem_info(struct channel_t *ch, unsigned int  __user *value
 	return put_user(result, value);
 }
 
-
 /*
  * dgnc_set_modem_info()
  *
  * Set modem signals, called by ld.
  */
-static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command, unsigned int __user *value)
+static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command,
+			       unsigned int __user *value)
 {
 	struct dgnc_board *bd;
 	struct channel_t *ch;
@@ -2175,7 +2172,6 @@ static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command, uns
 	return 0;
 }
 
-
 /*
  * dgnc_tty_digigeta()
  *
@@ -2184,7 +2180,8 @@ static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command, uns
  *
  *
  */
-static int dgnc_tty_digigeta(struct tty_struct *tty, struct digi_t __user *retinfo)
+static int dgnc_tty_digigeta(struct tty_struct *tty,
+			     struct digi_t __user *retinfo)
 {
 	struct channel_t *ch;
 	struct un_t *un;
@@ -2217,7 +2214,6 @@ static int dgnc_tty_digigeta(struct tty_struct *tty, struct digi_t __user *retin
 	return 0;
 }
 
-
 /*
  * dgnc_tty_digiseta()
  *
@@ -2226,7 +2222,8 @@ static int dgnc_tty_digigeta(struct tty_struct *tty, struct digi_t __user *retin
  *
  *
  */
-static int dgnc_tty_digiseta(struct tty_struct *tty, struct digi_t __user *new_info)
+static int dgnc_tty_digiseta(struct tty_struct *tty,
+			     struct digi_t __user *new_info)
 {
 	struct dgnc_board *bd;
 	struct channel_t *ch;
@@ -2257,17 +2254,20 @@ static int dgnc_tty_digiseta(struct tty_struct *tty, struct digi_t __user *new_i
 	/*
 	 * Handle transistions to and from RTS Toggle.
 	 */
-	if (!(ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) && (new_digi.digi_flags & DIGI_RTS_TOGGLE))
+	if (!(ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) &&
+	    (new_digi.digi_flags & DIGI_RTS_TOGGLE))
 		ch->ch_mostat &= ~(UART_MCR_RTS);
-	if ((ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) && !(new_digi.digi_flags & DIGI_RTS_TOGGLE))
+	if ((ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) &&
+	    !(new_digi.digi_flags & DIGI_RTS_TOGGLE))
 		ch->ch_mostat |= (UART_MCR_RTS);
-
 	/*
 	 * Handle transistions to and from DTR Toggle.
 	 */
-	if (!(ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) && (new_digi.digi_flags & DIGI_DTR_TOGGLE))
+	if (!(ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) &&
+	    (new_digi.digi_flags & DIGI_DTR_TOGGLE))
 		ch->ch_mostat &= ~(UART_MCR_DTR);
-	if ((ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) && !(new_digi.digi_flags & DIGI_DTR_TOGGLE))
+	if ((ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) &&
+	    !(new_digi.digi_flags & DIGI_DTR_TOGGLE))
 		ch->ch_mostat |= (UART_MCR_DTR);
 
 	memcpy(&ch->ch_digi, &new_digi, sizeof(new_digi));
@@ -2300,11 +2300,11 @@ static int dgnc_tty_digiseta(struct tty_struct *tty, struct digi_t __user *new_i
 	return 0;
 }
 
-
 /*
  * dgnc_set_termios()
  */
-static void dgnc_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
+static void dgnc_tty_set_termios(struct tty_struct *tty,
+				 struct ktermios *old_termios)
 {
 	struct dgnc_board *bd;
 	struct channel_t *ch;
@@ -2341,7 +2341,6 @@ static void dgnc_tty_set_termios(struct tty_struct *tty, struct ktermios *old_te
 	spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
-
 static void dgnc_tty_throttle(struct tty_struct *tty)
 {
 	struct channel_t *ch;
@@ -2366,7 +2365,6 @@ static void dgnc_tty_throttle(struct tty_struct *tty)
 	spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
-
 static void dgnc_tty_unthrottle(struct tty_struct *tty)
 {
 	struct channel_t *ch;
@@ -2391,7 +2389,6 @@ static void dgnc_tty_unthrottle(struct tty_struct *tty)
 	spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
-
 static void dgnc_tty_start(struct tty_struct *tty)
 {
 	struct dgnc_board *bd;
@@ -2421,7 +2418,6 @@ static void dgnc_tty_start(struct tty_struct *tty)
 	spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
-
 static void dgnc_tty_stop(struct tty_struct *tty)
 {
 	struct dgnc_board *bd;
@@ -2451,7 +2447,6 @@ static void dgnc_tty_stop(struct tty_struct *tty)
 	spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
-
 /*
  * dgnc_tty_flush_chars()
  *
@@ -2494,8 +2489,6 @@ static void dgnc_tty_flush_chars(struct tty_struct *tty)
 	spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
-
-
 /*
  * dgnc_tty_flush_buffer()
  *
@@ -2540,8 +2533,6 @@ static void dgnc_tty_flush_buffer(struct tty_struct *tty)
 	spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
-
-
 /*****************************************************************************
  *
  * The IOCTL function and all of its helpers
@@ -2554,7 +2545,7 @@ static void dgnc_tty_flush_buffer(struct tty_struct *tty)
  * The usual assortment of ioctl's
  */
 static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
-		unsigned long arg)
+			  unsigned long arg)
 {
 	struct dgnc_board *bd;
 	struct channel_t *ch;
@@ -2586,7 +2577,6 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 	}
 
 	switch (cmd) {
-
 	/* Here are all the standard ioctl's that we MUST implement */
 
 	case TCSBRK:
@@ -2617,7 +2607,6 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 
 		return 0;
 
-
 	case TCSBRKP:
 		/* support for POSIX tcsendbreak()
 		 * According to POSIX.1 spec (7.2.2.1.2) breaks should be
@@ -2668,7 +2657,8 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 
 		spin_unlock_irqrestore(&ch->ch_lock, flags);
 
-		rc = put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *) arg);
+		rc = put_user(C_CLOCAL(tty) ? 1 : 0,
+			     (unsigned long __user *) arg);
 		return rc;
 
 	case TIOCSSOFTCAR:
@@ -2679,7 +2669,8 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 			return rc;
 
 		spin_lock_irqsave(&ch->ch_lock, flags);
-		tty->termios.c_cflag = ((tty->termios.c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
+		tty->termios.c_cflag = ((tty->termios.c_cflag & ~CLOCAL)
+					| (arg ? CLOCAL : 0));
 		ch->ch_bd->bd_ops->param(tty);
 		spin_unlock_irqrestore(&ch->ch_lock, flags);
 
@@ -2736,7 +2727,6 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 					ch->ch_pun.un_flags &= ~(UN_LOW|UN_EMPTY);
 					wake_up_interruptible(&ch->ch_pun.un_flags_wait);
 				}
-
 			}
 		}
 
@@ -2797,7 +2787,6 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 
 		/* set information for ditty */
 		if (cmd == (DIGI_SETAW)) {
-
 			spin_unlock_irqrestore(&ch->ch_lock, flags);
 			rc = ch->ch_bd->bd_ops->drain(tty, 0);
 
@@ -2817,7 +2806,8 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 	case DIGI_LOOPBACK:
 		{
 			uint loopback = 0;
-			/* Let go of locks when accessing user space, could sleep */
+			/* Let go of locks when accessing user space,
+			 * could sleep */
 			spin_unlock_irqrestore(&ch->ch_lock, flags);
 			rc = get_user(loopback, (unsigned int __user *) arg);
 			if (rc)
@@ -2918,7 +2908,8 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 		if ((ch->ch_flags & CH_STOP) || (ch->ch_flags & CH_FORCED_STOP))
 			events |= (EV_OPU | EV_OPS);
 
-		if ((ch->ch_flags & CH_STOPI) || (ch->ch_flags & CH_FORCED_STOPI))
+		if ((ch->ch_flags & CH_STOPI) ||
+		    (ch->ch_flags & CH_FORCED_STOPI))
 			events |= (EV_IPU | EV_IPS);
 
 		spin_unlock_irqrestore(&ch->ch_lock, flags);
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ