perf/x86/intel: Fix event update for auto-reload
[linux/fpc-iii.git] / kernel / livepatch / core.h
blob48a83d4364cff3c6995025ac6459d04e868f169f
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LIVEPATCH_CORE_H
3 #define _LIVEPATCH_CORE_H
5 #include <linux/livepatch.h>
7 extern struct mutex klp_mutex;
9 static inline bool klp_is_object_loaded(struct klp_object *obj)
11 return !obj->name || obj->mod;
14 static inline int klp_pre_patch_callback(struct klp_object *obj)
16 int ret = 0;
18 if (obj->callbacks.pre_patch)
19 ret = (*obj->callbacks.pre_patch)(obj);
21 obj->callbacks.post_unpatch_enabled = !ret;
23 return ret;
26 static inline void klp_post_patch_callback(struct klp_object *obj)
28 if (obj->callbacks.post_patch)
29 (*obj->callbacks.post_patch)(obj);
32 static inline void klp_pre_unpatch_callback(struct klp_object *obj)
34 if (obj->callbacks.pre_unpatch)
35 (*obj->callbacks.pre_unpatch)(obj);
38 static inline void klp_post_unpatch_callback(struct klp_object *obj)
40 if (obj->callbacks.post_unpatch_enabled &&
41 obj->callbacks.post_unpatch)
42 (*obj->callbacks.post_unpatch)(obj);
44 obj->callbacks.post_unpatch_enabled = false;
47 #endif /* _LIVEPATCH_CORE_H */