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

Commit cb3714a6 authored by stalinsrinivasan.s's avatar stalinsrinivasan.s Committed by Greg Kroah-Hartman
Browse files

staging: dgnc: fix 80 characters per line limitation and code indent warnings.



This is a patch to the dgnc_cls.c file that
fixes up 80 characters per line and code indent
warnings found by the checkpatch.pl tool.

Signed-off-by: default avatarS. Stalin Srinivasan <stalinsrinivasan.s@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 07300f43
Loading
Loading
Loading
Loading
+139 −105
Original line number Diff line number Diff line
@@ -119,7 +119,10 @@ static inline void cls_set_cts_flow_control(struct channel_t *ch)
	/* Write old LCR value back out, which turns enhanced access off */
	writeb(lcrb, &ch->ch_cls_uart->lcr);

	/* Enable interrupts for CTS flow, turn off interrupts for received XOFF chars */
	/*
	 * Enable interrupts for CTS flow, turn off interrupts for
	 * received XOFF chars
	 */
	ier |= (UART_EXAR654_IER_CTSDSR);
	ier &= ~(UART_EXAR654_IER_XOFF);
	writeb(ier, &ch->ch_cls_uart->ier);
@@ -167,7 +170,10 @@ static inline void cls_set_ixon_flow_control(struct channel_t *ch)
	/* Write old LCR value back out, which turns enhanced access off */
	writeb(lcrb, &ch->ch_cls_uart->lcr);

	/* Disable interrupts for CTS flow, turn on interrupts for received XOFF chars */
	/*
	 * Disable interrupts for CTS flow, turn on interrupts for
	 * received XOFF chars
	 */
	ier &= ~(UART_EXAR654_IER_CTSDSR);
	ier |= (UART_EXAR654_IER_XOFF);
	writeb(ier, &ch->ch_cls_uart->ier);
@@ -207,7 +213,10 @@ static inline void cls_set_no_output_flow_control(struct channel_t *ch)
	/* Write old LCR value back out, which turns enhanced access off */
	writeb(lcrb, &ch->ch_cls_uart->lcr);

	/* Disable interrupts for CTS flow, turn off interrupts for received XOFF chars */
	/*
	 * Disable interrupts for CTS flow, turn off interrupts for
	 * received XOFF chars
	 */
	ier &= ~(UART_EXAR654_IER_CTSDSR);
	ier &= ~(UART_EXAR654_IER_XOFF);
	writeb(ier, &ch->ch_cls_uart->ier);
@@ -385,7 +394,8 @@ static inline void cls_clear_break(struct channel_t *ch, int force)
			writeb((temp & ~UART_LCR_SBC), &ch->ch_cls_uart->lcr);
			ch->ch_flags &= ~(CH_BREAK_SENDING);
			ch->ch_stop_sending_break = 0;
			DPR_IOCTL(("Finishing UART_LCR_SBC! finished: %lx\n", jiffies));
			DPR_IOCTL(("Finishing UART_LCR_SBC! finished: %lx\n",
								jiffies));
		}
	}
	DGNC_UNLOCK(ch->ch_lock, lock_flags);
@@ -420,7 +430,8 @@ static inline void cls_parse_isr(struct dgnc_board *brd, uint port)
		if (isr & UART_IIR_NO_INT)
			break;

		DPR_INTR(("%s:%d port: %x isr: %x\n", __FILE__, __LINE__, port, isr));
		DPR_INTR(("%s:%d port: %x isr: %x\n", __FILE__, __LINE__,
								 port, isr));

		/* Receive Interrupt pending */
		if (isr & (UART_IIR_RDI | UART_IIR_RDI_TIMEOUT)) {
@@ -495,7 +506,8 @@ static void cls_param(struct tty_struct *tty)
		return;

	DPR_PARAM(("param start: tdev: %x cflags: %x oflags: %x iflags: %x\n",
		ch->ch_tun.un_dev, ch->ch_c_cflag, ch->ch_c_oflag, ch->ch_c_iflag));
		ch->ch_tun.un_dev, ch->ch_c_cflag, ch->ch_c_oflag,
							 ch->ch_c_iflag));

	/*
	 * If baud rate is zero, flush queues, and set mval to drop DTR.
@@ -558,8 +570,12 @@ static void cls_param(struct tty_struct *tty)
				4800,   9600,   19200,  38400 }
		};

		/* Only use the TXPrint baud rate if the terminal unit is NOT open */
		if (!(ch->ch_tun.un_flags & UN_ISOPEN) && (un->un_type == DGNC_PRINT))
		/*
		 * Only use the TXPrint baud rate if the terminal
		 * unit is NOT open
		 */
		if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
					 (un->un_type == DGNC_PRINT))
			baud = C_BAUD(ch->ch_pun.un_tty) & 0xff;
		else
			baud = C_BAUD(ch->ch_tun.un_tty) & 0xff;
