mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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).
This commit is contained in:
commit
56b85f32d5
45 changed files with 4538 additions and 189 deletions
|
|
@ -15,6 +15,7 @@ proc-y += devices.o
|
|||
proc-y += interrupts.o
|
||||
proc-y += loadavg.o
|
||||
proc-y += meminfo.o
|
||||
proc-y += proc_console.o
|
||||
proc-y += stat.o
|
||||
proc-y += uptime.o
|
||||
proc-y += version.o
|
||||
|
|
|
|||
114
fs/proc/proc_console.c
Normal file
114
fs/proc/proc_console.c
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Copyright (c) 2010 Werner Fink, Jiri Slaby
|
||||
*
|
||||
* Licensed under GPLv2
|
||||
*/
|
||||
|
||||
#include <linux/console.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/tty_driver.h>
|
||||
|
||||
/*
|
||||
* This is handler for /proc/consoles
|
||||
*/
|
||||
static int show_console_dev(struct seq_file *m, void *v)
|
||||
{
|
||||
static const struct {
|
||||
short flag;
|
||||
char name;
|
||||
} con_flags[] = {
|
||||
{ CON_ENABLED, 'E' },
|
||||
{ CON_CONSDEV, 'C' },
|
||||
{ CON_BOOT, 'B' },
|
||||
{ CON_PRINTBUFFER, 'p' },
|
||||
{ CON_BRL, 'b' },
|
||||
{ CON_ANYTIME, 'a' },
|
||||
};
|
||||
char flags[ARRAY_SIZE(con_flags) + 1];
|
||||
struct console *con = v;
|
||||
unsigned int a;
|
||||
int len;
|
||||
dev_t dev = 0;
|
||||
|
||||
if (con->device) {
|
||||
const struct tty_driver *driver;
|
||||
int index;
|
||||
driver = con->device(con, &index);
|
||||
if (driver) {
|
||||
dev = MKDEV(driver->major, driver->minor_start);
|
||||
dev += index;
|
||||
}
|
||||
}
|
||||
|
||||
for (a = 0; a < ARRAY_SIZE(con_flags); a++)
|
||||
flags[a] = (con->flags & con_flags[a].flag) ?
|
||||
con_flags[a].name : ' ';
|
||||
flags[a] = 0;
|
||||
|
||||
seq_printf(m, "%s%d%n", con->name, con->index, &len);
|
||||
len = 21 - len;
|
||||
if (len < 1)
|
||||
len = 1;
|
||||
seq_printf(m, "%*c%c%c%c (%s)", len, ' ', con->read ? 'R' : '-',
|
||||
con->write ? 'W' : '-', con->unblank ? 'U' : '-',
|
||||
flags);
|
||||
if (dev)
|
||||
seq_printf(m, " %4d:%d", MAJOR(dev), MINOR(dev));
|
||||
|
||||
seq_printf(m, "\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *c_start(struct seq_file *m, loff_t *pos)
|
||||
{
|
||||
struct console *con;
|
||||
loff_t off = 0;
|
||||
|
||||
acquire_console_sem();
|
||||
for_each_console(con)
|
||||
if (off++ == *pos)
|
||||
break;
|
||||
|
||||
return con;
|
||||
}
|
||||
|
||||
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
|
||||
{
|
||||
struct console *con = v;
|
||||
++*pos;
|
||||
return con->next;
|
||||
}
|
||||
|
||||
static void c_stop(struct seq_file *m, void *v)
|
||||
{
|
||||
release_console_sem();
|
||||
}
|
||||
|
||||
static const struct seq_operations consoles_op = {
|
||||
.start = c_start,
|
||||
.next = c_next,
|
||||
.stop = c_stop,
|
||||
.show = show_console_dev
|
||||
};
|
||||
|
||||
static int consoles_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open(file, &consoles_op);
|
||||
}
|
||||
|
||||
static const struct file_operations proc_consoles_operations = {
|
||||
.open = consoles_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
|
||||
static int register_proc_consoles(void)
|
||||
{
|
||||
proc_create("consoles", 0, NULL, &proc_consoles_operations);
|
||||
return 0;
|
||||
}
|
||||
module_init(register_proc_consoles);
|
||||
Loading…
Reference in a new issue