public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Valentin <eduardo.valentin@nokia.com>
To: ext Paul Mundt <lethal@linux-sh.org>
Cc: "Valentin Eduardo (Nokia-D/Helsinki)"
	<eduardo.valentin@nokia.com>, LKML <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Linux-OMAP <linux-omap@vger.kernel.org>,
	Russell King <linux@arm.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	ext Tony Lindgren <tony@atomide.com>,
	ext Kevin Hilman <khilman@deeprootsystems.com>,
	"De-Schrijver Peter (Nokia-D/Helsinki)"
	<Peter.De-Schrijver@nokia.com>,
	"santosh.shilimkar@ti.com" <santosh.shilimkar@ti.com>,
	Ambresh <a0393775@ti.com>,
	"Balbi Felipe (Nokia-D/Helsinki)" <felipe.balbi@nokia.com>
Subject: Re: [PATCHv4 1/4] procfs: Introduce socinfo under /proc
Date: Mon, 10 May 2010 15:35:14 +0300	[thread overview]
Message-ID: <20100510123514.GA11804@besouro.research.nokia.com> (raw)
In-Reply-To: <20100510111259.GA14680@linux-sh.org>

On Mon, May 10, 2010 at 01:13:00PM +0200, ext Paul Mundt wrote:
> On Mon, May 10, 2010 at 01:37:34PM +0300, Eduardo Valentin wrote:
> > + */
> > +#include <linux/fs.h>
> > +#include <linux/init.h>
> > +#include <linux/proc_fs.h>
> > +#include <linux/seq_file.h>
> > +
> > +extern const struct seq_operations socinfo_op;
> 
> This doesn't look promising..

Right.. as stated in patch description (maybe not that clear), this was
basically same thing which you see under fs/proc/cpuinfo.c

> 
> > +static int socinfo_open(struct inode *inode, struct file *file)
> > +{
> > +	return seq_open(file, &socinfo_op);
> > +}
> > +
> If you use single_open() ..
> 
> > +static const struct file_operations proc_socinfo_operations = {
> > +	.open		= socinfo_open,
> > +	.read		= seq_read,
> > +	.llseek		= seq_lseek,
> > +	.release	= seq_release,
> > +};
> > +
> .. and single_release(), then none of the seq_operations are necessary.

Good! will replace than with single_[open,release].

> 
> > +static int __init proc_socinfo_init(void)
> > +{
> > +	proc_create("socinfo", 0, NULL, &proc_socinfo_operations);
> > +	return 0;
> > +}
> > +module_init(proc_socinfo_init);
> 
> proc_create() can fail, so some error handling here would be nice.

right. will add it.

> 
> On Mon, May 10, 2010 at 01:37:35PM +0300, Eduardo Valentin wrote:
> > +static int c_show(struct seq_file *m, void *v)
> > +{
> > +	seq_printf(m, "SoC\t: %s\n", socinfo);
> > +
> > +	return 0;
> > +}
> > +
> > +static void *c_start(struct seq_file *m, loff_t *pos)
> > +{
> > +	return *pos < 1 ? (void *)1 : NULL;
> > +}
> > +
> > +static void *c_next(struct seq_file *m, void *v, loff_t *pos)
> > +{
> > +	++*pos;
> > +	return NULL;
> > +}
> > +
> > +static void c_stop(struct seq_file *m, void *v)
> > +{
> > +}
> > +
> > +const struct seq_operations socinfo_op = {
> > +	.start	= c_start,
> > +	.next	= c_next,
> > +	.stop	= c_stop,
> > +	.show	= c_show
> > +};
> 
> You'll still need the show function, but all of the rest of this is just
> duplicating what single_open() already does. If the socinfo string is
> static you may also want to rework this a bit so you can just stash the
> string in the proc_dir_entry private data. Combine this with something
> like kstrdup() and you'll save yourself a bit of stack while you're at
> it.

yeah. will add those comments as well.


Thanks for reviewing,

--
Eduardo Valentin

  reply	other threads:[~2010-05-10 12:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-10 10:37 [PATCHv4 0/4] Introduce the /proc/socinfo and use it to export OMAP data Eduardo Valentin
2010-05-10 10:37 ` [PATCHv4 1/4] procfs: Introduce socinfo under /proc Eduardo Valentin
2010-05-10 11:13   ` Paul Mundt
2010-05-10 12:35     ` Eduardo Valentin [this message]
2010-05-10 12:39       ` Paul Mundt
2010-05-10 12:55         ` Eduardo Valentin
2010-05-11  3:14           ` Paul Mundt
2010-05-11  6:21             ` Russell King - ARM Linux
2010-05-10 12:54     ` Felipe Balbi
2010-05-10 13:08       ` Eduardo Valentin
2010-05-10 18:15         ` Felipe Balbi
2010-05-10 14:22     ` Eduardo Valentin
2010-05-11  3:11       ` Paul Mundt
2010-05-10 10:37 ` [PATCHv4 2/4] mach-omap2: export omap2 info under /proc/socinfo Eduardo Valentin
2010-05-10 10:37 ` [PATCHv4 3/4] mach-omap1: export omap1 " Eduardo Valentin
2010-05-10 10:52   ` Russell King - ARM Linux
2010-05-10 12:13     ` Eduardo Valentin
2010-05-10 10:37 ` [PATCHv4 4/4] OMAP3: export chip IDCODE, Production ID and Die ID Eduardo Valentin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100510123514.GA11804@besouro.research.nokia.com \
    --to=eduardo.valentin@nokia.com \
    --cc=Peter.De-Schrijver@nokia.com \
    --cc=a0393775@ti.com \
    --cc=akpm@linux-foundation.org \
    --cc=felipe.balbi@nokia.com \
    --cc=khilman@deeprootsystems.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=santosh.shilimkar@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox