Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH 0/2] s390/ipl: Improve readability
@ 2026-07-21 18:47 Mete Durlu
  2026-07-21 18:47 ` [PATCH 1/2] s390/ipl: Use ARRAY_SIZE macro Mete Durlu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mete Durlu @ 2026-07-21 18:47 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle
  Cc: linux-s390, 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.

Signed-off-by: Mete Durlu <meted@linux.ibm.com>
---
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,
-- 
Mete Durlu <meted@linux.ibm.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] s390/ipl: Use ARRAY_SIZE macro
  2026-07-21 18:47 [PATCH 0/2] s390/ipl: Improve readability Mete Durlu
@ 2026-07-21 18:47 ` Mete Durlu
  2026-07-21 19:00   ` sashiko-bot
  2026-07-21 18:47 ` [PATCH 2/2] s390/ipl: Improve readability Mete Durlu
  2026-07-22  8:28 ` [PATCH 0/2] " Heiko Carstens
  2 siblings, 1 reply; 6+ messages in thread
From: Mete Durlu @ 2026-07-21 18:47 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle
  Cc: linux-s390, Mete Durlu

Use ARRAY_SIZE macro instead of reimplementing it.

Signed-off-by: Mete Durlu <meted@linux.ibm.com>
---
 arch/s390/kernel/ipl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 3c346b02ceb9..2e1e37588d0d 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -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 =

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] s390/ipl: Improve readability
  2026-07-21 18:47 [PATCH 0/2] s390/ipl: Improve readability Mete Durlu
  2026-07-21 18:47 ` [PATCH 1/2] s390/ipl: Use ARRAY_SIZE macro Mete Durlu
@ 2026-07-21 18:47 ` Mete Durlu
  2026-07-21 19:04   ` sashiko-bot
  2026-07-22  8:28 ` [PATCH 0/2] " Heiko Carstens
  2 siblings, 1 reply; 6+ messages in thread
From: Mete Durlu @ 2026-07-21 18:47 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle
  Cc: linux-s390, Mete Durlu

Use explicit decleration on all shutdown_action/shutdown_trigger
declerations and reformat shutdown_actions_list decleration to
improve readability. No functional changes.

Signed-off-by: Mete Durlu <meted@linux.ibm.com>
---
 arch/s390/kernel/ipl.c | 53 ++++++++++++++++++++++++++++++++++----------------
 1 file changed, 36 insertions(+), 17 deletions(-)

diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 2e1e37588d0d..d74ef30155aa 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -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)

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] s390/ipl: Use ARRAY_SIZE macro
  2026-07-21 18:47 ` [PATCH 1/2] s390/ipl: Use ARRAY_SIZE macro Mete Durlu
@ 2026-07-21 19:00   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-07-21 19:00 UTC (permalink / raw)
  To: Mete Durlu; +Cc: linux-s390, Alexander Gordeev, Heiko Carstens, Vasily Gorbik

> Use ARRAY_SIZE macro instead of reimplementing it.
> 
> Signed-off-by: Mete Durlu <meted@linux.ibm.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721-ipl_refactor-v1-0-4d5938de9a70@linux.ibm.com?part=1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] s390/ipl: Improve readability
  2026-07-21 18:47 ` [PATCH 2/2] s390/ipl: Improve readability Mete Durlu
@ 2026-07-21 19:04   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-07-21 19:04 UTC (permalink / raw)
  To: Mete Durlu; +Cc: Heiko Carstens, linux-s390, Vasily Gorbik, Alexander Gordeev

> Use explicit decleration on all shutdown_action/shutdown_trigger
> declerations and reformat shutdown_actions_list decleration to
> improve readability. No functional changes.
> 
> Signed-off-by: Mete Durlu <meted@linux.ibm.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721-ipl_refactor-v1-0-4d5938de9a70@linux.ibm.com?part=2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] s390/ipl: Improve readability
  2026-07-21 18:47 [PATCH 0/2] s390/ipl: Improve readability Mete Durlu
  2026-07-21 18:47 ` [PATCH 1/2] s390/ipl: Use ARRAY_SIZE macro Mete Durlu
  2026-07-21 18:47 ` [PATCH 2/2] s390/ipl: Improve readability Mete Durlu
@ 2026-07-22  8:28 ` Heiko Carstens
  2 siblings, 0 replies; 6+ messages in thread
From: Heiko Carstens @ 2026-07-22  8:28 UTC (permalink / raw)
  To: Mete Durlu
  Cc: Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
	Sven Schnelle, linux-s390

On Tue, Jul 21, 2026 at 08:47:26PM +0200, Mete Durlu wrote:
> 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.
> 
> Signed-off-by: Mete Durlu <meted@linux.ibm.com>
> ---
> 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(-)

Acked-by: Heiko Carstens <hca@linux.ibm.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-22  8:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21 18:47 [PATCH 0/2] s390/ipl: Improve readability Mete Durlu
2026-07-21 18:47 ` [PATCH 1/2] s390/ipl: Use ARRAY_SIZE macro Mete Durlu
2026-07-21 19:00   ` sashiko-bot
2026-07-21 18:47 ` [PATCH 2/2] s390/ipl: Improve readability Mete Durlu
2026-07-21 19:04   ` sashiko-bot
2026-07-22  8:28 ` [PATCH 0/2] " Heiko Carstens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox