From: Federico Vaga <federico.vaga@gmail.com>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alessandro Rubini <rubini@gnudd.com>,
linux-kernel@vger.kernel.org
Subject: Re: How to make a bus with heterogeneous devices?
Date: Sat, 03 Mar 2012 16:44:05 +0100 [thread overview]
Message-ID: <14955578.F1pbkdA1CJ@harkonnen> (raw)
In-Reply-To: <CAPXgP13-5URbxH9u344CnreRP2v9VR-ADcQRUBA5AdNj26P+LA@mail.gmail.com>
> Maybe I miss something but it sounds not that different from USB.
>
> You have a bus that enumerates devices and a "bus driver" creates a
> generic device on that bus for everything it finds. These devices stay
> generic, do not have type-specific attributes, but export matches
> again to bind other device-specific drivers, which create _new_ child
> devices below the generic ones with the proper attributes matching
> their individual type of devices. So every "logical" device is always
> represented by one generic device and one type-specific child device.
It sounds like our option 5:
> 5- The real attributes may live in another device, which is a child of
> the one used within the bus abstraction. Here the drawback is using
> an additional device and directory level for no reason.
- I register the generic (empty) device on the bus
- when the device match with a driver
- I register a new device child of the matched one but without connect
it directly on the bus.
The result will be something like (zio is our bus):
/sys/bus/zio/devices/<generic-dev1>/<real-device1>/<attributes>
/sys/bus/zio/devices/<generic-dev2>/<real-device2>/<attributes>
/sys/bus/zio/devices/<generic-devN>/<real-deviceN>/<attributes>
When there is not a driver:
/sys/bus/zio/devices/<generic-dev1>/<device-stuff>
/sys/bus/zio/devices/<generic-devN>/<device-stuff>
Where the generic-dev is an empty device used to make the bus work. Is
it correct?
> All these devices, the generic ones and the type-specific ones can be
> on the same bus (struct bus_type) when they get a "struct device_type"
> assigned which carries the device-type specific set of attributes.
But if all devices can live on the bus (set device->bus for all
devices), when I register the "real-device" (type-specific) the bus try
to match it with a driver (again); but we already matched the device
with its driver. it is better if the type-specific devices are not
directly on the bus but only a child of a device on the bus.
--
Federico Vaga
next prev parent reply other threads:[~2012-03-03 15:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-24 15:20 Alessandro Rubini
2012-02-25 0:40 ` Greg Kroah-Hartman
2012-02-29 13:57 ` Federico Vaga
2012-02-29 23:58 ` Greg Kroah-Hartman
2012-03-02 10:18 ` Federico Vaga
2012-03-02 22:38 ` Greg Kroah-Hartman
2012-03-03 11:43 ` Kay Sievers
2012-03-03 15:44 ` Federico Vaga [this message]
2012-03-04 18:59 ` Kay Sievers
2012-03-12 15:08 ` Federico Vaga
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=14955578.F1pbkdA1CJ@harkonnen \
--to=federico.vaga@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rubini@gnudd.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
all inboxes | Powered by JetHome®