lkml.org 
[lkml]   [2008]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject2.6.24-rc4: pci_remove_bus_device() => pci_scan_child_bus() => pci_bus_add_devices bug?
Short:
1. Calling pci_remove_bus_device() on some of the devices on a bus will
remove them. (ok)
2. Calling pci_scan_child_bus() on that bus will scan the bus for
devices and add them all. even the ones already in the bus device list,
which will now be duplicated in the bus device list! (no so ok)
3. Calling pci_bus_add_devices() Will try to add the device, assign
resource, and create procfs files. The devices which were not originally
removed are were being assigned resource they don't need and procfs
files already exist and will collide (Bug)

Background:
I have a programmable component which implements a pci device. Upon
warm update i need to remove my devices from the bus, upgrade, and add
them back.
I have bashed my head against pci.h API for the last week trying to make
this work with no success. Right now I have devised a hideous hack to
circumvent pci.h and directly remap the pci device registers.

demo code:

reload_my_hardware_design() {
struct pci_dev *dev = NULL;
struct pci_bus *bus = NULL;

while ((dev = pci_get_device(PCI_VENDOR_ID_MY_ID,PCI_ANY_ID,NULL))) {
pci_remove_bus_device(dev);
}

...
reload the hardware
...

bus = pci_find_bus(0,0); /* though hard coded in this example this
is the right bus*/
pci_scan_child_bus(bus);
pci_bus_add_devices(bus);
}


Is this a bug or am I doing something wrong?

Liberty


\
 
 \ /
  Last update: 2008-06-18 16:53    [W:0.157 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site