Skip to contentSkip to conversation

scsi: Prevent several section mismatch warnings

PATCH Applied Uwe Kleine-König 2 participants 7 messages Mar 29, 2024 – Apr 9, 2024

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

cover scsi: Prevent several section mismatch warnings

Hello,

this series fixes the same issue in four drivers. The warning is a false positive and to suppress it the driver structs are marked with __refdata and a comment is added to describe the (non-trivial) situation.

Best regards
Uwe

Uwe Kleine-König (4):
scsi: a3000: Mark driver struct with __refdata to prevent section mismatch
scsi: a4000t: Mark driver struct with __refdata to prevent section mismatch
scsi: atari_scsi: Mark driver struct with __refdata to prevent section mismatch
scsi: mac_scsi: Mark driver struct with __refdata to prevent section mismatch

 drivers/scsi/a3000.c      | 8 +++++++-
 drivers/scsi/a4000t.c     | 8 +++++++-
 drivers/scsi/atari_scsi.c | 8 +++++++-
 drivers/scsi/mac_scsi.c   | 8 +++++++-
 4 files changed, 28 insertions(+), 4 deletions(-)

base-commit: a6bd6c9333397f5a0e2667d4d82fef8c970108f2

Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/4 scsi: a3000: Mark driver struct with __refdata to prevent section mismatch

As described in the added code comment, a reference to .exit.text is ok for drivers registered via module_platform_driver_probe(). Make this explicit to prevent the following section mismatch warning

	WARNING: modpost: drivers/scsi/a3000: section mismatch in reference: amiga_a3000_scsi_driver+0x8 (section: .data) -> amiga_a3000_scsi_remove (section: .exit.text)

that triggers on an allmodconfig W=1 build.

---
 drivers/scsi/a3000.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/a3000.c +7 -1
index 378906f77909..ad39797890e5 100644
@@ -295,7 +295,13 @@ static void __exit amiga_a3000_scsi_remove(struct platform_device *pdev)
 	release_mem_region(res->start, resource_size(res));
 }
 
