From patchwork Sun Aug 19 06:28:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 178540 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C28862C0084 for ; Sun, 19 Aug 2012 16:28:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752683Ab2HSG2e (ORCPT ); Sun, 19 Aug 2012 02:28:34 -0400 Received: from shards.monkeyblade.net ([149.20.54.216]:39572 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751572Ab2HSG2d (ORCPT ); Sun, 19 Aug 2012 02:28:33 -0400 Received: from localhost (74-93-104-98-Washington.hfc.comcastbusiness.net [74.93.104.98]) by shards.monkeyblade.net (Postfix) with ESMTPSA id 7EB16586F75 for ; Sat, 18 Aug 2012 23:28:35 -0700 (PDT) Date: Sat, 18 Aug 2012 23:28:33 -0700 (PDT) Message-Id: <20120818.232833.1014846262877017501.davem@davemloft.net> To: sparclinux@vger.kernel.org Subject: [PATCH 13/17] sparc64: Rework sparc_pmu_enable() so that the side effects are clearer. From: David Miller X-Mailer: Mew version 6.5 on Emacs 24.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org 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: David S. Miller --- arch/sparc/kernel/perf_event.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index 9be089a..197c79e 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c @@ -752,7 +752,6 @@ out: static void sparc_pmu_enable(struct pmu *pmu) { struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); - u64 pcr; if (cpuc->enabled) return; @@ -760,11 +759,8 @@ static void sparc_pmu_enable(struct pmu *pmu) cpuc->enabled = 1; barrier(); - pcr = cpuc->pcr[0]; - if (!cpuc->n_events) { - pcr = 0; - } else { - pcr = maybe_change_configuration(cpuc, pcr); + if (cpuc->n_events) { + u64 pcr = maybe_change_configuration(cpuc, cpuc->pcr[0]); /* We require that all of the events have the same * configuration, so just fetch the settings from the