Message ID | b2c56fa3556505befe9b4cb9a830d9e2a962e72c.1730831769.git.geert@linux-m68k.org (mailing list archive) |
---|---|
State | Under Review |
Headers | show |
Series | scsi: sun3: Mark driver struct with __refdata to prevent section mismatch | expand |
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@linux-m68k.org> Acked-by: Finn Thain <fthain@linux-m68k.org> 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, >
On Tue, Nov 05, 2024 at 07:36:31PM +0100, 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@linux-m68k.org> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> 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
Hi Uwe, On Wed, Nov 6, 2024 at 9:50 AM Uwe Kleine-König <u.kleine-koenig@baylibre.com> wrote: > On Tue, Nov 05, 2024 at 07:36:31PM +0100, 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@linux-m68k.org> > > Reviewed-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Thanks! > 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
Geert, > 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!
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,
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@linux-m68k.org> --- drivers/scsi/sun3_scsi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)