aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/line.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-01-06 03:18:50 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:45 -0500
commitd50084a2991f3d9490d5c0f3af72e6fe1515a493 (patch)
tree051d6c46ddab1ee47db40252cdad4cbbe0a04f5b /arch/um/drivers/line.c
parent1b57e9c27882a908f180d4daf72ee12c6f137178 (diff)
[PATCH] uml: Formatting changes
This patch makes a bunch of non-functional changes - return(foo); becomes return foo; some statements are broken across lines for readability some trailing whitespace is cleaned up open_one_chan took four arguments, three of which could be deduced from the first. Accordingly, they were eliminated. some examples of "} else {" had a newline added some whitespace cleanup in the indentation lines_init got some control flow cleanup some long lines were broken removed another emacs-specific C formatting comment Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/drivers/line.c')
-rw-r--r--arch/um/drivers/line.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index c31fc541e210..2ee00cbe8f9a 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -124,7 +124,8 @@ static int buffer_data(struct line *line, const char *buf, int len)
124 if (len < end){ 124 if (len < end){
125 memcpy(line->tail, buf, len); 125 memcpy(line->tail, buf, len);
126 line->tail += len; 126 line->tail += len;
127 } else { 127 }
128 else {
128 /* The circular buffer is wrapping */ 129 /* The circular buffer is wrapping */
129 memcpy(line->tail, buf, end); 130 memcpy(line->tail, buf, end);
130 buf += end; 131 buf += end;
@@ -170,7 +171,7 @@ static int flush_buffer(struct line *line)
170 } 171 }
171 172
172 count = line->tail - line->head; 173 count = line->tail - line->head;
173 n = write_chan(&line->chan_list, line->head, count, 174 n = write_chan(&line->chan_list, line->head, count,
174 line->driver->write_irq); 175 line->driver->write_irq);
175 176
176 if(n < 0) 177 if(n < 0)
@@ -227,7 +228,7 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
227 if (err <= 0 && (err != -EAGAIN || !ret)) 228 if (err <= 0 && (err != -EAGAIN || !ret))
228 ret = err; 229 ret = err;
229 } else { 230 } else {
230 n = write_chan(&line->chan_list, buf, len, 231 n = write_chan(&line->chan_list, buf, len,
231 line->driver->write_irq); 232 line->driver->write_irq);
232 if (n < 0) { 233 if (n < 0) {
233 ret = n; 234 ret = n;
@@ -384,13 +385,13 @@ int line_setup_irq(int fd, int input, int output, struct tty_struct *tty)
384 385
385 if (input) 386 if (input)
386 err = um_request_irq(driver->read_irq, fd, IRQ_READ, 387 err = um_request_irq(driver->read_irq, fd, IRQ_READ,
387 line_interrupt, flags, 388 line_interrupt, flags,
388 driver->read_irq_name, tty); 389 driver->read_irq_name, tty);
389 if (err) 390 if (err)
390 return err; 391 return err;
391 if (output) 392 if (output)
392 err = um_request_irq(driver->write_irq, fd, IRQ_WRITE, 393 err = um_request_irq(driver->write_irq, fd, IRQ_WRITE,
393 line_write_interrupt, flags, 394 line_write_interrupt, flags,
394 driver->write_irq_name, tty); 395 driver->write_irq_name, tty);
395 line->have_irq = 1; 396 line->have_irq = 1;
396 return err; 397 return err;
@@ -512,10 +513,11 @@ int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed
512 /* We said con=/ssl= instead of con#=, so we are configuring all 513 /* We said con=/ssl= instead of con#=, so we are configuring all
513 * consoles at once.*/ 514 * consoles at once.*/
514 n = -1; 515 n = -1;
515 } else { 516 }
517 else {
516 n = simple_strtoul(init, &end, 0); 518 n = simple_strtoul(init, &end, 0);
517 if(*end != '='){ 519 if(*end != '='){
518 printk(KERN_ERR "line_setup failed to parse \"%s\"\n", 520 printk(KERN_ERR "line_setup failed to parse \"%s\"\n",
519 init); 521 init);
520 return 0; 522 return 0;
521 } 523 }
@@ -527,7 +529,8 @@ int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed
527 printk("line_setup - %d out of range ((0 ... %d) allowed)\n", 529 printk("line_setup - %d out of range ((0 ... %d) allowed)\n",
528 n, num - 1); 530 n, num - 1);
529 return 0; 531 return 0;
530 } else if (n >= 0){ 532 }
533 else if (n >= 0){
531 if (lines[n].count > 0) { 534 if (lines[n].count > 0) {
532 printk("line_setup - device %d is open\n", n); 535 printk("line_setup - device %d is open\n", n);
533 return 0; 536 return 0;
@@ -541,11 +544,13 @@ int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed
541 lines[n].valid = 1; 544 lines[n].valid = 1;
542 } 545 }
543 } 546 }
544 } else if(!all_allowed){ 547 }
548 else if(!all_allowed){
545 printk("line_setup - can't configure all devices from " 549 printk("line_setup - can't configure all devices from "
546 "mconsole\n"); 550 "mconsole\n");
547 return 0; 551 return 0;
548 } else { 552 }
553 else {
549 for(i = 0; i < num; i++){ 554 for(i = 0; i < num; i++){
550 if(lines[i].init_pri <= INIT_ALL){ 555 if(lines[i].init_pri <= INIT_ALL){
551 lines[i].init_pri = INIT_ALL; 556 lines[i].init_pri = INIT_ALL;
@@ -627,7 +632,7 @@ int line_remove(struct line *lines, unsigned int num, int n)
627} 632}
628 633
629struct tty_driver *line_register_devfs(struct lines *set, 634struct tty_driver *line_register_devfs(struct lines *set,
630 struct line_driver *line_driver, 635 struct line_driver *line_driver,
631 struct tty_operations *ops, struct line *lines, 636 struct tty_operations *ops, struct line *lines,
632 int nlines) 637 int nlines)
633{ 638{
@@ -656,7 +661,7 @@ struct tty_driver *line_register_devfs(struct lines *set,
656 } 661 }
657 662
658 for(i = 0; i < nlines; i++){ 663 for(i = 0; i < nlines; i++){
659 if(!lines[i].valid) 664 if(!lines[i].valid)
660 tty_unregister_device(driver, i); 665 tty_unregister_device(driver, i);
661 } 666 }
662 667
@@ -677,11 +682,12 @@ void lines_init(struct line *lines, int nlines)
677 line = &lines[i]; 682 line = &lines[i];
678 INIT_LIST_HEAD(&line->chan_list); 683 INIT_LIST_HEAD(&line->chan_list);
679 spin_lock_init(&line->lock); 684 spin_lock_init(&line->lock);
680 if(line->init_str != NULL){ 685 if(line->init_str == NULL)
681 line->init_str = kstrdup(line->init_str, GFP_KERNEL); 686 continue;
682 if(line->init_str == NULL) 687
683 printk("lines_init - kstrdup returned NULL\n"); 688 line->init_str = kstrdup(line->init_str, GFP_KERNEL);
684 } 689 if(line->init_str == NULL)
690 printk("lines_init - kstrdup returned NULL\n");
685 } 691 }
686} 692}
687 693
@@ -717,8 +723,7 @@ irqreturn_t winch_interrupt(int irq, void *data, struct pt_regs *unused)
717 tty = winch->tty; 723 tty = winch->tty;
718 if (tty != NULL) { 724 if (tty != NULL) {
719 line = tty->driver_data; 725 line = tty->driver_data;
720 chan_window_size(&line->chan_list, 726 chan_window_size(&line->chan_list, &tty->winsize.ws_row,
721 &tty->winsize.ws_row,
722 &tty->winsize.ws_col); 727 &tty->winsize.ws_col);
723 kill_pg(tty->pgrp, SIGWINCH, 1); 728 kill_pg(tty->pgrp, SIGWINCH, 1);
724 } 729 }
@@ -749,7 +754,7 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty)
749 spin_unlock(&winch_handler_lock); 754 spin_unlock(&winch_handler_lock);
750 755
751 if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt, 756 if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt,
752 SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM, 757 SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM,
753 "winch", winch) < 0) 758 "winch", winch) < 0)
754 printk("register_winch_irq - failed to register IRQ\n"); 759 printk("register_winch_irq - failed to register IRQ\n");
755} 760}
@@ -800,7 +805,7 @@ static void winch_cleanup(void)
800 deactivate_fd(winch->fd, WINCH_IRQ); 805 deactivate_fd(winch->fd, WINCH_IRQ);
801 os_close_file(winch->fd); 806 os_close_file(winch->fd);
802 } 807 }
803 if(winch->pid != -1) 808 if(winch->pid != -1)
804 os_kill_process(winch->pid, 1); 809 os_kill_process(winch->pid, 1);
805 } 810 }
806} 811}