Skip to contentSkip to conversation

scsi: sun3: Mark driver struct with __refdata to prevent section mismatch

PATCH Applied Geert Uytterhoeven 4 participants 6 messages Nov 5, 2024 – Nov 14, 2024

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

PATCH 1/1 scsi: sun3: 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 warnings

    WARNING: modpost: drivers/scsi/sun3_scsi: section mismatch in reference: sun3_scsi_driver+0x4 (section: .data) -> sun3_scsi_remove (section: .exit.text)
    WARNING: modpost: drivers/scsi/sun3_scsi_vme: section mismatch in reference: sun3_scsi_driver+0x4 (section: .data) -> sun3_scsi_remove (section: .exit.text)

that trigger on a Sun 3 allmodconfig build.

---
 drivers/scsi/sun3_scsi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/sun3_scsi.c +7 -1
index fffc0fa525940cee..1bd1c3f87ff7dd42 100644
@@ -656,7 +656,13 @@ static void __exit sun3_scsi_remove(struct platform_device *pdev)
 	iounmap(ioaddr);
 }
 
-static struct platform_driver sun3_scsi_driver = {
+/*
+ * sun3_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 sun3_scsi_driver __refdata = {
 	.remove_new = __exit_p(sun3_scsi_remove),
 	.driver = {
 		.name	= DRV_MODULE_NAME,
Signature · 1 line
2.34.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Geert Uytterhoeven

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 warnings

    WARNING: modpost: drivers/scsi/sun3_scsi: section mismatch in reference: sun3_scsi_driver+0x4 (section: .data) -> sun3_scsi_remove (section: .exit.text)
    WARNING: modpost: drivers/scsi/sun3_scsi_vme: section mismatch in reference: sun3_scsi_driver+0x4 (section: .data) -> sun3_scsi_remove (section: .exit.text)

that trigger on a Sun 3 allmodconfig build.

Thanks, Geert.

Quoted 24 lines
---
 drivers/scsi/sun3_scsi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/sun3_scsi.c +7 -1
index fffc0fa525940cee..1bd1c3f87ff7dd42 100644
@@ -656,7 +656,13 @@ static void __exit sun3_scsi_remove(struct platform_device *pdev)
 	iounmap(ioaddr);
 }
 
-static struct platform_driver sun3_scsi_driver = {
+/*
+ * sun3_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 sun3_scsi_driver __refdata = {
 	.remove_new = __exit_p(sun3_scsi_remove),
 	.driver = {
 		.name	= DRV_MODULE_NAME,
Reviewed-by on v1 1/1
#2 lore raw
In reply to Geert Uytterhoeven
Quoted 10 lines · Geert Uytterhoeven

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 warnings

    WARNING: modpost: drivers/scsi/sun3_scsi: section mismatch in reference: sun3_scsi_driver+0x4 (section: .data) -> sun3_scsi_remove (section: .exit.text)
    WARNING: modpost: drivers/scsi/sun3_scsi_vme: section mismatch in reference: sun3_scsi_driver+0x4 (section: .data) -> sun3_scsi_remove (section: .exit.text)

that trigger on a Sun 3 allmodconfig build.

Seems I missed that one before posting 7308bf8a2c3d ("modpost: Enable section warning from *driver to .exit.text"). My excuse is that this driver isn't enabled for an ARCH=m68k allmodconfig build.

Thanks
Uwe

#3 lore raw

Hi Uwe,

Quoted 5 lines · Uwe Kleine-König
Quoted 4 lines · Geert Uytterhoeven

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 warnings

Quoted 8 lines
Quoted 6 lines
    WARNING: modpost: drivers/scsi/sun3_scsi: section mismatch in reference: sun3_scsi_driver+0x4 (section: .data) -> sun3_scsi_remove (section: .exit.text)
    WARNING: modpost: drivers/scsi/sun3_scsi_vme: section mismatch in reference: sun3_scsi_driver+0x4 (section: .data) -> sun3_scsi_remove (section: .exit.text)

that trigger on a Sun 3 allmodconfig build.

Thanks!

Quoted 3 lines

Seems I missed that one before posting 7308bf8a2c3d ("modpost: Enable section warning from *driver to .exit.text"). My excuse is that this driver isn't enabled for an ARCH=m68k allmodconfig build.

Understandable, as there are basically 5 classes of m68k kernels:
- Classic with MMU,
- Coldfire with MMU,
- Sun-3,
- Classic without MMU,
- Coldire without MMU.

As the last two consist of multiple single-platform kernels, they're harder to do allmodconfig for.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#4 lore raw
In reply to Geert Uytterhoeven

Geert,

Quoted 3 lines

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 warnings

Applied to 6.13/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#5 lore raw
In reply to Geert Uytterhoeven
Quoted 8 lines · Geert Uytterhoeven

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 warnings

    WARNING: modpost: drivers/scsi/sun3_scsi: section mismatch in reference: sun3_scsi_driver+0x4 (section: .data) -> sun3_scsi_remove (section: .exit.text)
    WARNING: modpost: drivers/scsi/sun3_scsi_vme: section mismatch in reference: sun3_scsi_driver+0x4 (section: .data) -> sun3_scsi_remove (section: .exit.text)

[...]

Applied to 6.13/scsi-queue, thanks!

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

      https://git.kernel.org/mkp/scsi/c/50133cf05263
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering