Skip to content

Commit

Permalink
oprofile: perf: use NR_CPUS instead or nr_cpumask_bits for static array
Browse files Browse the repository at this point in the history
The OProfile perf backend uses a static array to keep track of the
perf events on the system. When compiling with CONFIG_CPUMASK_OFFSTACK=y
&& SMP, nr_cpumask_bits is not a compile-time constant and the build
will fail with:

oprofile_perf.c:28: error: variably modified 'perf_events' at file scope

This patch uses NR_CPUs instead of nr_cpumask_bits for the array
initialisation. If this causes space problems in the future, we can
always move to dynamic allocation for the events array.

Cc: Matt Fleming <[email protected]>
Reported-by: Russell King - ARM Linux <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
Cc: <[email protected]> # v2.6.37+
Signed-off-by: Robert Richter <[email protected]>
  • Loading branch information
wildea01 authored and Robert Richter committed Jun 21, 2012
1 parent 6921a57 commit e734568
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/oprofile/oprofile_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static int oprofile_perf_enabled;
static DEFINE_MUTEX(oprofile_perf_mutex);

static struct op_counter_config *counter_config;
static struct perf_event **perf_events[nr_cpumask_bits];
static struct perf_event **perf_events[NR_CPUS];
static int num_counters;

/*
Expand Down

0 comments on commit e734568

Please sign in to comment.