The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] genirq: switch /proc/irq/*/spurious to seq_file
@ 2009-08-28 18:19 Alexey Dobriyan
  2009-11-18 11:54 ` [tip:irq/core] " tip-bot for Alexey Dobriyan
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Dobriyan @ 2009-08-28 18:19 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 kernel/irq/proc.c |   28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -148,18 +148,30 @@ static const struct file_operations default_affinity_proc_fops = {
 };
 #endif
 
-static int irq_spurious_read(char *page, char **start, off_t off,
-				  int count, int *eof, void *data)
+static int irq_spurious_proc_show(struct seq_file *m, void *v)
 {
-	struct irq_desc *desc = irq_to_desc((long) data);
-	return sprintf(page, "count %u\n"
+	struct irq_desc *desc = irq_to_desc((long) m->private);
+	seq_printf(m, "count %u\n"
 			     "unhandled %u\n"
 			     "last_unhandled %u ms\n",
 			desc->irq_count,
 			desc->irqs_unhandled,
 			jiffies_to_msecs(desc->last_unhandled));
+	return 0;
 }
 
+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
 
 static int name_unique(unsigned int irq, struct irqaction *new_action)
@@ -204,7 +216,6 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
 void register_irq_proc(unsigned int irq, struct irq_desc *desc)
 {
 	char name [MAX_NAMELEN];
-	struct proc_dir_entry *entry;
 
 	if (!root_irq_dir || (desc->chip == &no_irq_chip) || desc->dir)
 		return;
@@ -221,11 +232,8 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
 			 &irq_affinity_proc_fops, (void *)(long)irq);
 #endif
 
-	entry = create_proc_entry("spurious", 0444, desc->dir);
-	if (entry) {
-		entry->data = (void *)(long)irq;
-		entry->read_proc = irq_spurious_read;
-	}
+	proc_create_data("spurious", 0444, desc->dir,
+			 &irq_spurious_proc_fops, (void *)(long)irq);
 }
 
 #undef MAX_NAMELEN

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:irq/core] genirq: switch /proc/irq/*/spurious to seq_file
  2009-08-28 18:19 [PATCH] genirq: switch /proc/irq/*/spurious to seq_file Alexey Dobriyan
@ 2009-11-18 11:54 ` tip-bot for Alexey Dobriyan
  2009-11-19 18:50   ` Alexey Dobriyan
  0 siblings, 1 reply; 5+ messages in thread
From: tip-bot for Alexey Dobriyan @ 2009-11-18 11:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, akpm, tglx, adobriyan

Commit-ID:  a1afb6371bb5341057056194d1168753f6d77242
Gitweb:     http://git.kernel.org/tip/a1afb6371bb5341057056194d1168753f6d77242
Author:     Alexey Dobriyan <adobriyan@gmail.com>
AuthorDate: Fri, 28 Aug 2009 22:19:33 +0400
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 18 Nov 2009 12:50:51 +0100

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

[ tglx: compacted it a bit ]

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
LKML-Reference: <20090828181743.GA14050@x200.localdomain>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/irq/proc.c |   36 +++++++++++++++++++++---------------
 1 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index dfef5b9..4e47f11 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -148,18 +148,28 @@ static const struct file_operations default_affinity_proc_fops = {
 };
 #endif
 
-static int irq_spurious_read(char *page, char **start, off_t off,
-				  int count, int *eof, void *data)
+static int irq_spurious_proc_show(struct seq_file *m, void *v)
 {
-	struct irq_desc *desc = irq_to_desc((long) data);
-	return sprintf(page, "count %u\n"
-			     "unhandled %u\n"
-			     "last_unhandled %u ms\n",
-			desc->irq_count,
-			desc->irqs_unhandled,
-			jiffies_to_msecs(desc->last_unhandled));
+	struct irq_desc *desc = irq_to_desc((long) m->private);
+
+	seq_printf(m, "count %u\n" "unhandled %u\n" "last_unhandled %u ms\n",
+		   desc->irq_count, desc->irqs_unhandled,
+		   jiffies_to_msecs(desc->last_unhandled));
+	return 0;
+}
+
+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
 
 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)
 void register_irq_proc(unsigned int irq, struct irq_desc *desc)
 {
 	char name [MAX_NAMELEN];
-	struct proc_dir_entry *entry;
 
 	if (!root_irq_dir || (desc->chip == &no_irq_chip) || desc->dir)
 		return;
@@ -223,11 +232,8 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
 			 &irq_affinity_proc_fops, (void *)(long)irq);
 #endif
 
-	entry = create_proc_entry("spurious", 0444, desc->dir);
-	if (entry) {
-		entry->data = (void *)(long)irq;
-		entry->read_proc = irq_spurious_read;
-	}
+	proc_create_data("spurious", 0444, desc->dir,
+			 &irq_spurious_proc_fops, (void *)(long)irq);
 }
 
 #undef MAX_NAMELEN

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [tip:irq/core] genirq: switch /proc/irq/*/spurious to seq_file
  2009-11-18 11:54 ` [tip:irq/core] " tip-bot for Alexey Dobriyan
@ 2009-11-19 18:50   ` Alexey Dobriyan
  2009-11-20 10:19     ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Dobriyan @ 2009-11-19 18:50 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, akpm, tglx

