• Russell King's avatar
    [PATCH] Only add devices to bus->devices while scanning... · 64964f5b
    Russell King authored
      The pci_find* functions search using the following lists:
            bus->children   (for subordinate buses)
            pci_root_buses  (for all root buses)
            pci_devices     (for devices)
    
      This leaves one list which we can add devices to without any drivers
      finding the new devices before we've finished with them.
    
    - initialise bus->node list head.
    
    - pci_scan_slot will scan the specified slot, and add the discovered
      devices to the bus->devices list only.  These devices will not
      appear on the global device list, and do not show in sysfs, procfs.
      pci_scan_slot returns the number of functions found.  If you want
      to find the devices, you have to scan bus->devices and look for
      devices where list_empty(&dev->global_list) is true.
    
    - new function "pci_bus_add_devices" adds newly discovered devices
      to the global device lists, and handles the sysfs and procfs
      stuff, making the devices available to drivers.  All our buses
      which have an empty list head are treated as "new" (since they
      are not attached to the parent buses list of children) and are
      also added.  Currently, no buses will be in this state when this
      function is called.
    
    - new function "pci_scan_child_bus" scans a complete bus, building
      a list of devices on bus->devices only, performing bus fixups
      via pcibios_fixup_bus() and scanning behind bridges.  It does
      make devices externally visible.
    
    - pci_do_scan_bus retains its original behaviour - ie, it scans
      and makes devices available immediately.
    64964f5b
probe.c 17.2 KB