Coverage Report

Created: 2026-10-13 06:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/barebox/include/notifier.h
Line
Count
Source
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
#ifndef __NOTIFIER_H
3
#define __NOTIFIER_H
4
5
#include <linux/list.h>
6
7
/*
8
 * Notifer chains loosely based on the according Linux framework
9
 */
10
11
struct notifier_block {
12
  int (*notifier_call)(struct notifier_block *, unsigned long, void *);
13
  struct list_head list;
14
};
15
16
struct notifier_head {
17
  struct list_head blocks;
18
};
19
20
int notifier_chain_register(struct notifier_head *nh, struct notifier_block *n);
21
int notifier_chain_unregister(struct notifier_head *nh, struct notifier_block *n);
22
23
int notifier_call_chain(struct notifier_head *nh, unsigned long val, void *v);
24
25
/*
26
 * Register a function which is called upon changes of
27
 * clock frequencies in the system.
28
 */
29
int clock_register_client(struct notifier_block *nb);
30
int clock_unregister_client(struct notifier_block *nb);
31
int clock_notifier_call_chain(void);
32
33
#define NOTIFIER_HEAD(name)         \
34
  struct notifier_head name = {       \
35
    .blocks = LIST_HEAD_INIT((name).blocks),  \
36
  };
37
38
0
#define NOTIFY_DONE   0x0000    /* Don't care */
39
#define NOTIFY_OK   0x0001    /* Suits me */
40
0
#define NOTIFY_STOP_MASK  0x8000    /* Don't call further */
41
#define NOTIFY_BAD    (NOTIFY_STOP_MASK|0x0002)
42
            /* Bad/Veto action */
43
/*
44
 * Clean way to return from the notifier and stop further calls.
45
 */
46
#define NOTIFY_STOP   (NOTIFY_OK|NOTIFY_STOP_MASK)
47
48
/* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */
49
static inline int notifier_from_errno(int err)
50
0
{
51
0
  if (err)
52
0
    return NOTIFY_STOP_MASK | (NOTIFY_OK - err);
53
0
54
0
  return NOTIFY_OK;
55
0
}
Unexecuted instantiation: console_common.c:notifier_from_errno
Unexecuted instantiation: bootm.c:notifier_from_errno
Unexecuted instantiation: memtest.c:notifier_from_errno
Unexecuted instantiation: console.c:notifier_from_errno
Unexecuted instantiation: console_ctrlc.c:notifier_from_errno
Unexecuted instantiation: environment.c:notifier_from_errno
Unexecuted instantiation: hush.c:notifier_from_errno
Unexecuted instantiation: fastboot.c:notifier_from_errno
Unexecuted instantiation: go.c:notifier_from_errno
Unexecuted instantiation: bfetch.c:notifier_from_errno
Unexecuted instantiation: notifier.c:notifier_from_errno
Unexecuted instantiation: show_progress.c:notifier_from_errno
Unexecuted instantiation: libfile.c:notifier_from_errno
Unexecuted instantiation: fs.c:notifier_from_errno
56
57
#endif /* __NOTIFIER_H */