public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	"Brown, Len" <len.brown@intel.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: driver model, duplicate names question
Date: Wed, 17 Jul 2013 11:55:09 -0700	[thread overview]
Message-ID: <51E6E88D.3030107@linux.intel.com> (raw)
In-Reply-To: <20130717183105.GA14988@kroah.com>

On 07/17/2013 11:31 AM, Greg KH wrote:
> On Wed, Jul 17, 2013 at 11:09:44AM -0700, Srinivas Pandruvada wrote:
>>> But thermal devices are not "real" at all.  There are just a number of
>>> "cooling devices" on a virtual bus and not attached to any type of a
>>> real device at all.
>>>
>>> There's also no hierarchy that I can see with the thermal class, but you
>>> want to have this, so you will have to do something different because
>>> classes do not have hierarchies.
>>>
>>> So try using a device and a bus and see if that helps out.  If not,
>>> please let me know.
>> Experimented by using a device and a bus. As your initial mail pointed
>> out, it still fails.
>> It will try to create symlink to /sys/bus/BUSTYPE/devices/, which will
>> prevent duplicate names.
> Where are you going to create a symlink from?  That doesn't make sense,
> just use a class if you want a link.
Sorry, my reply may not be clear here. I am not creating any symlinks.
device_register will create a symlink. For example, if I create a bus 
named "test",
with two parents and one child each:
ls -l /sys/bus/test/devices
lrwxrwxrwx 1 root root 0 Jul 17 09:05 child_0 -> 
../../../devices/parent_0/child_0
lrwxrwxrwx 1 root root 0 Jul 17 09:05 child_1 -> 
../../../devices/parent_1/child_1
lrwxrwxrwx 1 root root 0 Jul 17 09:05 parent_0 -> ../../../devices/parent_0
lrwxrwxrwx 1 root root 0 Jul 17 09:05 parent_1 -> ../../../devices/parent_1

>> Someone suggested to do like usb by creating file system entries, which
>> will require me to wear a body armour to post upstream for review.
> So a separate filesystem alltogether?  That would work, but you then
> loose any benifit that the driver core and sysfs provides you, for no
> benifit other than looking at a pretty tree in a filesystem.  I don't
> see the real need for that at all.
>
>> So I think the solution is to use prevent duplicate names. So in the
>> above example of sys-fs:
>>
>> "package-0" may be called power_zone#, with attribute "name" =
>> "package_0". Its children can
>> be called power_zone#:#. I will still use parent child relationships
>> during device_register.
>> For constraints, I will be using attributes like constraint_0_name,
>> constraint_0_power_limit etc. under each power_zone.
>> Hope this is an acceptable solution.
> That's what other busses have used for this very reason :)
>
> Also look at the "type" of device you are creating for your bus, that
> will help you differentiate them from each other instead of having to
> rely on the names of them to determine what is going on within the
> kernel.
<Thanks for your time and help.>
> good luck,
>
> greg k-h
>


      reply	other threads:[~2013-07-17 18:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16 16:34 driver model, duplicate names question Srinivas Pandruvada
2013-07-16 16:44 ` Greg KH
2013-07-16 18:29   ` Srinivas Pandruvada
2013-07-16 18:31     ` Greg KH
2013-07-16 18:54       ` Srinivas Pandruvada
2013-07-16 19:04         ` Greg KH
2013-07-16 19:33           ` Srinivas Pandruvada
2013-07-16 19:32             ` Greg KH
2013-07-16 20:11               ` Srinivas Pandruvada
     [not found]               ` <51E6D95B.1070203@linux.intel.com>
2013-07-17 17:48                 ` Greg KH
2013-07-17 18:09               ` Srinivas Pandruvada
2013-07-17 18:31                 ` Greg KH
2013-07-17 18:55                   ` Srinivas Pandruvada [this message]

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=51E6E88D.3030107@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    /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