mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-11 07:39:47 +00:00
proc tty: switch ia64 simserial to ->proc_fops
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
d594027d62
commit
bf54215ef8
@ -24,6 +24,7 @@
|
|||||||
#include <linux/major.h>
|
#include <linux/major.h>
|
||||||
#include <linux/fcntl.h>
|
#include <linux/fcntl.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/capability.h>
|
#include <linux/capability.h>
|
||||||
#include <linux/console.h>
|
#include <linux/console.h>
|
||||||
@ -848,38 +849,36 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
|
|||||||
* /proc fs routines....
|
* /proc fs routines....
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline int line_info(char *buf, struct serial_state *state)
|
static inline void line_info(struct seq_file *m, struct serial_state *state)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%d: uart:%s port:%lX irq:%d\n",
|
seq_printf(m, "%d: uart:%s port:%lX irq:%d\n",
|
||||||
state->line, uart_config[state->type].name,
|
state->line, uart_config[state->type].name,
|
||||||
state->port, state->irq);
|
state->port, state->irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 i, len = 0, l;
|
int i;
|
||||||
off_t begin = 0;
|
|
||||||
|
|
||||||
len += sprintf(page, "simserinfo:1.0 driver:%s\n", serial_version);
|
seq_printf(m, "simserinfo:1.0 driver:%s\n", serial_version);
|
||||||
for (i = 0; i < NR_PORTS && len < 4000; i++) {
|
for (i = 0; i < NR_PORTS; i++)
|
||||||
l = line_info(page + len, &rs_table[i]);
|
line_info(m, &rs_table[i]);
|
||||||
len += l;
|
return 0;
|
||||||
if (len+begin > off+count)
|
|
||||||
goto done;
|
|
||||||
if (len+begin < off) {
|
|
||||||
begin += len;
|
|
||||||
len = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*eof = 1;
|
|
||||||
done:
|
|
||||||
if (off >= len+begin)
|
|
||||||
return 0;
|
|
||||||
*start = page + (begin-off);
|
|
||||||
return ((count < begin+len-off) ? count : begin+len-off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int rs_proc_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------------------------------------------------------------------
|
* ---------------------------------------------------------------------
|
||||||
* rs_init() and friends
|
* rs_init() and friends
|
||||||
@ -917,7 +916,7 @@ static const struct tty_operations hp_ops = {
|
|||||||
.start = rs_start,
|
.start = rs_start,
|
||||||
.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,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user