summaryrefslogtreecommitdiff
path: root/die.c
blob: 4e525f9e15539434be76341c237ef06d7f0fe8f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * Subject to the GPL, version 2.
 */

#include "xmalloc.h"

struct panic_handler {
	void *arg;
	pid_t pid;
	bool is_enabled;
	void (*on_panic)(void *arg);
	struct panic_handler *next;
};

static struct panic_handler *panic_handlers;

void panic_handler_add(void (*on_panic)(void *arg), void *arg)
{
	struct panic_handler *handler = xmallocz(sizeof(*handler));

	handler->arg		= arg;
	handler->pid		= getpid();
	handler->is_enabled	= true;
	handler->on_panic	= on_panic;
	handler->next		= panic_handlers;
	panic_handlers		= handler;
};

void call_panic_handlers(void)
{
	struct panic_handler *it;
	pid_t pid = getpid();

	for (it = panic_handlers; it; it = it->next) {
		if (it->pid == pid && it->is_enabled) {
			it->is_enabled = false;
			it->on_panic(it->arg);
		}
	}
}
=178457e171bf1ae7a90a6b0aa6a404fec129e8c4'>drivers parentfcba5d04c87c5c0174f159d26b295a46bfb6da58 (diff)
greybus: es2: fix arpc error message
Add missing le16_to_cpu() to an ARPC error message in the receive path, and also use %u to print the unsigned id. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/greybus/es2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c