public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: Eduardo Valentin <eduardo.valentin@nokia.com>
Cc: 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: Tue, 11 May 2010 12:11:26 +0900	[thread overview]
Message-ID: <20100511031126.GA20453@linux-sh.org> (raw)
In-Reply-To: <20100510142248.GD11804@besouro.research.nokia.com>

On Mon, May 10, 2010 at 05:22:48PM +0300, Eduardo Valentin wrote:
> On Mon, May 10, 2010 at 01:13:00PM +0200, ext Paul Mundt wrote:
> > 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.
> 
> While still here, about cleaning this, so, let me see if I got your point.
> Basically, the file under fs/proc/socinfo.c whould do the thing with single_open &
> single_release, as you stated. But then there is the .show and its data.
> One idea would then be to have a function:
> 
> int register_socinfo_show(int (*show)(struct seq_file *, void *), void *data);
> 
> Which would be exported to other parts of the kernel (something placed under
> include/linux/socinfo.h for instance). Then the soc core code
> (like arch/arm/mach-omap[1,2]) would then register its local show function and pass its data.
> 
> This way I think we can avoid the exports inside .c files (as in this patch)
> and also pass the static char * needed during the show.
> 
> What do you think?
> 
Yes, you'll need something like that. kstrdup() also does an allocation,
but you're only going to be registering once and are unlikely to ever
unregister (particular since you have this configured as a bool) so that
doesn't really matter. On the other hand if the string itself is static
you can just pass that in with a static initializer, or have some sort of
opaque socinfo data structure that contains the strings you care about.
You'll always be able to get back at the pointer through the
proc_dir_entry private data.

  reply	other threads:[~2010-05-11  3:12 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
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 [this message]
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=20100511031126.GA20453@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=Peter.De-Schrijver@nokia.com \
    --cc=a0393775@ti.com \
    --cc=akpm@linux-foundation.org \
    --cc=eduardo.valentin@nokia.com \
    --cc=felipe.balbi@nokia.com \
    --cc=khilman@deeprootsystems.com \
    --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