[PATCH 3/6] perf/core: Add a callback to perf events

Paul Mackerras
2009-11-02T04:47:18Z

Frederic Weisbecker writes:

> @@ -4335,6 +4336,15 @@ perf_event_alloc(struct perf_event_attr *attr,
>
> event->state = PERF_EVENT_STATE_INACTIVE;
>
> + if (!callback) {
> + if (parent_event)
> + event->callback = parent_event->callback;
> + else
> + event->callback = NULL;
> + } else {
> + event->callback = callback;
> + }

Wouldn't this be simpler and clearer as:

if (!callback && parent_event)
callback = parent_event->callback;
event->callback = callback;

?

Paul.