提交 14071693 编写于 作者: A Alexey Dobriyan 提交者: Linus Torvalds

proc tty: switch xtensa iss console to ->proc_fops

Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 bf54215e
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/major.h> #include <linux/major.h>
#include <linux/param.h> #include <linux/param.h>
#include <linux/seq_file.h>
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/serialP.h> #include <linux/serialP.h>
...@@ -176,22 +177,24 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -176,22 +177,24 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
/* Stub, once again.. */ /* Stub, once again.. */
} }
static int rs_read_proc(char *page, char **start, off_t off, int count, static int rs_proc_show(struct seq_file *m, void *v)
int *eof, void *data)
{ {
int len = 0; seq_printf(m, "serinfo:1.0 driver:%s\n", serial_version);
off_t begin = 0;
len += sprintf(page, "serinfo:1.0 driver:%s\n", serial_version);
*eof = 1;
if (off >= len + begin)
return 0; return 0;
}
*start = page + (off - begin); static int rs_proc_open(struct inode *inode, struct file *file)
return ((count < begin + len - off) ? count : begin + len - off); {
return single_open(file, rs_proc_show, NULL);
} }
static const struct file_operations rs_proc_fops = {
.owner = THIS_MODULE,
.open = rs_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct tty_operations serial_ops = { static struct tty_operations serial_ops = {
.open = rs_open, .open = rs_open,
...@@ -203,7 +206,7 @@ static struct tty_operations serial_ops = { ...@@ -203,7 +206,7 @@ static struct tty_operations serial_ops = {
.chars_in_buffer = rs_chars_in_buffer, .chars_in_buffer = rs_chars_in_buffer,
.hangup = rs_hangup, .hangup = rs_hangup,
.wait_until_sent = rs_wait_until_sent, .wait_until_sent = rs_wait_until_sent,
.read_proc = rs_read_proc .proc_fops = &rs_proc_fops,
}; };
int __init rs_init(void) int __init rs_init(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册