Skip to contentSkip to conversation

scsi: Improve style of pnp_device_id array terminator

PATCH Applied Uwe Kleine-König (The Capable Hub) 4 participants 5 messages Jun 10 – Jul 12

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: Improve style of pnp_device_id array terminator

To match how device-id array terminators look like for other device types drop .id = "" from it and let the compiler care for zeroing the entry.

There are no changes in the compiled drivers, only the source looks nicer.

---
Hello,

I'm currently working on changing various *_device_id definitions. This patch is irrelevant for this quest and a pure style update for consistency reasons without further dependencies on it. I just stumbled over this while working on that quest.

So if you don't like this patch, I won't insist.

Best regards
Uwe

 drivers/scsi/aha1542.c   | 2 +-
 drivers/scsi/g_NCR5380.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/aha1542.c +1 -1
index fd766282d4a4..93dab19c1cb9 100644
@@ -1083,7 +1083,7 @@ static int isa_registered;
 #ifdef CONFIG_PNP
 static const struct pnp_device_id aha1542_pnp_ids[] = {
 	{ .id = "ADP1542" },
-	{ .id = "" }
+	{ }
 };
 MODULE_DEVICE_TABLE(pnp, aha1542_pnp_ids);
 
drivers/scsi/g_NCR5380.c +1 -1
index 270eae7ac427..41731a7304dd 100644
@@ -739,7 +739,7 @@ static struct isa_driver generic_NCR5380_isa_driver = {
 #ifdef CONFIG_PNP
 static const struct pnp_device_id generic_NCR5380_pnp_ids[] = {
 	{ .id = "DTC436e", .driver_data = BOARD_DTC3181E },
-	{ .id = "" }
+	{ }
 };
 MODULE_DEVICE_TABLE(pnp, generic_NCR5380_pnp_ids);
 

base-commit: 49e02880ec0a8c378e811bc9d85da188d7c6204c

Signature · 1 line
2.47.3
#1 lore raw
Quoted 30 lines · Uwe Kleine-König (The Capable Hub)

To match how device-id array terminators look like for other device types drop .id = "" from it and let the compiler care for zeroing the entry.

There are no changes in the compiled drivers, only the source looks nicer.

---
Hello,

I'm currently working on changing various *_device_id definitions. This patch is irrelevant for this quest and a pure style update for consistency reasons without further dependencies on it. I just stumbled over this while working on that quest.

So if you don't like this patch, I won't insist.

Best regards
Uwe

  drivers/scsi/aha1542.c   | 2 +-
  drivers/scsi/g_NCR5380.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/aha1542.c +0 -0
index fd766282d4a4..93dab19c1cb9 100644

drivers/scsi/aha1542.c static int isa_registered; · line 1086

Quoted 4 lines
drivers/scsi/aha1542.c +0 -1
@@ -1083,7 +1083,7 @@ static int isa_registered;
  #ifdef CONFIG_PNP
  static const struct pnp_device_id aha1542_pnp_ids[] = {
  	{ .id = "ADP1542" },
-	{ .id = "" }

It seems to be standard practice to use { .id = "" } as pnp dev table sentinel - so why change? Are they all going to be changed?

Quoted 19 lines
drivers/scsi/aha1542.c +1 -0
+	{ }
  };
  MODULE_DEVICE_TABLE(pnp, aha1542_pnp_ids);
 
drivers/scsi/g_NCR5380.c +1 -1
index 270eae7ac427..41731a7304dd 100644
@@ -739,7 +739,7 @@ static struct isa_driver generic_NCR5380_isa_driver = {
  #ifdef CONFIG_PNP
  static const struct pnp_device_id generic_NCR5380_pnp_ids[] = {
  	{ .id = "DTC436e", .driver_data = BOARD_DTC3181E },
-	{ .id = "" }
+	{ }
  };
  MODULE_DEVICE_TABLE(pnp, generic_NCR5380_pnp_ids);
 

base-commit: 49e02880ec0a8c378e811bc9d85da188d7c6204c

#2 lore raw
Quoted 26 lines · John Garry
Quoted 25 lines · Uwe Kleine-König (The Capable Hub)

To match how device-id array terminators look like for other device types drop .id = "" from it and let the compiler care for zeroing the entry.

There are no changes in the compiled drivers, only the source looks nicer.

---
Hello,

I'm currently working on changing various *_device_id definitions. This patch is irrelevant for this quest and a pure style update for consistency reasons without further dependencies on it. I just stumbled over this while working on that quest.

So if you don't like this patch, I won't insist.

Best regards
Uwe

  drivers/scsi/aha1542.c   | 2 +-
  drivers/scsi/g_NCR5380.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 12 lines

drivers/scsi/aha1542.c static int isa_registered; · line 1086

Quoted 9 lines
drivers/scsi/aha1542.c +0 -1
index fd766282d4a4..93dab19c1cb9 100644
@@ -1083,7 +1083,7 @@ static int isa_registered;
  #ifdef CONFIG_PNP
  static const struct pnp_device_id aha1542_pnp_ids[] = {
  	{ .id = "ADP1542" },
-	{ .id = "" }

It seems to be standard practice to use { .id = "" } as pnp dev table sentinel - so why change? Are they all going to be changed?

I sent several patches reworking pnp_device_id arrays. Both styles exist (and also { "", 0 }) and I adapted all arrays I touched to the { } style matching what is usual for all other *_device_id arrays I saw so far.

And I sent this patch only to create consistency. I think I catched most instances already, and before declaring the quest done I will make sure to tackle also those that I now might have missed for now.

Best regards
Uwe

Reviewed-by on v1 1/1
#3 lore raw
In reply to Uwe Kleine-König (The Capable Hub)
Quoted 18 lines · Uwe Kleine-König (The Capable Hub)
drivers/scsi/aha1542.c +1 -1
index fd766282d4a4..93dab19c1cb9 100644
@@ -1083,7 +1083,7 @@ static int isa_registered;
  #ifdef CONFIG_PNP
  static const struct pnp_device_id aha1542_pnp_ids[] = {
  	{ .id = "ADP1542" },
-	{ .id = "" }
+	{ }
  };
  MODULE_DEVICE_TABLE(pnp, aha1542_pnp_ids);
 
drivers/scsi/g_NCR5380.c +0 -0
index 270eae7ac427..41731a7304dd 100644

drivers/scsi/g_NCR5380.c static struct isa_driver generic_NCR5380_isa_driver = { · line 744

Quoted 7 lines
drivers/scsi/g_NCR5380.c +1 -1
@@ -739,7 +739,7 @@ static struct isa_driver generic_NCR5380_isa_driver = {
  #ifdef CONFIG_PNP
  static const struct pnp_device_id generic_NCR5380_pnp_ids[] = {
  	{ .id = "DTC436e", .driver_data = BOARD_DTC3181E },
-	{ .id = "" }
+	{ }
  };
  MODULE_DEVICE_TABLE(pnp, generic_NCR5380_pnp_ids);

Although in general I'm not a fan of code cleanups for legacy drivers, I like this change. Hence: