Skip to contentSkip to conversation

perf/x86/uncore: fix compilation warning in snb_uncore_imc_init_box()

PATCH Superseded Stephane Eranian 2 participants 3 messages Mar 11, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/x86/uncore: fix compilation warning in snb_uncore_imc_init_box()

This patches fixes a compilation problem (unused variable) with the new SNB/IVB/HSW uncore IMC code.

arch/x86/kernel/cpu/perf_event_intel_uncore.c +7 -3
index b262c61..3846a37 100644
@@ -1722,15 +1722,19 @@ static struct attribute_group snb_uncore_imc_format_group = {
 static void snb_uncore_imc_init_box(struct intel_uncore_box *box)
 {
 	struct pci_dev *pdev = box->pci_dev;
-	u32 addr_lo, addr_hi;
+	u32 addr_lo;
 	resource_size_t addr;
 
 	pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET, &addr_lo);
 	addr = addr_lo;
 
 #ifdef CONFIG_PHYS_ADDR_T_64BIT
-	pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET+4, &addr_hi);
-	addr = ((resource_size_t)addr_hi << 32) | addr_lo;
+	{ u32 addr_hi;
+	  int where = SNB_UNCORE_PCI_IMC_BAR_OFFSET + 4;
+
+	  pci_read_config_dword(pdev, where, &addr_hi);
+	  addr = ((resource_size_t)addr_hi << 32) | addr_lo;
+	}
 #endif
 
 	addr &= ~(PAGE_SIZE - 1);
maintainer
#1 lore raw
Quoted 23 lines · Stephane Eranian

This patches fixes a compilation problem (unused variable) with the new SNB/IVB/HSW uncore IMC code.

arch/x86/kernel/cpu/perf_event_intel_uncore.c +1 -1
index b262c61..3846a37 100644
@@ -1722,15 +1722,19 @@ static struct attribute_group snb_uncore_imc_format_group = {
 static void snb_uncore_imc_init_box(struct intel_uncore_box *box)
 {
 	struct pci_dev *pdev = box->pci_dev;
-	u32 addr_lo, addr_hi;
+	u32 addr_lo;
 	resource_size_t addr;
 
 	pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET, &addr_lo);
 	addr = addr_lo;
 

arch/x86/kernel/cpu/perf_event_intel_uncore.c static struct attribute_group snb_uncore_imc_format_group = { · line 1738

Quoted 10 lines
arch/x86/kernel/cpu/perf_event_intel_uncore.c +6 -2
 #ifdef CONFIG_PHYS_ADDR_T_64BIT
-	pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET+4, &addr_hi);
-	addr = ((resource_size_t)addr_hi << 32) | addr_lo;
+	{ u32 addr_hi;
+	  int where = SNB_UNCORE_PCI_IMC_BAR_OFFSET + 4;
+
+	  pci_read_config_dword(pdev, where, &addr_hi);
+	  addr = ((resource_size_t)addr_hi << 32) | addr_lo;
+	}
 #endif

How about something like:

- u32 addr_lo, addr_hi;
+ u32 pci_dword;

	pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET, &pci_dword);
	addr = pci_dword;
#ifdef ..
	pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET + 4, &pci_dword);
	addr |= ((u64)pci_dword) << 32;

#endif

That avoids the need for the ugly {} thing.

#2 lore raw
Quoted 43 lines · Peter Zijlstra
Quoted 23 lines · Stephane Eranian

This patches fixes a compilation problem (unused variable) with the new SNB/IVB/HSW uncore IMC code.

arch/x86/kernel/cpu/perf_event_intel_uncore.c +1 -1
index b262c61..3846a37 100644
@@ -1722,15 +1722,19 @@ static struct attribute_group snb_uncore_imc_format_group = {
 static void snb_uncore_imc_init_box(struct intel_uncore_box *box)
 {
      struct pci_dev *pdev = box->pci_dev;
-     u32 addr_lo, addr_hi;
+     u32 addr_lo;
      resource_size_t addr;
 
      pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET, &addr_lo);
      addr = addr_lo;
 

arch/x86/kernel/cpu/perf_event_intel_uncore.c static struct attribute_group snb_uncore_imc_format_group = { · line 1738

Quoted 10 lines
arch/x86/kernel/cpu/perf_event_intel_uncore.c +6 -2
 #ifdef CONFIG_PHYS_ADDR_T_64BIT
-     pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET+4, &addr_hi);
-     addr = ((resource_size_t)addr_hi << 32) | addr_lo;
+     { u32 addr_hi;
+       int where = SNB_UNCORE_PCI_IMC_BAR_OFFSET + 4;
+
+       pci_read_config_dword(pdev, where, &addr_hi);
+       addr = ((resource_size_t)addr_hi << 32) | addr_lo;
+     }
 #endif

How about something like:

- u32 addr_lo, addr_hi;
+ u32 pci_dword;

        pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET, &pci_dword);
        addr = pci_dword;
Quoted 6 lines
#ifdef ..
        pci_read_config_dword(pdev, SNB_UNCORE_PCI_IMC_BAR_OFFSET + 4, &pci_dword);
        addr |= ((u64)pci_dword) << 32;

#endif

That avoids the need for the ugly {} thing.

Okay, that's better.
I will repost then.
Thanks.