perf tools: Add WARN_ONCE equivalent for UI warnings
Currently WARN_ONCE prints to stderr and corrupts the TUI. Add equivalent methods for UI warnings. Signed-off-by: James Clark <james.clark@arm.com> Reviewed-by: Leo Yan <leo.yan@linaro.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: John Garry <john.garry@huawei.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Will Deacon <will@kernel.org> Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lore.kernel.org/lkml/20210729155805.2830-2-james.clark@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
ec02f2b134
commit
1094795eb9
@ -22,6 +22,13 @@ extern int debug_data_convert;
|
||||
eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_warning(fmt, ...) \
|
||||
eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_warning_once(fmt, ...) ({ \
|
||||
static int __warned; \
|
||||
if (unlikely(!__warned)) { \
|
||||
pr_warning(fmt, ##__VA_ARGS__); \
|
||||
__warned = 1; \
|
||||
} \
|
||||
})
|
||||
#define pr_info(fmt, ...) \
|
||||
eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
|
||||
#define pr_debug(fmt, ...) \
|
||||
@ -55,6 +62,13 @@ void trace_event(union perf_event *event);
|
||||
|
||||
int ui__error(const char *format, ...) __printf(1, 2);
|
||||
int ui__warning(const char *format, ...) __printf(1, 2);
|
||||
#define ui__warning_once(format, ...) ({ \
|
||||
static int __warned; \
|
||||
if (unlikely(!__warned)) { \
|
||||
ui__warning(format, ##__VA_ARGS__); \
|
||||
__warned = 1; \
|
||||
} \
|
||||
})
|
||||
|
||||
void pr_stat(const char *fmt, ...);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user