summaryrefslogtreecommitdiff
path: root/include/state.h
blob: be1b592576c1fe74b66e155b65adc2bdba88546c (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __STATE_H
#define __STATE_H

#include <of.h>

struct state;

#if IS_ENABLED(CONFIG_STATE)

struct state *state_new_from_node(struct device_node *node, bool readonly);
void state_release(struct state *state);

struct state *state_by_name(const char *name);
struct state *state_by_node(const struct device_node *node);

int state_load_no_auth(struct state *state);
int state_load(struct state *state);
int state_save(struct state *state);
void state_info(void);

int state_read_mac(struct state *state, const char *name, u8 *buf);

#else /* #if IS_ENABLED(CONFIG_STATE) */

static inline struct state *state_new_from_node(struct device_node *node,
						bool readonly)
{
	return ERR_PTR(-ENOSYS);
}

static inline struct state *state_by_name(const char *name)
{
	return NULL;
}

static inline struct state *state_by_node(const struct device_node *node)
{
	return NULL;
};

static inline int state_load(struct state *state)
{
	return -ENOSYS;
}

static inline int state_save(struct state *state)
{
	return -ENOSYS;
}

static inline int state_read_mac(struct state *state, const char *name, u8 *buf)
{
	return -ENOSYS;
}

#endif /* #if IS_ENABLED(CONFIG_STATE) / #else */

#endif /* __STATE_H */