From: Adam Belay <abelay@novell.com>
To: Greg KH <greg@kroah.com>
Cc: rml@novell.com, linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH] add driver matching priorities
Date: Thu, 10 Feb 2005 12:18:37 -0500 [thread overview]
Message-ID: <1108055918.3423.23.camel@localhost.localdomain> (raw)
In-Reply-To: <20050210084113.GZ32727@kroah.com>
On Thu, 2005-02-10 at 00:41 -0800, Greg KH wrote:
> On Fri, Jan 28, 2005 at 05:30:04PM -0500, Adam Belay wrote:
> > Hi,
> >
> > This patch adds initial support for driver matching priorities to the
> > driver model. It is needed for my work on converting the pci bridge
> > driver to use "struct device_driver". It may also be helpful for driver
> > with more complex (or long id lists as I've seen in many cases) matching
> > criteria.
> >
> > "match" has been added to "struct device_driver". There are now two
> > steps in the matching process. The first step is a bus specific filter
> > that determines possible driver candidates. The second step is a driver
> > specific match function that verifies if the driver will work with the
> > hardware, and returns a priority code (how well it is able to handle the
> > device). The bus layer could override the driver's match function if
> > necessary (similar to how it passes *probe through it's layer and then
> > on to the actual driver).
> >
> > The current priorities are as follows:
> >
> > enum {
> > MATCH_PRIORITY_FAILURE = 0,
> > MATCH_PRIORITY_GENERIC,
> > MATCH_PRIORITY_NORMAL,
> > MATCH_PRIORITY_VENDOR,
> > };
> >
> > let me know if any of this would need to be changed. For example, the
> > "struct bus_type" match function could return a priority code.
> >
> > Of course this patch is not going to be effective alone. We also need
> > to change the init order. If a driver is registered early but isn't the
> > best available, it will be bound to the device prematurely. This would
> > be a problem for carbus (yenta) bridges.
> >
> > I think we may have to load all in kernel drivers first, and then begin
> > matching them to hardware. Do you agree? If so, I'd be happy to make a
> > patch for that too.
>
> I think the issue that Al raises about drivers grabbing devices, and
> then trying to unbind them might be a real problem.
I agree. Do you think registering every in-kernel driver before probing
hardware would solve this problem?
>
> Also, why can't this just be done in the bus specific code, in the match
> function? I don't see how putting this into the driver core helps out
> any.
The match priority is a chararistic of the driver and how it's
implemented rather than the bus's matching mechanism. The type of match
doesn't necessarily reflect the driver's ability to control the hardware
(ex. a driver could match on a specific PCI id but only provide generic
support for the device).
Also, I think this is a feature that would be useful for all of the
buses. Therefore, it would seem implementing it in the driver core
might result in the least code duplication.
The second "*match" function in "struct device_driver" gives the driver
a chance to evaluate it's ability of controlling the device and solves a
few problems with the current implementation. (ex. it's not possible to
detect ISA Modems with only a list of PnP IDs, and some PCI devices
support a pool of IDs that is too large to put in an ID table).
Thanks,
Adam
next prev parent reply other threads:[~2005-02-10 17:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-28 22:30 [RFC][PATCH] add driver matching priorities Adam Belay
2005-01-28 23:23 ` Dmitry Torokhov
2005-01-28 23:33 ` Adam Belay
2005-01-28 23:51 ` Dmitry Torokhov
2005-01-29 0:05 ` Adam Belay
2005-01-29 0:11 ` Al Viro
2005-01-29 2:45 ` Dmitry Torokhov
2005-02-10 8:41 ` Greg KH
2005-02-10 17:18 ` Adam Belay [this message]
2005-02-10 18:08 ` Dmitry Torokhov
2005-02-10 18:12 ` Greg KH
2005-02-10 21:26 ` Adam Belay
2005-02-10 18:33 ` Greg KH
2005-02-10 18:46 ` Dmitry Torokhov
2005-02-10 21:32 ` Adam Belay
2005-02-10 18:45 ` Russell King
2005-02-10 21:37 ` Adam Belay
2005-02-25 23:41 ` Greg KH
2005-03-01 0:05 ` Adam Belay
2005-03-01 7:58 ` 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=1108055918.3423.23.camel@localhost.localdomain \
--to=abelay@novell.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@novell.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