[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1285948587-24521-4-git-send-email-robert.richter@amd.com>
Date: Fri, 1 Oct 2010 17:56:25 +0200
From: Robert Richter <robert.richter@....com>
To: Ingo Molnar <mingo@...e.hu>
CC: LKML <linux-kernel@...r.kernel.org>,
oprofile-list <oprofile-list@...ts.sourceforge.net>,
Will Deacon <will.deacon@....com>,
Matt Fleming <matt@...sole-pimps.org>,
Robert Richter <robert.richter@....com>
Subject: [PATCH 3/5] oprofile, ARM: Rework op_create_counter()
This patch simplifies op_create_counter(). Removing if/else if paths
and return code variable by direct returning from function.
Cc: Will Deacon <will.deacon@....com>
Signed-off-by: Robert Richter <robert.richter@....com>
---
arch/arm/oprofile/common.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index 7ae9eeb..cec9305 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -89,28 +89,28 @@ static void op_perf_setup(void)
static int op_create_counter(int cpu, int event)
{
- int ret = 0;
struct perf_event *pevent;
- if (!counter_config[event].enabled || (perf_events[cpu][event] != NULL))
- return ret;
+ if (!counter_config[event].enabled || perf_events[cpu][event])
+ return 0;
pevent = perf_event_create_kernel_counter(&counter_config[event].attr,
cpu, -1,
op_overflow_handler);
- if (IS_ERR(pevent)) {
- ret = PTR_ERR(pevent);
- } else if (pevent->state != PERF_EVENT_STATE_ACTIVE) {
+ if (IS_ERR(pevent))
+ return PTR_ERR(pevent);
+
+ if (pevent->state != PERF_EVENT_STATE_ACTIVE) {
perf_event_release_kernel(pevent);
pr_warning("oprofile: failed to enable event %d "
"on CPU %d\n", event, cpu);
- ret = -EBUSY;
- } else {
- perf_events[cpu][event] = pevent;
+ return -EBUSY;
}
- return ret;
+ perf_events[cpu][event] = pevent;
+
+ return 0;
}
static void op_destroy_counter(int cpu, int event)
--
1.7.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists