TTY: simserial, reindent some code

Make the code to conform to the standard. Also make it readable.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jiri Slaby 2012-03-05 14:52:41 +01:00 committed by Greg Kroah-Hartman
parent 8b91633056
commit f66279cd7d

View File

@ -62,28 +62,25 @@ static void receive_chars(struct tty_struct *tty)
static unsigned char seen_esc = 0; static unsigned char seen_esc = 0;
while ( (ch = ia64_ssc(0, 0, 0, 0, SSC_GETCHAR)) ) { while ( (ch = ia64_ssc(0, 0, 0, 0, SSC_GETCHAR)) ) {
if ( ch == 27 && seen_esc == 0 ) { if (ch == 27 && seen_esc == 0) {
seen_esc = 1; seen_esc = 1;
continue; continue;
} else { } else if (seen_esc == 1 && ch == 'O') {
if ( seen_esc==1 && ch == 'O' ) { seen_esc = 2;
seen_esc = 2; continue;
continue; } else if (seen_esc == 2) {
} else if ( seen_esc == 2 ) { if (ch == 'P') /* F1 */
if ( ch == 'P' ) /* F1 */ show_state();
show_state();
#ifdef CONFIG_MAGIC_SYSRQ #ifdef CONFIG_MAGIC_SYSRQ
if ( ch == 'S' ) { /* F4 */ if (ch == 'S') { /* F4 */
do do {
ch = ia64_ssc(0, 0, 0, 0, ch = ia64_ssc(0, 0, 0, 0, SSC_GETCHAR);
SSC_GETCHAR); } while (!ch);
while (!ch); handle_sysrq(ch);
handle_sysrq(ch);
}
#endif
seen_esc = 0;
continue;
} }
#endif
seen_esc = 0;
continue;
} }
seen_esc = 0; seen_esc = 0;
@ -195,8 +192,8 @@ static void rs_flush_chars(struct tty_struct *tty)
{ {
struct serial_state *info = tty->driver_data; struct serial_state *info = tty->driver_data;
if (info->xmit.head == info->xmit.tail || tty->stopped || tty->hw_stopped || if (info->xmit.head == info->xmit.tail || tty->stopped ||
!info->xmit.buf) tty->hw_stopped || !info->xmit.buf)
return; return;
transmit_chars(tty, info, NULL); transmit_chars(tty, info, NULL);
@ -232,10 +229,10 @@ static int rs_write(struct tty_struct * tty,
/* /*
* Hey, we transmit directly from here in our case * Hey, we transmit directly from here in our case
*/ */
if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) &&
&& !tty->stopped && !tty->hw_stopped) { !tty->stopped && !tty->hw_stopped)
transmit_chars(tty, info, NULL); transmit_chars(tty, info, NULL);
}
return ret; return ret;
} }
@ -293,7 +290,8 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
*/ */
static void rs_throttle(struct tty_struct * tty) static void rs_throttle(struct tty_struct * tty)
{ {
if (I_IXOFF(tty)) rs_send_xchar(tty, STOP_CHAR(tty)); if (I_IXOFF(tty))
rs_send_xchar(tty, STOP_CHAR(tty));
printk(KERN_INFO "simrs_throttle called\n"); printk(KERN_INFO "simrs_throttle called\n");
} }
@ -322,48 +320,21 @@ static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
} }
switch (cmd) { switch (cmd) {
case TIOCGSERIAL: case TIOCGSERIAL:
printk(KERN_INFO "simrs_ioctl TIOCGSERIAL called\n"); case TIOCSSERIAL:
return 0; case TIOCSERGSTRUCT:
case TIOCSSERIAL: case TIOCMIWAIT:
printk(KERN_INFO "simrs_ioctl TIOCSSERIAL called\n"); return 0;
return 0; case TIOCSERCONFIG:
case TIOCSERCONFIG: case TIOCSERGETLSR: /* Get line status register */
printk(KERN_INFO "rs_ioctl: TIOCSERCONFIG called\n"); return -EINVAL;
return -EINVAL; case TIOCSERGWILD:
case TIOCSERSWILD:
case TIOCSERGETLSR: /* Get line status register */ /* "setserial -W" is called in Debian boot */
printk(KERN_INFO "rs_ioctl: TIOCSERGETLSR called\n"); printk (KERN_INFO "TIOCSER?WILD ioctl obsolete, ignored.\n");
return -EINVAL; return 0;
}
case TIOCSERGSTRUCT: return -ENOIOCTLCMD;
printk(KERN_INFO "rs_ioctl: TIOCSERGSTRUCT called\n");
#if 0
if (copy_to_user((struct async_struct *) arg,
info, sizeof(struct async_struct)))
return -EFAULT;
#endif
return 0;
/*
* Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change
* - mask passed in arg for lines of interest
* (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
* Caller should use TIOCGICOUNT to see which one it was
*/
case TIOCMIWAIT:
printk(KERN_INFO "rs_ioctl: TIOCMIWAIT: called\n");
return 0;
case TIOCSERGWILD:
case TIOCSERSWILD:
/* "setserial -W" is called in Debian boot */
printk (KERN_INFO "TIOCSER?WILD ioctl obsolete, ignored.\n");
return 0;
default:
return -ENOIOCTLCMD;
}
return 0;
} }
#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
@ -387,14 +358,12 @@ static void shutdown(struct tty_port *port)
unsigned long flags; unsigned long flags;
local_irq_save(flags); local_irq_save(flags);
{ if (info->irq)
if (info->irq) free_irq(info->irq, info);
free_irq(info->irq, info);
if (info->xmit.buf) { if (info->xmit.buf) {
free_page((unsigned long) info->xmit.buf); free_page((unsigned long) info->xmit.buf);
info->xmit.buf = NULL; info->xmit.buf = NULL;
}
} }
local_irq_restore(flags); local_irq_restore(flags);
} }
@ -418,9 +387,8 @@ static int activate(struct tty_port *port, struct tty_struct *tty)
{ {
struct serial_state *state = container_of(port, struct serial_state, struct serial_state *state = container_of(port, struct serial_state,
port); port);
unsigned long flags; unsigned long flags, page;
int retval=0; int retval = 0;
unsigned long page;
page = get_zeroed_page(GFP_KERNEL); page = get_zeroed_page(GFP_KERNEL);
if (!page) if (!page)