Sharing a pci device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm looking at the 2.6 kernel today.

I've got questions about how to best share the pci bus device of the Voodoo3 card with three drivers that need to tinker with the Voodoo3 chip. They are:

tdfxfb:		This one should be given priority, but not every one
		wants to use it.
i2c-voodoo3:	The v3tv driver depends on this one.
v3tv:		Can't watch TV without it.

For reasons that I probably would not explain very well, not every one with the Voodoo3 card uses the tdfxfb driver. The v3tv module does not enter into the dscussion at this time since it does not define a pci_driver struct.

(I hope I get close to correct in describing the various structs involved)

When the tdfxfb driver is present in the kernel (or loaded as a module) it takes the pci_dev->driver slot, and then prevents the i2c-voodoo3 module from loading, since it also wants to register a driver.

I modified i2c-voodoo3 to use pci_get_device() to find the Voodoo3 card, (see i2c-voodoo3.diff refrenced in v3tv-v4l2 below) but with this, things don't work if the tdfxfb driver is not present when a call to dev_info() is made to print a status message to the log and pci_device->dev is not defined. This is also easy enough to test for and work around.

It seems like there are four situations I need to take into account.

1: tdfxfb is compiled into the kernel.
2: tdfxfb is compiled as a module, and has been loaded.
3: tdfxfb is compiled as a module, and is not loaded.
4: tdfxfb is not configured in the kernel.

In the first case, I have a working patch to the 2.6.6 kernel, which also works in the second case.

The third and fourth case can also be accounted for.

It's the second and third cases that need extra attention, when the tdfxfb is compiled as a module.

Should I make the i2c-voodoo3 module so it can cope with any of these cases at run time, or should I use preprocessor conditionals to handle the first and fourth case, and just do the runtime tests in i2c-voodoo3 if the tdfxfb driver is a module and it's presence can't be known when i2c-voodoo3 is loaded?

Is it true that each physical pci device can have just one driver attached to it?

I've seen it said in several places that having multiple drivers twidle with a single device can be hazardous to your system stability, and this is true, as the v3tv driver and X server don't always get along. That's for another time though.

Thanks,

Perry
-----
Gilfillan Family: http://www.gilfillan.org/

Projects:
  V3TV:		http://www.gilfillan.org/v3tv/
  VPX3224:	http://www.gilfillan.org/vpx3224/
  V3TV-V4L2:	http://www.gilfillan.org/v3tv-v4l2/
  snd-tvmixer:	http://www.gilfillan.org/ALSA/
                http://v3tv.sourceforge.net/



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux