linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Mochel <mochel@osdl.org>
To: Matt_Domsch@Dell.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: devicefs requests
Date: Mon, 30 Sep 2002 18:32:02 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.44.0209301821580.18550-100000@cherise.pdx.osdl.net> (raw)
In-Reply-To: <20BF5713E14D5B48AA289F72BD372D68C1E8BD@AUSXMPC122.aus.amer.dell.com>


> 1)  As new drivers pick up the model, check that all xxx_bus_type objects
> get EXPORT_SYMBOLd and included in a include/xxxx header somewhere - My BIOS
> EDD code walks the list of bus types looking for attached devices to compare
> against (pci, ide, scsi, usb, ...).
> ide_bus_type is in include/linux/ide.h but isn't EXPORT_SYMBOL;
> usb_bus_type is in include/linux/usb.h but isn't EXPORT_SYMBOL;

Yes, sorry about that. I think I've added most of them, and forgot to 
export them..

> Alternately, keep the list of registered bus types accessible via a
> list_for_each type macro.  I like the exported symbols myself, it lets me
> do:

There is a master bus list: bus_drivers_list in drivers/base/bus.c. It 
could easily be exportable, and may be a good idea for you firmware 
people. 

> static const struct edd_known_bus_types_s edd_known_bus_types[] = {
> 	{bus:&scsi_driverfs_bus_type, edd_type: "SCSI", match:
> edd_match_scsidev},
> //	{bus:&ide_bus_type,           edd_type: "ATA",  match: NULL},
> //	{bus:&usb_bus_type,           edd_type: "USB",  match: NULL},
> 	{bus:NULL,                    edd_type: NULL,   match: NULL},
> };
> 
> so I can supply my own match functions which match one type of device (e.g.
> EDD's idea of a SCSI device) to that of the standard device.  I could
> accomplish the same using well-known names for bus_type I suppose, and doing
> a list_for_each until I find it.  Just a different thing getting exported, a
> well-known name and a lookup method rather than the symbol itself.

Don't rely on the name, as it could change. It could, but at least the 
compiler will warn you..

> 2) bus_for_each_dev() is really restrictive right now due to all the locking
> mechanisms in place.  In my code I'd like to, given a struct device *, walk
> a list of devices on a given bus and compare each device with the given
> device, returning a match, or not.  As it stands, bus_for_each_dev returns
> either success (the callback worked for each device on the list), or failure
> (the callback failed for some device on the list), but I don't see a
> mechanism to return which device failed without excessive abuse of the
> void*.  For now I've made a private copy of bus_for_each_dev which I've
> mucked with the return the properly matching device, and wonder if this
> couldn't be made more generic somehow.

Yes, those helpers are restrictive, and not very useful to you in that 
case. It's easy to make more complex versions, but I fear the resulting 
code..

	-pat


  parent reply	other threads:[~2002-10-01  1:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-25 19:28 Matt_Domsch
2002-09-25 21:33 ` Greg KH
2002-09-25 21:33 ` Greg KH
2002-10-01  1:32 ` Patrick Mochel [this message]
2002-09-25 22:03 Matt_Domsch
2002-09-25 22:46 ` Greg KH
2002-10-01  1:39 ` Patrick Mochel
2002-09-25 22:11 Matt_Domsch
2002-09-26  3:48 Matt_Domsch
2002-09-26  4:14 ` Greg KH
2002-09-26 14:41   ` Randy.Dunlap
2002-09-26 16:13 Matt_Domsch
2002-09-27  4:41 ` 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=Pine.LNX.4.44.0209301821580.18550-100000@cherise.pdx.osdl.net \
    --to=mochel@osdl.org \
    --cc=Matt_Domsch@Dell.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: devicefs requests' \
    /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

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).