@@ -572,7 +588,8 @@ static void cls_param(struct tty_struct *tty)

		jindex = baud;

		if ((iindex >= 0) && (iindex < 4) && (jindex >= 0) && (jindex < 16)) {
		if ((iindex >= 0) && (iindex < 4) && (jindex >= 0) &&
								(jindex < 16)) {
			baud = bauds[iindex][jindex];
		} else {
			DPR_IOCTL(("baud indices were out of range (%d)(%d)",
@@ -598,13 +615,11 @@ static void cls_param(struct tty_struct *tty)
		}
	}

	if (ch->ch_c_cflag & PARENB) {
	if (ch->ch_c_cflag & PARENB)
		lcr |= UART_LCR_PARITY;
	}

	if (!(ch->ch_c_cflag & PARODD)) {
	if (!(ch->ch_c_cflag & PARODD))
		lcr |= UART_LCR_EPAR;
	}

	/*
	 * Not all platforms support mark/space parity,
@@ -653,26 +668,23 @@ static void cls_param(struct tty_struct *tty)
	if (uart_lcr != lcr)
		writeb(lcr, &ch->ch_cls_uart->lcr);

	if (ch->ch_c_cflag & CREAD) {
	if (ch->ch_c_cflag & CREAD)
		ier |= (UART_IER_RDI | UART_IER_RLSI);
	}
	else {
	else
		ier &= ~(UART_IER_RDI | UART_IER_RLSI);
	}

	/*
	 * Have the UART interrupt on modem signal changes ONLY when
	 * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
	 */
	if ((ch->ch_digi.digi_flags & CTSPACE) || (ch->ch_digi.digi_flags & RTSPACE) ||
		(ch->ch_c_cflag & CRTSCTS) || !(ch->ch_digi.digi_flags & DIGI_FORCEDCD) ||
	if ((ch->ch_digi.digi_flags & CTSPACE) ||
		(ch->ch_digi.digi_flags & RTSPACE) ||
		(ch->ch_c_cflag & CRTSCTS) ||
		!(ch->ch_digi.digi_flags & DIGI_FORCEDCD) ||
		!(ch->ch_c_cflag & CLOCAL))
	{
			ier |= UART_IER_MSI;
	}
	else {
	else
			ier &= ~UART_IER_MSI;
	}

	ier |= UART_IER_THRI;

@@ -681,29 +693,33 @@ static void cls_param(struct tty_struct *tty)

	if (ch->ch_digi.digi_flags & CTSPACE || ch->ch_c_cflag & CRTSCTS) {
		cls_set_cts_flow_control(ch);
	}
	else if (ch->ch_c_iflag & IXON) {
		/* If start/stop is set to disable, then we should disable flow control */
		if ((ch->ch_startc == _POSIX_VDISABLE) || (ch->ch_stopc == _POSIX_VDISABLE))
	} else if (ch->ch_c_iflag & IXON) {
		/*
		 * If start/stop is set to disable, then we should
		 * disable flow control
		 */
		if ((ch->ch_startc == _POSIX_VDISABLE) ||
					 (ch->ch_stopc == _POSIX_VDISABLE))
			cls_set_no_output_flow_control(ch);
		else
			cls_set_ixon_flow_control(ch);
	}
	else {
	} else {
		cls_set_no_output_flow_control(ch);
	}

	if (ch->ch_digi.digi_flags & RTSPACE || ch->ch_c_cflag & CRTSCTS) {
		cls_set_rts_flow_control(ch);
	}
	else if (ch->ch_c_iflag & IXOFF) {
		/* If start/stop is set to disable, then we should disable flow control */
		if ((ch->ch_startc == _POSIX_VDISABLE) || (ch->ch_stopc == _POSIX_VDISABLE))
	} else if (ch->ch_c_iflag & IXOFF) {
		/*
		 * If start/stop is set to disable, then we should disable
		 * flow control
		 */
		if ((ch->ch_startc == _POSIX_VDISABLE) ||
				(ch->ch_stopc == _POSIX_VDISABLE))
			cls_set_no_input_flow_control(ch);
		else
			cls_set_ixoff_flow_control(ch);
	}
	else {
	} else {
		cls_set_no_input_flow_control(ch);
	}

@@ -802,7 +818,8 @@ static irqreturn_t cls_intr(int irq, void *voidbrd)
	unsigned long lock_flags;

	if (!brd) {
		APR(("Received interrupt (%d) with null board associated\n", irq));
		APR(("Received interrupt (%d) with null board associated\n",
									 irq));
		return IRQ_NONE;
	}

@@ -810,7 +827,9 @@ static irqreturn_t cls_intr(int irq, void *voidbrd)
	 * Check to make sure its for us.
	 */
	if (brd->magic != DGNC_BOARD_MAGIC) {
		APR(("Received interrupt (%d) with a board pointer that wasn't ours!\n", irq));
		APR((
		    "Received interrupt (%d) with a board pointer "
						"that wasn't ours!\n", irq));
		return IRQ_NONE;
	}

@@ -826,7 +845,9 @@ static irqreturn_t cls_intr(int irq, void *voidbrd)

	/* If 0, no interrupts pending */
	if (!poll_reg) {
		DPR_INTR(("Kernel interrupted to me, but no pending interrupts...\n"));
		DPR_INTR((
			 "Kernel interrupted to me, but no pending "
							"interrupts...\n"));
		DGNC_UNLOCK(brd->bd_intr_lock, lock_flags);
		return IRQ_NONE;
	}
@@ -834,9 +855,8 @@ static irqreturn_t cls_intr(int irq, void *voidbrd)
	DPR_INTR(("%s:%d poll_reg: %x\n", __FILE__, __LINE__, poll_reg));

	/* Parse each port to find out what caused the interrupt */
	for (i = 0; i < brd->nasync; i++) {
	for (i = 0; i < brd->nasync; i++)
		cls_parse_isr(brd, i);
	}

	/*
	 * Schedule tasklet to more in-depth servicing at a better time.
@@ -885,7 +905,8 @@ static void cls_copy_data_from_uart_to_queue(struct channel_t *ch)
	tail = ch->ch_r_tail;

	/* Store how much space we have left in the queue */
	if ((qleft = tail - head - 1) < 0)
	qleft = (tail - head - 1);
	if (qleft < 0)
		qleft += RQUEUEMASK + 1;

	/*
@@ -912,9 +933,9 @@ static void cls_copy_data_from_uart_to_queue(struct channel_t *ch)
		}

		/*
		 * If our queue is full, we have no choice but to drop some data.
		 * The assumption is that HWFLOW or SWFLOW should have stopped
		 * things way way before we got to this point.
		 * If our queue is full, we have no choice but to drop some
		 * data. The assumption is that HWFLOW or SWFLOW should have
		 * stopped things way way before we got to this point.
		 *
		 * I decided that I wanted to ditch the oldest data first,
		 * I hope thats okay with everyone? Yes? Good.
@@ -928,13 +949,16 @@ static void cls_copy_data_from_uart_to_queue(struct channel_t *ch)
			qleft++;
		}

		ch->ch_equeue[head] = linestatus & (UART_LSR_BI | UART_LSR_PE | UART_LSR_FE);
		ch->ch_equeue[head] = linestatus & (UART_LSR_BI | UART_LSR_PE
								 | UART_LSR_FE);
		ch->ch_rqueue[head] = readb(&ch->ch_cls_uart->txrx);
		dgnc_sniff_nowait_nolock(ch, "UART READ", ch->ch_rqueue + head, 1);
		dgnc_sniff_nowait_nolock(ch, "UART READ",
						 ch->ch_rqueue + head, 1);

		qleft--;

		DPR_READ(("DATA/LSR pair: %x %x\n", ch->ch_rqueue[head], ch->ch_equeue[head]));
		DPR_READ(("DATA/LSR pair: %x %x\n", ch->ch_rqueue[head],
							 ch->ch_equeue[head]));

		if (ch->ch_equeue[head] & UART_LSR_PE)
			ch->ch_err_parity++;
@@ -969,19 +993,16 @@ static int cls_drain(struct tty_struct *tty, uint seconds)
	struct un_t *un;
	int rc = 0;

	if (!tty || tty->magic != TTY_MAGIC) {
	if (!tty || tty->magic != TTY_MAGIC)
		return -ENXIO;
	}

	un = (struct un_t *) tty->driver_data;
	if (!un || un->magic != DGNC_UNIT_MAGIC) {
	if (!un || un->magic != DGNC_UNIT_MAGIC)
		return -ENXIO;
	}

	ch = un->un_ch;
	if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) {
	if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
		return -ENXIO;
	}

	DGNC_LOCK(ch->ch_lock, lock_flags);
	un->un_flags |= UN_EMPTY;
@@ -990,7 +1011,8 @@ static int cls_drain(struct tty_struct *tty, uint seconds)
	/*
	 * NOTE: Do something with time passed in.
	 */
	rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
	rc = wait_event_interruptible(un->un_flags_wait,
					 ((un->un_flags & UN_EMPTY) == 0));

	/* If ret is non-zero, user ctrl-c'ed us */
	if (rc)
@@ -1003,11 +1025,11 @@ static int cls_drain(struct tty_struct *tty, uint seconds)
/* Channel lock MUST be held before calling this function! */
static void cls_flush_uart_write(struct channel_t *ch)
{
	if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) {
	if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
		return;
	}

	writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT), &ch->ch_cls_uart->isr_fcr);
	writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT),
						&ch->ch_cls_uart->isr_fcr);
	udelay(10);

	ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
