Re: [PATCH 2/3] tracing/profile: add ref count for registeringprofile events

From: Steven Rostedt
Date: Fri Sep 11 2009 - 10:12:20 EST


On Fri, 2009-09-11 at 16:04 +0200, Peter Zijlstra wrote:
> On Fri, 2009-09-11 at 09:54 -0400, Steven Rostedt wrote:
>
> > +#ifdef MODULE
> > +# define event_trace_up_ref() \
> > + do { \
> > + if (!try_module_get(THIS_MODULE)) { \
> > + atomic_dec(&event_call->profile_count); \
> > + return -ENOENT; \
> > + } \
> > + } while (0)
> > +# define event_trace_down_ref() module_put(THIS_MODULE)
> > +#else
> > +# define event_trace_up_ref() do { } while (0)
> > +# define event_trace_down_ref() do { } while (0)
> > +#endif
>
> That's like truely gruesomely ugly.
>
> At the very least write it like:
>
> int event_trace_up_ref(struct ftrace_event_call *call)
> {
> if (!try_module_get(THIS_MODULE)) {
> atomic_dev(&call->profile_count);
> return -ENOENT;
> }
> return 0;
> }

OK, I'll replace the MACROS with static inline, rebase and resend.

Ingo, don't pull that yet.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/