Merge branch 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6

* 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6:
tty/serial: fix apbuart build
n_hdlc: fix read and write locking
serial: unbreak billionton CF card
tty: use for_each_console() and WARN() on sysfs failures
vt: fix issue when fbcon wants to takeover a second time.

Fix up trivial conflict in drivers/tty/tty_io.c

+58 -51
+45 -45
drivers/tty/n_hdlc.c
··· 581 __u8 __user *buf, size_t nr) 582 { 583 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); 584 - int ret; 585 struct n_hdlc_buf *rbuf; 586 587 if (debuglevel >= DEBUG_LEVEL_INFO) 588 printk("%s(%d)n_hdlc_tty_read() called\n",__FILE__,__LINE__); ··· 599 return -EFAULT; 600 } 601 602 - tty_lock(); 603 604 for (;;) { 605 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { 606 - tty_unlock(); 607 - return -EIO; 608 } 609 610 - n_hdlc = tty2n_hdlc (tty); 611 - if (!n_hdlc || n_hdlc->magic != HDLC_MAGIC || 612 - tty != n_hdlc->tty) { 613 - tty_unlock(); 614 - return 0; 615 - } 616 617 rbuf = n_hdlc_buf_get(&n_hdlc->rx_buf_list); 618 - if (rbuf) 619 break; 620 621 /* no data */ 622 if (file->f_flags & O_NONBLOCK) { 623 - tty_unlock(); 624 - return -EAGAIN; 625 } 626 - 627 - interruptible_sleep_on (&tty->read_wait); 628 if (signal_pending(current)) { 629 - tty_unlock(); 630 - return -EINTR; 631 } 632 } 633 - 634 - if (rbuf->count > nr) 635 - /* frame too large for caller's buffer (discard frame) */ 636 - ret = -EOVERFLOW; 637 - else { 638 - /* Copy the data to the caller's buffer */ 639 - if (copy_to_user(buf, rbuf->buf, rbuf->count)) 640 - ret = -EFAULT; 641 - else 642 - ret = rbuf->count; 643 - } 644 - 645 - /* return HDLC buffer to free list unless the free list */ 646 - /* count has exceeded the default value, in which case the */ 647 - /* buffer is freed back to the OS to conserve memory */ 648 - if (n_hdlc->rx_free_buf_list.count > DEFAULT_RX_BUF_COUNT) 649 - kfree(rbuf); 650 - else 651 - n_hdlc_buf_put(&n_hdlc->rx_free_buf_list,rbuf); 652 - tty_unlock(); 653 return ret; 654 655 } /* end of n_hdlc_tty_read() */ ··· 690 count = maxframe; 691 } 692 693 - tty_lock(); 694 - 695 add_wait_queue(&tty->write_wait, &wait); 696 - set_current_state(TASK_INTERRUPTIBLE); 697 698 - /* Allocate transmit buffer */ 699 - /* sleep until transmit buffer available */ 700 - while (!(tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list))) { 701 if (file->f_flags & O_NONBLOCK) { 702 error = -EAGAIN; 703 break; ··· 719 } 720 } 721 722 - set_current_state(TASK_RUNNING); 723 remove_wait_queue(&tty->write_wait, &wait); 724 725 if (!error) { ··· 731 n_hdlc_buf_put(&n_hdlc->tx_buf_list,tbuf); 732 n_hdlc_send_frames(n_hdlc,tty); 733 } 734 - tty_unlock(); 735 return error; 736 737 } /* end of n_hdlc_tty_write() */
··· 581 __u8 __user *buf, size_t nr) 582 { 583 struct n_hdlc *n_hdlc = tty2n_hdlc(tty); 584 + int ret = 0; 585 struct n_hdlc_buf *rbuf; 586 + DECLARE_WAITQUEUE(wait, current); 587 588 if (debuglevel >= DEBUG_LEVEL_INFO) 589 printk("%s(%d)n_hdlc_tty_read() called\n",__FILE__,__LINE__); ··· 598 return -EFAULT; 599 } 600 601 + add_wait_queue(&tty->read_wait, &wait); 602 603 for (;;) { 604 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { 605 + ret = -EIO; 606 + break; 607 } 608 + if (tty_hung_up_p(file)) 609 + break; 610 611 + set_current_state(TASK_INTERRUPTIBLE); 612 613 rbuf = n_hdlc_buf_get(&n_hdlc->rx_buf_list); 614 + if (rbuf) { 615 + if (rbuf->count > nr) { 616 + /* too large for caller's buffer */ 617 + ret = -EOVERFLOW; 618 + } else { 619 + if (copy_to_user(buf, rbuf->buf, rbuf->count)) 620 + ret = -EFAULT; 621 + else 622 + ret = rbuf->count; 623 + } 624 + 625 + if (n_hdlc->rx_free_buf_list.count > 626 + DEFAULT_RX_BUF_COUNT) 627 + kfree(rbuf); 628 + else 629 + n_hdlc_buf_put(&n_hdlc->rx_free_buf_list, rbuf); 630 break; 631 + } 632 633 /* no data */ 634 if (file->f_flags & O_NONBLOCK) { 635 + ret = -EAGAIN; 636 + break; 637 } 638 + 639 + schedule(); 640 + 641 if (signal_pending(current)) { 642 + ret = -EINTR; 643 + break; 644 } 645 } 646 + 647 + remove_wait_queue(&tty->read_wait, &wait); 648 + __set_current_state(TASK_RUNNING); 649 + 650 return ret; 651 652 } /* end of n_hdlc_tty_read() */ ··· 691 count = maxframe; 692 } 693 694 add_wait_queue(&tty->write_wait, &wait); 695 + 696 + for (;;) { 697 + set_current_state(TASK_INTERRUPTIBLE); 698 699 + tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list); 700 + if (tbuf) 701 + break; 702 + 703 if (file->f_flags & O_NONBLOCK) { 704 error = -EAGAIN; 705 break; ··· 719 } 720 } 721 722 + __set_current_state(TASK_RUNNING); 723 remove_wait_queue(&tty->write_wait, &wait); 724 725 if (!error) { ··· 731 n_hdlc_buf_put(&n_hdlc->tx_buf_list,tbuf); 732 n_hdlc_send_frames(n_hdlc,tty); 733 } 734 + 735 return error; 736 737 } /* end of n_hdlc_tty_write() */
+2 -1
drivers/tty/serial/8250.c
··· 236 .fifo_size = 128, 237 .tx_loadsz = 128, 238 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, 239 - .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP, 240 }, 241 [PORT_16654] = { 242 .name = "ST16654",
··· 236 .fifo_size = 128, 237 .tx_loadsz = 128, 238 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, 239 + /* UART_CAP_EFR breaks billionon CF bluetooth card. */ 240 + .flags = UART_CAP_FIFO | UART_CAP_SLEEP, 241 }, 242 [PORT_16654] = { 243 .name = "ST16654",
+1
drivers/tty/serial/Kconfig
··· 1518 config SERIAL_GRLIB_GAISLER_APBUART 1519 tristate "GRLIB APBUART serial support" 1520 depends on OF 1521 ---help--- 1522 Add support for the GRLIB APBUART serial port. 1523
··· 1518 config SERIAL_GRLIB_GAISLER_APBUART 1519 tristate "GRLIB APBUART serial support" 1520 depends on OF 1521 + select SERIAL_CORE 1522 ---help--- 1523 Add support for the GRLIB APBUART serial port. 1524
+2 -2
drivers/tty/tty_io.c
··· 3257 ssize_t count = 0; 3258 3259 console_lock(); 3260 - for (c = console_drivers; c; c = c->next) { 3261 if (!c->device) 3262 continue; 3263 if (!c->write) ··· 3306 if (IS_ERR(consdev)) 3307 consdev = NULL; 3308 else 3309 - device_create_file(consdev, &dev_attr_active); 3310 3311 #ifdef CONFIG_VT 3312 vty_init(&console_fops);
··· 3257 ssize_t count = 0; 3258 3259 console_lock(); 3260 + for_each_console(c) { 3261 if (!c->device) 3262 continue; 3263 if (!c->write) ··· 3306 if (IS_ERR(consdev)) 3307 consdev = NULL; 3308 else 3309 + WARN_ON(device_create_file(consdev, &dev_attr_active) < 0); 3310 3311 #ifdef CONFIG_VT 3312 vty_init(&console_fops);
+8 -3
drivers/tty/vt/vt.c
··· 2994 if (IS_ERR(tty0dev)) 2995 tty0dev = NULL; 2996 else 2997 - device_create_file(tty0dev, &dev_attr_active); 2998 2999 vcs_init(); 3000 ··· 3545 3546 /* already registered */ 3547 if (con_driver->con == csw) 3548 - retval = -EINVAL; 3549 } 3550 3551 if (retval) ··· 3656 int err; 3657 3658 err = register_con_driver(csw, first, last); 3659 - 3660 if (!err) 3661 bind_con_driver(csw, first, last, deflt); 3662
··· 2994 if (IS_ERR(tty0dev)) 2995 tty0dev = NULL; 2996 else 2997 + WARN_ON(device_create_file(tty0dev, &dev_attr_active) < 0); 2998 2999 vcs_init(); 3000 ··· 3545 3546 /* already registered */ 3547 if (con_driver->con == csw) 3548 + retval = -EBUSY; 3549 } 3550 3551 if (retval) ··· 3656 int err; 3657 3658 err = register_con_driver(csw, first, last); 3659 + /* if we get an busy error we still want to bind the console driver 3660 + * and return success, as we may have unbound the console driver 3661 +  * but not unregistered it. 3662 + */ 3663 + if (err == -EBUSY) 3664 + err = 0; 3665 if (!err) 3666 bind_con_driver(csw, first, last, deflt); 3667