2024-03-29 21:12:17

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 0/4] 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
--
2.43.0



2024-03-29 21:12:24

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 3/4] scsi: atari_scsi: 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/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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/scsi/atari_scsi.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index d99e70914817..742625ac7d99 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -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,
--
2.43.0


2024-03-29 21:12:30

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 4/4] scsi: mac_scsi: 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/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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/scsi/mac_scsi.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c
index 181f16899fdc..a402c4dc4645 100644
--- a/drivers/scsi/mac_scsi.c
+++ b/drivers/scsi/mac_scsi.c
@@ -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,
--
2.43.0


2024-03-29 21:12:37

by Uwe Kleine-König

[permalink] [raw]
Subject: [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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/scsi/a3000.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c
index 378906f77909..ad39797890e5 100644
--- a/drivers/scsi/a3000.c
+++ b/drivers/scsi/a3000.c
@@ -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",
--
2.43.0


2024-03-29 21:12:50

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH 2/4] scsi: a4000t: 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/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.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/scsi/a4000t.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/a4000t.c b/drivers/scsi/a4000t.c
index e435fc06a624..d9103adc87fe 100644
--- a/drivers/scsi/a4000t.c
+++ b/drivers/scsi/a4000t.c
@@ -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",
--
2.43.0


2024-04-06 01:13:07

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH 0/4] scsi: Prevent several section mismatch warnings


Uwe,

> 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!

--
Martin K. Petersen Oracle Linux Engineering

2024-04-09 03:09:44

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH 0/4] scsi: Prevent several section mismatch warnings

On Fri, 29 Mar 2024 22:11:40 +0100, Uwe Kleine-König wrote:

> 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

--
Martin K. Petersen Oracle Linux Engineering