diff options
author | Frank Munzert <munzert@de.ibm.com> | 2009-07-07 10:37:07 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-07-07 10:37:52 -0400 |
commit | 81088819d588ba4d2dce3bf083fafc91974b14e0 (patch) | |
tree | 1b94bccf932dedeccaea29c6fea4d30d44b463d4 | |
parent | aeec92ca3a1d5ca96efe76988fd4df943a90300d (diff) |
[S390] shutdown actions: save/return rc from init function
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>
-rw-r--r-- | arch/s390/kernel/ipl.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index b8bf4b140065..371a2d88f4ac 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -70,6 +70,7 @@ struct shutdown_action { | |||
70 | char *name; | 70 | char *name; |
71 | void (*fn) (struct shutdown_trigger *trigger); | 71 | void (*fn) (struct shutdown_trigger *trigger); |
72 | int (*init) (void); | 72 | int (*init) (void); |
73 | int init_rc; | ||
73 | }; | 74 | }; |
74 | 75 | ||
75 | static char *ipl_type_str(enum ipl_type type) | 76 | static char *ipl_type_str(enum ipl_type type) |
@@ -1486,11 +1487,13 @@ static int set_trigger(const char *buf, struct shutdown_trigger *trigger, | |||
1486 | int i; | 1487 | int i; |
1487 | 1488 | ||
1488 | for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) { | 1489 | for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) { |
1489 | if (!shutdown_actions_list[i]) | ||
1490 | continue; | ||
1491 | if (sysfs_streq(buf, shutdown_actions_list[i]->name)) { | 1490 | if (sysfs_streq(buf, shutdown_actions_list[i]->name)) { |
1492 | trigger->action = shutdown_actions_list[i]; | 1491 | if (shutdown_actions_list[i]->init_rc) { |
1493 | return len; | 1492 | return shutdown_actions_list[i]->init_rc; |
1493 | } else { | ||
1494 | trigger->action = shutdown_actions_list[i]; | ||
1495 | return len; | ||
1496 | } | ||
1494 | } | 1497 | } |
1495 | } | 1498 | } |
1496 | return -EINVAL; | 1499 | return -EINVAL; |
@@ -1640,8 +1643,8 @@ static void __init shutdown_actions_init(void) | |||
1640 | for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) { | 1643 | for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) { |
1641 | if (!shutdown_actions_list[i]->init) | 1644 | if (!shutdown_actions_list[i]->init) |
1642 | continue; | 1645 | continue; |
1643 | if (shutdown_actions_list[i]->init()) | 1646 | shutdown_actions_list[i]->init_rc = |
1644 | shutdown_actions_list[i] = NULL; | 1647 | shutdown_actions_list[i]->init(); |
1645 | } | 1648 | } |
1646 | } | 1649 | } |
1647 | 1650 | ||