From: Greg KH <greg@kroah.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-kernel@vger.kernel.org, Linux/m68k <linux-m68k@vger.kernel.org>
Subject: Re: Driver framework: binding a driver to two devices?
Date: Sun, 14 Aug 2011 10:38:16 -0700 [thread overview]
Message-ID: <20110814173816.GA10062@kroah.com> (raw)
In-Reply-To: <CAMuHMdVr9iAyqQJUgHq4gcLg+gp7GxF=sH+SBKBuqVWYymXs8Q@mail.gmail.com>
On Sat, Aug 13, 2011 at 10:44:42PM +0200, Geert Uytterhoeven wrote:
> As Amiga Zorro expansion boards have only one BAR (unlike PCI, which has
> multiple BARs), several Amiga graphics cards show up as two Zorro devices:
> one for the graphics memory and one for the graphics controller's registers.
>
> Traditionally, a driver for such a device used
>
> dev1 = zorro_find_device(id1, ...)
> dev2 = zorro_find_device(id2, ...)
>
> to find the two devices and match them.
>
> With the "new" driver framework, the matching with device id1 is now
> done using a
> struct zorro_driver with a table of IDs, while the matching with device id2 is
> still done by calling zorro_find_device(id2, ...).
>
> Recently (with cirrusfb) it turned out that the call to
> zorro_find_device(id2, ...)
> may fail to find the second device. I suspect this happens due to the second
> device haven't been probed for at the time the zorro_driver for the
> first device is
> initialized.
>
> I expect this can be fixed by delaying all calls to device_register() in
> amiga_zorro_probe() until all devices have been detected and added to the array
> used by zorro_find_device(). But I was wondering whether there's a more generic
> way in the driver framework to bind a driver to two devices?
What you really want is the same "driver instance" bound to two devices,
right? That way the device would operate "knowing" about both physical
devices so as to properly control the thing.
Right now, no, there's not a simple way to do this with the driver
model. USB does this on its own for some devices that need to have
multiple "interfaces" (the USB equalivant for a "device") controlled at
the same time, so you might want to look at how that happens (in the
indivdual drivers, not in the USB core.)
Sorry,
greg k-h
next prev parent reply other threads:[~2011-08-14 17:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-13 20:44 Driver framework: binding a driver to two devices? Geert Uytterhoeven
2011-08-14 17:38 ` Greg KH [this message]
2011-08-14 19:32 ` Geert Uytterhoeven
2011-08-15 2:20 ` 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=20110814173816.GA10062@kroah.com \
--to=greg@kroah.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@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