[PATCH 6/7] alpha: marvel: notify environmental events

From: Matt Turner

Date: Sat Nov 14 2026 - 12:41:01 EST


A change in the state of a sensor arrives as a system event logout
frame. Call an atomic notifier chain on each one, so that a sensor
driver can reread its sensors and tell userspace without polling.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Matt Turner <mattst88@xxxxxxxxx>
---
arch/alpha/include/asm/marvel_env.h | 5 +++++
arch/alpha/kernel/err_marvel.c | 9 ++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/alpha/include/asm/marvel_env.h b/arch/alpha/include/asm/marvel_env.h
index 583dca6c02d1..14b05efa6f51 100644
--- a/arch/alpha/include/asm/marvel_env.h
+++ b/arch/alpha/include/asm/marvel_env.h
@@ -2,6 +2,8 @@
#ifndef __ALPHA_MARVEL_ENV_H
#define __ALPHA_MARVEL_ENV_H

+#include <linux/notifier.h>
+
/*
* Ask the console to refresh the environmental readings of the GCT node at
* @offset from the start of the GCT. Returns the console status, which is 1
@@ -9,4 +11,7 @@
*/
long marvel_cfgtree_partial_update(unsigned long offset);

+/* Called from machine check context on each environmental system event. */
+extern struct atomic_notifier_head marvel_env_notifier;
+
#endif /* __ALPHA_MARVEL_ENV_H */
diff --git a/arch/alpha/kernel/err_marvel.c b/arch/alpha/kernel/err_marvel.c
index 46c521cea9a0..6e0b0aabdaca 100644
--- a/arch/alpha/kernel/err_marvel.c
+++ b/arch/alpha/kernel/err_marvel.c
@@ -17,10 +17,14 @@
#include <asm/smp.h>
#include <asm/err_common.h>
#include <asm/err_ev7.h>
+#include <asm/marvel_env.h>

#include "err_impl.h"
#include "proto.h"

+ATOMIC_NOTIFIER_HEAD(marvel_env_notifier);
+EXPORT_SYMBOL_GPL(marvel_env_notifier);
+
static const char *
marvel_env_state(u16 state)
{
@@ -82,8 +86,11 @@ marvel_process_680_frame(struct ev7_lf_subpackets *lf_subpackets, int print)
status = MCHK_DISPOSITION_REPORT;
}

- if (print)
+ /* The frame is processed twice; notify on the printing pass only. */
+ if (print) {
marvel_print_680_frame(lf_subpackets);
+ atomic_notifier_call_chain(&marvel_env_notifier, 0, NULL);
+ }

return status;
}

--
2.56.1