提交 a1afb637 编写于 作者: A Alexey Dobriyan 提交者: Thomas Gleixner

genirq: switch /proc/irq/*/spurious to seq_file

[ tglx: compacted it a bit ]
Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
LKML-Reference: <20090828181743.GA14050@x200.localdomain>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 c82a43d4
...@@ -148,18 +148,28 @@ static const struct file_operations default_affinity_proc_fops = { ...@@ -148,18 +148,28 @@ static const struct file_operations default_affinity_proc_fops = {
}; };
#endif #endif
static int irq_spurious_read(char *page, char **start, off_t off, static int irq_spurious_proc_show(struct seq_file *m, void *v)
int count, int *eof, void *data)
{ {
struct irq_desc *desc = irq_to_desc((long) data); struct irq_desc *desc = irq_to_desc((long) m->private);
return sprintf(page, "count %u\n"
"unhandled %u\n" seq_printf(m, "count %u\n" "unhandled %u\n" "last_unhandled %u ms\n",
"last_unhandled %u ms\n", desc->irq_count, desc->irqs_unhandled,
desc->irq_count, jiffies_to_msecs(desc->last_unhandled));
desc->irqs_unhandled, return 0;
jiffies_to_msecs(desc->last_unhandled)); }
static int irq_spurious_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, irq_spurious_proc_show, NULL);
} }
static const struct file_operations irq_spurious_proc_fops = {
.open = irq_spurious_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#define MAX_NAMELEN 128 #define MAX_NAMELEN 128
static int name_unique(unsigned int irq, struct irqaction *new_action) static int name_unique(unsigned int irq, struct irqaction *new_action)
...@@ -204,7 +214,6 @@ void register_handler_proc(unsigned int irq, struct irqaction *action) ...@@ -204,7 +214,6 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
void register_irq_proc(unsigned int irq, struct irq_desc *desc) void register_irq_proc(unsigned int irq, struct irq_desc *desc)
{ {
char name [MAX_NAMELEN]; char name [MAX_NAMELEN];
struct proc_dir_entry *entry;
if (!root_irq_dir || (desc->chip == &no_irq_chip) || desc->dir) if (!root_irq_dir || (desc->chip == &no_irq_chip) || desc->dir)
return; return;
...@@ -223,11 +232,8 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc) ...@@ -223,11 +232,8 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
&irq_affinity_proc_fops, (void *)(long)irq); &irq_affinity_proc_fops, (void *)(long)irq);
#endif #endif
entry = create_proc_entry("spurious", 0444, desc->dir); proc_create_data("spurious", 0444, desc->dir,
if (entry) { &irq_spurious_proc_fops, (void *)(long)irq);
entry->data = (void *)(long)irq;
entry->read_proc = irq_spurious_read;
}
} }
#undef MAX_NAMELEN #undef MAX_NAMELEN
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册