On Wed, Nov 18, 2009 at 11:54:34AM +0000, tip-bot for Alexey Dobriyan wrote:
> --- a/kernel/irq/proc.c
> +++ b/kernel/irq/proc.c
> @@ -148,18 +148,28 @@ static const struct file_operations default_affinity_proc_fops = {
>  };
>  #endif
>  
> -static int irq_spurious_read(char *page, char **start, off_t off,
> -				  int count, int *eof, void *data)
> +static int irq_spurious_proc_show(struct seq_file *m, void *v)
>  {
> -	struct irq_desc *desc = irq_to_desc((long) data);
> -	return sprintf(page, "count %u\n"
> -			     "unhandled %u\n"
> -			     "last_unhandled %u ms\n",
> -			desc->irq_count,
> -			desc->irqs_unhandled,
> -			jiffies_to_msecs(desc->last_unhandled));
> +	struct irq_desc *desc = irq_to_desc((long) m->private);
						   ^^^^^^^^^^
> +
> +	seq_printf(m, "count %u\n" "unhandled %u\n" "last_unhandled %u ms\n",
> +		   desc->irq_count, desc->irqs_unhandled,
> +		   jiffies_to_msecs(desc->last_unhandled));
> +	return 0;
> +}
> +
> +static int irq_spurious_proc_open(struct inode *inode, struct file *file)
> +{
> +	return single_open(file, irq_spurious_proc_show, NULL);

Oops, there has to be PDE(inode)->data instead of NULL.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [tip:irq/core] genirq: switch /proc/irq/*/spurious to seq_file
  2009-11-19 18:50   ` Alexey Dobriyan
@ 2009-11-20 10:19     ` Ingo Molnar
  2009-11-20 11:23       ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2009-11-20 10:19 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: linux-tip-commits, linux-kernel, hpa, mingo, akpm, tglx


* Alexey Dobriyan <adobriyan@gmail.com> wrote:

> On Wed, Nov 18, 2009 at 11:54:34AM +0000, tip-bot for Alexey Dobriyan wrote:
> > --- a/kernel/irq/proc.c
> > +++ b/kernel/irq/proc.c
> > @@ -148,18 +148,28 @@ static const struct file_operations default_affinity_proc_fops = {
> >  };
> >  #endif
> >  
> > -static int irq_spurious_read(char *page, char **start, off_t off,
> > -				  int count, int *eof, void *data)
> > +static int irq_spurious_proc_show(struct seq_file *m, void *v)
> >  {
> > -	struct irq_desc *desc = irq_to_desc((long) data);
> > -	return sprintf(page, "count %u\n"
> > -			     "unhandled %u\n"
> > -			     "last_unhandled %u ms\n",
> > -			desc->irq_count,
> > -			desc->irqs_unhandled,
> > -			jiffies_to_msecs(desc->last_unhandled));
> > +	struct irq_desc *desc = irq_to_desc((long) m->private);
> 						   ^^^^^^^^^^
> > +
> > +	seq_printf(m, "count %u\n" "unhandled %u\n" "last_unhandled %u ms\n",
> > +		   desc->irq_count, desc->irqs_unhandled,
> > +		   jiffies_to_msecs(desc->last_unhandled));
> > +	return 0;
> > +}
> > +
> > +static int irq_spurious_proc_open(struct inode *inode, struct file *file)
> > +{
> > +	return single_open(file, irq_spurious_proc_show, NULL);
> 
> Oops, there has to be PDE(inode)->data instead of NULL.

Send a patch please.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [tip:irq/core] genirq: switch /proc/irq/*/spurious to seq_file
  2009-11-20 10:19     ` Ingo Molnar
@ 2009-11-20 11:23       ` Ingo Molnar
  0 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2009-11-20 11:23 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: linux-tip-commits, linux-kernel, hpa, mingo, akpm, tglx


* Ingo Molnar <mingo@elte.hu> wrote:

> 
> * Alexey Dobriyan <adobriyan@gmail.com> wrote:
> 
> > On Wed, Nov 18, 2009 at 11:54:34AM +0000, tip-bot for Alexey Dobriyan wrote:
> > > --- a/kernel/irq/proc.c
> > > +++ b/kernel/irq/proc.c
> > > @@ -148,18 +148,28 @@ static const struct file_operations default_affinity_proc_fops = {
> > >  };
> > >  #endif
> > >  
> > > -static int irq_spurious_read(char *page, char **start, off_t off,
> > > -				  int count, int *eof, void *data)
> > > +static int irq_spurious_proc_show(struct seq_file *m, void *v)
> > >  {
> > > -	struct irq_desc *desc = irq_to_desc((long) data);
> > > -	return sprintf(page, "count %u\n"
> > > -			     "unhandled %u\n"
> > > -			     "last_unhandled %u ms\n",
> > > -			desc->irq_count,
> > > -			desc->irqs_unhandled,
> > > -			jiffies_to_msecs(desc->last_unhandled));
> > > +	struct irq_desc *desc = irq_to_desc((long) m->private);
> > 						   ^^^^^^^^^^
> > > +
> > > +	seq_printf(m, "count %u\n" "unhandled %u\n" "last_unhandled %u ms\n",
> > > +		   desc->irq_count, desc->irqs_unhandled,
> > > +		   jiffies_to_msecs(desc->last_unhandled));
> > > +	return 0;
> > > +}
> > > +
> > > +static int irq_spurious_proc_open(struct inode *inode, struct file *file)
> > > +{
> > > +	return single_open(file, irq_spurious_proc_show, NULL);
> > 
> > Oops, there has to be PDE(inode)->data instead of NULL.
> 
> Send a patch please.
> 
> Thanks,

Never mind - Thomas queued up the fix meanwhile.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-20 11:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-28 18:19 [PATCH] genirq: switch /proc/irq/*/spurious to seq_file Alexey Dobriyan
2009-11-18 11:54 ` [tip:irq/core] " tip-bot for Alexey Dobriyan
2009-11-19 18:50   ` Alexey Dobriyan
2009-11-20 10:19     ` Ingo Molnar
2009-11-20 11:23       ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox