diff mbox series

cpufreq / CPPC: Mark acpi_ids as used

Message ID 20181002223457.7564-1-natechancellor@gmail.com (mailing list archive)
State Mainlined
Delegated to: Rafael Wysocki
Headers show
Series cpufreq / CPPC: Mark acpi_ids as used | expand

Commit Message

Nathan Chancellor Oct. 2, 2018, 10:34 p.m. UTC
Clang warns:

drivers/cpufreq/cppc_cpufreq.c:431:36: warning: variable 'cppc_acpi_ids'
is not needed and will not be emitted [-Wunneeded-internal-declaration]
static const struct acpi_device_id cppc_acpi_ids[] = {
                                   ^
1 warning generated.

Mark the definition as used so that Clang understands we don't want this
warning while not inhibiting Clang's dead code elimination from removing
the unreferenced internal symbol when moving the data it contains to the
globally available symbol via MODULE_DEVICE_TABLE.

$ nm -S drivers/cpufreq/cppc_cpufreq.o | grep acpi | tail -1
0000000000000000 0000000000000040 R __mod_acpi__cppc_acpi_ids_device_table

Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/cpufreq/cppc_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nick Desaulniers Oct. 2, 2018, 10:40 p.m. UTC | #1
On Tue, Oct 2, 2018 at 3:35 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns:
>
> drivers/cpufreq/cppc_cpufreq.c:431:36: warning: variable 'cppc_acpi_ids'
> is not needed and will not be emitted [-Wunneeded-internal-declaration]
> static const struct acpi_device_id cppc_acpi_ids[] = {
>                                    ^
> 1 warning generated.
>
> Mark the definition as used so that Clang understands we don't want this
> warning while not inhibiting Clang's dead code elimination from removing
> the unreferenced internal symbol when moving the data it contains to the
> globally available symbol via MODULE_DEVICE_TABLE.
>
> $ nm -S drivers/cpufreq/cppc_cpufreq.o | grep acpi | tail -1
> 0000000000000000 0000000000000040 R __mod_acpi__cppc_acpi_ids_device_table
>
> Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  drivers/cpufreq/cppc_cpufreq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
> index 30f302149730..fd25c21cee72 100644
> --- a/drivers/cpufreq/cppc_cpufreq.c
> +++ b/drivers/cpufreq/cppc_cpufreq.c
> @@ -428,7 +428,7 @@ MODULE_LICENSE("GPL");
>
>  late_initcall(cppc_cpufreq_init);
>
> -static const struct acpi_device_id cppc_acpi_ids[] = {
> +static const struct acpi_device_id cppc_acpi_ids[] __used = {
>         {ACPI_PROCESSOR_DEVICE_HID, },
>         {}
>  };
> --
> 2.19.0
>

LGTM, thanks Nathan.  For other reviewers,
https://lkml.org/lkml/2018/9/27/91 might provide more insight into why
this is the correct fix for this particular bug.
Rafael J. Wysocki Oct. 5, 2018, 9:51 a.m. UTC | #2
On Wednesday, October 3, 2018 12:40:19 AM CEST Nick Desaulniers wrote:
> On Tue, Oct 2, 2018 at 3:35 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > Clang warns:
> >
> > drivers/cpufreq/cppc_cpufreq.c:431:36: warning: variable 'cppc_acpi_ids'
> > is not needed and will not be emitted [-Wunneeded-internal-declaration]
> > static const struct acpi_device_id cppc_acpi_ids[] = {
> >                                    ^
> > 1 warning generated.
> >
> > Mark the definition as used so that Clang understands we don't want this
> > warning while not inhibiting Clang's dead code elimination from removing
> > the unreferenced internal symbol when moving the data it contains to the
> > globally available symbol via MODULE_DEVICE_TABLE.
> >
> > $ nm -S drivers/cpufreq/cppc_cpufreq.o | grep acpi | tail -1
> > 0000000000000000 0000000000000040 R __mod_acpi__cppc_acpi_ids_device_table
> >
> > Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >  drivers/cpufreq/cppc_cpufreq.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
> > index 30f302149730..fd25c21cee72 100644
> > --- a/drivers/cpufreq/cppc_cpufreq.c
> > +++ b/drivers/cpufreq/cppc_cpufreq.c
> > @@ -428,7 +428,7 @@ MODULE_LICENSE("GPL");
> >
> >  late_initcall(cppc_cpufreq_init);
> >
> > -static const struct acpi_device_id cppc_acpi_ids[] = {
> > +static const struct acpi_device_id cppc_acpi_ids[] __used = {
> >         {ACPI_PROCESSOR_DEVICE_HID, },
> >         {}
> >  };
> > --

Patch applied, thanks!
diff mbox series

Patch

diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index 30f302149730..fd25c21cee72 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -428,7 +428,7 @@  MODULE_LICENSE("GPL");
 
 late_initcall(cppc_cpufreq_init);
 
-static const struct acpi_device_id cppc_acpi_ids[] = {
+static const struct acpi_device_id cppc_acpi_ids[] __used = {
 	{ACPI_PROCESSOR_DEVICE_HID, },
 	{}
 };