* [PATCH] perf/x86/uncore: fix compilation warning in snb_uncore_imc_init_box()
@ 2014-03-11 10:44 Stephane Eranian
2014-03-11 11:13 ` Peter Zijlstra
0 siblings, 1 reply; 3+ messages in thread
From: Stephane Eranian @ 2014-03-11 10:44 UTC (permalink / raw)
To: linux-kernel; +Cc: peterz, mingo, sfr, hpa, tglx
This patches fixes a compilation problem (unused variable) with the
new SNB/IVB/HSW uncore IMC code.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Stephane Eranian <eranian@google.com>
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index b262c61..3846a37 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -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);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf/x86/uncore: fix compilation warning in snb_uncore_imc_init_box()
2014-03-11 10:44 [PATCH] perf/x86/uncore: fix compilation warning in snb_uncore_imc_init_box() Stephane Eranian
@ 2014-03-11 11:13 ` Peter Zijlstra
2014-03-11 11:24 ` Stephane Eranian
0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2014-03-11 11:13 UTC (permalink / raw)
To: Stephane Eranian; +Cc: linux-kernel, mingo, sfr, hpa, tglx
On Tue, Mar 11, 2014 at 11:44:33AM +0100, Stephane Eranian wrote:
>
>
> This patches fixes a compilation problem (unused variable) with the
> new SNB/IVB/HSW uncore IMC code.
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Stephane Eranian <eranian@google.com>
>
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> index b262c61..3846a37 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> @@ -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
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf/x86/uncore: fix compilation warning in snb_uncore_imc_init_box()
2014-03-11 11:13 ` Peter Zijlstra
@ 2014-03-11 11:24 ` Stephane Eranian
0 siblings, 0 replies; 3+ messages in thread
From: Stephane Eranian @ 2014-03-11 11:24 UTC (permalink / raw)
To: Peter Zijlstra
Cc: LKML, mingo@elte.hu, Stephen Rothwell, H. Peter Anvin, tglx
On Tue, Mar 11, 2014 at 12:13 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, Mar 11, 2014 at 11:44:33AM +0100, Stephane Eranian wrote:
>>
>>
>> This patches fixes a compilation problem (unused variable) with the
>> new SNB/IVB/HSW uncore IMC code.
>>
>> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
>> Signed-off-by: Stephane Eranian <eranian@google.com>
>>
>> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
>> index b262c61..3846a37 100644
>> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
>> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
>> @@ -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
>
> 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.
Okay, that's better.
I will repost then.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-11 11:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-11 10:44 [PATCH] perf/x86/uncore: fix compilation warning in snb_uncore_imc_init_box() Stephane Eranian
2014-03-11 11:13 ` Peter Zijlstra
2014-03-11 11:24 ` Stephane Eranian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox