[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1503320081-9209-1-git-send-email-himanshujha199640@gmail.com>
Date: Mon, 21 Aug 2017 18:24:41 +0530
From: Himanshu Jha <himanshujha199640@...il.com>
To: gregkh@...uxfoundation.org
Cc: jslaby@...e.com, linux-kernel@...r.kernel.org,
Himanshu Jha <himanshujha199640@...il.com>
Subject: [PATCH] drivers: tty: Fix improper spaces and braces
Fixes improper spacing by adding/subtracting necessary spaces
around expression and keywords, and removing unnecessary braces.
Signed-off-by: Himanshu Jha <himanshujha199640@...il.com>
---
drivers/tty/amiserial.c | 107 +++++++++++++++++++++++-------------------------
1 file changed, 51 insertions(+), 56 deletions(-)
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 4b057f8..bd07f50 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -16,8 +16,8 @@
* Richard Lucock 28/12/99
*
* Copyright (C) 1991, 1992 Linus Torvalds
- * Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997,
- * 1998, 1999 Theodore Ts'o
+ * Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997,
+ * 1998, 1999 Theodore Ts'o
*
*/
@@ -25,8 +25,8 @@
* Serial driver configuration section. Here are the various options:
*
* SERIAL_PARANOIA_CHECK
- * Check the magic number for the async_structure where
- * ever possible.
+ * Check the magic number for the async_structure where
+ * ever possible.
*/
#include <linux/delay.h>
@@ -44,7 +44,7 @@
#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
#define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \
- tty->name, (info->tport.flags), serial_driver->refcount,info->count,tty->count,s)
+tty->name, (info->tport.flags), serial_driver->refcount, info->count, tty->count, s)
#else
#define DBG_CNT(s)
#endif
@@ -103,7 +103,7 @@ struct serial_state {
int ignore_status_mask;
int timeout;
int quot;
- int IER; /* Interrupt Enable Register */
+ int IER; /* Interrupt Enable Register */
int MCR; /* Modem control register */
int x_char; /* xon/xoff character */
};
@@ -237,12 +237,12 @@ static void rs_start(struct tty_struct *tty)
* rs_interrupt() should try to keep the interrupt handler as fast as
* possible. After you are done making modifications, it is not a bad
* idea to do:
- *
+ *
* gcc -S -DKERNEL -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer serial.c
*
* and look at the resulting assemble code in serial.s.
*
- * - Ted Ts'o (tytso@....edu), 7-Mar-93
+ * - Ted Ts'o (tytso@....edu), 7-Mar-93
* -----------------------------------------------------------------------
*/
@@ -262,10 +262,10 @@ static void receive_chars(struct serial_state *info)
custom.intreq = IF_RBF;
mb();
- if((serdatr & 0x1ff) == 0)
- status |= UART_LSR_BI;
- if(serdatr & SDR_OVRUN)
- status |= UART_LSR_OE;
+ if ((serdatr & 0x1ff) == 0)
+ status |= UART_LSR_BI;
+ if (serdatr & SDR_OVRUN)
+ status |= UART_LSR_OE;
ch = serdatr & 0xff;
icount->rx++;
@@ -390,9 +390,8 @@ static void check_modem_status(struct serial_state *info)
/* update input line counters */
if (dstatus & SER_DSR)
icount->dsr++;
- if (dstatus & SER_DCD) {
+ if (dstatus & SER_DCD)
icount->dcd++;
- }
if (dstatus & SER_CTS)
icount->cts++;
wake_up_interruptible(&port->delta_msr_wait);
@@ -446,7 +445,7 @@ static void check_modem_status(struct serial_state *info)
}
}
-static irqreturn_t ser_vbl_int( int irq, void *data)
+static irqreturn_t ser_vbl_int(int irq, void *data)
{
/* vbl is just a periodic interrupt we tie into to update modem status */
struct serial_state *info = data;
@@ -454,7 +453,7 @@ static irqreturn_t ser_vbl_int( int irq, void *data)
* TBD - is it better to unregister from this interrupt or to
* ignore it if MSI is clear ?
*/
- if(info->IER & UART_IER_MSI)
+ if (info->IER & UART_IER_MSI)
check_modem_status(info);
return IRQ_HANDLED;
}
@@ -516,7 +515,7 @@ static int startup(struct tty_struct *tty, struct serial_state *info)
{
struct tty_port *port = &info->tport;
unsigned long flags;
- int retval=0;
+ int retval = 0;
unsigned long page;
page = get_zeroed_page(GFP_KERNEL);
@@ -744,7 +743,7 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
if (I_IGNBRK(tty)) {
info->ignore_status_mask |= UART_LSR_BI;
/*
- * If we're ignore parity and break indicators, ignore
+ * If we're ignore parity and break indicators, ignore
* overruns too. (For real raw support).
*/
if (I_IGNPAR(tty))
@@ -765,7 +764,7 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
/* Enable or disable parity bit */
- if(cval & UART_LCR_PARITY)
+ if (cval & UART_LCR_PARITY)
serper |= (SERPER_PARENB);
custom.serper = serper;
@@ -826,7 +825,7 @@ static void rs_flush_chars(struct tty_struct *tty)
local_irq_restore(flags);
}
-static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count)
+static int rs_write(struct tty_struct *tty, const unsigned char *buf, int count)
{
int c, ret = 0;
struct serial_state *info = tty->driver_data;
@@ -845,9 +844,8 @@ static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count
SERIAL_XMIT_SIZE);
if (count < c)
c = count;
- if (c <= 0) {
+ if (c <= 0)
break;
- }
memcpy(info->xmit.buf + info->xmit.head, buf, c);
info->xmit.head = ((info->xmit.head + c) &
(SERIAL_XMIT_SIZE-1));
@@ -922,7 +920,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
/* Check this ! */
local_irq_save(flags);
- if(!(custom.intenar & IF_TBE)) {
+ if (!(custom.intenar & IF_TBE)) {
custom.intena = IF_SETCLR | IF_TBE;
mb();
/* set a pending Tx Interrupt, transmitter should restart now */
@@ -938,12 +936,12 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
/*
* ------------------------------------------------------------
* rs_throttle()
- *
+ *
* This routine is called by the upper-layer tty layer to signal that
* incoming characters should be throttled.
* ------------------------------------------------------------
*/
-static void rs_throttle(struct tty_struct * tty)
+static void rs_throttle(struct tty_struct *tty)
{
struct serial_state *info = tty->driver_data;
unsigned long flags;
@@ -965,7 +963,7 @@ static void rs_throttle(struct tty_struct * tty)
local_irq_restore(flags);
}
-static void rs_unthrottle(struct tty_struct * tty)
+static void rs_unthrottle(struct tty_struct *tty)
{
struct serial_state *info = tty->driver_data;
unsigned long flags;
@@ -996,10 +994,9 @@ static void rs_unthrottle(struct tty_struct * tty)
*/
static int get_serial_info(struct tty_struct *tty, struct serial_state *state,
- struct serial_struct __user * retinfo)
+ struct serial_struct __user *retinfo)
{
struct serial_struct tmp;
-
memset(&tmp, 0, sizeof(tmp));
tty_lock(tty);
tmp.line = tty->index;
@@ -1011,20 +1008,20 @@ static int get_serial_info(struct tty_struct *tty, struct serial_state *state,
tmp.closing_wait = state->tport.closing_wait;
tmp.custom_divisor = state->custom_divisor;
tty_unlock(tty);
- if (copy_to_user(retinfo,&tmp,sizeof(*retinfo)))
+ if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
return -EFAULT;
return 0;
}
static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
- struct serial_struct __user * new_info)
+ struct serial_struct __user *new_info)
{
struct tty_port *port = &state->tport;
struct serial_struct new_serial;
bool change_spd;
- int retval = 0;
+ int retval = 0;
- if (copy_from_user(&new_serial,new_info,sizeof(new_serial)))
+ if (copy_from_user(&new_serial, new_info, sizeof(new_serial)))
return -EFAULT;
tty_lock(tty);
@@ -1035,7 +1032,7 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
tty_unlock(tty);
return -EINVAL;
}
-
+
if (!serial_isroot()) {
if ((new_serial.baud_base != state->baud_base) ||
(new_serial.close_delay != port->close_delay) ||
@@ -1092,7 +1089,7 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
* release the bus after transmitting. This must be done when
* the transmit shift register is empty, not be done when the
* transmit holding register is empty. This functionality
- * allows an RS485 driver to be written in user space.
+ * allows an RS485 driver to be written in user space.
*/
static int get_lsr_info(struct serial_state *info, unsigned int __user *value)
{
@@ -1256,20 +1253,20 @@ static int rs_ioctl(struct tty_struct *tty,
cprev = info->icount;
local_irq_restore(flags);
while (1) {
- prepare_to_wait(&info->tport.delta_msr_wait,&wait,
+ prepare_to_wait(&info->tport.delta_msr_wait, &wait,
TASK_INTERRUPTIBLE);
local_irq_save(flags);
cnow = info->icount; /* atomic copy */
local_irq_restore(flags);
- if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
+ if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) {
ret = -EIO; /* no change => error */
break;
}
- if ( ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
+ if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
- ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)) ) {
+ ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
ret = 0;
break;
}
@@ -1287,7 +1284,7 @@ static int rs_ioctl(struct tty_struct *tty,
case TIOCSERGWILD:
case TIOCSERSWILD:
/* "setserial -W" is called in Debian boot */
- printk ("TIOCSER?WILD ioctl obsolete, ignored.\n");
+ printk("TIOCSER?WILD ioctl obsolete, ignored.\n");
return 0;
default:
return -ENOIOCTLCMD;
@@ -1342,14 +1339,14 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
/*
* ------------------------------------------------------------
* rs_close()
- *
+ *
* This routine is called when the serial port gets closed. First, we
* wait for the last remaining data to be sent. Then, we unlink its
* async structure from the interrupt chain if necessary, and we free
* that IRQ if nothing is left in the chain.
* ------------------------------------------------------------
*/
-static void rs_close(struct tty_struct *tty, struct file * filp)
+static void rs_close(struct tty_struct *tty, struct file *filp)
{
struct serial_state *state = tty->driver_data;
struct tty_port *port = &state->tport;
@@ -1384,7 +1381,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
}
shutdown(tty, state);
rs_flush_buffer(tty);
-
+
tty_ldisc_flush(tty);
port->tty = NULL;
@@ -1412,7 +1409,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
* Set the check interval to be 1/5 of the estimated time to
* send a single character, and make it at least 1. The check
* interval should also be less than the timeout.
- *
+ *
* Note: we have to use pretty tight timings here to satisfy
* the NIST-PCTS.
*/
@@ -1437,7 +1434,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
printk("In rs_wait_until_sent(%d) check=%lu...", timeout, char_time);
printk("jiff=%lu...", jiffies);
#endif
- while(!((lsr = custom.serdatr) & SDR_TSRE)) {
+ while (!((lsr = custom.serdatr) & SDR_TSRE)) {
#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
printk("serdatr = %d (jiff=%lu)...", lsr, jiffies);
#endif
@@ -1478,7 +1475,7 @@ static void rs_hangup(struct tty_struct *tty)
* the IRQ chain. It also performs the serial-specific
* initialization for the tty structure.
*/
-static int rs_open(struct tty_struct *tty, struct file * filp)
+static int rs_open(struct tty_struct *tty, struct file *filp)
{
struct serial_state *info = rs_table + tty->index;
struct tty_port *port = &info->tport;
@@ -1494,9 +1491,8 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
retval = startup(tty, info);
- if (retval) {
+ if (retval)
return retval;
- }
return tty_port_block_til_ready(port, tty, filp);
}
@@ -1520,15 +1516,15 @@ static inline void line_info(struct seq_file *m, int line,
stat_buf[0] = 0;
stat_buf[1] = 0;
- if(!(control & SER_RTS))
+ if (!(control & SER_RTS))
strcat(stat_buf, "|RTS");
- if(!(status & SER_CTS))
+ if (!(status & SER_CTS))
strcat(stat_buf, "|CTS");
- if(!(control & SER_DTR))
+ if (!(control & SER_DTR))
strcat(stat_buf, "|DTR");
- if(!(status & SER_DSR))
+ if (!(status & SER_DSR))
strcat(stat_buf, "|DSR");
- if(!(status & SER_DCD))
+ if (!(status & SER_DCD))
strcat(stat_buf, "|CD");
if (state->quot)
@@ -1589,10 +1585,9 @@ static const struct file_operations rs_proc_fops = {
*/
static void show_serial_version(void)
{
- printk(KERN_INFO "%s version %s\n", serial_name, serial_version);
+ printk(KERN_INFO "%s version %s\n", serial_name, serial_version);
}
-
static const struct tty_operations serial_ops = {
.open = rs_open,
.close = rs_close,
@@ -1650,7 +1645,7 @@ static const struct tty_port_operations amiga_port_ops = {
static int __init amiga_serial_probe(struct platform_device *pdev)
{
unsigned long flags;
- struct serial_state * state;
+ struct serial_state *state;
int error;
serial_driver = alloc_tty_driver(NR_PORTS);
@@ -1676,7 +1671,7 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
state = rs_table;
state->port = (int)&custom.serdatr; /* Just to give it a value */
state->custom_divisor = 0;
- state->icount.cts = state->icount.dsr =
+ state->icount.cts = state->icount.dsr =
state->icount.rng = state->icount.dcd = 0;
state->icount.rx = state->icount.tx = 0;
state->icount.frame = state->icount.parity = 0;
--
2.7.4
Powered by blists - more mailing lists