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