Skip to contentSkip to conversation

cpufreq / CPPC: Mark acpi_ids as used

PATCH In review Nathan Chancellor 3 participants 3 messages Oct 2, 2018 – Oct 5, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq / CPPC: Mark acpi_ids as used

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
---
 drivers/cpufreq/cppc_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cppc_cpufreq.c +1 -1
index 30f302149730..fd25c21cee72 100644
@@ -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, },
 	{}
 };
Signature · 1 line
2.19.0
#1 lore raw
Quoted 38 lines · Nathan Chancellor

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
---
 drivers/cpufreq/cppc_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cppc_cpufreq.c +1 -2
index 30f302149730..fd25c21cee72 100644
@@ -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, },
        {}
 };
--
Quoted 2 lines

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.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw
Quoted 32 lines · CEST Nick Desaulniers
Quoted 30 lines · Nathan Chancellor

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
---
 drivers/cpufreq/cppc_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cppc_cpufreq.c +0 -0
index 30f302149730..fd25c21cee72 100644
@@ -428,7 +428,7 @@ MODULE_LICENSE("GPL");
 
Quoted 8 lines

drivers/cpufreq/cppc_cpufreq.c MODULE_LICENSE("GPL");

Quoted 8 lines
drivers/cpufreq/cppc_cpufreq.c +1 -2
 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!