From: gregkh@suse.de (Greg KH)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] Framework for exporting System-on-Chip information via sysfs
Date: Fri, 2 Sep 2011 11:14:48 -0700 [thread overview]
Message-ID: <20110902181448.GB29430@suse.de> (raw)
In-Reply-To: <201109021922.04449.arnd@arndb.de>
On Fri, Sep 02, 2011 at 07:22:04PM +0200, Arnd Bergmann wrote:
> On Friday 02 September 2011, Greg KH wrote:
> > no.
> >
> > How did you pass the attribute data into this core so that it knows how
> > to get to it? You didn't, which is a mess.
> >
> > How about something like:
> > struct soc_device *soc_device_create(struct device *parent, struct soc_device_attributes *attr);
> >
> > That would have the proper way to handle lifetime rules, userspace
> > notificatation of userpace, placement in sysfs, and all the other good
> > stuff.
>
> I early on objected to the individual soc driver providing a set of
> attributes, because we really want the attributes to follow a
> common interface and I want to make it *hard* to add arbitrary
> other attributes that are not documented.
That's fine, which is why the struct soc_device_attributes are there,
those are common and well defined.
We can just do a simple return of 'int' to keep the caller from ever
having access to the device at all, which, if these can never be
removed, is a great way to keep anyone from messing with them.
So the interface gets even simpler:
int soc_device_create(struct device *parent, struct soc_device_attributes *attr);
Look good?
> > > >> +
> > > >> + if (!soc_count) {
> > > >> + /* Register top-level SoC device '/sys/devices/soc' */
> > > >> + ret = device_register(&soc_grandparent);
> > > >
> > > > device_register can't be called with a spinlock. You must have gotten
> > > > lucky in your testing, if you tested this.
> > > >
> > > > Anyway, this is not needed at all, please don't create "dummy" devices
> > > > in the sysfs tree, properly hook up your new device to where it should
> > > > be in the device tree.
> > >
> > > We need a /sys/devices/soc, how else can this be done?
> >
> > No you do not not, why would you think so?
>
> Well, where is all comes from is the desire to have a way from user space
> to find these devices, based on some path in the device tree. We had
> discussed putting it into
>
> /sys/class/soc
> /sys/bus/soc
> /sys/devices/platform/soc
> /sys/devices/platform/soc%d
>
> and a few others and eventually settled on /sys/devices/soc.
No, please use /sys/bus/soc as these are all of the same "type".
> > > Would it make you happier if I called it a bus?
> >
> > Yes, see the other response about creating a bus for these, which would
> > give you /sys/bus/soc/ where you can properly enumerate your devices,
> > which is what I think you want to be able to do, right?
>
> I think that would be a reasonable interface, but how does this work
> when the device was created by of_platform_bus_probe? Should we
> assume that any top-level device in the flattened device tree is
> a soc? How about just adding a child device in each soc node that
> is registered to the soc_bus_type?
Yes, that will work with the above soc_device_create() call.
> That would end up looking like
>
> /sys/devices/db8500
> /soc0 # this is the soc device
> /i2c-0 # and here are the other platform devices below db8500
> /spi-0
> /bus/soc/devices/soc0 -> ../../../devices/db8500/soc0
> /bus/platform/devices/i2c-0 -> ../../../devices/db8500/i2c-0
Looks good to me. Using a bus, and the above interface, will result in
this.
thanks,
greg k-h
next prev parent reply other threads:[~2011-09-02 18:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-01 12:27 [PATCH 1/5] Framework for exporting System-on-Chip information via sysfs Lee Jones
2011-09-01 12:27 ` [PATCH 2/5] Add documentation for new sysfs devices/soc functionality Lee Jones
2011-09-01 12:27 ` [PATCH 3/5] mach-ux500: export System-on-Chip information ux500 via sysfs Lee Jones
2011-09-02 14:31 ` Arnd Bergmann
2011-09-01 12:27 ` [PATCH 4/5] mach-ux500: move top level platform devices in sysfs to /sys/devices/soc/X Lee Jones
2011-09-01 12:27 ` [PATCH 5/5] mach-ux500: add a SoC ID (serial) callback for the u8500 Lee Jones
2011-09-02 14:22 ` Arnd Bergmann
2011-09-02 15:16 ` Lee Jones
2011-09-02 15:56 ` Arnd Bergmann
2011-09-01 23:34 ` [PATCH 1/5] Framework for exporting System-on-Chip information via sysfs Greg KH
2011-09-02 8:44 ` Lee Jones
2011-09-02 9:29 ` Jamie Iles
2011-09-02 9:37 ` Lee Jones
2011-09-02 9:56 ` Jamie Iles
2011-09-02 16:31 ` Greg KH
2011-09-02 17:22 ` Arnd Bergmann
2011-09-02 18:14 ` Greg KH [this message]
2011-09-06 9:41 ` Lee Jones
2011-09-06 19:33 ` Arnd Bergmann
2011-09-06 19:45 ` Greg KH
2011-09-07 6:14 ` Lee Jones
2011-09-02 14:02 ` Arnd Bergmann
2011-09-02 16:24 ` Greg KH
2011-09-02 17:32 ` Arnd Bergmann
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=20110902181448.GB29430@suse.de \
--to=gregkh@suse.de \
--cc=linux-arm-kernel@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.