Skip to content

Commit b8ac089

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 12ed292 commit b8ac089

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
@@ -102,14 +102,17 @@ struct uart_sunzilog_port {
102102

103103
static void sunzilog_putchar(struct uart_port *port, int ch);
104104

105-
#define ZILOG_CHANNEL_FROM_PORT(PORT) ((struct zilog_channel __iomem *)((PORT)->membase))
106-
#define UART_ZILOG(PORT) ((struct uart_sunzilog_port *)(PORT))
105+
#define ZILOG_CHANNEL_FROM_PORT(PORT) \
106+
((struct zilog_channel __iomem *)((PORT)->membase))
107+
#define UART_ZILOG(PORT) \
108+
((struct uart_sunzilog_port *)(PORT))
107109

108110
#define ZS_IS_KEYB(UP) ((UP)->flags & SUNZILOG_FLAG_CONS_KEYB)
109111
#define ZS_IS_MOUSE(UP) ((UP)->flags & SUNZILOG_FLAG_CONS_MOUSE)
110112
#define ZS_IS_CONS(UP) ((UP)->flags & SUNZILOG_FLAG_IS_CONS)
111113
#define ZS_IS_KGDB(UP) ((UP)->flags & SUNZILOG_FLAG_IS_KGDB)
112-
#define ZS_WANTS_MODEM_STATUS(UP) ((UP)->flags & SUNZILOG_FLAG_MODEM_STATUS)
114+
#define ZS_WANTS_MODEM_STATUS(UP) \
115+
((UP)->flags & SUNZILOG_FLAG_MODEM_STATUS)
113116
#define ZS_IS_CHANNEL_A(UP) ((UP)->flags & SUNZILOG_FLAG_IS_CHANNEL_A)
114117
#define ZS_REGS_HELD(UP) ((UP)->flags & SUNZILOG_FLAG_REGS_HELD)
115118
#define ZS_TX_STOPPED(UP) ((UP)->flags & SUNZILOG_FLAG_TX_STOPPED)
@@ -172,7 +175,8 @@ static void sunzilog_clear_fifo(struct zilog_channel __iomem *channel)
172175
/* This function must only be called when the TX is not busy. The UART
173176
* port lock must be held and local interrupts disabled.
174177
*/
175-
static int __load_zsregs(struct zilog_channel __iomem *channel, unsigned char *regs)
178+
static int __load_zsregs(struct zilog_channel __iomem *channel,
179+
unsigned char *regs)
176180
{
177181
int i;
178182
int escc;
@@ -181,6 +185,7 @@ static int __load_zsregs(struct zilog_channel __iomem *channel, unsigned char *r
181185
/* Let pending transmits finish. */
182186
for (i = 0; i < 1000; i++) {
183187
unsigned char stat = read_zsreg(channel, R1);
188+
184189
if (stat & ALL_SNT)
185190
break;
186191
udelay(100);
@@ -224,7 +229,7 @@ static int __load_zsregs(struct zilog_channel __iomem *channel, unsigned char *r
224229
/* Lower and upper byte of baud rate generator divisor. */
225230
write_zsreg(channel, R12, regs[R12]);
226231
write_zsreg(channel, R13, regs[R13]);
227-
232+
228233
/* Now rewrite R14, with BRENAB (if set). */
229234
write_zsreg(channel, R14, regs[R14]);
230235

@@ -269,11 +274,10 @@ static void sunzilog_maybe_update_regs(struct uart_sunzilog_port *up,
269274
struct zilog_channel __iomem *channel)
270275
{
271276
if (!ZS_REGS_HELD(up)) {
272-
if (ZS_TX_ACTIVE(up)) {
277+
if (ZS_TX_ACTIVE(up))
273278
up->flags |= SUNZILOG_FLAG_REGS_HELD;
274-
} else {
279+
else
275280
__load_zsregs(channel, up->curregs);
276-
}
277281
}
278282
}
279283

@@ -370,8 +374,7 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up,
370374
up->port.icount.brk++;
371375
if (uart_handle_break(&up->port))
372376
continue;
373-
}
374-
else if (r1 & PAR_ERR)
377+
} else if (r1 & PAR_ERR)
375378
up->port.icount.parity++;
376379
else if (r1 & CRC_ERR)
377380
up->port.icount.frame++;
@@ -390,7 +393,7 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up,
390393

391394
if (up->port.ignore_status_mask == 0xff ||
392395
(r1 & up->port.ignore_status_mask) == 0) {
393-
tty_insert_flip_char(port, ch, flag);
396+
tty_insert_flip_char(port, ch, flag);
394397
}
395398
if (r1 & Rx_OVR)
396399
tty_insert_flip_char(port, 0, TTY_OVERRUN);
@@ -433,9 +436,9 @@ static void sunzilog_status_handle(struct uart_sunzilog_port *up,
433436
if (status & SYNC)
434437
up->port.icount.dsr++;
435438

436-
/* The Zilog just gives us an interrupt when DCD/CTS/etc. change.
437-
* But it does not tell us which bit has changed, we have to keep
438-
* track of this ourselves.
439+
/* The Zilog just gives us an interrupt when DCD/CTS/etc.
440+
* change.But it does not tell us which bit has changed,
441+
* we have to keep track of this ourselves.
439442
*/
440443
if ((status ^ up->prev_status) ^ DCD)
441444
uart_handle_dcd_change(&up->port,
@@ -457,15 +460,17 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up,
457460

458461
if (ZS_IS_CONS(up)) {
459462
unsigned char status = readb(&channel->control);
463+
460464
ZSDELAY();
461465

462466
/* TX still busy? Just wait for the next TX done interrupt.
463467
*
464-
* It can occur because of how we do serial console writes. It would
465-
* be nice to transmit console writes just like we normally would for
466-
* a TTY line. (ie. buffered and TX interrupt driven). That is not
467-
* easy because console writes cannot sleep. One solution might be
468-
* to poll on enough port->xmit space becoming free. -DaveM
468+
* It can occur because of how we do serial console writes.
469+
* It would be nice to transmit console writes just like we
470+
* normally would for a TTY line. (ie. buffered and TX
471+
* interrupt driven). That is not easy because console
472+
* writes cannot sleep. One solution might be to poll on
473+
* enough port->xmit space becoming free. -DaveM
469474
*/
470475
if (!(status & Tx_BUF_EMP))
471476
return;
@@ -586,7 +591,8 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id)
586591
/* A convenient way to quickly get R0 status. The caller must _not_ hold the
587592
* port lock, it is acquired here.
588593
*/
589-
static __inline__ unsigned char sunzilog_read_channel_status(struct uart_port *port)
594+
static inline unsigned char
595+
sunzilog_read_channel_status(struct uart_port *port)
590596
{
591597
struct zilog_channel __iomem *channel;
592598
unsigned char status;
@@ -657,13 +663,13 @@ static void sunzilog_set_mctrl(struct uart_port *port, unsigned int mctrl)
657663
else
658664
clear_bits |= DTR;
659665

660-
/* NOTE: Not subject to 'transmitter active' rule. */
666+
/* NOTE: Not subject to 'transmitter active' rule. */
661667
up->curregs[R5] |= set_bits;
662668
up->curregs[R5] &= ~clear_bits;
663669
write_zsreg(channel, R5, up->curregs[R5]);
664670
}
665671

666-
/* The port lock is held and interrupts are disabled. */
672+
/* The port lock is held and interrupts are disabled. */
667673
static void sunzilog_stop_tx(struct uart_port *port)
668674
{
669675
struct uart_sunzilog_port *up =
@@ -745,7 +751,7 @@ static void sunzilog_enable_ms(struct uart_port *port)
745751
if (new_reg != up->curregs[R15]) {
746752
up->curregs[R15] = new_reg;
747753

748-
/* NOTE: Not subject to 'transmitter active' rule. */
754+
/* NOTE: Not subject to 'transmitter active' rule. */
749755
write_zsreg(channel, R15, up->curregs[R15] & ~WR7pEN);
750756
}
751757
}
@@ -772,7 +778,7 @@ static void sunzilog_break_ctl(struct uart_port *port, int break_state)
772778
if (new_reg != up->curregs[R5]) {
773779
up->curregs[R5] = new_reg;
774780

775-
/* NOTE: Not subject to 'transmitter active' rule. */
781+
/* NOTE: Not subject to 'transmitter active' rule. */
776782
write_zsreg(channel, R5, up->curregs[R5]);
777783
}
778784

@@ -992,7 +998,8 @@ static void sunzilog_config_port(struct uart_port *port, int flags)
992998
}
993999

9941000
/* We do not support letting the user mess with the divisor, IRQ, etc. */
995-
static int sunzilog_verify_port(struct uart_port *port, struct serial_struct *ser)
1001+
static int sunzilog_verify_port(struct uart_port *port,
1002+
struct serial_struct *ser)
9961003
{
9971004
return -EINVAL;
9981005
}
@@ -1135,6 +1142,7 @@ static void sunzilog_putchar(struct uart_port *port, int ch)
11351142
*/
11361143
do {
11371144
unsigned char val = readb(&channel->control);
1145+
11381146
if (val & Tx_BUF_EMP) {
11391147
ZSDELAY();
11401148
break;
@@ -1233,15 +1241,34 @@ static int __init sunzilog_console_setup(struct console *con, char *options)
12331241
* this hackish cflag thing is OK.
12341242
*/
12351243
switch (con->cflag & CBAUD) {
1236-
case B150: baud = 150; break;
1237-
case B300: baud = 300; break;
1238-
case B600: baud = 600; break;
1239-
case B1200: baud = 1200; break;
1240-
case B2400: baud = 2400; break;
1241-
case B4800: baud = 4800; break;
1242-
default: case B9600: baud = 9600; break;
1243-
case B19200: baud = 19200; break;
1244-
case B38400: baud = 38400; break;
1244+
case B150:
1245+
baud = 150;
1246+
break;
1247+
case B300:
1248+
baud = 300;
1249+
break;
1250+
case B600:
1251+
baud = 600;
1252+
break;
1253+
case B1200:
1254+
baud = 1200;
1255+
break;
1256+
case B2400:
1257+
baud = 2400;
1258+
break;
1259+
case B4800:
1260+
baud = 4800;
1261+
break;
1262+
default:
1263+
case B9600:
1264+
baud = 9600;
1265+
break;
1266+
case B19200:
1267+
baud = 19200;
1268+
break;
1269+
case B38400:
1270+
baud = 38400;
1271+
break;
12451272
}
12461273

12471274
brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
@@ -1376,9 +1403,9 @@ static void sunzilog_init_hw(struct uart_sunzilog_port *up)
13761403
up->curregs[R14] = BRSRC | BRENAB;
13771404
up->curregs[R15] = FIFOEN; /* Use FIFO if on ESCC */
13781405
up->curregs[R7p] = TxFIFO_LVL | RxFIFO_LVL;
1379-
if (__load_zsregs(channel, up->curregs)) {
1406+
if (__load_zsregs(channel, up->curregs))
13801407
up->flags |= SUNZILOG_FLAG_ESCC;
1381-
}
1408+
13821409
/* Only enable interrupts if an ISR handler available */
13831410
if (up->flags & SUNZILOG_FLAG_ISR_HANDLER)
13841411
up->curregs[R9] |= MIE;
@@ -1487,12 +1514,12 @@ static int zs_probe(struct platform_device *op)
14871514
}
14881515
uart_inst++;
14891516
} else {
1490-
dev_info(&op->dev, "Keyboard at MMIO 0x%llx (irq = %d) "
1491-
"is a %s\n",
1517+
dev_info(&op->dev,
1518+
"Keyboard at MMIO 0x%llx (irq = %d) is a %s\n",
14921519
(unsigned long long) up[0].port.mapbase,
14931520
op->archdata.irqs[0], sunzilog_type(&up[0].port));
1494-
dev_info(&op->dev, "Mouse at MMIO 0x%llx (irq = %d) "
1495-
"is a %s\n",
1521+
dev_info(&op->dev,
1522+
"Mouse at MMIO 0x%llx (irq = %d) is a %s\n",
14961523
(unsigned long long) up[1].port.mapbase,
14971524
op->archdata.irqs[0], sunzilog_type(&up[1].port));
14981525
kbm_inst++;
@@ -1576,6 +1603,7 @@ static int __init sunzilog_init(void)
15761603

15771604
if (zilog_irq) {
15781605
struct uart_sunzilog_port *up = sunzilog_irq_chain;
1606+
15791607
err = request_irq(zilog_irq, sunzilog_interrupt, IRQF_SHARED,
15801608
"zs", sunzilog_irq_chain);
15811609
if (err)
@@ -1585,7 +1613,10 @@ static int __init sunzilog_init(void)
15851613
while (up) {
15861614
struct zilog_channel __iomem *channel;
15871615

1588-
/* printk (KERN_INFO "Enable IRQ for ZILOG Hardware %p\n", up); */
1616+
/* printk(KERN_INFO
1617+
* "Enable IRQ for ZILOG Hardware %p\n",
1618+
* up);
1619+
*/
15891620
channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
15901621
up->flags |= SUNZILOG_FLAG_ISR_HANDLER;
15911622
up->curregs[R9] |= MIE;
@@ -1622,7 +1653,10 @@ static void __exit sunzilog_exit(void)
16221653
while (up) {
16231654
struct zilog_channel __iomem *channel;
16241655

1625-
/* printk (KERN_INFO "Disable IRQ for ZILOG Hardware %p\n", up); */
1656+
/* printk(KERN_INFO
1657+
* "Disable IRQ for ZILOG Hardware %p\n",
1658+
* up);
1659+
*/
16261660
channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
16271661
up->flags &= ~SUNZILOG_FLAG_ISR_HANDLER;
16281662
up->curregs[R9] &= ~MIE;

0 commit comments

Comments
 (0)