diff mbox series

[1/2] fb: amifb: Mark driver struct with __refdata to prevent section mismatch warning

Message ID 20231109220151.10654-2-u.kleine-koenig@pengutronix.de
State New
Headers show
Series [1/2] fb: amifb: Mark driver struct with __refdata to prevent section mismatch warning | expand

Commit Message

Uwe Kleine-König Nov. 9, 2023, 10:01 p.m. UTC
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 a section mismatch warning.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/video/fbdev/amifb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Geert Uytterhoeven Nov. 10, 2023, 7:58 a.m. UTC | #1
Hi Uwe,

On Thu, Nov 9, 2023 at 11:02 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> 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 a section mismatch warning.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thanks for your patch!
Why am I not seeing the actual section mismatch warning, not even
with W=1?

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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
Uwe Kleine-König Nov. 10, 2023, 8:57 a.m. UTC | #2
Hello,

On Fri, Nov 10, 2023 at 08:58:37AM +0100, Geert Uytterhoeven wrote:
> On Thu, Nov 9, 2023 at 11:02 PM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> 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 a section mismatch warning.
> >
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> Thanks for your patch!
> Why am I not seeing the actual section mismatch warning, not even
> with W=1?

Do you have f177cd0c15fcc7bdbb68d8d1a3166dead95314c8 in your tree? And
note it's only there if you compile the driver as a module and it is
only emitted once you completed the whole build.

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c
index b18c6b4f129a..4a1bc693cebd 100644
--- a/drivers/video/fbdev/amifb.c
+++ b/drivers/video/fbdev/amifb.c
@@ -3768,7 +3768,13 @@  static int __exit amifb_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static struct platform_driver amifb_driver = {
+/*
+ * amifb_remove() lives in .exit.text. For drivers registered via
+ * module_platform_driver_probe() this ok because they cannot get unboud at
+ * runtime. The driver needs to be marked with __refdata, otherwise modpost
+ * triggers a section mismatch warning.
+ */
+static struct platform_driver amifb_driver __refdata = {
 	.remove = __exit_p(amifb_remove),
 	.driver   = {
 		.name	= "amiga-video",