linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (ibmpowernv) Remove bogus __init annotations
@ 2018-10-28 17:16 Geert Uytterhoeven
  2018-10-30 18:23 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2018-10-28 17:16 UTC (permalink / raw)
  To: Cédric Le Goater, Jean Delvare, Guenter Roeck,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linux-hwmon, linuxppc-dev, linux-kernel, Geert Uytterhoeven

If gcc decides not to inline make_sensor_label():

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

As .probe() can be called after freeing of __init memory, all __init
annotiations in the driver are bogus, and should be removed.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Compile-tested only.
---
 drivers/hwmon/ibmpowernv.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
index 0ccca87f527191dc..293dd1c6c7b36ef2 100644
--- a/drivers/hwmon/ibmpowernv.c
+++ b/drivers/hwmon/ibmpowernv.c
@@ -181,7 +181,7 @@ static ssize_t show_label(struct device *dev, struct device_attribute *devattr,
 	return sprintf(buf, "%s\n", sdata->label);
 }
 
-static int __init get_logical_cpu(int hwcpu)
+static int get_logical_cpu(int hwcpu)
 {
 	int cpu;
 
@@ -192,9 +192,8 @@ static int __init get_logical_cpu(int hwcpu)
 	return -ENOENT;
 }
 
-static void __init make_sensor_label(struct device_node *np,
-				     struct sensor_data *sdata,
-				     const char *label)
+static void make_sensor_label(struct device_node *np,
+			      struct sensor_data *sdata, const char *label)
 {
 	u32 id;
 	size_t n;
-- 
2.17.1

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

* Re: [PATCH] hwmon: (ibmpowernv) Remove bogus __init annotations
  2018-10-28 17:16 [PATCH] hwmon: (ibmpowernv) Remove bogus __init annotations Geert Uytterhoeven
@ 2018-10-30 18:23 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2018-10-30 18:23 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Cédric Le Goater, Jean Delvare, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, linux-hwmon, linuxppc-dev,
	linux-kernel

On Sun, Oct 28, 2018 at 06:16:51PM +0100, Geert Uytterhoeven wrote:
> If gcc decides not to inline make_sensor_label():
> 
>     WARNING: vmlinux.o(.text+0x4df549c): Section mismatch in reference from the function .create_device_attrs() to the function .init.text:.make_sensor_label()
>     The function .create_device_attrs() references
>     the function __init .make_sensor_label().
>     This is often because .create_device_attrs lacks a __init
>     annotation or the annotation of .make_sensor_label is wrong.
> 
> As .probe() can be called after freeing of __init memory, all __init
> annotiations in the driver are bogus, and should be removed.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Applied.

Thanks,
Guenter

> ---
> Compile-tested only.
> ---
>  drivers/hwmon/ibmpowernv.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
> index 0ccca87f527191dc..293dd1c6c7b36ef2 100644
> --- a/drivers/hwmon/ibmpowernv.c
> +++ b/drivers/hwmon/ibmpowernv.c
> @@ -181,7 +181,7 @@ static ssize_t show_label(struct device *dev, struct device_attribute *devattr,
>  	return sprintf(buf, "%s\n", sdata->label);
>  }
>  
> -static int __init get_logical_cpu(int hwcpu)
> +static int get_logical_cpu(int hwcpu)
>  {
>  	int cpu;
>  
> @@ -192,9 +192,8 @@ static int __init get_logical_cpu(int hwcpu)
>  	return -ENOENT;
>  }
>  
> -static void __init make_sensor_label(struct device_node *np,
> -				     struct sensor_data *sdata,
> -				     const char *label)
> +static void make_sensor_label(struct device_node *np,
> +			      struct sensor_data *sdata, const char *label)
>  {
>  	u32 id;
>  	size_t n;

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-28 17:16 [PATCH] hwmon: (ibmpowernv) Remove bogus __init annotations Geert Uytterhoeven
2018-10-30 18:23 ` Guenter Roeck

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).