git: cd29688e8ec5 - main - kbdreg.h: include opt_kbd.h
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 27 Feb 2023 14:40:47 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=cd29688e8ec55a45cda1a5620dfc9b3ba297c0c1
commit cd29688e8ec55a45cda1a5620dfc9b3ba297c0c1
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-02-27 14:27:45 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-02-27 14:37:32 +0000
kbdreg.h: include opt_kbd.h
This is a kernel-only file, so it's safe to include opt_kbd.h. However,
add #ifdef _KERNEL guards to emphasize that. And also move the include
of opt_kbd.h in atkbdcreg.h to inside the kernel guards. Nothing outside
the kernel in tree uses the rest of that file, but I'm less comfortable
moving the #ifdef _KERNEL to the top of that file.
Sponsored by: Netflix
---
sys/dev/atkbdc/atkbdcreg.h | 4 ++--
sys/dev/kbd/kbdreg.h | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/sys/dev/atkbdc/atkbdcreg.h b/sys/dev/atkbdc/atkbdcreg.h
index 956861b657d6..c0bfbf27a880 100644
--- a/sys/dev/atkbdc/atkbdcreg.h
+++ b/sys/dev/atkbdc/atkbdcreg.h
@@ -36,8 +36,6 @@
#ifndef _DEV_ATKBDC_ATKBDCREG_H_
#define _DEV_ATKBDC_ATKBDCREG_H_
-#include "opt_kbd.h" /* Structures depend on the value if KBDIO_DEBUG */
-
/* constants */
/* I/O ports */
@@ -145,6 +143,8 @@
#ifdef _KERNEL
+#include "opt_kbd.h" /* Structures depend on the value if KBDIO_DEBUG */
+
#define ATKBDC_DRIVER_NAME "atkbdc"
/*
diff --git a/sys/dev/kbd/kbdreg.h b/sys/dev/kbd/kbdreg.h
index 2839e259420d..822af48c932b 100644
--- a/sys/dev/kbd/kbdreg.h
+++ b/sys/dev/kbd/kbdreg.h
@@ -31,6 +31,10 @@
#ifndef _DEV_KBD_KBDREG_H_
#define _DEV_KBD_KBDREG_H_
+#ifdef _KERNEL
+
+#include "opt_kbd.h" /* KBD_DELAY* */
+
/* forward declarations */
typedef struct keyboard keyboard_t;
struct keymap;
@@ -411,4 +415,5 @@ int genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg);
int genkbd_keyaction(keyboard_t *kbd, int keycode, int up,
int *shiftstate, int *accents);
+#endif
#endif /* !_DEV_KBD_KBDREG_H_ */