[S390] shutdown actions: save/return rc from init function
authorFrank Munzert <munzert@de.ibm.com>
Tue, 7 Jul 2009 14:37:07 +0000 (16:37 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 7 Jul 2009 14:37:52 +0000 (16:37 +0200)
We always returned -EINVAL when setting of a shutdown action failed. This was
misleading, if for example the hardware did not support the shutdown action.
Now we save each shutdown action's init return code and return it when the
action is being set.

Signed-off-by: Frank Munzert <munzert@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/ipl.c

index b8bf4b140065226bbb8f48e3f4eadd07e8c04b7b..371a2d88f4ac7b6e170134b96b4924c69f8a8b99 100644 (file)
@@ -70,6 +70,7 @@ struct shutdown_action {
        char *name;
        void (*fn) (struct shutdown_trigger *trigger);
        int (*init) (void);
+       int init_rc;
 };
 
 static char *ipl_type_str(enum ipl_type type)
@@ -1486,11 +1487,13 @@ static int set_trigger(const char *buf, struct shutdown_trigger *trigger,
        int i;
 
        for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) {
-               if (!shutdown_actions_list[i])
-                       continue;
                if (sysfs_streq(buf, shutdown_actions_list[i]->name)) {
-                       trigger->action = shutdown_actions_list[i];
-                       return len;
+                       if (shutdown_actions_list[i]->init_rc) {
+                               return shutdown_actions_list[i]->init_rc;
+                       } else {
+                               trigger->action = shutdown_actions_list[i];
+                               return len;
+                       }
                }
        }
        return -EINVAL;
@@ -1640,8 +1643,8 @@ static void __init shutdown_actions_init(void)
        for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) {
                if (!shutdown_actions_list[i]->init)
                        continue;
-               if (shutdown_actions_list[i]->init())
-                       shutdown_actions_list[i] = NULL;
+               shutdown_actions_list[i]->init_rc =
+                       shutdown_actions_list[i]->init();
        }
 }