Re: Multi-function PCI devices

Jeff Garzik
2001-04-07T19:40:37Z

Tim Waugh wrote:
> If we have to do this, then Gunther's approach (multifunc_quirks or
> whatever) looks a lot better than having a separate driver for every
> single multi-IO card.

Who said you have to have a separate driver for every single multi-IO
card? A single driver could support all serial+parallel multi-IO cards,
for example.

Due to the differences in busses and hardware implementations and such,
typically you want to provide two pieces of code for each common
hardware subsystem (like "parport" or "serial"): foo_lib.c and
foo_card.c.

foo_lib.c is the guts of the hardware support, and it provides an
[un]register_foodev() interface. foo_card.c is totally separate, and it
holds the PCI or ISAPNP or USB device ids. foo_card does all the
hardware detection, and calls register_foodev() for each hardware device
it finds.

For small subsystems, this is obviously overkill. But for common
subsystems like serial or parport, this makes complete sense. If an
sbus device appears that acts just like a PC parallel port, all DaveM
needs to do is write a parport_sbus.c shim which calls
register_foodev(). No patching one central file necessary to add
support for a new bus.

Regards,

Jeff

--
Jeff Garzik | Sam: "Mind if I drive?"
Building 1024 | Max: "Not if you don't mind me clawing at the dash
MandrakeSoft | and shrieking like a cheerleader."