Skip to content

Commit 1051742

Browse files
author
Jiri Kosina
committed
livepatch: make klp_mutex proper part of API
klp_mutex is shared between core.c and transition.c, and as such would rather be properly located in a header so that we don't have to play 'extern' games from .c sources. This also silences sparse warning (wrongly) suggesting that klp_mutex should be defined static. Acked-by: Miroslav Benes <mbenes@suse.cz> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 3ec2477 commit 1051742

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

kernel/livepatch/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/moduleloader.h>
3232
#include <linux/completion.h>
3333
#include <asm/cacheflush.h>
34+
#include "core.h"
3435
#include "patch.h"
3536
#include "transition.h"
3637

kernel/livepatch/core.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef _LIVEPATCH_CORE_H
2+
#define _LIVEPATCH_CORE_H
3+
4+
extern struct mutex klp_mutex;
5+
6+
#endif /* _LIVEPATCH_CORE_H */

kernel/livepatch/transition.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@
2121

2222
#include <linux/cpu.h>
2323
#include <linux/stacktrace.h>
24+
#include "core.h"
2425
#include "patch.h"
2526
#include "transition.h"
2627
#include "../sched/sched.h"
2728

2829
#define MAX_STACK_ENTRIES 100
2930
#define STACK_ERR_BUF_SIZE 128
3031

31-
extern struct mutex klp_mutex;
32-
3332
struct klp_patch *klp_transition_patch;
3433

3534
static int klp_target_state = KLP_UNDEFINED;

0 commit comments

Comments
 (0)