Skip to content

Commit

Permalink
(squash) checkpatch: fix extern warnings
Browse files Browse the repository at this point in the history
Note: squash with ("livepatch/selftests: add klp-convert")

Fix the following checkpatch warnings:

  WARNING: externs should be avoided in .c files
  torvalds#66: FILE: lib/livepatch/test_klp_convert1.c:13:
  +extern char driver_name[];

  WARNING: externs should be avoided in .c files
  torvalds#67: FILE: lib/livepatch/test_klp_convert1.c:14:
  +extern char homonym_string[];

  WARNING: externs should be avoided in .c files
  torvalds#68: FILE: lib/livepatch/test_klp_convert1.c:15:
  +extern const char *get_homonym_string(void);

  WARNING: externs should be avoided in .c files
  torvalds#69: FILE: lib/livepatch/test_klp_convert1.c:16:
  +extern const char *test_klp_get_driver_name(void);

  WARNING: externs should be avoided in .c files
  torvalds#191: FILE: lib/livepatch/test_klp_convert2.c:13:
  +extern char driver_name[];

  WARNING: externs should be avoided in .c files
  torvalds#192: FILE: lib/livepatch/test_klp_convert2.c:14:
  +extern char homonym_string[];

  WARNING: externs should be avoided in .c files
  torvalds#193: FILE: lib/livepatch/test_klp_convert2.c:15:
  +extern const char *get_homonym_string(void);

  WARNING: externs should be avoided in .c files
  torvalds#194: FILE: lib/livepatch/test_klp_convert2.c:16:
  +extern const char *test_klp_get_driver_name(void);

  WARNING: externs should be avoided in .c files
  torvalds#30: FILE: lib/livepatch/test_klp_convert1.c:18:
  +extern char klp_string_a[] __asm__("klp_string.12345");

  WARNING: externs should be avoided in .c files
  torvalds#31: FILE: lib/livepatch/test_klp_convert1.c:19:
  +extern char klp_string_b[] __asm__("klp_string.67890");

Signed-off-by: Joe Lawrence <[email protected]>
  • Loading branch information
joe-lawrence committed Oct 27, 2021
1 parent ce26109 commit 04ef1ab
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
17 changes: 17 additions & 0 deletions lib/livepatch/test_klp_convert.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0 */

#ifndef _TEST_KLP_CONVERT_
#define _TEST_KLP_CONVERT_

/* klp-convert symbols - vmlinux */
extern char *saved_command_line;
/* klp-convert symbols - test_klp_convert_mod.ko */
extern char driver_name[];
extern char homonym_string[];
extern const char *get_homonym_string(void);
extern const char *test_klp_get_driver_name(void);

extern char klp_string_a[] __asm__("klp_string.12345");
extern char klp_string_b[] __asm__("klp_string.67890");

#endif
12 changes: 1 addition & 11 deletions lib/livepatch/test_klp_convert1.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/livepatch.h>

/* klp-convert symbols - vmlinux */
extern char *saved_command_line;
/* klp-convert symbols - test_klp_convert_mod.ko */
extern char driver_name[];
extern char homonym_string[];
extern const char *get_homonym_string(void);
extern const char *test_klp_get_driver_name(void);

extern char klp_string_a[] __asm__("klp_string.12345");
extern char klp_string_b[] __asm__("klp_string.67890");
#include "test_klp_convert.h"

void print_saved_command_line(void)
{
Expand Down
9 changes: 1 addition & 8 deletions lib/livepatch/test_klp_convert2.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/livepatch.h>

/* klp-convert symbols - vmlinux */
extern char *saved_command_line;
/* klp-convert symbols - test_klp_convert_mod.ko */
extern char driver_name[];
extern char homonym_string[];
extern const char *get_homonym_string(void);
extern const char *test_klp_get_driver_name(void);
#include "test_klp_convert.h"

void print_saved_command_line(void)
{
Expand Down

0 comments on commit 04ef1ab

Please sign in to comment.