From 8f3cb60584d94fc490eec2fe97c5835db8e2db57 Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Wed, 6 Jul 2022 00:10:57 -0700 Subject: [PATCH] tegra: hwpm: add wrapper for log functions In an effort to make HWPM driver OS agnostic, add wrapper for log functions. Jira THWPM-59 Change-Id: I27ba6fac4c4f87c113c3d2cf8c62214bf4db1329 Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2740404 Reviewed-by: svc_kernel_abi Reviewed-by: Vasuki Shankar Reviewed-by: Seema Khowala GVS: Gerrit_Virtual_Submit --- include/tegra_hwpm_log.h | 21 ++++++++++++++------- os/linux/log.h | 24 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 os/linux/log.h diff --git a/include/tegra_hwpm_log.h b/include/tegra_hwpm_log.h index 2bde2c4..936ef14 100644 --- a/include/tegra_hwpm_log.h +++ b/include/tegra_hwpm_log.h @@ -14,7 +14,21 @@ #ifndef TEGRA_HWPM_LOG_H #define TEGRA_HWPM_LOG_H +#ifdef __KERNEL__ #include +#include +#else +void tegra_hwpm_err_impl(struct tegra_soc_hwpm *hwpm, + const char *func, int line, const char *fmt, ...) +{ + return; +} +void tegra_hwpm_dbg_impl(struct tegra_soc_hwpm *hwpm, + u32 dbg_mask, const char *func, int line, const char *fmt, ...) +{ + return; +} +#endif #define TEGRA_SOC_HWPM_MODULE_NAME "tegra-soc-hwpm" @@ -69,11 +83,4 @@ enum tegra_soc_hwpm_log_type { #define tegra_hwpm_fn(hwpm, fmt, arg...) \ tegra_hwpm_dbg_impl(hwpm, hwpm_fn, __func__, __LINE__, fmt, ##arg) -struct tegra_soc_hwpm; - -void tegra_hwpm_err_impl(struct tegra_soc_hwpm *hwpm, - const char *func, int line, const char *fmt, ...); -void tegra_hwpm_dbg_impl(struct tegra_soc_hwpm *hwpm, - u32 dbg_mask, const char *func, int line, const char *fmt, ...); - #endif /* TEGRA_HWPM_LOG_H */ diff --git a/os/linux/log.h b/os/linux/log.h new file mode 100644 index 0000000..e827923 --- /dev/null +++ b/os/linux/log.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#ifndef TEGRA_HWPM_OS_LINUX_LOG_H +#define TEGRA_HWPM_OS_LINUX_LOG_H + +struct tegra_soc_hwpm; + +void tegra_hwpm_err_impl(struct tegra_soc_hwpm *hwpm, + const char *func, int line, const char *fmt, ...); +void tegra_hwpm_dbg_impl(struct tegra_soc_hwpm *hwpm, + u32 dbg_mask, const char *func, int line, const char *fmt, ...); + +#endif /* TEGRA_HWPM_OS_LINUX_LOG_H */