public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Artem B. Bityutskiy" <dedekind@yandex.ru>
To: linux-kernel@vger.kernel.org
Subject: Re: [QUESTION/sysfs] strange refcounting
Date: Mon, 06 Feb 2006 12:58:00 +0300	[thread overview]
Message-ID: <43E71DA8.3020103@yandex.ru> (raw)
In-Reply-To: <43E4AD2F.1020703@yandex.ru>

As &struct device structure has no @owner field, and corresponding 
functions rely on the @owner field at &struct device_driver, I conclude 
that I cannot use &struct device objects without bus and device driver 
objects, just by design.

On the other hand, 'device_register()' accepts &struct device objects 
with NULL-filled @bus and @driver fields perfectly fine, does not 
complain, does not return any error, and I even see corresponding 
entries at /sys/devices/. But there is a refcounting problem described 
at my first mail.

This is obviously a confusing discrepancy. Sysfs has to either reject 
bus-less and driver-less &struct device objects or deal with them 
correctly. The latter is impossible due to lack of an @owner field in 
&struct device.

In connection with this, I have a question. There is a whole bunch of 
drivers which do not directly relate to hardware devices, but which 
still want to expose their parameters via sysfs. For example, this could 
be a filesystem, LVM, a compression layer on top of a file system of a 
block device, whatever. These are "virtual" devices and they are not 
physically connected to any bus. How should they deal with sysfs?

I see there is the "class" stuff in sysfs, but it seems that it is far 
not as flexible as the "device, driver, and bus" stuff, because I cannot 
create many nested layers within classes. I can create a class, which 
goes to /sys/class/, and devices within this class, which go to 
/sys/class/myclass/mydev/. But I cannot create a class, devices within 
that class, and daughter devices within them, like:

/sys/class/myclass/
            |-- mydev1/
                | -- doughterdev1/
                | -- doughterdev1/
                | -- ...
            |-- mydev2/
            |-- mydev3/
            |-- ...

Please, comment this.

Thanks.

-- 
Best Regards,
Artem B. Bityutskiy,
St.-Petersburg, Russia.

  reply	other threads:[~2006-02-06  9:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-04  8:13 [QUESTION/sysfs] strange refcounting Artem B. Bityutskiy
2006-02-04 12:04 ` Artem B. Bityutskiy
2006-02-04 13:33   ` Artem B. Bityutskiy
2006-02-06  9:58     ` Artem B. Bityutskiy [this message]
2006-02-06 17:20       ` Artem B. Bityutskiy
  -- strict thread matches above, loose matches on Subject: below --
2006-02-03 14:16 Artem B. Bityutskiy
2006-02-03 17:08 ` Greg KH

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=43E71DA8.3020103@yandex.ru \
    --to=dedekind@yandex.ru \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox