Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Benes <mbenes@suse.cz>2019-03-07 15:23:42 +0100
committerMiroslav Benes <mbenes@suse.cz>2019-03-07 15:23:42 +0100
commit060163bd26b9dfff93989de95ba0fa4f29d9744c (patch)
tree942da8492e8aeeba0da3485edb705f442801b228
parent4c9eb70c86cceee420856573ea1e21835c92980b (diff)
livepatch_main.c: Adaptation to a new livepatch API
The atomic replace patch set among others removed the two-stage API. There is no (un)registration step needed now. SLES backport defines KLP_NOREG_API macro to easily distinguish whether the kernel provides the old or the new API. Use it and change the module init and exit functions accordingly. Signed-off-by: Miroslav Benes <mbenes@suse.cz>
-rw-r--r--livepatch_main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/livepatch_main.c b/livepatch_main.c
index a6262cb..990e5fe 100644
--- a/livepatch_main.c
+++ b/livepatch_main.c
@@ -48,14 +48,18 @@ static int __init klp_patch_init(void)
@@KLP_PATCHES_INIT_CALLS@@;
+#ifndef KLP_NOREG_API
retval = klp_register_patch(&patch);
if (retval)
goto err_patches_cleanup;
+#endif
retval = klp_enable_patch(&patch);
if (!retval)
return retval;
+#ifndef KLP_NOREG_API
WARN_ON(klp_unregister_patch(&patch));
+#endif
err_patches_cleanup:
@@KLP_PATCHES_INIT_ERR_HANDLERS@@;
@@ -68,7 +72,9 @@ static void __exit klp_patch_cleanup(void)
@@KLP_PATCHES_CLEANUP_CALLS@@;
+#ifndef KLP_NOREG_API
WARN_ON(klp_unregister_patch(&patch));
+#endif
}
module_init(klp_patch_init);