Skip to contentSkip to conversation

pci: dev->driver "runtime" acquisition?

DISCUSSION Daniel Stodden 2 participants 2 messages Dec 4, 2001

lore
Share & tools
lore
#0 lore raw

hi.

supposing i've got a "hotplug" style pci_driver,
but who's going to gain access to a device _not_ at initialization time, i.e. not within pci_register_driver(), but rather somehere in a bottom half. no pci_device_id* at pci_register_driver( ), since i don't know the signature yet.

how do i request access here?
could anyone comment on the following please:

1. simple, but intrusive somehow:

	dev_probe_lock()
	if ( dev->driver == NULL )
		dev->driver = my_driver;
	dev_probe_unlock()

is the locking correct?

2. rather use pci_announce_device()?

	my_driver->id_table =
       		somthing_i_just_built_on_the_fly_and_i_know_it_matches;
	pci_announce_device( my_driver, dev );
	/* probe() does the rest */

3. patch drivers/pci/pci.c?

	pci_acquire_device( struct pci *dev, struct pci_driver *drv )
	{
		/* fill in 1. */
	}

4. simply rely on the "compat", i.e. just taking over some resource? i think that's not why it's been called "compat"

any better ideas? something i'm missing?
besides: policy? -- do i _have_ to pci_register_driver() at during initialization before considering to actually drive something?

any help appreciated.

regards,
dns

Signature · 2 lines
__________________________________________________________________
mailto: [email protected]
#1 lore raw
Quoted 3 lines · Daniel Stodden

hi.

supposing i've got a "hotplug" style pci_driver,

Any hints on what kind of driver this is? :)

Quoted 4 lines

but who's going to gain access to a device _not_ at initialization time, i.e. not within pci_register_driver(), but rather somehere in a bottom half. no pci_device_id* at pci_register_driver( ), since i don't know the signature yet.

Take a look at the pci_read_config_*_nodev() and pci_write_config_*_nodev() functions in the drivers/hotplug/pci_hotplug.h file. Do these functions help you out?

thanks,

greg k-h