xref: /linux/drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.h (revision 2e05544060b9fef5d4d0e0172944e6956c55080f)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright 2024 Advanced Micro Devices, Inc.
4  *
5  * Lockdep annotation interface for AMDGPU
6  */
7 
8 #ifndef __AMDGPU_LOCKDEP_H__
9 #define __AMDGPU_LOCKDEP_H__
10 
11 #include <linux/lockdep.h>
12 
13 struct amdgpu_device;
14 
15 #ifdef CONFIG_LOCKDEP
16 
17 /**
18  * amdgpu_lockdep_init - Train lockdep on correct lock ordering
19  *
20  * Call once during module init to establish the lock dependency chain.
21  */
22 int amdgpu_lockdep_init(void);
23 
24 /**
25  * amdgpu_lockdep_set_class - Associate lock class keys with real locks
26  * @adev: AMDGPU device
27  *
28  * Call during device init to associate lock classes with actual locks.
29  */
30 void amdgpu_lockdep_set_class(struct amdgpu_device *adev);
31 
32 #else /* !CONFIG_LOCKDEP */
33 
34 static inline int amdgpu_lockdep_init(void) { return 0; }
35 static inline void amdgpu_lockdep_set_class(struct amdgpu_device *adev) {}
36 
37 #endif /* CONFIG_LOCKDEP */
38 
39 #endif /* __AMDGPU_LOCKDEP_H__ */
40