perf: Provide generic perf_sample_data initialization
[linux-2.6.git] / arch / powerpc / kernel / perf_event.c
index 1eb85fb..5120bd4 100644 (file)
@@ -718,10 +718,10 @@ static int collect_events(struct perf_event *group, int max_count,
        return n;
 }
 
-static void event_sched_in(struct perf_event *event, int cpu)
+static void event_sched_in(struct perf_event *event)
 {
        event->state = PERF_EVENT_STATE_ACTIVE;
-       event->oncpu = cpu;
+       event->oncpu = smp_processor_id();
        event->tstamp_running += event->ctx->time - event->tstamp_stopped;
        if (is_software_event(event))
                event->pmu->enable(event);
@@ -735,7 +735,7 @@ static void event_sched_in(struct perf_event *event, int cpu)
  */
 int hw_perf_group_sched_in(struct perf_event *group_leader,
               struct perf_cpu_context *cpuctx,
-              struct perf_event_context *ctx, int cpu)
+              struct perf_event_context *ctx)
 {
        struct cpu_hw_events *cpuhw;
        long i, n, n0;
@@ -766,10 +766,10 @@ int hw_perf_group_sched_in(struct perf_event *group_leader,
                cpuhw->event[i]->hw.config = cpuhw->events[i];
        cpuctx->active_oncpu += n;
        n = 1;
-       event_sched_in(group_leader, cpu);
+       event_sched_in(group_leader);
        list_for_each_entry(sub, &group_leader->sibling_list, group_entry) {
                if (sub->state != PERF_EVENT_STATE_OFF) {
-                       event_sched_in(sub, cpu);
+                       event_sched_in(sub);
                        ++n;
                }
        }
@@ -1164,10 +1164,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
         * Finally record data if requested.
         */
        if (record) {
-               struct perf_sample_data data = {
-                       .addr   = ~0ULL,
-                       .period = event->hw.last_period,
-               };
+               struct perf_sample_data data;
+
+               perf_sample_data_init(&data, ~0ULL);
+               data.period = event->hw.last_period;
 
                if (event->attr.sample_type & PERF_SAMPLE_ADDR)
                        perf_get_data_addr(regs, &data.addr);