s390/ipl: Improve readability
cover s390/ipl: Improve readability
Improve readability of s390 ipl code by openly writing static struct definitions, reformatting list definitions and using ARRAY_SIZE() macro in suitable places.
No functional changes, only coding style changes.
---
Mete Durlu (2):
s390/ipl: Use ARRAY_SIZE macro
s390/ipl: Improve readability
arch/s390/kernel/ipl.c | 58 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 20 deletions(-)
---
base-commit: 248951ddc14de84de3910f9b13f51491a8cd91df
change-id: 20260721-ipl_refactor-ef6aa1bafa8a
Best regards,
Signature · 1 line
Mete Durlu <[email protected]>
PATCH 1/2 s390/ipl: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro instead of reimplementing it.
--- arch/s390/kernel/ipl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/s390/kernel/ipl.c +2 -3
@@ -2044,7 +2044,6 @@ static struct shutdown_action stop_action = {SHUTDOWN_ACTION_STOP_STR,static struct shutdown_action *shutdown_actions_list[] = { &ipl_action, &reipl_action, &dump_reipl_action, &dump_action, &vmcmd_action, &stop_action}; -#define SHUTDOWN_ACTIONS_COUNT (sizeof(shutdown_actions_list) / sizeof(void *))/* * Trigger section
@@ -2057,7 +2056,7 @@ static int set_trigger(const char *buf, struct shutdown_trigger *trigger, {int i; -for (i =0 ; i <SHUTDOWN_ACTIONS_COUNT ; i++) { +for (i =0 ; i <ARRAY_SIZE (shutdown_actions_list); i++) {if (sysfs_streq (buf, shutdown_actions_list[i]->name)) {if (shutdown_actions_list[i]->init_rc) {return shutdown_actions_list[i]->init_rc;
@@ -2242,7 +2241,7 @@ static void __init shutdown_actions_init(void) {int i; -for (i =0 ; i <SHUTDOWN_ACTIONS_COUNT ; i++) { +for (i =0 ; i <ARRAY_SIZE (shutdown_actions_list); i++) {if (!shutdown_actions_list[i]->init)continue ; shutdown_actions_list[i]->init_rc =
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 1/2] s390/ipl: Use ARRAY_SIZE macro
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 3 lines
Use
ARRAY_SIZEmacro instead of reimplementing it.Signed-off-by Mete Durlu <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH 2/2 s390/ipl: Improve readability
In reply to Mete DurluUse explicit decleration on all shutdown_action/shutdown_trigger declerations and reformat shutdown_actions_list decleration to improve readability. No functional changes.
--- arch/s390/kernel/ipl.c | 53 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 17 deletions(-)
arch/s390/kernel/ipl.c +36 -17
@@ -2021,8 +2021,11 @@ static int vmcmd_init(void)return sysfs_create_group (&vmcmd_kset->kobj, &vmcmd_attr_group); } -static struct shutdown_action vmcmd_action = {SHUTDOWN_ACTION_VMCMD_STR , - vmcmd_run, vmcmd_init}; +static struct shutdown_action vmcmd_action = { + .name =SHUTDOWN_ACTION_VMCMD_STR , + .fn = vmcmd_run, + .init = vmcmd_init +};/* * stop shutdown action: Stop Linux on shutdown.
@@ -2036,14 +2039,21 @@ static void stop_run(struct shutdown_trigger *trigger)smp_stop_cpu (); } -static struct shutdown_action stop_action = {SHUTDOWN_ACTION_STOP_STR , - stop_run,NULL }; +static struct shutdown_action stop_action = { + .name =SHUTDOWN_ACTION_STOP_STR , + .fn = stop_run +};/* action list */ static struct shutdown_action *shutdown_actions_list[] = { - &ipl_action, &reipl_action, &dump_reipl_action, &dump_action, - &vmcmd_action, &stop_action}; + &ipl_action, + &reipl_action, + &dump_reipl_action, + &dump_action, + &vmcmd_action, + &stop_action +};/* * Trigger section
@@ -2071,8 +2081,10 @@ static int set_trigger(const char *buf, struct shutdown_trigger *trigger,/* on reipl */ -static struct shutdown_trigger on_reboot_trigger = {ON_REIPL_STR , - &reipl_action}; +static struct shutdown_trigger on_reboot_trigger = { + .name =ON_REIPL_STR , + .action = &reipl_action +};static ssize_t on_reboot_show (struct kobject *kobj,struct kobj_attribute *attr,char *page)
@@ -2097,8 +2109,10 @@ static void do_machine_restart(char *__unused)void (*_machine_restart)(char *command) = do_machine_restart;/* on panic */ - -static struct shutdown_trigger on_panic_trigger = {ON_PANIC_STR , &stop_action}; +static struct shutdown_trigger on_panic_trigger = { + .name =ON_PANIC_STR , + .action = &stop_action +};static ssize_t on_panic_show (struct kobject *kobj,struct kobj_attribute *attr,char *page)
@@ -2122,9 +2136,10 @@ static void do_panic(void) }/* on restart */ - -static struct shutdown_trigger on_restart_trigger = {ON_RESTART_STR , - &stop_action}; +static struct shutdown_trigger on_restart_trigger = { + .name =ON_RESTART_STR , + .action = &stop_action +};static ssize_t on_restart_show (struct kobject *kobj,struct kobj_attribute *attr,char *page)
@@ -2159,8 +2174,10 @@ void do_restart(void *arg) }/* on halt */ - -static struct shutdown_trigger on_halt_trigger = {ON_HALT_STR , &stop_action}; +static struct shutdown_trigger on_halt_trigger = { + .name =ON_HALT_STR , + .action = &stop_action +};static ssize_t on_halt_show (struct kobject *kobj,struct kobj_attribute *attr,char *page)
@@ -2185,8 +2202,10 @@ static void do_machine_halt(void)void (*_machine_halt)(void ) = do_machine_halt;/* on power off */ - -static struct shutdown_trigger on_poff_trigger = {ON_POFF_STR , &stop_action}; +static struct shutdown_trigger on_poff_trigger = { + .name =ON_POFF_STR , + .action = &stop_action +};static ssize_t on_poff_show (struct kobject *kobj,struct kobj_attribute *attr,char *page)
Signature · 1 line
2.53.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines
Use explicit decleration on all shutdown_action/shutdown_trigger declerations and reformat
shutdown_actions_listdecleration to improve readability. No functional changes.Signed-off-by Mete Durlu <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Quoted 6 lines · Mete Durlu
Improve readability of s390 ipl code by openly writing static struct definitions, reformatting list definitions and using
ARRAY_SIZE()macro in suitable places.No functional changes, only coding style changes.
Quoted 8 lines
Signed-off-by Mete Durlu <[email protected]>---
Mete Durlu (2):
s390/ipl: UseARRAY_SIZEmacro
s390/ipl: Improve readabilityarch/s390/kernel/ipl.c | 58 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 20 deletions(-)
Quoted 6 lines · Mete Durlu
Improve readability of s390 ipl code by openly writing static struct definitions, reformatting list definitions and using
ARRAY_SIZE()macro in suitable places.No functional changes, only coding style changes.
Quoted 8 lines
Signed-off-by Mete Durlu <[email protected]>---
Mete Durlu (2):
s390/ipl: UseARRAY_SIZEmacro
s390/ipl: Improve readabilityarch/s390/kernel/ipl.c | 58 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 20 deletions(-)
Applied, thank you!