Skip to contentSkip to conversation

struct pci_bus, no release() function?

DISCUSSION John Rose 2 participants 4 messages Aug 3, 2004 – Aug 10, 2004

lore
Share & tools
lore

John Rose

author
#0 lore raw

At probe time, pci_scan_bus_parented() allocates and registers a struct device for each PCI bus it scans. This generic device structure never gets assigned a "release" function.

Attempts to unregister such a PCI Bus at runtime result in a kernel message like:
Device 'pci0001:00' does not have a release() function, it is broken and must be fixed.

Are architectures free to assign their own release function for "devices" associated with struct pci_bus? If so, does this have to happen at boot, or can it happen right before the remove?

Thanks-
John

#1 lore raw
Quoted 8 lines · John Rose

At probe time, pci_scan_bus_parented() allocates and registers a struct device for each PCI bus it scans. This generic device structure never gets assigned a "release" function.

Attempts to unregister such a PCI Bus at runtime result in a kernel message like:
Device 'pci0001:00' does not have a release() function, it is broken and must be fixed.

You're right, that should be fixed. Care to send a patch? Should just be a 1 line change. You can tell no one else has tried to remove a root bus device before...

Quoted 2 lines

Are architectures free to assign their own release function for "devices" associated with struct pci_bus?

Why would they want to? It should just be set to pci_release_dev, like all other struct pci_dev devices are, right?

Quoted 2 lines

If so, does this have to happen at boot, or can it happen right before the remove?

Heh, you can't assign a release function after it is needed :)

thanks,

greg k-h

author
#2 lore raw
Quoted 14 lines · Greg KH
Quoted 8 lines · John Rose

At probe time, pci_scan_bus_parented() allocates and registers a struct device for each PCI bus it scans. This generic device structure never gets assigned a "release" function.

Attempts to unregister such a PCI Bus at runtime result in a kernel message like:
Device 'pci0001:00' does not have a release() function, it is broken and must be fixed.

You're right, that should be fixed. Care to send a patch? Should just be a 1 line change. You can tell no one else has tried to remove a root bus device before...

Quoted 5 lines
Quoted 2 lines

Are architectures free to assign their own release function for "devices" associated with struct pci_bus?

Why would they want to? It should just be set to pci_release_dev, like all other struct pci_dev devices are, right?

Root buses don't have an associated pci_dev struct, so this function won't do. Is that specific to ppc64? Regardless, seems like we need a special release func for this case.

Thanks-
John

#3 lore raw
Quoted 15 lines · John Rose
Quoted 14 lines · Greg KH
Quoted 8 lines · John Rose

At probe time, pci_scan_bus_parented() allocates and registers a struct device for each PCI bus it scans. This generic device structure never gets assigned a "release" function.

Attempts to unregister such a PCI Bus at runtime result in a kernel message like:
Device 'pci0001:00' does not have a release() function, it is broken and must be fixed.

You're right, that should be fixed. Care to send a patch? Should just be a 1 line change. You can tell no one else has tried to remove a root bus device before...

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Are architectures free to assign their own release function for "devices" associated with struct pci_bus?

Why would they want to? It should just be set to pci_release_dev, like all other struct pci_dev devices are, right?

Root buses don't have an associated pci_dev struct, so this function won't do.

Ah, good point. We should probably fix that up and make it a struct pci_dev. Or just make a release function for the struct device we create. Either way is fine for me.

thanks,

greg k-h