Skip to content

Commit e341a63

Browse files
committed
drivers: tty: serial: sunzilog: fix formatting issues
Fix checkpatch warnings: WARNING: Use #include <linux/io.h> instead of <asm/io.h> torvalds#38: FILE: drivers/tty/serial/sunzilog.c:38: +#include <asm/io.h> WARNING: line over 80 characters torvalds#109: FILE: drivers/tty/serial/sunzilog.c:109: +#define ZILOG_CHANNEL_FROM_PORT(PORT) ((struct zilog_channel __iomem *)((PORT)->membase)) WARNING: line over 80 characters torvalds#116: FILE: drivers/tty/serial/sunzilog.c:116: +#define ZS_WANTS_MODEM_STATUS(UP) ((UP)->flags & SUNZILOG_FLAG_MODEM_STATUS) WARNING: line over 80 characters torvalds#179: FILE: drivers/tty/serial/sunzilog.c:179: +static int __load_zsregs(struct zilog_channel __iomem *channel, unsigned char *regs) WARNING: Missing a blank line after declarations torvalds#188: FILE: drivers/tty/serial/sunzilog.c:188: + unsigned char stat = read_zsreg(channel, R1); + if (stat & ALL_SNT) ERROR: trailing whitespace torvalds#231: FILE: drivers/tty/serial/sunzilog.c:231: +^I$ WARNING: braces {} are not necessary for any arm of this statement torvalds#276: FILE: drivers/tty/serial/sunzilog.c:276: + if (ZS_TX_ACTIVE(up)) { [...] + } else { [...] ERROR: else should follow close brace '}' torvalds#378: FILE: drivers/tty/serial/sunzilog.c:378: + } + else if (r1 & PAR_ERR) ERROR: code indent should use tabs where possible torvalds#397: FILE: drivers/tty/serial/sunzilog.c:397: +^I^I ^Itty_insert_flip_char(port, ch, flag);$ WARNING: please, no space before tabs torvalds#397: FILE: drivers/tty/serial/sunzilog.c:397: +^I^I ^Itty_insert_flip_char(port, ch, flag);$ WARNING: line over 80 characters torvalds#440: FILE: drivers/tty/serial/sunzilog.c:440: + /* The Zilog just gives us an interrupt when DCD/CTS/etc. change. WARNING: line over 80 characters torvalds#441: FILE: drivers/tty/serial/sunzilog.c:441: + * But it does not tell us which bit has changed, we have to keep WARNING: Missing a blank line after declarations torvalds#464: FILE: drivers/tty/serial/sunzilog.c:464: + unsigned char status = readb(&channel->control); + ZSDELAY(); WARNING: line over 80 characters torvalds#468: FILE: drivers/tty/serial/sunzilog.c:468: + * It can occur because of how we do serial console writes. It would WARNING: line over 80 characters torvalds#469: FILE: drivers/tty/serial/sunzilog.c:469: + * be nice to transmit console writes just like we normally would for WARNING: line over 80 characters torvalds#470: FILE: drivers/tty/serial/sunzilog.c:470: + * a TTY line. (ie. buffered and TX interrupt driven). That is not WARNING: line over 80 characters torvalds#471: FILE: drivers/tty/serial/sunzilog.c:471: + * easy because console writes cannot sleep. One solution might be WARNING: line over 80 characters torvalds#593: FILE: drivers/tty/serial/sunzilog.c:593: +static __inline__ unsigned char sunzilog_read_channel_status(struct uart_port *port) WARNING: plain inline is preferred over __inline__ torvalds#593: FILE: drivers/tty/serial/sunzilog.c:593: +static __inline__ unsigned char sunzilog_read_channel_status(struct uart_port *port) ERROR: trailing whitespace torvalds#664: FILE: drivers/tty/serial/sunzilog.c:664: +^I/* NOTE: Not subject to 'transmitter active' rule. */ $ ERROR: trailing whitespace torvalds#752: FILE: drivers/tty/serial/sunzilog.c:752: +^I^I/* NOTE: Not subject to 'transmitter active' rule. */ $ ERROR: trailing whitespace torvalds#779: FILE: drivers/tty/serial/sunzilog.c:779: +^I^I/* NOTE: Not subject to 'transmitter active' rule. */ $ WARNING: line over 80 characters torvalds#999: FILE: drivers/tty/serial/sunzilog.c:999: +static int sunzilog_verify_port(struct uart_port *port, struct serial_struct *ser) WARNING: Missing a blank line after declarations torvalds#1142: FILE: drivers/tty/serial/sunzilog.c:1142: + unsigned char val = readb(&channel->control); + if (val & Tx_BUF_EMP) { WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... #1230: FILE: drivers/tty/serial/sunzilog.c:1230: + printk(KERN_INFO "Console: ttyS%d (SunZilog zs%d)\n", WARNING: braces {} are not necessary for single statement blocks #1383: FILE: drivers/tty/serial/sunzilog.c:1383: + if (__load_zsregs(channel, up->curregs)) { + up->flags |= SUNZILOG_FLAG_ESCC; + } WARNING: quoted string split across lines #1493: FILE: drivers/tty/serial/sunzilog.c:1493: + dev_info(&op->dev, "Keyboard at MMIO 0x%llx (irq = %d) " + "is a %s\n", WARNING: quoted string split across lines #1497: FILE: drivers/tty/serial/sunzilog.c:1497: + dev_info(&op->dev, "Mouse at MMIO 0x%llx (irq = %d) " + "is a %s\n", WARNING: Missing a blank line after declarations #1581: FILE: drivers/tty/serial/sunzilog.c:1581: + struct uart_sunzilog_port *up = sunzilog_irq_chain; + err = request_irq(zilog_irq, sunzilog_interrupt, IRQF_SHARED, WARNING: line over 80 characters #1590: FILE: drivers/tty/serial/sunzilog.c:1590: + /* printk (KERN_INFO "Enable IRQ for ZILOG Hardware %p\n", up); */ WARNING: line over 80 characters #1627: FILE: drivers/tty/serial/sunzilog.c:1627: + /* printk (KERN_INFO "Disable IRQ for ZILOG Hardware %p\n", up); */ ERROR: trailing statements should be on next line #1248: FILE: drivers/tty/serial/sunzilog.c:1248: + case B150: baud = 150; break; ERROR: trailing statements should be on next line #1249: FILE: drivers/tty/serial/sunzilog.c:1249: + case B300: baud = 300; break; ERROR: trailing statements should be on next line #1250: FILE: drivers/tty/serial/sunzilog.c:1250: + case B600: baud = 600; break; ERROR: trailing statements should be on next line #1251: FILE: drivers/tty/serial/sunzilog.c:1251: + case B1200: baud = 1200; break; ERROR: trailing statements should be on next line #1252: FILE: drivers/tty/serial/sunzilog.c:1252: + case B2400: baud = 2400; break; ERROR: trailing statements should be on next line #1253: FILE: drivers/tty/serial/sunzilog.c:1253: + case B4800: baud = 4800; break; ERROR: trailing statements should be on next line #1254: FILE: drivers/tty/serial/sunzilog.c:1254: + default: case B9600: baud = 9600; break; ERROR: trailing statements should be on next line #1255: FILE: drivers/tty/serial/sunzilog.c:1255: + case B19200: baud = 19200; break; ERROR: trailing statements should be on next line #1256: FILE: drivers/tty/serial/sunzilog.c:1256: + case B38400: baud = 38400; break; Signed-off-by: Enrico Weigelt <[email protected]>
1 parent 3f89b3e commit e341a63