@@ -1017,9 +1039,8 @@ static void cls_flush_uart_write(struct channel_t *ch)
/* Channel lock MUST be held before calling this function! */
static void cls_flush_uart_read(struct channel_t *ch)
{
	if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) {
	if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
		return;
	}

	/*
	 * For complete POSIX compatibility, we should be purging the
@@ -1032,7 +1053,8 @@ static void cls_flush_uart_read(struct channel_t *ch)
	 * So for now, we will leave the code #ifdef'ed out...
	 */
#if 0
	writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR), &ch->ch_cls_uart->isr_fcr);
	writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR),
					 &ch->ch_cls_uart->isr_fcr);
#endif
	udelay(10);
}
@@ -1059,7 +1081,8 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch)
	}

	/* If port is "stopped", don't send any data to the UART */
	if ((ch->ch_flags & CH_FORCED_STOP) || (ch->ch_flags & CH_BREAK_SENDING)) {
	if ((ch->ch_flags & CH_FORCED_STOP) ||
				 (ch->ch_flags & CH_BREAK_SENDING)) {
		DGNC_UNLOCK(ch->ch_lock, lock_flags);
		return;
	}
@@ -1083,7 +1106,8 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch)

		/*
		 * If RTS Toggle mode is on, turn on RTS now if not already set,
		 * and make sure we get an event when the data transfer has completed.
		 * and make sure we get an event when the data transfer has
		 * completed.
		 */
		if (ch->ch_digi.digi_flags & DIGI_RTS_TOGGLE) {
			if (!(ch->ch_mostat & UART_MCR_RTS)) {
@@ -1095,7 +1119,8 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch)

		/*
		 * If DTR Toggle mode is on, turn on DTR now if not already set,
		 * and make sure we get an event when the data transfer has completed.
		 * and make sure we get an event when the data transfer has
		 * completed.
		 */
		if (ch->ch_digi.digi_flags & DIGI_DTR_TOGGLE) {
			if (!(ch->ch_mostat & UART_MCR_DTR)) {
@@ -1105,7 +1130,8 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch)
			ch->ch_tun.un_flags |= (UN_EMPTY);
		}
		writeb(ch->ch_wqueue[ch->ch_w_tail], &ch->ch_cls_uart->txrx);
		dgnc_sniff_nowait_nolock(ch, "UART WRITE", ch->ch_wqueue + ch->ch_w_tail, 1);
		dgnc_sniff_nowait_nolock(ch, "UART WRITE",
					    ch->ch_wqueue + ch->ch_w_tail, 1);
		DPR_WRITE(("Tx data: %x\n", ch->ch_wqueue[ch->ch_w_tail]));
		ch->ch_w_tail++;
		ch->ch_w_tail &= WQUEUEMASK;
@@ -1130,7 +1156,8 @@ static void cls_parse_modem(struct channel_t *ch, uchar signals)
	if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
		return;

	DPR_MSIGS(("cls_parse_modem: port: %d signals: %d\n", ch->ch_portnum, msignals));
	DPR_MSIGS(("cls_parse_modem: port: %d signals: %d\n",
					 ch->ch_portnum, msignals));

	/*
	 * Do altpin switching. Altpin switches DCD and DSR.
@@ -1156,7 +1183,10 @@ static void cls_parse_modem(struct channel_t *ch, uchar signals)
		}
	}

	/* Scrub off lower bits. They signify delta's, which I don't care about */
	/*
	 * Scrub off lower bits. They signify delta's, which I don't
	 * care about
	 */
	signals &= 0xf0;

	if (msignals & UART_MSR_DCD)
@@ -1180,7 +1210,8 @@ static void cls_parse_modem(struct channel_t *ch, uchar signals)
		ch->ch_mistat &= ~UART_MSR_CTS;


	DPR_MSIGS(("Port: %d DTR: %d RTS: %d CTS: %d DSR: %d " "RI: %d CD: %d\n",
	DPR_MSIGS((
		"Port: %d DTR: %d RTS: %d CTS: %d DSR: %d " "RI: %d CD: %d\n",
		ch->ch_portnum,
		!!((ch->ch_mistat | ch->ch_mostat) & UART_MCR_DTR),
		!!((ch->ch_mistat | ch->ch_mostat) & UART_MCR_RTS),
@@ -1262,7 +1293,8 @@ static void cls_uart_init(struct channel_t *ch)
	/* Clear out UART and FIFO */
	readb(&ch->ch_cls_uart->txrx);

	writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT), &ch->ch_cls_uart->isr_fcr);
	writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT),
						 &ch->ch_cls_uart->isr_fcr);
	udelay(10);

	ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
@@ -1302,8 +1334,7 @@ static uint cls_get_uart_bytes_left(struct channel_t *ch)
		if (ch->ch_flags & CH_TX_FIFO_EMPTY)
			tasklet_schedule(&ch->ch_bd->helper_tasklet);
		left = 1;
	}
	else {
	} else {
		ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
		left = 0;
	}
