• Benjamin Herrenschmidt's avatar
    [PATCH] Add try_acquire_console_sem · 24ddf24c
    Benjamin Herrenschmidt authored
    The new PowerMac sleep code provides an arch hook that can be used by video
    drivers on laptops to bring back the screen very early, pretty much before
    anything else.  This basically turns reports of the style "my laptop doesn't
    wakeup" to "I get this or this oops/error/panic on wakeup", making fixing the
    PM related bugs possible on a whole range of them.
    
    However, the fbdev wakeup code triggers WARN_ON's in the VT subsystem if
    called without the console semaphore when redrawing the screen (I added those
    warnings a couple of kernel versions ago), and we can't call
    acquire_console_sem() since we are so early in the wakeup process that we are
    considered as in_atomic() (we hold irqs off too).
    
    This patch addds a try_acquire_console_sem() function that can be used by
    those video drivers that implement this early wakeup hook.  If the acquire
    fails (which should never happen in practice), wakeup is delayed to the normal
    PCI callback which does a blocking acquire_console_sem().
    Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    24ddf24c
printk.c 23.5 KB