mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] scsi: Prevent several section mismatch warnings
@ 2024-03-29 21:11 Uwe Kleine-König
  2024-03-29 21:11 ` [PATCH 1/4] scsi: a3000: Mark driver struct with __refdata to prevent section mismatch Uwe Kleine-König
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2024-03-29 21:11 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: linux-scsi, linux-kernel, Finn Thain, Michael Schmitz

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


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

* [PATCH 1/4] scsi: a3000: Mark driver struct with __refdata to prevent section mismatch
  2024-03-29 21:11 [PATCH 0/4] scsi: Prevent several section mismatch warnings Uwe Kleine-König
@ 2024-03-29 21:11 ` Uwe Kleine-König
  2024-03-29 21:11 ` [PATCH 2/4] scsi: a4000t: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2024-03-29 21:11 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen; +Cc: linux-scsi, linux-kernel

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 <u.kleine-koenig@pengutronix.de>
---
 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


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

* [PATCH 2/4] scsi: a4000t: Mark driver struct with __refdata to prevent section mismatch
  2024-03-29 21:11 [PATCH 0/4] scsi: Prevent several section mismatch warnings Uwe Kleine-König
  2024-03-29 21:11 ` [PATCH 1/4] scsi: a3000: Mark driver struct with __refdata to prevent section mismatch Uwe Kleine-König
@ 2024-03-29 21:11 ` Uwe Kleine-König
  2024-03-29 21:11 ` [PATCH 3/4] scsi: atari_scsi: " Uwe Kleine-König
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2024-03-29 21:11 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen; +Cc: linux-scsi, linux-kernel

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 <u.kleine-koenig@pengutronix.de>
---
 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


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

* [PATCH 3/4] scsi: atari_scsi: Mark driver struct with __refdata to prevent section mismatch
  2024-03-29 21:11 [PATCH 0/4] scsi: Prevent several section mismatch warnings Uwe Kleine-König
  2024-03-29 21:11 ` [PATCH 1/4] scsi: a3000: Mark driver struct with __refdata to prevent section mismatch Uwe Kleine-König
  2024-03-29 21:11 ` [PATCH 2/4] scsi: a4000t: " Uwe Kleine-König
@ 2024-03-29 21:11 ` Uwe Kleine-König
  2024-03-29 21:11 ` [PATCH 4/4] scsi: mac_scsi: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2024-03-29 21:11 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: Finn Thain, Michael Schmitz, linux-scsi, linux-kernel

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 <u.kleine-koenig@pengutronix.de>
---
 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


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

* [PATCH 4/4] scsi: mac_scsi: Mark driver struct with __refdata to prevent section mismatch
  2024-03-29 21:11 [PATCH 0/4] scsi: Prevent several section mismatch warnings Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2024-03-29 21:11 ` [PATCH 3/4] scsi: atari_scsi: " Uwe Kleine-König
@ 2024-03-29 21:11 ` Uwe Kleine-König
  2024-04-06  1:12 ` [PATCH 0/4] scsi: Prevent several section mismatch warnings Martin K. Petersen
  2024-04-09  3:08 ` Martin K. Petersen
  5 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2024-03-29 21:11 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: Finn Thain, Michael Schmitz, linux-scsi, linux-kernel

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 <u.kleine-koenig@pengutronix.de>
---
 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


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

* Re: [PATCH 0/4] scsi: Prevent several section mismatch warnings
  2024-03-29 21:11 [PATCH 0/4] scsi: Prevent several section mismatch warnings Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2024-03-29 21:11 ` [PATCH 4/4] scsi: mac_scsi: " Uwe Kleine-König
@ 2024-04-06  1:12 ` Martin K. Petersen
  2024-04-09  3:08 ` Martin K. Petersen
  5 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2024-04-06  1:12 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel, Finn Thain, Michael Schmitz


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

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

* Re: [PATCH 0/4] scsi: Prevent several section mismatch warnings
  2024-03-29 21:11 [PATCH 0/4] scsi: Prevent several section mismatch warnings Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2024-04-06  1:12 ` [PATCH 0/4] scsi: Prevent several section mismatch warnings Martin K. Petersen
@ 2024-04-09  3:08 ` Martin K. Petersen
  5 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2024-04-09  3:08 UTC (permalink / raw)
  To: James E.J. Bottomley, Uwe Kleine-König
  Cc: Martin K . Petersen, linux-scsi, linux-kernel, Finn Thain,
	Michael Schmitz

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

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

end of thread, other threads:[~2024-04-09  3:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-29 21:11 [PATCH 0/4] scsi: Prevent several section mismatch warnings Uwe Kleine-König
2024-03-29 21:11 ` [PATCH 1/4] scsi: a3000: Mark driver struct with __refdata to prevent section mismatch Uwe Kleine-König
2024-03-29 21:11 ` [PATCH 2/4] scsi: a4000t: " Uwe Kleine-König
2024-03-29 21:11 ` [PATCH 3/4] scsi: atari_scsi: " Uwe Kleine-König
2024-03-29 21:11 ` [PATCH 4/4] scsi: mac_scsi: " Uwe Kleine-König
2024-04-06  1:12 ` [PATCH 0/4] scsi: Prevent several section mismatch warnings Martin K. Petersen
2024-04-09  3:08 ` Martin K. Petersen

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®