File tree

1 file changed

+76
-42
lines changed

1 file changed

+76
-42
lines changed

drivers/tty/serial/sunzilog.c

+76-42
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,17 @@ struct uart_sunzilog_port {
106106

107107
static void sunzilog_putchar(struct uart_port *port, int ch);
108108

109-
#define ZILOG_CHANNEL_FROM_PORT(PORT) ((struct zilog_channel __iomem *)((PORT)->membase))
110-
#define UART_ZILOG(PORT) ((struct uart_sunzilog_port *)(PORT))
109+
#define ZILOG_CHANNEL_FROM_PORT(PORT) \
110+
((struct zilog_channel __iomem *)((PORT)->membase))
111+
#define UART_ZILOG(PORT) \
112+
((struct uart_sunzilog_port *)(PORT))
111113

112114
#define ZS_IS_KEYB(UP) ((UP)->flags & SUNZILOG_FLAG_CONS_KEYB)
113115
#define ZS_IS_MOUSE(UP) ((UP)->flags & SUNZILOG_FLAG_CONS_MOUSE)
114116
#define ZS_IS_CONS(UP) ((UP)->flags & SUNZILOG_FLAG_IS_CONS)
115117
#define ZS_IS_KGDB(UP) ((UP)->flags & SUNZILOG_FLAG_IS_KGDB)
116-
#define ZS_WANTS_MODEM_STATUS(UP) ((UP)->flags & SUNZILOG_FLAG_MODEM_STATUS)
118+
#define ZS_WANTS_MODEM_STATUS(UP) \
119+
((UP)->flags & SUNZILOG_FLAG_MODEM_STATUS)
117120
#define ZS_IS_CHANNEL_A(UP) ((UP)->flags & SUNZILOG_FLAG_IS_CHANNEL_A)
118121
#define ZS_REGS_HELD(UP) ((UP)->flags & SUNZILOG_FLAG_REGS_HELD)
119122
#define ZS_TX_STOPPED(UP) ((UP)->flags & SUNZILOG_FLAG_TX_STOPPED)
@@ -176,7 +179,8 @@ static void sunzilog_clear_fifo(struct zilog_channel __iomem *channel)
176179
/* This function must only be called when the TX is not busy. The UART
177180
* port lock must be held and local interrupts disabled.
178181
*/
179-
static int __load_zsregs(struct zilog_channel __iomem *channel, unsigned char *regs)
182+
static int __load_zsregs(struct zilog_channel __iomem *channel,
183+
unsigned char *regs)
180184
{
181185
int i;
182186
int escc;
@@ -185,6 +189,7 @@ static int __load_zsregs(struct zilog_channel __iomem *channel, unsigned char *r
185189
/* Let pending transmits finish. */
186190
for (i = 0; i < 1000; i++) {
187191
unsigned char stat = read_zsreg(channel, R1);
192+
188193
if (stat & ALL_SNT)
189194
break;
190195
udelay(100);
@@ -228,7 +233,7 @@ static int __load_zsregs(struct zilog_channel __iomem *channel, unsigned char *r
228233
/* Lower and upper byte of baud rate generator divisor. */
229234
write_zsreg(channel, R12, regs[R12]);
230235
write_zsreg(channel, R13, regs[R13]);
231-
236+
232237
/* Now rewrite R14, with BRENAB (if set). */
233238
write_zsreg(channel, R14, regs[R14]);
234239

@@ -273,11 +278,10 @@ static void sunzilog_maybe_update_regs(struct uart_sunzilog_port *up,
273278
struct zilog_channel __iomem *channel)
274279
{
275280
if (!ZS_REGS_HELD(up)) {
276-
if (ZS_TX_ACTIVE(up)) {
281+
if (ZS_TX_ACTIVE(up))
277282
up->flags |= SUNZILOG_FLAG_REGS_HELD;
278-
} else {
283+
else
279284
__load_zsregs(channel, up->curregs);
280-
}
281285
}
282286
}
283287

@@ -374,8 +378,7 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up,
374378
up->port.icount.brk++;
375379
if (uart_handle_break(&up->port))
376380
continue;
377-
}
378-
else if (r1 & PAR_ERR)
381+
} else if (r1 & PAR_ERR)
379382
up->port.icount.parity++;
380383
else if (r1 & CRC_ERR)
381384
up->port.icount.frame++;
@@ -394,7 +397,7 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up,
394397

395398
if (up->port.ignore_status_mask == 0xff ||
396399
(r1 & up->port.ignore_status_mask) == 0) {
397-
tty_insert_flip_char(port, ch, flag);
400+
tty_insert_flip_char(port, ch, flag);
398401
}
399402
if (r1 & Rx_OVR)
400403
tty_insert_flip_char(port, 0, TTY_OVERRUN);
@@ -437,9 +440,9 @@ static void sunzilog_status_handle(struct uart_sunzilog_port *up,
437440
if (status & SYNC)
438441
up->port.icount.dsr++;
439442

440-
/* The Zilog just gives us an interrupt when DCD/CTS/etc. change.
441-
* But it does not tell us which bit has changed, we have to keep
442-
* track of this ourselves.
443+
/* The Zilog just gives us an interrupt when DCD/CTS/etc.
444+
* change.But it does not tell us which bit has changed,
445+
* we have to keep track of this ourselves.
443446
*/
444447
if ((status ^ up->prev_status) ^ DCD)
445448
uart_handle_dcd_change(&up->port,
@@ -461,15 +464,17 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up,
461464

462465
if (ZS_IS_CONS(up)) {
463466
unsigned char status = readb(&channel->control);
467+
464468
ZSDELAY();
465469

466470
/* TX still busy? Just wait for the next TX done interrupt.
467471
*
468-
* It can occur because of how we do serial console writes. It would
469-
* be nice to transmit console writes just like we normally would for
470-
* a TTY line. (ie. buffered and TX interrupt driven). That is not
471-
* easy because console writes cannot sleep. One solution might be
472-
* to poll on enough port->xmit space becoming free. -DaveM
472+
* It can occur because of how we do serial console writes.
473+
* It would be nice to transmit console writes just like we
474+
* normally would for a TTY line. (ie. buffered and TX
475+
* interrupt driven). That is not easy because console
476+
* writes cannot sleep. One solution might be to poll on
477+
* enough port->xmit space becoming free. -DaveM
473478
*/
474479
if (!(status & Tx_BUF_EMP))
475480
return;
@@ -590,7 +595,8 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id)
590595
/* A convenient way to quickly get R0 status. The caller must _not_ hold the
591596
* port lock, it is acquired here.
592597
*/
593-
static __inline__ unsigned char sunzilog_read_channel_status(struct uart_port *port)
598+
static inline unsigned char
599+
sunzilog_read_channel_status(struct uart_port *port)
594600
{
595601
struct zilog_channel __iomem *channel;
596602
unsigned char status;
@@ -661,13 +667,13 @@ static void sunzilog_set_mctrl(struct uart_port *port, unsigned int mctrl)
661667
else
662668
clear_bits |= DTR;
663669

664-
/* NOTE: Not subject to 'transmitter active' rule. */
670+
/* NOTE: Not subject to 'transmitter active' rule. */
665671
up->curregs[R5] |= set_bits;
666672
up->curregs[R5] &= ~clear_bits;
667673
write_zsreg(channel, R5, up->curregs[R5]);
668674
}
669675

670-
/* The port lock is held and interrupts are disabled. */
676+
/* The port lock is held and interrupts are disabled. */
671677
static void sunzilog_stop_tx(struct uart_port *port)
672678
{
673679
struct uart_sunzilog_port *up =
@@ -749,7 +755,7 @@ static void sunzilog_enable_ms(struct uart_port *port)
749755
if (new_reg != up->curregs[R15]) {
750756
up->curregs[R15] = new_reg;
751757

752-
/* NOTE: Not subject to 'transmitter active' rule. */
758+
/* NOTE: Not subject to 'transmitter active' rule. */
753759
write_zsreg(channel, R15, up->curregs[R15] & ~WR7pEN);
754760
}
755761
}
@@ -776,7 +782,7 @@ static void sunzilog_break_ctl(struct uart_port *port, int break_state)
776782
if (new_reg != up->curregs[R5]) {
777783
up->curregs[R5] = new_reg;
778784

779-
/* NOTE: Not subject to 'transmitter active' rule. */
785+
/* NOTE: Not subject to 'transmitter active' rule. */
780786
write_zsreg(channel, R5, up->curregs[R5]);
781787
}
782788

@@ -996,7 +1002,8 @@ static void sunzilog_config_port(struct uart_port *port, int flags)
9961002
}
9971003

9981004
/* We do not support letting the user mess with the divisor, IRQ, etc. */
999-
static int sunzilog_verify_port(struct uart_port *port, struct serial_struct *ser)
1005+
static int sunzilog_verify_port(struct uart_port *port,
1006+
struct serial_struct *ser)
10001007
{
10011008
return -EINVAL;
10021009
}
@@ -1139,6 +1146,7 @@ static void sunzilog_putchar(struct uart_port *port, int ch)
11391146
*/
11401147
do {
11411148
unsigned char val = readb(&channel->control);
1149+
11421150
if (val & Tx_BUF_EMP) {
11431151
ZSDELAY();
11441152
break;
@@ -1237,15 +1245,34 @@ static int __init sunzilog_console_setup(struct console *con, char *options)
12371245
* this hackish cflag thing is OK.
12381246
*/
12391247
switch (con->cflag & CBAUD) {
1240-
case B150: baud = 150; break;
1241-
case B300: baud = 300; break;
1242-
case B600: baud = 600; break;
1243-
case B1200: baud = 1200; break;
1244-
case B2400: baud = 2400; break;
1245-
case B4800: baud = 4800; break;
1246-
default: case B9600: baud = 9600; break;
1247-
case B19200: baud = 19200; break;
1248-
case B38400: baud = 38400; break;
1248+
case B150:
1249+
baud = 150;
1250+
break;
1251+
case B300:
1252+
baud = 300;
1253+
break;
1254+
case B600:
1255+
baud = 600;
1256+
break;
1257+
case B1200:
1258+
baud = 1200;
1259+
break;
1260+
case B2400:
1261+
baud = 2400;
1262+
break;
1263+
case B4800:
1264+
baud = 4800;
1265+
break;
1266+
default:
1267+
case B9600:
1268+
baud = 9600;
1269+
break;
1270+
case B19200:
1271+
baud = 19200;
1272+
break;
1273+
case B38400:
1274+
baud = 38400;
1275+
break;
12491276
}
12501277

12511278
brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
@@ -1380,9 +1407,9 @@ static void sunzilog_init_hw(struct uart_sunzilog_port *up)
13801407
up->curregs[R14] = BRSRC | BRENAB;
13811408
up->curregs[R15] = FIFOEN; /* Use FIFO if on ESCC */
13821409
up->curregs[R7p] = TxFIFO_LVL | RxFIFO_LVL;
1383-
if (__load_zsregs(channel, up->curregs)) {
1410+
if (__load_zsregs(channel, up->curregs))
13841411
up->flags |= SUNZILOG_FLAG_ESCC;
1385-
}
1412+
13861413
/* Only enable interrupts if an ISR handler available */
13871414
if (up->flags & SUNZILOG_FLAG_ISR_HANDLER)
13881415
up->curregs[R9] |= MIE;
@@ -1489,12 +1516,12 @@ static int zs_probe(struct platform_device *op)
14891516
}
14901517
uart_inst++;
14911518
} else {
1492-
dev_info(&op->dev, "Keyboard at MMIO 0x%llx (irq = %d) "
1493-
"is a %s\n",
1519+
dev_info(&op->dev,
1520+
"Keyboard at MMIO 0x%llx (irq = %d) is a %s\n",
14941521
(unsigned long long) up[0].port.mapbase,
14951522
op->archdata.irqs[0], sunzilog_type(&up[0].port));
1496-
dev_info(&op->dev, "Mouse at MMIO 0x%llx (irq = %d) "
1497-
"is a %s\n",
1523+
dev_info(&op->dev,
1524+
"Mouse at MMIO 0x%llx (irq = %d) is a %s\n",
14981525
(unsigned long long) up[1].port.mapbase,
14991526
op->archdata.irqs[0], sunzilog_type(&up[1].port));
15001527
kbm_inst++;
@@ -1578,6 +1605,7 @@ static int __init sunzilog_init(void)
15781605

15791606
if (zilog_irq) {
15801607
struct uart_sunzilog_port *up = sunzilog_irq_chain;
1608+
15811609
err = request_irq(zilog_irq, sunzilog_interrupt, IRQF_SHARED,
15821610
"zs", sunzilog_irq_chain);
15831611
if (err)
@@ -1587,7 +1615,10 @@ static int __init sunzilog_init(void)
15871615
while (up) {
15881616
struct zilog_channel __iomem *channel;
15891617

1590-
/* printk (KERN_INFO "Enable IRQ for ZILOG Hardware %p\n", up); */
1618+
/* printk(KERN_INFO
1619+
* "Enable IRQ for ZILOG Hardware %p\n",
1620+
* up);
1621+
*/
15911622
channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
15921623
up->flags |= SUNZILOG_FLAG_ISR_HANDLER;
15931624
up->curregs[R9] |= MIE;
@@ -1624,7 +1655,10 @@ static void __exit sunzilog_exit(void)
16241655
while (up) {
16251656
struct zilog_channel __iomem *channel;
16261657

1627-
/* printk (KERN_INFO "Disable IRQ for ZILOG Hardware %p\n", up); */
1658+
/* printk(KERN_INFO
1659+
* "Disable IRQ for ZILOG Hardware %p\n",
1660+
* up);
1661+
*/
16281662
channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
16291663
up->flags &= ~SUNZILOG_FLAG_ISR_HANDLER;
16301664
up->curregs[R9] &= ~MIE;

0 commit comments

Comments
 (0)