Bug 11743 (PCI_MMCONFIG)

Summary: Defined but not used variable: 'acpi_mcfg_64bit_base_addr'
Product: ACPI Reporter: Pavel Vasilyev (dixlor)
Component: Config-ProcessorsAssignee: Len Brown (lenb)
Status: CLOSED CODE_FIX    
Severity: low CC: dixlor
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.27 Subsystem:
Regression: --- Bisected commit-id:
Attachments: FIX PATCH
FIX PATCH VERSION 2

Description Pavel Vasilyev 2008-10-11 16:39:50 UTC
Latest working kernel version: 2.6.27
Earliest failing kernel version: 2.6.27
Distribution: SuSE 10.3
Hardware Environment: Opteron 265, 4Gb ECC RAM, 1Tb HDD, Nforce4 chipset   
Software Environment: gcc-4.3.1, glibc-2.6.1  
Problem Description: warning: 'acpi_mcfg_64bit_base_addr' defined but not used

Steps to reproduce:

1. Configure kernel without MMCONFIG support and compile.
2. make

....
arch/x86/kernel/acpi/boot.c:100: warning: 'acpi_mcfg_64bit_base_addr' defined but not used
....

Comment:

acpi_mcfg_64bit_base_addr defined on line 100 in arch/x86/kernel/acpi/boot.c
as "static int acpi_mcfg_64bit_base_addr __initdata = FALSE;"
But used only in functions in same file boot.c: 

acpi_mcfg_oem_check() on line 166 
and in acpi_parse_mcfg() on line 208 

And this functions work only if CONFIG_PCI_MMCONFIG true, inside 

#ifdef CONFIG_PCI_MMCONFIG
...
...
#endif 

Solution:

--- patch version 1

################################################################

--- a/arch/x86/kernel/acpi/boot.c   2008-10-10 02:13:53.000000000 +0400
+++ b/arch/x86/kernel/acpi/boot.c   2008-10-12 03:13:16.888033920 +0400
@@ -97,7 +97,9 @@
 #warning ACPI uses CMPXCHG, i486 and later hardware
 #endif

+#ifdef CONFIG_PCI_MMCONFIG
 static int acpi_mcfg_64bit_base_addr __initdata = FALSE;
+#endif

 /* --------------------------------------------------------------------------
                               Boot-time Configuration

###############################################################

or patch version 2

################################################################################

--- a/arch/x86/kernel/acpi/boot.c   2008-10-10 02:13:53.000000000 +0400
+++ b/arch/x86/kernel/acpi/boot.c   2008-10-12 03:35:18.992034200 +0400
@@ -97,7 +97,6 @@
 #warning ACPI uses CMPXCHG, i486 and later hardware
 #endif

-static int acpi_mcfg_64bit_base_addr __initdata = FALSE;

 /* --------------------------------------------------------------------------
                               Boot-time Configuration
@@ -156,6 +155,9 @@
 }

 #ifdef CONFIG_PCI_MMCONFIG
+
+static int acpi_mcfg_64bit_base_addr __initdata = FALSE;
+
 /* The physical address of the MMCONFIG aperture.  Set from ACPI tables. */
 struct acpi_mcfg_allocation *pci_mmcfg_config;
 int pci_mmcfg_config_num;

#############################################################################
Comment 1 Pavel Vasilyev 2008-10-11 16:44:12 UTC
Created attachment 18268 [details]
FIX PATCH
Comment 2 Pavel Vasilyev 2008-10-11 16:44:40 UTC
Created attachment 18269 [details]
FIX PATCH VERSION 2
Comment 3 Shaohua 2008-10-14 20:21:24 UTC
Mark this as solved so Len will merge it. If not, better you can send the patch to acpi maillist
Comment 4 Len Brown 2008-10-15 14:34:07 UTC
patch in comment #2 applied.
Comment 5 Pavel Vasilyev 2008-10-15 15:24:41 UTC
(In reply to comment #4)
> patch in comment #2 applied.
> 

Great! :)
Comment 6 Len Brown 2008-10-24 23:17:27 UTC
shipped in linux-2.6.28-rc1
closed

commit 1339c367a842a9fc34b8fcfa1abadb07b11848ad
Author: Pavel Vasilyev <linuxoid@tochka.ru>
Date:   Wed Oct 15 17:33:48 2008 -0400

    fix CONFIG_MMCONFIG=n build warning