@@ -1333,7 +1364,8 @@ static void cls_send_break(struct channel_t *ch, int msecs)
			writeb((temp & ~UART_LCR_SBC), &ch->ch_cls_uart->lcr);
			ch->ch_flags &= ~(CH_BREAK_SENDING);
			ch->ch_stop_sending_break = 0;
			DPR_IOCTL(("Finishing UART_LCR_SBC! finished: %lx\n", jiffies));
			DPR_IOCTL(("Finishing UART_LCR_SBC! finished: %lx\n",
								     jiffies));
		}
		return;
	}
@@ -1350,7 +1382,9 @@ static void cls_send_break(struct channel_t *ch, int msecs)
		uchar temp = readb(&ch->ch_cls_uart->lcr);
		writeb((temp | UART_LCR_SBC), &ch->ch_cls_uart->lcr);
		ch->ch_flags |= (CH_BREAK_SENDING);
		DPR_IOCTL(("Port %d. Starting UART_LCR_SBC! start: %lx should end: %lx\n",
		DPR_IOCTL((
			"Port %d. Starting UART_LCR_SBC! start: %lx "
			"should end: %lx\n",
			ch->ch_portnum, jiffies, ch->ch_stop_sending_break));
	}
}
@@ -1392,9 +1426,9 @@ static void cls_vpd(struct dgnc_board *brd)
	/* Store the VPD into our buffer */
	for (i = 0; i < 0x40; i++) {
		brd->vpd[i] = readb(re_map_vpdbase + i);
		printk("%x ", brd->vpd[i]);
		pr_info("%x ", brd->vpd[i]);
	}
	printk("\n");
	pr_info("\n");

	if (re_map_vpdbase)
		iounmap(re_map_vpdbase);