Commit 5ab96841 authored by David S. Miller's avatar David S. Miller

sparc64: Rework sparc_pmu_enable() so that the side effects are clearer.

When cpuc->n_events is zero, we actually don't do anything and we just
write the cpuc->pcr[0] value as-is without any modifications.

The "pcr = 0;" assignment there was just useless and confusing.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3f1a2097
...@@ -752,7 +752,6 @@ static u64 maybe_change_configuration(struct cpu_hw_events *cpuc, u64 pcr) ...@@ -752,7 +752,6 @@ static u64 maybe_change_configuration(struct cpu_hw_events *cpuc, u64 pcr)
static void sparc_pmu_enable(struct pmu *pmu) static void sparc_pmu_enable(struct pmu *pmu)
{ {
struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
u64 pcr;
if (cpuc->enabled) if (cpuc->enabled)
return; return;
...@@ -760,11 +759,8 @@ static void sparc_pmu_enable(struct pmu *pmu) ...@@ -760,11 +759,8 @@ static void sparc_pmu_enable(struct pmu *pmu)
cpuc->enabled = 1; cpuc->enabled = 1;
barrier(); barrier();
pcr = cpuc->pcr[0]; if (cpuc->n_events) {
if (!cpuc->n_events) { u64 pcr = maybe_change_configuration(cpuc, cpuc->pcr[0]);
pcr = 0;
} else {
pcr = maybe_change_configuration(cpuc, pcr);
/* We require that all of the events have the same /* We require that all of the events have the same
* configuration, so just fetch the settings from the * configuration, so just fetch the settings from the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment