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 <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2740404
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Vedashree Vidwans
2022-07-06 00:10:57 -07:00
committed by mobile promotions
parent ae38729467
commit 8f3cb60584
2 changed files with 38 additions and 7 deletions

View File

@@ -14,7 +14,21 @@
#ifndef TEGRA_HWPM_LOG_H #ifndef TEGRA_HWPM_LOG_H
#define TEGRA_HWPM_LOG_H #define TEGRA_HWPM_LOG_H
#ifdef __KERNEL__
#include <linux/bits.h> #include <linux/bits.h>
#include <os/linux/log.h>
#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" #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...) \ #define tegra_hwpm_fn(hwpm, fmt, arg...) \
tegra_hwpm_dbg_impl(hwpm, hwpm_fn, __func__, __LINE__, 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 */ #endif /* TEGRA_HWPM_LOG_H */

24
os/linux/log.h Normal file
View File

@@ -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 */