mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-kernel@vger.kernel.org,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	Patrice VILCHEZ <patrice.vilchez@atmel.com>
Subject: Re: [PATCH] base: add sysfs socs info
Date: Tue, 14 Dec 2010 08:11:30 -0800	[thread overview]
Message-ID: <20101214161130.GB1857@suse.de> (raw)
In-Reply-To: <1292330417-13703-1-git-send-email-plagnioj@jcrosoft.com>

On Tue, Dec 14, 2010 at 01:40:17PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> this provide an easy way to register soc information
> 
> arch, family, model, id, revision
> 
> as this for at91sam9g20
> 
> $ cat /sys/devices/system/soc/soc0/arch
> current
> $ cat /sys/devices/system/soc/soc0/family
> at91
> $ cat /sys/devices/system/soc/soc0/id
> at91sam9g20
> $ cat /sys/devices/system/soc/soc0/model
> 0x00000000019905a0
> $ cat /sys/devices/system/soc/soc0/revision
> 1.1

What is this for?  When you add sysfs files, you are required to add
entries to the Documentation/ABI/ files as well, please always provide
this so we are able to review the code easier.

> +/*
> + * register_soc - Setup a sysfs device for a SOC.
> + *
> + * Initialize and register the SOC device.
> + */
> +int register_soc(struct soc *soc)
> +{
> +	int err;
> +
> +	if (!soc)
> +		return -EINVAL;
> +
> +	soc->sysdev.id = nb_socs;
> +	soc->sysdev.cls = &soc_sysdev_class;
> +
> +	if (!soc->arch)
> +		soc->arch = arch_current;
> +
> +	err = sysdev_register(&soc->sysdev);
> +
> +	if (err)
> +		return err;
> +
> +	err = sysdev_create_file(&soc->sysdev, &attr_arch);
> +
> +	if (err)
> +		goto end;

<snip>

Please use an attribute group, it makes the code simpler and easier to
read.

> +struct soc {
> +	u64 id;
> +	char *arch;
> +	char *family;
> +	char *model;
> +	char *revision;
> +	struct sys_device sysdev;
> +};

What is a "SOC"?  A "Small Ordinary Creature"?

And does every system have one of these?  Just one?  Not multiple?  We
need a whole lot more information here as to why this code is needed,
and who will be using it.

Also, isn't this information already in /proc/cpu/ today?

thanks,

greg k-h

  reply	other threads:[~2010-12-14 16:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 12:40 Jean-Christophe PLAGNIOL-VILLARD
2010-12-14 16:11 ` Greg KH [this message]
2010-12-15  1:25   ` Jean-Christophe PLAGNIOL-VILLARD
2010-12-15  3:47     ` Greg KH
2010-12-15  7:39       ` Jean-Christophe PLAGNIOL-VILLARD
2010-12-15  8:17         ` Kay Sievers
2010-12-15 15:45 ` Re : " Didier Lagard
2010-12-15 20:17 ` Ryan Mallon
2010-12-15 20:24   ` Ryan Mallon

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=20101214161130.GB1857@suse.de \
    --to=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=patrice.vilchez@atmel.com \
    --cc=plagnioj@jcrosoft.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

Powered by JetHome