linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] staging: dgnc: Fix lines longer than 80 characters
@ 2016-12-04 19:41 Fernando Apesteguia
  2016-12-06  9:12 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Fernando Apesteguia @ 2016-12-04 19:41 UTC (permalink / raw)
  To: lidza.louina
  Cc: markh, gregkh, driverdev-devel, devel, linux-kernel, Fernando Apesteguia

For the first lines of the patch, I opted to create a small function
instead of breaking the the line in a weird way.

This is v2 of the patch with the name of the function changed from
v1

The other changes are simple ones.

Signed-off-by: Fernando Apesteguia <fernando.apesteguia@gmail.com>
---
 drivers/staging/dgnc/dgnc_tty.c | 42 +++++++++++++++++++++++++----------------
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index af4bc86..557b566 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -102,6 +102,7 @@ static int dgnc_tty_write(struct tty_struct *tty, const unsigned char *buf,
 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 void dgnc_set_signal_low(struct channel_t *ch, const unsigned char line);
 
 static const struct tty_operations dgnc_tty_ops = {
 	.open = dgnc_tty_open,
@@ -786,6 +787,12 @@ void dgnc_check_queue_flow_control(struct channel_t *ch)
 	}
 }
 
+static void dgnc_set_signal_low(struct channel_t *ch, const unsigned char sig)
+{
+	ch->ch_mostat &= ~(sig);
+	ch->ch_bd->bd_ops->assert_modem_signals(ch);
+}
+
 void dgnc_wakeup_writes(struct channel_t *ch)
 {
 	int qlen = 0;
@@ -823,19 +830,15 @@ void dgnc_wakeup_writes(struct channel_t *ch)
 				 * If RTS Toggle mode is on, whenever
 				 * the queue and UART is empty, keep RTS low.
 				 */
-				if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
-					ch->ch_mostat &= ~(UART_MCR_RTS);
-					ch->ch_bd->bd_ops->assert_modem_signals(ch);
-				}
+				if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE)
+					dgnc_set_signal_low(ch, UART_MCR_RTS);
 
 				/*
 				 * If DTR Toggle mode is on, whenever
 				 * the queue and UART is empty, keep DTR low.
 				 */
-				if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
-					ch->ch_mostat &= ~(UART_MCR_DTR);
-					ch->ch_bd->bd_ops->assert_modem_signals(ch);
-				}
+				if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE)
+					dgnc_set_signal_low(ch, UART_MCR_DTR);
 			}
 		}
 
@@ -969,8 +972,9 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
 	 * touched safely, the close routine will signal the
 	 * 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));
+	rc = wait_event_interruptible(ch->ch_flags_wait,
+			(((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)
@@ -1188,11 +1192,12 @@ static int dgnc_block_til_ready(struct tty_struct *tty,
 		 */
 		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)));
+				(un->un_flags_wait,
+				 (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.
@@ -2511,13 +2516,15 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 				if (ch->ch_tun.un_flags & (UN_LOW | UN_EMPTY)) {
 					ch->ch_tun.un_flags &=
 						~(UN_LOW | UN_EMPTY);
-					wake_up_interruptible(&ch->ch_tun.un_flags_wait);
+					wake_up_interruptible(&ch->ch_tun
+							.un_flags_wait);
 				}
 
 				if (ch->ch_pun.un_flags & (UN_LOW | UN_EMPTY)) {
 					ch->ch_pun.un_flags &=
 						~(UN_LOW | UN_EMPTY);
-					wake_up_interruptible(&ch->ch_pun.un_flags_wait);
+					wake_up_interruptible(&ch->ch_pun
+							.un_flags_wait);
 				}
 			}
 		}
@@ -2737,7 +2744,10 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 		buf.rxbuf = (ch->ch_r_head - ch->ch_r_tail) & RQUEUEMASK;
 		buf.txbuf = (ch->ch_w_head - ch->ch_w_tail) & WQUEUEMASK;
 
-		/* Is the UART empty? Add that value to whats in our TX queue. */
+		/*
+		 * Is the UART empty?
+		 * Add that value to whats in our TX queue.
+		 */
 
 		count = buf.txbuf + ch_bd_ops->get_uart_bytes_left(ch);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] staging: dgnc: Fix lines longer than 80 characters
  2016-12-04 19:41 [PATCH V2] staging: dgnc: Fix lines longer than 80 characters Fernando Apesteguia
@ 2016-12-06  9:12 ` Greg KH
  2016-12-06 13:27   ` Fernando Apesteguia
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2016-12-06  9:12 UTC (permalink / raw)
  To: Fernando Apesteguia
  Cc: lidza.louina, markh, driverdev-devel, devel, linux-kernel

On Sun, Dec 04, 2016 at 08:41:04PM +0100, Fernando Apesteguia wrote:
> For the first lines of the patch, I opted to create a small function
> instead of breaking the the line in a weird way.
> 
> This is v2 of the patch with the name of the function changed from
> v1

This goes below the --- line.

> 
> The other changes are simple ones.

What does that mean?  Please always be specific.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] staging: dgnc: Fix lines longer than 80 characters
  2016-12-06  9:12 ` Greg KH
@ 2016-12-06 13:27   ` Fernando Apesteguia
  0 siblings, 0 replies; 3+ messages in thread
From: Fernando Apesteguia @ 2016-12-06 13:27 UTC (permalink / raw)
  To: Greg KH; +Cc: lidza.louina, markh, driverdev-devel, devel, linux-kernel

On Tue, Dec 06, 2016 at 10:12:56AM +0100, Greg KH wrote:
> On Sun, Dec 04, 2016 at 08:41:04PM +0100, Fernando Apesteguia wrote:
> > For the first lines of the patch, I opted to create a small function
> > instead of breaking the the line in a weird way.
> > 
> > This is v2 of the patch with the name of the function changed from
> > v1
> 
> This goes below the --- line.
> 
> > 
> > The other changes are simple ones.
> 
> What does that mean?  Please always be specific.

I'll rework the patch.

Thanks.

> 
> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-06 13:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-04 19:41 [PATCH V2] staging: dgnc: Fix lines longer than 80 characters Fernando Apesteguia
2016-12-06  9:12 ` Greg KH
2016-12-06 13:27   ` Fernando Apesteguia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).