LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Multiple virtual bus instances
@ 2007-02-07 22:15 Simon White
  2007-02-08  5:54 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Simon White @ 2007-02-07 22:15 UTC (permalink / raw)
  To: linux-kernel

Hi,

I've been working through trying to create a virtual
bus.  I've
successfuly made it work for a single instance but
wanted to
confirm how to create multiple instances of the
virtual bus.  I
believe to do this you have only one instance of your
new
bus_type registered but register multiple instances of
struct
device for it.  I just wanted to confirm that was
correct.

Lastly how do you walk over all devices on a bus
instance?  I
note bus_for_each_dev but that appears to take a
bus_type
rather than struct device instance, hence I assume it
will return
all devices from all instances.  I know I could
compare each
device to see if it is on a certain bus instance but
wondered if
there was a better way?

Regards,
Simon


 
____________________________________________________________________________________
Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Multiple virtual bus instances
  2007-02-07 22:15 Multiple virtual bus instances Simon White
@ 2007-02-08  5:54 ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2007-02-08  5:54 UTC (permalink / raw)
  To: Simon White; +Cc: linux-kernel

On Wed, Feb 07, 2007 at 02:15:08PM -0800, Simon White wrote:
> Hi,
> 
> I've been working through trying to create a virtual
> bus.

How does this differ from a "real" bus?

> I've successfuly made it work for a single instance but wanted to
> confirm how to create multiple instances of the virtual bus.

Why would you need that?

> I believe to do this you have only one instance of your new
> bus_type registered but register multiple instances of struct device
> for it.  I just wanted to confirm that was correct.

That would create multiple devices on the same bus.  Is that what you
need to do?

> Lastly how do you walk over all devices on a bus
> instance?

You usually do this in your bus-specific code somehow.

> I note bus_for_each_dev but that appears to take a bus_type rather
> than struct device instance, hence I assume it will return all devices
> from all instances.

No, it will walk the bus that you created.  If you need multiple busses,
create multiple 'struct bus_type' structures.

> I know I could compare each device to see if it is on a certain bus
> instance but wondered if there was a better way?

I think you will find that it works the way it is described.

Might I ask what you are trying to do with these multiple busses?

Note that you can have multiple trees of devices, all with the same
bus_type, yet not joined together in any other way.  Odds are, you
probably want to do that, right?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Multiple virtual bus instances
@ 2007-02-08  9:23 Simon White
  0 siblings, 0 replies; 3+ messages in thread
From: Simon White @ 2007-02-08  9:23 UTC (permalink / raw)
  To: linux-kernel

Hi Greg,

>> I've been working through trying to
>> create a virtual bus.

>How does this differ from a "real" bus?

None, just there wasn't a real hardware
bus (O'Reilly's Linux Device Drivers 3
chapter 14 page 377).

>> I've successfuly made it work for a
>> single instance but wanted to confirm
>> how to create multiple instances of
>> the virtual bus.

> Why would you need that?

We are trying to get the device drivers
for the Catweasel MK3/4 cards ready for
submission into mainline after repeated
requests.  However the hardware on it
differs greatly in nature so we have
serveral fragmented drivers for each
specific bit (written by different
parties).  Naturally they don't play
well together.

It was thought creating a bus for each
pci cmk3/4 card, where the bus deals
with bank switching, etc.  This allows
individual drivers to use newly
exported devices fixing the issues we
have now.  It would also help being
this way for debugging, i.e. other
parties code can be easily removed.

>> I believe to do this you have only
>> one instance of your new bus_type
>> registered but register multiple
>> instances of struct device for it.
>> I just wanted to confirm that was
>> correct.

>That would create multiple devices on
>the same bus.  Is that what you need
>to do?

>From your description no.  One thing I
was however trying to avoid was lots of
buses showing under /sys/bus.

> Note that you can have multiple trees
> of devices, all with the same
> bus_type, yet not joined together in
> any other way.  Odds are, you probably
> want to do that, right?

Yes.  If you still think that is correct
given the above are there examples to
follow?

Regards,
Simon


 
____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check. 
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-08  9:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07 22:15 Multiple virtual bus instances Simon White
2007-02-08  5:54 ` Greg KH
2007-02-08  9:23 Simon White

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).