[boot] Initialize klog structure statically
@@ -28,7 +28,11 @@ typedef struct klog {
int prev;
} klog_t;
-static klog_t klog;
+static klog_t klog = (klog_t){
+ .mask = KL_DEFAULT_MASK,
+ .prev = -1,
+};
+
static SPIN_DEFINE(klog_lock, LK_RECURSIVE);
static const char *subsystems[] = {
@@ -45,10 +49,6 @@ static const char *subsystems[] = {
void init_klog(void) {
const char *mask = kenv_get("klog-mask");
klog.mask = mask ? (unsigned)strtol(mask, NULL, 16) : KL_DEFAULT_MASK;
- klog.first = 0;
- klog.last = 0;
- klog.repeated = 0;
- klog.prev = -1;
}
static inline unsigned next(unsigned i) {