-static struct platform_driver amiga_a3000_scsi_driver = {
+/*
+ * amiga_a3000_scsi_remove() lives in .exit.text. For drivers registered via
+ * module_platform_driver_probe() this is ok because they cannot get unbound at
+ * runtime. So mark the driver struct with __refdata to prevent modpost
+ * triggering a section mismatch warning.
+ */
+static struct platform_driver amiga_a3000_scsi_driver __refdata = {
 	.remove_new = __exit_p(amiga_a3000_scsi_remove),
 	.driver   = {
 		.name	= "amiga-a3000-scsi",
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/4 scsi: a4000t: Mark driver struct with __refdata to prevent section mismatch

In reply to Uwe Kleine-König

As described in the added code comment, a reference to .exit.text is ok for drivers registered via module_platform_driver_probe(). Make this explicit to prevent the following section mismatch warning

	WARNING: modpost: drivers/scsi/a4000t: section mismatch in reference: amiga_a4000t_scsi_driver+0x8 (section: .data) -> amiga_a4000t_scsi_remove (section: .exit.text)

that triggers on an allmodconfig W=1 build.

---
 drivers/scsi/a4000t.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/a4000t.c +7 -1
index e435fc06a624..d9103adc87fe 100644
@@ -108,7 +108,13 @@ static void __exit amiga_a4000t_scsi_remove(struct platform_device *pdev)
 	release_mem_region(res->start, resource_size(res));
 }
 
-static struct platform_driver amiga_a4000t_scsi_driver = {
+/*
+ * amiga_a4000t_scsi_remove() lives in .exit.text. For drivers registered via
+ * module_platform_driver_probe() this is ok because they cannot get unbound at
+ * runtime. So mark the driver struct with __refdata to prevent modpost
+ * triggering a section mismatch warning.
+ */
+static struct platform_driver amiga_a4000t_scsi_driver __refdata = {
 	.remove_new = __exit_p(amiga_a4000t_scsi_remove),
 	.driver   = {
 		.name	= "amiga-a4000t-scsi",
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/4 scsi: atari_scsi: Mark driver struct with __refdata to prevent section mismatch

In reply to Uwe Kleine-König

As described in the added code comment, a reference to .exit.text is ok for drivers registered via module_platform_driver_probe(). Make this explicit to prevent the following section mismatch warning

	WARNING: modpost: drivers/scsi/atari_scsi: section mismatch in reference: atari_scsi_driver+0x8 (section: .data) -> atari_scsi_remove (section: .exit.text)

that triggers on an allmodconfig W=1 build.

---
 drivers/scsi/atari_scsi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/atari_scsi.c +7 -1
index d99e70914817..742625ac7d99 100644
@@ -878,7 +878,13 @@ static void __exit atari_scsi_remove(struct platform_device *pdev)
 		atari_stram_free(atari_dma_buffer);
 }
 
-static struct platform_driver atari_scsi_driver = {
+/*
+ * atari_scsi_remove() lives in .exit.text. For drivers registered via
+ * module_platform_driver_probe() this is ok because they cannot get unbound at
+ * runtime. So mark the driver struct with __refdata to prevent modpost
+ * triggering a section mismatch warning.
+ */
+static struct platform_driver atari_scsi_driver __refdata = {
 	.remove_new = __exit_p(atari_scsi_remove),
 	.driver = {
 		.name	= DRV_MODULE_NAME,
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/4 scsi: mac_scsi: Mark driver struct with __refdata to prevent section mismatch

In reply to Uwe Kleine-König

As described in the added code comment, a reference to .exit.text is ok for drivers registered via module_platform_driver_probe(). Make this explicit to prevent the following section mismatch warning

	WARNING: modpost: drivers/scsi/mac_scsi: section mismatch in reference: mac_scsi_driver+0x8 (section: .data) -> mac_scsi_remove (section: .exit.text)

that triggers on an allmodconfig W=1 build.

---
 drivers/scsi/mac_scsi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/mac_scsi.c +7 -1
index 181f16899fdc..a402c4dc4645 100644
@@ -534,7 +534,13 @@ static void __exit mac_scsi_remove(struct platform_device *pdev)
 	scsi_host_put(instance);
 }
 
-static struct platform_driver mac_scsi_driver = {
+/*
+ * mac_scsi_remove() lives in .exit.text. For drivers registered via
+ * module_platform_driver_probe() this is ok because they cannot get unbound at
+ * runtime. So mark the driver struct with __refdata to prevent modpost
+ * triggering a section mismatch warning.
+ */
+static struct platform_driver mac_scsi_driver __refdata = {
 	.remove_new = __exit_p(mac_scsi_remove),
 	.driver = {
 		.name	= DRV_MODULE_NAME,
Signature · 1 line
2.43.0
#5 lore raw
In reply to Uwe Kleine-König

Uwe,

Quoted 4 lines

this series fixes the same issue in four drivers. The warning is a false positive and to suppress it the driver structs are marked with __refdata and a comment is added to describe the (non-trivial) situation.

Applied to 6.10/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#6 lore raw
In reply to Uwe Kleine-König
Quoted 9 lines · Uwe Kleine-König

this series fixes the same issue in four drivers. The warning is a false positive and to suppress it the driver structs are marked with __refdata and a comment is added to describe the (non-trivial) situation.

Best regards
Uwe

[...]

Applied to 6.10/scsi-queue, thanks!

[1/4] scsi: a3000: Mark driver struct with __refdata to prevent section mismatch

      https://git.kernel.org/mkp/scsi/c/e81bb6f59b35
[2/4] scsi: a4000t: Mark driver struct with __refdata to prevent section mismatch
      https://git.kernel.org/mkp/scsi/c/e70d4cce8923
[3/4] scsi: atari_scsi: Mark driver struct with __refdata to prevent section mismatch
      https://git.kernel.org/mkp/scsi/c/bb8520996fe1
[4/4] scsi: mac_scsi: Mark driver struct with __refdata to prevent section mismatch
      https://git.kernel.org/mkp/scsi/c/4a0166d55edd
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering