Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752706AbcDQLwe (ORCPT ); Sun, 17 Apr 2016 07:52:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46457 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751899AbcDQLwd (ORCPT ); Sun, 17 Apr 2016 07:52:33 -0400 Date: Sun, 17 Apr 2016 13:52:29 +0200 From: Jiri Olsa To: Wang Nan Cc: acme@kernel.org, linux-kernel@vger.kernel.org, pi3orama@163.com, Adrian Hunter , He Kuang , Jiri Olsa , Masami Hiramatsu , Namhyung Kim , Zefan Li , Arnaldo Carvalho de Melo Subject: Re: [PATCH v3 1/6] perf tools: Derive trigger class from auxtrace_snapshot Message-ID: <20160417115229.GB31336@krava.brq.redhat.com> References: <1460744420-175165-1-git-send-email-wangnan0@huawei.com> <1460744420-175165-2-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1460744420-175165-2-git-send-email-wangnan0@huawei.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 17 Apr 2016 11:52:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1033 Lines: 30 On Fri, Apr 15, 2016 at 06:20:15PM +0000, Wang Nan wrote: SNIP > + > +#define __TRIGGER_VAR(n) n##_state > +#define __DEF_TRIGGER_VOID_FUNC(n, op) \ > +static inline void n##_##op(void) {trigger_##op(&__TRIGGER_VAR(n)); } > + > +#define __DEF_TRIGGER_FUNC(n, type, op) \ > +static inline type n##_##op(void) {return trigger_##op(&__TRIGGER_VAR(n)); } > + > +#define DEFINE_TRIGGER(n, def) \ > +struct trigger n##_state = {.state = TRIGGER_##def, .error = false,};\ > +__DEF_TRIGGER_VOID_FUNC(n, on) \ > +__DEF_TRIGGER_VOID_FUNC(n, release) \ > +__DEF_TRIGGER_VOID_FUNC(n, toggle) \ > +__DEF_TRIGGER_VOID_FUNC(n, colddown) \ > +__DEF_TRIGGER_VOID_FUNC(n, off) \ > +__DEF_TRIGGER_VOID_FUNC(n, error) \ > +__DEF_TRIGGER_FUNC(n, bool, is_released) \ > +__DEF_TRIGGER_FUNC(n, bool, is_toggled) \ > +__DEF_TRIGGER_FUNC(n, bool, is_error) hum, it gets the impression that __DEF_TRIGGER_FUNC is generic but it's not, right? __DEF_TRIGGER_BOOL_FUNC might suit better without the bool type as an argument thanks, jirka