mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
gpu: nvgpu: bug: move nvgpu_do_assert_print() into assert.c
There was a header file circular dependency that was preventing including some files. For example, for utils.h to include safe_ops.h would include bug.h which included log.h which included bitops.h which included utils.h. To break this loop, the macro nvgpu_do_assert_print() into a function in a new file assert.c. With this change, log.h is no longer required in bug.h. This change also required adding a few includes in C files that were picking up definitions through the chain above. JIRA NVGPU-3868 Change-Id: Icf95677bb36e4aa034cba25594cf71f2d028c289 Signed-off-by: Philip Elcan <pelcan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2168528 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
35799f369e
commit
acc65f6e84
@@ -196,7 +196,8 @@ utils:
|
|||||||
common/utils/string.c,
|
common/utils/string.c,
|
||||||
common/utils/worker.c,
|
common/utils/worker.c,
|
||||||
common/utils/rbtree.c,
|
common/utils/rbtree.c,
|
||||||
common/utils/enabled.c ]
|
common/utils/enabled.c,
|
||||||
|
common/utils/assert.c ]
|
||||||
|
|
||||||
##
|
##
|
||||||
## Common elements.
|
## Common elements.
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ obj-$(CONFIG_GK20A) := nvgpu.o
|
|||||||
# is in progress.
|
# is in progress.
|
||||||
|
|
||||||
nvgpu-y += \
|
nvgpu-y += \
|
||||||
|
common/utils/assert.o \
|
||||||
common/utils/enabled.o \
|
common/utils/enabled.o \
|
||||||
common/utils/rbtree.o \
|
common/utils/rbtree.o \
|
||||||
common/utils/string.o \
|
common/utils/string.o \
|
||||||
|
|||||||
@@ -80,7 +80,8 @@ srcs += os/posix/bug.c \
|
|||||||
os/posix/bitmap.c \
|
os/posix/bitmap.c \
|
||||||
os/posix/kmem.c
|
os/posix/kmem.c
|
||||||
|
|
||||||
srcs += common/utils/enabled.c \
|
srcs += common/utils/assert.c \
|
||||||
|
common/utils/enabled.c \
|
||||||
common/utils/rbtree.c \
|
common/utils/rbtree.c \
|
||||||
common/utils/string.c \
|
common/utils/string.c \
|
||||||
common/utils/worker.c \
|
common/utils/worker.c \
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <nvgpu/pmu/pmu_perfmon.h>
|
#include <nvgpu/pmu/pmu_perfmon.h>
|
||||||
|
#include <nvgpu/log.h>
|
||||||
#include "pmu_perfmon_sw_gm20b.h"
|
#include "pmu_perfmon_sw_gm20b.h"
|
||||||
|
|
||||||
void nvgpu_gm20b_perfmon_sw_init(struct gk20a *g,
|
void nvgpu_gm20b_perfmon_sw_init(struct gk20a *g,
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nvgpu/pmu/pmu_perfmon.h>
|
#include <nvgpu/pmu/pmu_perfmon.h>
|
||||||
|
#include <nvgpu/log.h>
|
||||||
#include "pmu_perfmon_sw_gv11b.h"
|
#include "pmu_perfmon_sw_gv11b.h"
|
||||||
|
|
||||||
void nvgpu_gv11b_perfmon_sw_init(struct gk20a *g,
|
void nvgpu_gv11b_perfmon_sw_init(struct gk20a *g,
|
||||||
|
|||||||
37
drivers/gpu/nvgpu/common/utils/assert.c
Normal file
37
drivers/gpu/nvgpu/common/utils/assert.c
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nvgpu/gk20a.h>
|
||||||
|
#include <nvgpu/bug.h>
|
||||||
|
#include <nvgpu/log.h>
|
||||||
|
|
||||||
|
void nvgpu_do_assert_print(struct gk20a *g, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NVGPU_LOGGING
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args, fmt);
|
||||||
|
nvgpu_err(g, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
#endif
|
||||||
|
nvgpu_do_assert();
|
||||||
|
}
|
||||||
@@ -28,8 +28,6 @@
|
|||||||
#include <nvgpu/posix/bug.h>
|
#include <nvgpu/posix/bug.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <nvgpu/log.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define an assert macro that code within nvgpu can use.
|
* Define an assert macro that code within nvgpu can use.
|
||||||
*
|
*
|
||||||
@@ -69,10 +67,7 @@ static inline void nvgpu_assert(bool cond)
|
|||||||
*/
|
*/
|
||||||
#define nvgpu_do_assert() nvgpu_assert(false)
|
#define nvgpu_do_assert() nvgpu_assert(false)
|
||||||
|
|
||||||
#define nvgpu_do_assert_print(g, fmt, ...) \
|
struct gk20a;
|
||||||
do { \
|
void nvgpu_do_assert_print(struct gk20a *g, const char *fmt, ...);
|
||||||
nvgpu_err(g, fmt, ##__VA_ARGS__); \
|
|
||||||
nvgpu_do_assert(); \
|
|
||||||
} while (false)
|
|
||||||
|
|
||||||
#endif /* NVGPU_BUG_H */
|
#endif /* NVGPU_BUG_H */
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
#include <nvgpu/types.h>
|
#include <nvgpu/types.h>
|
||||||
#include <nvgpu/safe_ops.h>
|
#include <nvgpu/safe_ops.h>
|
||||||
|
#include <nvgpu/utils.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: this code uses the GCC builtins to implement atomics.
|
* Note: this code uses the GCC builtins to implement atomics.
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nvgpu/cond.h>
|
#include <nvgpu/cond.h>
|
||||||
|
#include <nvgpu/safe_ops.h>
|
||||||
|
|
||||||
int nvgpu_cond_init(struct nvgpu_cond *cond)
|
int nvgpu_cond_init(struct nvgpu_cond *cond)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <nvgpu/bug.h>
|
#include <nvgpu/bug.h>
|
||||||
|
#include <nvgpu/log.h>
|
||||||
#include <nvgpu/kmem.h>
|
#include <nvgpu/kmem.h>
|
||||||
#include <nvgpu/types.h>
|
#include <nvgpu/types.h>
|
||||||
#include <nvgpu/atomic.h>
|
#include <nvgpu/atomic.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user