Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp792617ybe; Fri, 13 Sep 2019 06:28:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQnDiMf/kmA1LJrO7jPCvAo6zaCUugLZXCqXIwU38H0NgU666hKEYZggdWtPcyRSOdLHfE X-Received: by 2002:a17:906:cf85:: with SMTP id um5mr38660794ejb.186.1568381315255; Fri, 13 Sep 2019 06:28:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568381315; cv=none; d=google.com; s=arc-20160816; b=JyXutYXxHqAnKHZHgLlt/Aj9lGdXiYUifOB1q8+6y0EeNnXdLX67Z+MWNohP8+m5Gb EPnhHVPsY7T7Lnw446FHkivzm99W6/VkSBfoXe0Ygr3Up9qKSC82HrugeFBbKpTrZ9pQ OT6CkuEjwM0gWNPETtiq24siGZdQyqEMxFaP2/Ll4XtKQDIL3okhkuSOpqzmLbA3Lz7Y KNxEqcSm6K8UXEkuu66kACKHT8Gm/bmvWet0v3H2wI5Y0rcpIiBbK5G5G9qCMofCfS1Q sXM1JlqcnYRlnYNoYAnfNCOHMB47gDNQ+cLOWXWbCSpQW/eKWSrZYDehrR7VA+98Sl9w B9Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DNCE9YpBop7wE9EMYwF23OV4BgD0BNleLWPdvVPoKUc=; b=Lcnb+agBX8YUJCkPt5Gn0uTuVSf7ewWuImA9/xT10TwhpGv3qi272YXkK50FWlZkbr MmWY8A3MPU21z2PXzvGzWq5jMOOWSt4bfxX86egrNhHA0CaoakRTo0f6LzFztrkCnKgv gAvkEAyZPiwOqUieITCiNEnDM7DtvSNnubw6DrJNeBxLjk10f9EwlrWqDv9M7oEONIOd S/bSU9wRKRoLmGBsG3Ydgts0TDiFOyF+9rtHzPGTGo5luSdXhM1UUtlxcevKGeHFom5n zsyuu4GDBhTV4Jpr+r3r+bx/ehOaDmSklzmnXFrO+cgIBbczmXeebZdSxPOFGjDszG9R aT9A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v24si16180110edq.156.2019.09.13.06.28.11; Fri, 13 Sep 2019 06:28:35 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391353AbfIMNZ0 (ORCPT + 99 others); Fri, 13 Sep 2019 09:25:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53366 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390988AbfIMNZY (ORCPT ); Fri, 13 Sep 2019 09:25:24 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6FE4C1DA4; Fri, 13 Sep 2019 13:25:24 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02C275C1D4; Fri, 13 Sep 2019 13:25:20 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH 33/73] libperf: Merge libperf_set_print in libperf_init Date: Fri, 13 Sep 2019 15:23:15 +0200 Message-Id: <20190913132355.21634-34-jolsa@kernel.org> In-Reply-To: <20190913132355.21634-1-jolsa@kernel.org> References: <20190913132355.21634-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Fri, 13 Sep 2019 13:25:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The libperf_set_print needs to be called in any case so let's merge it with libperf_init, so we have just one init function. Link: http://lkml.kernel.org/n/tip-ak1oqlj43qsbioo7q9m5fg9t@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/lib/core.c | 8 ++------ tools/perf/lib/include/perf/core.h | 3 +-- tools/perf/lib/libperf.map | 1 - tools/perf/perf.c | 8 +++++++- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/perf/lib/core.c b/tools/perf/lib/core.c index 6689d593c2d1..d0b9ae422b9f 100644 --- a/tools/perf/lib/core.c +++ b/tools/perf/lib/core.c @@ -17,11 +17,6 @@ static int __base_pr(enum libperf_print_level level, const char *format, static libperf_print_fn_t __libperf_pr = __base_pr; -void libperf_set_print(libperf_print_fn_t fn) -{ - __libperf_pr = fn; -} - __printf(2, 3) void libperf_print(enum libperf_print_level level, const char *format, ...) { @@ -35,7 +30,8 @@ void libperf_print(enum libperf_print_level level, const char *format, ...) va_end(args); } -void libperf_init(void) +void libperf_init(libperf_print_fn_t fn) { page_size = sysconf(_SC_PAGE_SIZE); + __libperf_pr = fn; } diff --git a/tools/perf/lib/include/perf/core.h b/tools/perf/lib/include/perf/core.h index ba2f4e76a3e2..cfd70e720c1c 100644 --- a/tools/perf/lib/include/perf/core.h +++ b/tools/perf/lib/include/perf/core.h @@ -17,7 +17,6 @@ enum libperf_print_level { typedef int (*libperf_print_fn_t)(enum libperf_print_level level, const char *, va_list ap); -LIBPERF_API void libperf_set_print(libperf_print_fn_t fn); -LIBPERF_API void libperf_init(void); +LIBPERF_API void libperf_init(libperf_print_fn_t fn); #endif /* __LIBPERF_CORE_H */ diff --git a/tools/perf/lib/libperf.map b/tools/perf/lib/libperf.map index 3fbf050b5add..507b4cc4784c 100644 --- a/tools/perf/lib/libperf.map +++ b/tools/perf/lib/libperf.map @@ -1,7 +1,6 @@ LIBPERF_0.0.1 { global: libperf_init; - libperf_set_print; perf_cpu_map__dummy_new; perf_cpu_map__get; perf_cpu_map__put; diff --git a/tools/perf/perf.c b/tools/perf/perf.c index ead18b712d6c..d13a9b1ce65d 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -429,6 +429,12 @@ void pthread__unblock_sigwinch(void) pthread_sigmask(SIG_UNBLOCK, &set, NULL); } +static int libperf_print(enum libperf_print_level level, + const char *fmt, va_list ap) +{ + return eprintf(level, verbose, fmt, ap); +} + int main(int argc, const char **argv) { int err; @@ -439,7 +445,7 @@ int main(int argc, const char **argv) exec_cmd_init("perf", PREFIX, PERF_EXEC_PATH, EXEC_PATH_ENVIRONMENT); pager_init(PERF_PAGER_ENVIRONMENT); - libperf_init(); + libperf_init(libperf_print); cmd = extract_argv0_path(argv[0]); if (!cmd) -- 2.21.0