lkml.org 
[lkml]   [2001]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectPCI device search.
Hi,

I have a device driver (drivers/char/sonypi in this case)
which can handle two cases:
- on older hardware, it gets attached to a specific
PCI device

- on newer hardware, when the previous PCI device
is missing, it just uses a predefined set of
ioports to access the hardware. There is no PCI
device involved here.

I am wondering what is the cleanest way to program this.
As I see it, I have two distinct choices:

1. Create a PCI driver (pci_device_id, struct pci_driver etc)
and in init_module call pci_module_init. If it fails,
assume the driver deals with newer hardware and
call 'by hand' the 'probe' routine from pci_driver struct.

2. Not use the PCI driver infrastructure, and in
init_module just call pci_find_device manually searching
for older hardware, if it is present go further, if
it fails assume newer hardware and go further.

What is considered to be the best way to do it ?
(this is _not_ a hotplug device if it matters).

Thanks,

Stelian.
--
Stelian Pop <stelian.pop@fr.alcove.com>
|---------------- Free Software Engineer -----------------|
| Alcôve - http://www.alcove.com - Tel: +33 1 49 22 68 00 |
|------------- Alcôve, liberating software ---------------|
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:08    [W:0.125 / U:24.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site