2.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: The Body as Battlefield
    ... The only really potentially scary situation I have been in as an adult ... He then became emollient and unctuously friendly, calling me ... alternatively 'sir' and 'mate', I decided to be his mate indeed. ... Fortunately he did not get on the bus. ...
    (uk.philosophy.humanism)
  • Re: The Body as Battlefield
    ... He then became emollient and unctuously friendly, calling me ... alternatively 'sir' and 'mate', I decided to be his mate indeed. ... Fortunately he did not get on the bus. ...
    (uk.philosophy.humanism)
  • Re: Rainout Policy
    ... the bus at no charge and reschedule. ... I'd suggest calling the ticket office not looking for advice on here. ...
    (alt.sports.baseball.ny-yankees)
  • Re: HalTranslateBusAddress
    ... Please use bus function in CEDDK. ... The different between hal function and bus bus function is bus function will ... route to Bus driver before calling into OAL. ... thing for you while HalTranslateBusAddress can't. ...
    (microsoft.public.windowsce.platbuilder)
  • Hind.
    ... I was going to throw the Story of the BUG ... showed up over that city, I was camped out in my V.W. Bus, ... Cave Creek rd. ... fortune in treasure, inside a cave in the Organ Mountains ...
    (talk.religion.newage)