linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] misc: atmel-ssc: Fix section annotation on atmel_ssc_get_driver_data
@ 2018-10-17 17:09 Nathan Chancellor
  2018-10-17 18:16 ` Alexandre Belloni
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2018-10-17 17:09 UTC (permalink / raw)
  To: linux-arm-kernel

After building the kernel with Clang, the following section mismatch
warning appears:

WARNING: vmlinux.o(.text+0x3bf19a6): Section mismatch in reference from
the function ssc_probe() to the function
.init.text:atmel_ssc_get_driver_data()
The function ssc_probe() references
the function __init atmel_ssc_get_driver_data().
This is often because ssc_probe lacks a __init
annotation or the annotation of atmel_ssc_get_driver_data is wrong.

Remove __init from atmel_ssc_get_driver_data to get rid of the mismatch.

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---

Alternatively, ssc_probe could be marked as __init, I don't think there
is any way for the probe to defer. I decided to go with the more
conservative option first but I'm happy to respin if necessary.

Thanks!

 drivers/misc/atmel-ssc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index b2a0340f277e..d8e3cc2dc747 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -132,7 +132,7 @@ static const struct of_device_id atmel_ssc_dt_ids[] = {
 MODULE_DEVICE_TABLE(of, atmel_ssc_dt_ids);
 #endif
 
-static inline const struct atmel_ssc_platform_data * __init
+static inline const struct atmel_ssc_platform_data *
 	atmel_ssc_get_driver_data(struct platform_device *pdev)
 {
 	if (pdev->dev.of_node) {
-- 
2.19.1

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

* [PATCH] misc: atmel-ssc: Fix section annotation on atmel_ssc_get_driver_data
  2018-10-17 17:09 [PATCH] misc: atmel-ssc: Fix section annotation on atmel_ssc_get_driver_data Nathan Chancellor
@ 2018-10-17 18:16 ` Alexandre Belloni
  2018-10-17 18:20   ` Nathan Chancellor
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2018-10-17 18:16 UTC (permalink / raw)
  To: linux-arm-kernel

On 17/10/2018 10:09:02-0700, Nathan Chancellor wrote:
> After building the kernel with Clang, the following section mismatch
> warning appears:
> 
> WARNING: vmlinux.o(.text+0x3bf19a6): Section mismatch in reference from
> the function ssc_probe() to the function
> .init.text:atmel_ssc_get_driver_data()
> The function ssc_probe() references
> the function __init atmel_ssc_get_driver_data().
> This is often because ssc_probe lacks a __init
> annotation or the annotation of atmel_ssc_get_driver_data is wrong.
> 
> Remove __init from atmel_ssc_get_driver_data to get rid of the mismatch.
> 

Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

I would add:

Fixes: 5c86ac695c7e ("ASoC: atmel-ssc: use module_platform_driver macro")

> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> 
> Alternatively, ssc_probe could be marked as __init, I don't think there
> is any way for the probe to defer. I decided to go with the more
> conservative option first but I'm happy to respin if necessary.
> 

A probe function should never be marked __init, unless you ensure there
is no way to bind/unbind the driver at runtime.

> Thanks!
> 
>  drivers/misc/atmel-ssc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
> index b2a0340f277e..d8e3cc2dc747 100644
> --- a/drivers/misc/atmel-ssc.c
> +++ b/drivers/misc/atmel-ssc.c
> @@ -132,7 +132,7 @@ static const struct of_device_id atmel_ssc_dt_ids[] = {
>  MODULE_DEVICE_TABLE(of, atmel_ssc_dt_ids);
>  #endif
>  
> -static inline const struct atmel_ssc_platform_data * __init
> +static inline const struct atmel_ssc_platform_data *
>  	atmel_ssc_get_driver_data(struct platform_device *pdev)
>  {
>  	if (pdev->dev.of_node) {
> -- 
> 2.19.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [PATCH] misc: atmel-ssc: Fix section annotation on atmel_ssc_get_driver_data
  2018-10-17 18:16 ` Alexandre Belloni
