• Patrick Mochel's avatar
    [driver model] Make sure system device drivers are added if registered late. · 8861b6ce
    Patrick Mochel authored
    From Jeremy Fitzhardinge:
    
    With the current system device changes (I picked them up in 2.5.70-mm8),
    the system device class assumes that all system device drivers are
    registered before any system devices are registered.
    
    Unfortunately, this is often not the case.  CPU devices are registered
    very early, but cpufreq registers drivers for them; since cpufreq
    drivers can be loaded as modules, they clearly can't be registered
    before the device is.
    
    This patch keeps a list of all registered devices hanging off the system
    device class.  When a new driver is registered, it calls the driver's
    add() function with all existing devices.
    
    Conversely, when a driver is unregistered, it calls the driver's
    remove() function for all existing devices so the driver can clean up.
    
    Note: the list in the class's embedded kset is used, rather than creating
    a new field.
    8861b6ce
sys.c 11.2 KB