]> git.ipfire.org Git - people/ms/u-boot.git/blame - include/hwconfig.h
Convert CONFIG_BOOTCOUNT_ENV to Kconfig
[people/ms/u-boot.git] / include / hwconfig.h
CommitLineData
93f9dcf9
AV
1/*
2 * An inteface for configuring a hardware via u-boot environment.
3 *
4 * Copyright (c) 2009 MontaVista Software, Inc.
dd50af25 5 * Copyright 2011 Freescale Semiconductor, Inc.
93f9dcf9
AV
6 *
7 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
8 *
1a459660 9 * SPDX-License-Identifier: GPL-2.0+
93f9dcf9
AV
10 */
11
12#ifndef _HWCONFIG_H
13#define _HWCONFIG_H
14
15#include <linux/types.h>
1221ce45 16#include <linux/errno.h>
93f9dcf9
AV
17
18#ifdef CONFIG_HWCONFIG
19
dd50af25
KG
20extern int hwconfig_f(const char *opt, char *buf);
21extern const char *hwconfig_arg_f(const char *opt, size_t *arglen, char *buf);
22extern int hwconfig_arg_cmp_f(const char *opt, const char *arg, char *buf);
23extern int hwconfig_sub_f(const char *opt, const char *subopt, char *buf);
24extern const char *hwconfig_subarg_f(const char *opt, const char *subopt,
25 size_t *subarglen, char *buf);
26extern int hwconfig_subarg_cmp_f(const char *opt, const char *subopt,
27 const char *subarg, char *buf);
93f9dcf9
AV
28#else
29
dd50af25 30static inline int hwconfig_f(const char *opt, char *buf)
93f9dcf9
AV
31{
32 return -ENOSYS;
33}
34
dd50af25
KG
35static inline const char *hwconfig_arg_f(const char *opt, size_t *arglen,
36 char *buf)
93f9dcf9
AV
37{
38 *arglen = 0;
39 return "";
40}
41
dd50af25
KG
42static inline int hwconfig_arg_cmp_f(const char *opt, const char *arg,
43 char *buf)
93f9dcf9
AV
44{
45 return -ENOSYS;
46}
47
dd50af25 48static inline int hwconfig_sub_f(const char *opt, const char *subopt, char *buf)
93f9dcf9
AV
49{
50 return -ENOSYS;
51}
52
dd50af25
KG
53static inline const char *hwconfig_subarg_f(const char *opt, const char *subopt,
54 size_t *subarglen, char *buf)
93f9dcf9
AV
55{
56 *subarglen = 0;
57 return "";
58}
59
dd50af25
KG
60static inline int hwconfig_subarg_cmp_f(const char *opt, const char *subopt,
61 const char *subarg, char *buf)
93f9dcf9
AV
62{
63 return -ENOSYS;
64}
65
66#endif /* CONFIG_HWCONFIG */
67
dd50af25
KG
68static inline int hwconfig(const char *opt)
69{
70 return hwconfig_f(opt, NULL);
71}
72
73static inline const char *hwconfig_arg(const char *opt, size_t *arglen)
74{
75 return hwconfig_arg_f(opt, arglen, NULL);
76}
77
78static inline int hwconfig_arg_cmp(const char *opt, const char *arg)
79{
80 return hwconfig_arg_cmp_f(opt, arg, NULL);
81}
82
83static inline int hwconfig_sub(const char *opt, const char *subopt)
84{
85 return hwconfig_sub_f(opt, subopt, NULL);
86}
87
88static inline const char *hwconfig_subarg(const char *opt, const char *subopt,
89 size_t *subarglen)
90{
91 return hwconfig_subarg_f(opt, subopt, subarglen, NULL);
92}
93
94static inline int hwconfig_subarg_cmp(const char *opt, const char *subopt,
95 const char *subarg)
96{
97 return hwconfig_subarg_cmp_f(opt, subopt, subarg, NULL);
98}
99
93f9dcf9 100#endif /* _HWCONFIG_H */