@ 2018-10-17 18:20   ` Nathan Chancellor
  2018-10-17 18:31     ` Alexandre Belloni
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2018-10-17 18:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 17, 2018 at 08:16:25PM +0200, Alexandre Belloni wrote:
> On 17/10/2018 10:09:02-0700, Nathan Chancellor wrote:
> > After building the kernel with Clang, the following section mismatch
> > warning appears:
> > 
> > WARNING: vmlinux.o(.text+0x3bf19a6): Section mismatch in reference from
> > the function ssc_probe() to the function
> > .init.text:atmel_ssc_get_driver_data()
> > The function ssc_probe() references
> > the function __init atmel_ssc_get_driver_data().
> > This is often because ssc_probe lacks a __init
> > annotation or the annotation of atmel_ssc_get_driver_data is wrong.
> > 
> > Remove __init from atmel_ssc_get_driver_data to get rid of the mismatch.
> > 
> 
> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> 
> I would add:
> 
> Fixes: 5c86ac695c7e ("ASoC: atmel-ssc: use module_platform_driver macro")
> 
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> > 
> > Alternatively, ssc_probe could be marked as __init, I don't think there
> > is any way for the probe to defer. I decided to go with the more
> > conservative option first but I'm happy to respin if necessary.
> > 
> 
> A probe function should never be marked __init, unless you ensure there
> is no way to bind/unbind the driver at runtime.
> 

Thank you for the review and that clarification, wasn't able to find
much regarding __init on probe functions in my research.

> > Thanks!
> > 
> >  drivers/misc/atmel-ssc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
> > index b2a0340f277e..d8e3cc2dc747 100644
> > --- a/drivers/misc/atmel-ssc.c
> > +++ b/drivers/misc/atmel-ssc.c
> > @@ -132,7 +132,7 @@ static const struct of_device_id atmel_ssc_dt_ids[] = {
> >  MODULE_DEVICE_TABLE(of, atmel_ssc_dt_ids);
> >  #endif
> >  
> > -static inline const struct atmel_ssc_platform_data * __init
> > +static inline const struct atmel_ssc_platform_data *
> >  	atmel_ssc_get_driver_data(struct platform_device *pdev)
> >  {
> >  	if (pdev->dev.of_node) {
> > -- 
> > 2.19.1
> > 
> 
> -- 
> Alexandre Belloni, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Cheers,
Nathan

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

* [PATCH] misc: atmel-ssc: Fix section annotation on atmel_ssc_get_driver_data
  2018-10-17 18:20   ` Nathan Chancellor
@ 2018-10-17 18:31     ` Alexandre Belloni
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2018-10-17 18:31 UTC (permalink / raw)
  To: linux-arm-kernel

On 17/10/2018 11:20:31-0700, Nathan Chancellor wrote:
> On Wed, Oct 17, 2018 at 08:16:25PM +0200, Alexandre Belloni wrote:
> > On 17/10/2018 10:09:02-0700, Nathan Chancellor wrote:
> > > After building the kernel with Clang, the following section mismatch
> > > warning appears:
> > > 
> > > WARNING: vmlinux.o(.text+0x3bf19a6): Section mismatch in reference from
> > > the function ssc_probe() to the function
> > > .init.text:atmel_ssc_get_driver_data()
> > > The function ssc_probe() references
> > > the function __init atmel_ssc_get_driver_data().
> > > This is often because ssc_probe lacks a __init
> > > annotation or the annotation of atmel_ssc_get_driver_data is wrong.
> > > 
> > > Remove __init from atmel_ssc_get_driver_data to get rid of the mismatch.
> > > 
> > 
> > Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > 
> > I would add:
> > 
> > Fixes: 5c86ac695c7e ("ASoC: atmel-ssc: use module_platform_driver macro")
> > 
> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > ---
> > > 
> > > Alternatively, ssc_probe could be marked as __init, I don't think there
> > > is any way for the probe to defer. I decided to go with the more
> > > conservative option first but I'm happy to respin if necessary.
> > > 
> > 
> > A probe function should never be marked __init, unless you ensure there
> > is no way to bind/unbind the driver at runtime.
> > 
> 
> Thank you for the review and that clarification, wasn't able to find
> much regarding __init on probe functions in my research.
> 

You can look for suppress_bind_attrs for more info.


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2018-10-17 18:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-17 17:09 [PATCH] misc: atmel-ssc: Fix section annotation on atmel_ssc_get_driver_data Nathan Chancellor
2018-10-17 18:16 ` Alexandre Belloni
2018-10-17 18:20   ` Nathan Chancellor
2018-10-17 18:31     ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).