aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/vt
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-07 17:39:20 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-07 17:39:20 -0500
commit56b85f32d530d09d6805488ad00775d4e0e3baab (patch)
treee7fbe69e338ef775d3b2dd822aa915d259b4bc94 /drivers/tty/vt
parent3e5b08cbbf78bedd316904ab0cf3b27119433ee5 (diff)
parent568389c257fa7d74ce36c2f78bad31965fded4cf (diff)
Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (36 commits) serial: apbuart: Fixup apbuart_console_init() TTY: Add tty ioctl to figure device node of the system console. tty: add 'active' sysfs attribute to tty0 and console device drivers: serial: apbuart: Handle OF failures gracefully Serial: Avoid unbalanced IRQ wake disable during resume tty: fix typos/errors in tty_driver.h comments pch_uart : fix warnings for 64bit compile 8250: fix uninitialized FIFOs ip2: fix compiler warning on ip2main_pci_tbl specialix: fix compiler warning on specialix_pci_tbl rocket: fix compiler warning on rocket_pci_ids 8250: add a UPIO_DWAPB32 for 32 bit accesses 8250: use container_of() instead of casting serial: omap-serial: Add support for kernel debugger serial: fix pch_uart kconfig & build drivers: char: hvc: add arm JTAG DCC console support RS485 documentation: add 16C950 UART description serial: ifx6x60: fix memory leak serial: ifx6x60: free IRQ on error Serial: EG20T: add PCH_UART driver ... Fixed up conflicts in drivers/serial/apbuart.c with evil merge that makes the code look fairly sane (unlike either side).
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/vt.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index a8ec48ed14d9..76407eca9ab0 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -236,6 +236,14 @@ enum {
236}; 236};
237 237
238/* 238/*
239 * /sys/class/tty/tty0/
240 *
241 * the attribute 'active' contains the name of the current vc
242 * console and it supports poll() to detect vc switches
243 */
244static struct device *tty0dev;
245
246/*
239 * Notifier list for console events. 247 * Notifier list for console events.
240 */ 248 */
241static ATOMIC_NOTIFIER_HEAD(vt_notifier_list); 249static ATOMIC_NOTIFIER_HEAD(vt_notifier_list);
@@ -688,6 +696,8 @@ void redraw_screen(struct vc_data *vc, int is_switch)
688 save_screen(old_vc); 696 save_screen(old_vc);
689 set_origin(old_vc); 697 set_origin(old_vc);
690 } 698 }
699 if (tty0dev)
700 sysfs_notify(&tty0dev->kobj, NULL, "active");
691 } else { 701 } else {
692 hide_cursor(vc); 702 hide_cursor(vc);
693 redraw = 1; 703 redraw = 1;
@@ -2967,13 +2977,24 @@ static const struct tty_operations con_ops = {
2967 2977
2968static struct cdev vc0_cdev; 2978static struct cdev vc0_cdev;
2969 2979
2980static ssize_t show_tty_active(struct device *dev,
2981 struct device_attribute *attr, char *buf)
2982{
2983 return sprintf(buf, "tty%d\n", fg_console + 1);
2984}
2985static DEVICE_ATTR(active, S_IRUGO, show_tty_active, NULL);
2986
2970int __init vty_init(const struct file_operations *console_fops) 2987int __init vty_init(const struct file_operations *console_fops)
2971{ 2988{
2972 cdev_init(&vc0_cdev, console_fops); 2989 cdev_init(&vc0_cdev, console_fops);
2973 if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || 2990 if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
2974 register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) 2991 register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
2975 panic("Couldn't register /dev/tty0 driver\n"); 2992 panic("Couldn't register /dev/tty0 driver\n");
2976 device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); 2993 tty0dev = device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
2994 if (IS_ERR(tty0dev))
2995 tty0dev = NULL;
2996 else
2997 device_create_file(tty0dev, &dev_attr_active);
2977 2998
2978 vcs_init(); 2999 vcs_init();
2979 3000