mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: zorro7xx: Use individual zorro_driver_data structures
@ 2026-08-31  9:49 Geert Uytterhoeven
  2026-09-10  1:48 ` Martin K. Petersen (Oracle)
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2026-08-31  9:49 UTC (permalink / raw)
  To: James E . J . Bottomley, Martin K . Petersen
  Cc: linux-scsi, linux-m68k, linux-kernel, Geert Uytterhoeven

Using an array of zorro_driver_data objects and referring to its
elements by index obfuscates the code and is error-prone.

Improve readability and reduce code size by replacing the array (which
includes an unneeded sentinel) by individual zorro_driver_data objects.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Compile-tested + assembler output inspected.
---
 drivers/scsi/zorro7xx.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c
index 21c769dc1ecbda49..89475632675c0fb1 100644
--- a/drivers/scsi/zorro7xx.c
+++ b/drivers/scsi/zorro7xx.c
@@ -35,38 +35,45 @@ static struct scsi_host_template zorro7xx_scsi_driver_template = {
 	.module		= THIS_MODULE,
 };
 
-static struct zorro_driver_data {
+struct zorro_driver_data {
 	const char *name;
 	unsigned long offset;
 	int absolute;	/* offset is absolute address */
-} zorro7xx_driver_data[] = {
-	{ .name = "PowerUP 603e+", .offset = 0xf40000, .absolute = 1 },
-	{ .name = "WarpEngine 40xx", .offset = 0x40000 },
-	{ .name = "A4091", .offset = 0x800000 },
-	{ .name = "GForce 040/060", .offset = 0x40000 },
-	{ 0 }
+};
+
+static const struct zorro_driver_data zorro7xx_blizzard_603e_plus_data = {
+	.name = "PowerUP 603e+", .offset = 0xf40000, .absolute = 1
+};
+static const struct zorro_driver_data zorro7xx_warp_engine_40xx_data = {
+	.name = "WarpEngine 40xx", .offset = 0x40000
+};
+static const struct zorro_driver_data zorro7xx_a4091_data = {
+	.name = "A4091", .offset = 0x800000
+};
+static const struct zorro_driver_data zorro7xx_gforce_040_060_data = {
+	.name = "GForce 040/060", .offset = 0x40000
 };
 
 static struct zorro_device_id zorro7xx_zorro_tbl[] = {
 	{
 		.id = ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS,
-		.driver_data_ptr = &zorro7xx_driver_data[0],
+		.driver_data_ptr = &zorro7xx_blizzard_603e_plus_data,
 	},
 	{
 		.id = ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE_40xx,
-		.driver_data_ptr = &zorro7xx_driver_data[1],
+		.driver_data_ptr = &zorro7xx_warp_engine_40xx_data,
 	},
 	{
 		.id = ZORRO_PROD_CBM_A4091_1,
-		.driver_data_ptr = &zorro7xx_driver_data[2],
+		.driver_data_ptr = &zorro7xx_a4091_data,
 	},
 	{
 		.id = ZORRO_PROD_CBM_A4091_2,
-		.driver_data_ptr = &zorro7xx_driver_data[2],
+		.driver_data_ptr = &zorro7xx_a4091_data,
 	},
 	{
 		.id = ZORRO_PROD_GVP_GFORCE_040_060,
-		.driver_data_ptr = &zorro7xx_driver_data[3],
+		.driver_data_ptr = &zorro7xx_gforce_040_060_data,
 	},
 	{ }
 };
-- 
2.43.0


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

* Re: [PATCH] scsi: zorro7xx: Use individual zorro_driver_data structures
  2026-08-31  9:49 [PATCH] scsi: zorro7xx: Use individual zorro_driver_data structures Geert Uytterhoeven
@ 2026-09-10  1:48 ` Martin K. Petersen (Oracle)
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen (Oracle) @ 2026-09-10  1:48 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
	linux-m68k, linux-kernel


Geert,

> Using an array of zorro_driver_data objects and referring to its
> elements by index obfuscates the code and is error-prone.
>
> Improve readability and reduce code size by replacing the array (which
> includes an unneeded sentinel) by individual zorro_driver_data objects.

Applied to 7.4/scsi-staging, thanks!

-- 
Martin K. Petersen

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

end of thread, other threads:[~2026-09-10  1:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31  9:49 [PATCH] scsi: zorro7xx: Use individual zorro_driver_data structures Geert Uytterhoeven
2026-09-10  1:48 ` Martin K. Petersen (Oracle)

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

all inboxes | Powered by JetHome®