ia64/xen-unstable

changeset 6218:7c1d66d4e51e

Avoid spurious "Ignoring shutdown request" messages, fix memory leak and simplif
y code.
Also fix whitespace.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Wed Aug 17 08:26:58 2005 +0000 (2005-08-17)
parents 26c03c17c418
children 3b0ce44f7b7a
files linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Tue Aug 16 17:02:49 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Wed Aug 17 08:26:58 2005 +0000
     1.3 @@ -256,19 +256,23 @@ static void shutdown_handler(struct xenb
     1.4      char *str;
     1.5  
     1.6      str = (char *)xenbus_read("control", "shutdown", NULL);
     1.7 -    /* Ignore read errors and recursive shutdown events. */
     1.8 -    if (IS_ERR(str) || !strcmp(str, __stringify(SHUTDOWN_INVALID)))
     1.9 +    /* Ignore read errors. */
    1.10 +    if (IS_ERR(str))
    1.11          return;
    1.12 -
    1.13 -    xenbus_printf("control", "shutdown", "%i", SHUTDOWN_INVALID);
    1.14 +    if (strlen(str) == 0) {
    1.15 +        kfree(str);
    1.16 +        return;
    1.17 +    }
    1.18  
    1.19 -    if (strcmp(str, "poweroff") == 0) {
    1.20 +    xenbus_printf("control", "shutdown", "");
    1.21 +
    1.22 +    if (strcmp(str, "poweroff") == 0)
    1.23          shutting_down = SHUTDOWN_POWEROFF;
    1.24 -    } else if (strcmp(str, "reboot") == 0) {
    1.25 +    else if (strcmp(str, "reboot") == 0)
    1.26          shutting_down = SHUTDOWN_REBOOT;
    1.27 -    } else if (strcmp(str, "suspend") == 0) {
    1.28 +    else if (strcmp(str, "suspend") == 0)
    1.29          shutting_down = SHUTDOWN_SUSPEND;
    1.30 -    } else {
    1.31 +    else {
    1.32          printk("Ignoring shutdown request: %s\n", str);
    1.33          shutting_down = SHUTDOWN_INVALID;
    1.34      }