• Patrick Mochel's avatar
    [driver model] Add save() and restore() methods for system device drivers. · d507789a
    Patrick Mochel authored
    It turns out that at least some system device drivers need to allocate 
    memory and/or sleep for one reason or another when either saving or 
    restoring state. 
    
    Instead of adding a 'level' paramter to the suspend() and resume() methods,
    which I despise and think is a horrible programming interface, two new 
    methods have been added to struct sysdev_driver:
    
            int     (*save)(struct sys_device *, u32 state);
            int     (*restore)(struct sys_device *);
    
    that are called explicitly before and after suspend() and resume() 
    respectively, with interrupts enabled. This gives the drivers the
    flexibility to allocate memory and sleep, if necessary. 
    d507789a
power.c 3.66 KB