Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3794704img; Mon, 25 Mar 2019 18:41:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIqcqjqdueJkR2TZcGEKiKJQHdvQBkIGu+3fzQgvoic44AROAtLdi7BJz9XY1cWSL0Iqha X-Received: by 2002:a63:2f44:: with SMTP id v65mr26117373pgv.141.1553564491104; Mon, 25 Mar 2019 18:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553564491; cv=none; d=google.com; s=arc-20160816; b=K0wE5FX6zGDvuaZhN7QEoZ/pEwy34wcyyp+8whsZNdvWrop5aU5TOtWQGP5AQa9/1W UnNh6RA7MmJGtGR36vsGVH8QuVcWYhcHJJgaTTV6Fai3O0a07RcemSUsbqAq2pvT2dFj uSNVZzfaHb9cfbLCclrLKcqC+DMTXR9/pLHJN56SxIUMIodPugtpw6dflXkfIfZih8Ao 5w1c2Xp1PTbi3zz++z5/QUyhaDZG3CPyz+exPOql/vbNWOG7k7vEY3DHkpkRdKNx4GoR stLlD1aY4kR2O+voXhsUXS+SzLshPYKfImW+1ov3m2rwEmx5/vplIQJpvRYGNryD80w9 tdIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=9dpIZIy9gCyE7D6yDcqhwzJJ98DH5uQDvoJ4ObuHyl8=; b=ee5mBVYWGl6YFZWNgAwC7ezohJktuL9RF5/2WaOisKu2N5enwNGavpbrgeq1wkBiHr mMsh2YPCQVfLWVBwsgGZTN4vzQ7WvSnWUOwicRpAHyy3hygQrOhgygHPwrQQ/smlKGy2 WjlWj35UIEtxM71wxKJws/X9AYaghglsuAYdbIS8L9UMeT1RHUyRh4gFQUPEZbPqlD6C rAX7qGMihzoNMLUCXX37g9S8NtJeNL3djzc4CtBCW1nR6ZLg7ZrmU6xCDIt0p5/AkjT+ 2x2EoDWDtzBEeRxz2nT0eqIC5u/BVL1+aEzRyQdfJiBnjVIS+6MMag0AaujG3MiE+5jZ XTSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kLq7A+xy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si8468588pgq.74.2019.03.25.18.41.15; Mon, 25 Mar 2019 18:41:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kLq7A+xy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730823AbfCZBkc (ORCPT + 99 others); Mon, 25 Mar 2019 21:40:32 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37654 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727506AbfCZBkb (ORCPT ); Mon, 25 Mar 2019 21:40:31 -0400 Received: by mail-pl1-f195.google.com with SMTP id q6so822355pll.4 for ; Mon, 25 Mar 2019 18:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9dpIZIy9gCyE7D6yDcqhwzJJ98DH5uQDvoJ4ObuHyl8=; b=kLq7A+xy7lyi5BtN1RX486UF1RizLtOtVCjlyVj72sZAVsO6GcEfSMyQEz4aALaXAP fcEOu7hV10PINlc4S4JQq+Bidaa1bqB7NTzJn27AgG6n+FkYKZrQ7k44CuCeeu1fAI8O vZ25yJu2qXEDmJXZmO3MG5GPxwZi6l0pU5clHf24PbDau30y83CcyULWBiZBfccUXHZt VMtIX/zB6BF2Cy/vyqzCY+6jDjR3uHLZ4r3iC1wcNt9h0ls8VkSFo0/LvIJOyu/pusQM FmXsWPy/g232H+XDHzDoKNsJ+LGPfkssLwVcCdZiYA+OfruUbZp45iCpxJ8f/8QriOKr VYNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9dpIZIy9gCyE7D6yDcqhwzJJ98DH5uQDvoJ4ObuHyl8=; b=L7byZRR2GCJBk6iqzqwz1r1Y7/m89FEugmfNK048z6NjeE+jnlQmAV9f4r0vJXfPPe BHRf5rZ5oCGd+5/YCKTKV2IkMNFnXfweI7Im1h7NPkOW9bhFW2kQfaGF+xJBy1urh2/P EcT5UofFWplEpxTKGc1x2v8Bcv7cxIp9Tpd4oP55TjRK9H9KBEOSS6ROJWjwBPeOwp8h 0KucMgevcg1ikHVVYohyjiIKBoIR6gGuKzTG71smfv7wBbP9C7m9nUhef+2UGxJXYHLr CXoeYcbhHZNuHcgVwc3xCBIhzmXqsSHdnE8xuW23wgpoYui7iOSzzWLXd+ndap5bbrKK ZzUQ== X-Gm-Message-State: APjAAAUtSbsfOARuKWM7U7QHETClxDLujQCJWlimxwwnRziJUTKBCTqE T7NarKm3k/e4SfiTiujRQkw= X-Received: by 2002:a17:902:bb05:: with SMTP id l5mr8572116pls.311.1553564431386; Mon, 25 Mar 2019 18:40:31 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id m7sm41464119pgg.62.2019.03.25.18.40.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 18:40:30 -0700 (PDT) From: Yafang Shao To: rostedt@goodmis.org, mingo@redhat.com, peterz@infradead.org, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, joel@joelfernandes.org Cc: shaoyafang@didiglobal.com, linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH 1/3] tracing: introduce TRACE_EVENT_NONE() Date: Tue, 26 Mar 2019 09:40:05 +0800 Message-Id: <1553564407-1162-2-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1553564407-1162-1-git-send-email-laoar.shao@gmail.com> References: <1553564407-1162-1-git-send-email-laoar.shao@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sometimes we want define a tracepoint as a do-nothing function. So I introduce this TRACE_EVENT_NONE() for this kind of usage. Signed-off-by: Yafang Shao --- include/linux/tracepoint.h | 8 ++++++++ include/trace/define_trace.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 9c31865..d00c5e6 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -548,4 +548,12 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) #define TRACE_EVENT_PERF_PERM(event, expr...) +#define TRACE_EVENT_NONE(name, proto) \ + static inline void trace_##name(proto) \ + { } \ + static inline bool trace_##name##_enabled(void) \ + { \ + return false; \ + } + #endif /* ifdef TRACE_EVENT (see note above) */ diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index cb30c55..a833b6f 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h @@ -46,6 +46,9 @@ assign, print, reg, unreg) \ DEFINE_TRACE_FN(name, reg, unreg) +#undef TRACE_EVENT_NONE +#define TRACE_EVENT_NONE(name, proto) + #undef DEFINE_EVENT #define DEFINE_EVENT(template, name, proto, args) \ DEFINE_TRACE(name) @@ -102,6 +105,7 @@ #undef TRACE_EVENT_FN #undef TRACE_EVENT_FN_COND #undef TRACE_EVENT_CONDITION +#undef TRACE_EVENT_NONE #undef DECLARE_EVENT_CLASS #undef DEFINE_EVENT #undef DEFINE_EVENT_FN -- 1.8.3.1