On Tue, 5 Nov 2024, Geert Uytterhoeven wrote: > 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. > > Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> Acked-by: Finn Thain <fthain@xxxxxxxxxxxxxx> Thanks, Geert. > --- > drivers/scsi/sun3_scsi.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c > index fffc0fa525940cee..1bd1c3f87ff7dd42 100644 > --- a/drivers/scsi/sun3_scsi.c > +++ b/drivers/scsi/sun3_scsi.c > @@ -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, >