Skip to contentSkip to conversation

pci probe

DISCUSSION Manu Abraham 3 participants 7 messages May 14, 2007 – Jun 13, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

I do have a device that's a multifunction device. Eventhough a MFD, it just has one Interrupt which is shared by by a Configuration space for each function. ie, INTA is shared between them functions.

In such a case, i am wondering, (since pci_probe returns a pointer to one PCI function alone and i need to use both the functions in one module alone rather than using a module for each function and that the functions are quite similar for them to be used in different modules, such that a separate probe/ISR etc is used) whether using pci_get_device would be a better alternative to do manual searching for the functions in such a case.

Thanks,
Manu

#1 lore raw
Quoted 6 lines · Manu Abraham

Hi,

I do have a device that's a multifunction device. Eventhough a MFD, it just has one Interrupt which is shared by by a Configuration space for each function. ie, INTA is shared between them functions.

Quoted 8 lines

In such a case, i am wondering, (since pci_probe returns a pointer to one PCI function alone and i need to use both the functions in one module alone rather than using a module for each function and that the functions are quite similar for them to be used in different modules, such that a separate probe/ISR etc is used) whether using pci_get_device would be a better alternative to do manual searching for the functions in such a case.

Just figured out that pci_get_subsys() does work in a better. Looking at kernel sources all i find is just one single user of pci_get_subsys()

building the code around pci_get_subsys(), does this have any negative impact ?

Thanks,
Manu

#2 lore raw
Quoted 16 lines · Manu Abraham
Quoted 6 lines · Manu Abraham

Hi,

I do have a device that's a multifunction device. Eventhough a MFD, it just has one Interrupt which is shared by by a Configuration space for each function. ie, INTA is shared between them functions.

Quoted 8 lines

In such a case, i am wondering, (since pci_probe returns a pointer to one PCI function alone and i need to use both the functions in one module alone rather than using a module for each function and that the functions are quite similar for them to be used in different modules, such that a separate probe/ISR etc is used) whether using pci_get_device would be a better alternative to do manual searching for the functions in such a case.

Quoted 5 lines

Just figured out that pci_get_subsys() does work in a better. Looking at kernel sources all i find is just one single user of pci_get_subsys()

building the code around pci_get_subsys(), does this have any negative impact ?

Yes:
- your device will not show up properly in sysfs (no device/driver binding ability from userspace, no good information so that udev can properly name the device, etc.)
- your driver will not work on any pci-hotplug type system (that includes expresscard and pccard and lots of high-end servers.
- your driver will not be notified if the system is being suspended or resumed or wanting to drop into a low power state.
- another driver can bind to your device without you ever knowing it.

So in short, use pci_probe and just handle the fact that you need to be called for two PCI devices and bind to both of them. It shouldn't be that hard...

thanks,

greg k-h

#3 lore raw
Quoted 19 lines · Greg KH
Quoted 18 lines · Manu Abraham
Quoted 6 lines · Manu Abraham

Hi,

I do have a device that's a multifunction device. Eventhough a MFD, it just has one Interrupt which is shared by by a Configuration space for each function. ie, INTA is shared between them functions.

Quoted 8 lines

In such a case, i am wondering, (since pci_probe returns a pointer to one PCI function alone and i need to use both the functions in one module alone rather than using a module for each function and that the functions are quite similar for them to be used in different modules, such that a separate probe/ISR etc is used) whether using pci_get_device would be a better alternative to do manual searching for the functions in such a case.

Just figured out that pci_get_subsys() does work in a better. Looking at kernel sources all i find is just one single user of pci_get_subsys()

Quoted 7 lines
Quoted 2 lines

building the code around pci_get_subsys(), does this have any negative impact ?

Yes:
- your device will not show up properly in sysfs (no device/driver binding ability from userspace, no good information so that udev can properly name the device, etc.)

This one sounds bad.

Quoted 2 lines

- your driver will not work on any pci-hotplug type system (that includes expresscard and pccard and lots of high-end servers.

This doesn't matter

Quoted 5 lines

- your driver will not be notified if the system is being suspended or resumed or wanting to drop into a low power state.
- another driver can bind to your device without you ever knowing it.

These also sound bad.

Quoted 3 lines

So in short, use pci_probe and just handle the fact that you need to be called for two PCI devices and bind to both of them. It shouldn't be that hard...

Thanks for the explanation.

Do you mean to have two PCIID tables ? But then that does mean 2 modules don't you ? (i thought probe would be called once per module) Or you mean to say use PCI_ANY_ID in the table to match multiple devices and then allow probe to return a list of devices ?

Thanks,
Manu

#4 lore raw
Quoted 28 lines · Manu Abraham
Quoted 19 lines · Greg KH
Quoted 18 lines · Manu Abraham
Quoted 6 lines · Manu Abraham

Hi,

I do have a device that's a multifunction device. Eventhough a MFD, it just has one Interrupt which is shared by by a Configuration space for each function. ie, INTA is shared between them functions.

Quoted 8 lines

In such a case, i am wondering, (since pci_probe returns a pointer to one PCI function alone and i need to use both the functions in one module alone rather than using a module for each function and that the functions are quite similar for them to be used in different modules, such that a separate probe/ISR etc is used) whether using pci_get_device would be a better alternative to do manual searching for the functions in such a case.

Just figured out that pci_get_subsys() does work in a better. Looking at kernel sources all i find is just one single user of pci_get_subsys()

Quoted 7 lines
Quoted 2 lines

building the code around pci_get_subsys(), does this have any negative impact ?

Yes:
- your device will not show up properly in sysfs (no device/driver binding ability from userspace, no good information so that udev can properly name the device, etc.)

Quoted 6 lines

This one sounds bad.

Quoted 2 lines

- your driver will not work on any pci-hotplug type system (that includes expresscard and pccard and lots of high-end servers.

This doesn't matter

Are you sure? PCI Hotplug is showing up in more places that people realize...

Quoted 12 lines
Quoted 5 lines

- your driver will not be notified if the system is being suspended or resumed or wanting to drop into a low power state.
- another driver can bind to your device without you ever knowing it.

These also sound bad.

Quoted 3 lines

So in short, use pci_probe and just handle the fact that you need to be called for two PCI devices and bind to both of them. It shouldn't be that hard...

Quoted 6 lines

Thanks for the explanation.

Do you mean to have two PCIID tables ? But then that does mean 2 modules don't you ? (i thought probe would be called once per module) Or you mean to say use PCI_ANY_ID in the table to match multiple devices and then allow probe to return a list of devices ?

No, you can specify multiple devices in the same device id table, and your driver will get called for all of the matching devices. You just need to "bind" them together in your driver to be able to handle everything properly. It shouldn't be that tough.

thanks,

greg k-h

#5 lore raw
Quoted 31 lines · Greg KH
Quoted 30 lines · Manu Abraham
Quoted 19 lines · Greg KH
Quoted 18 lines · Manu Abraham
Quoted 6 lines · Manu Abraham

Hi,

I do have a device that's a multifunction device. Eventhough a MFD, it just has one Interrupt which is shared by by a Configuration space for each function. ie, INTA is shared between them functions.

Quoted 8 lines

In such a case, i am wondering, (since pci_probe returns a pointer to one PCI function alone and i need to use both the functions in one module alone rather than using a module for each function and that the functions are quite similar for them to be used in different modules, such that a separate probe/ISR etc is used) whether using pci_get_device would be a better alternative to do manual searching for the functions in such a case.

Just figured out that pci_get_subsys() does work in a better. Looking at kernel sources all i find is just one single user of pci_get_subsys()

Quoted 7 lines
Quoted 2 lines

building the code around pci_get_subsys(), does this have any negative impact ?

Yes:
- your device will not show up properly in sysfs (no device/driver binding ability from userspace, no good information so that udev can properly name the device, etc.)

This one sounds bad.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

- your driver will not work on any pci-hotplug type system (that includes expresscard and pccard and lots of high-end servers.

This doesn't matter

Are you sure? PCI Hotplug is showing up in more places that people realize...

In case of video4linux and dvb, there are cx88 and saa7134 based pcmcia devices available which show up as PCI devices, both of these drivers enable the interrupts as soon as they're connected and there's no need to access the device nodes for that.
Another point is that they're not hotplug aware, the driver end up in an endless loop or crashes linux if someone unplugs the device (even if it's not in use).

Quoted 21 lines
Quoted 13 lines
Quoted 6 lines

- your driver will not be notified if the system is being suspended or resumed or wanting to drop into a low power state.
- another driver can bind to your device without you ever knowing it.

These also sound bad.

Quoted 3 lines

So in short, use pci_probe and just handle the fact that you need to be called for two PCI devices and bind to both of them. It shouldn't be that hard...

Quoted 6 lines

Thanks for the explanation.

Do you mean to have two PCIID tables ? But then that does mean 2 modules don't you ? (i thought probe would be called once per module) Or you mean to say use PCI_ANY_ID in the table to match multiple devices and then allow probe to return a list of devices ?

Quoted 5 lines

No, you can specify multiple devices in the same device id table, and your driver will get called for all of the matching devices. You just need to "bind" them together in your driver to be able to handle everything properly. It shouldn't be that tough.

Uwe posted an example how to tie multiple functions of a device together, there are quite a few ways how to solve that problem.

http://linuxtv.org/pipermail/linux-dvb/2007-June/018481.html

Markus

#6 lore raw
In reply to Greg KH

Hi,

Sorry for my late reply.

Quoted 6 lines · Greg KH
Quoted 3 lines
Quoted 2 lines

- your driver will not work on any pci-hotplug type system (that includes expresscard and pccard and lots of high-end servers.

This doesn't matter

Are you sure? PCI Hotplug is showing up in more places that people realize...

The PCI bridges that we have for the mentioned use, does not support Hotplugging at all and hence doesn't matter for those devices mentioned.

Quoted 18 lines
Quoted 10 lines
Quoted 5 lines

- your driver will not be notified if the system is being suspended or resumed or wanting to drop into a low power state.
- another driver can bind to your device without you ever knowing it.

These also sound bad.

Quoted 3 lines

So in short, use pci_probe and just handle the fact that you need to be called for two PCI devices and bind to both of them. It shouldn't be that hard...

Quoted 6 lines

Thanks for the explanation.

Do you mean to have two PCIID tables ? But then that does mean 2 modules don't you ? (i thought probe would be called once per module) Or you mean to say use PCI_ANY_ID in the table to match multiple devices and then allow probe to return a list of devices ?

Quoted 5 lines

No, you can specify multiple devices in the same device id table, and your driver will get called for all of the matching devices. You just need to "bind" them together in your driver to be able to handle everything properly. It shouldn't be that tough.

Will take a go at it.
I was using PCI_ANY_ID for the device id, so that should return all the devices.

Thanks,
Manu