1
2
3
4
5
6
7
8
9
10
11#ifndef _HWCONFIG_H
12#define _HWCONFIG_H
13
14#include <linux/types.h>
15#include <linux/errno.h>
16
17#ifdef CONFIG_HWCONFIG
18
19extern int hwconfig_f(const char *opt, char *buf);
20extern const char *hwconfig_arg_f(const char *opt, size_t *arglen, char *buf);
21extern int hwconfig_arg_cmp_f(const char *opt, const char *arg, char *buf);
22extern int hwconfig_sub_f(const char *opt, const char *subopt, char *buf);
23extern const char *hwconfig_subarg_f(const char *opt, const char *subopt,
24 size_t *subarglen, char *buf);
25extern int hwconfig_subarg_cmp_f(const char *opt, const char *subopt,
26 const char *subarg, char *buf);
27#else
28
29static inline int hwconfig_f(const char *opt, char *buf)
30{
31 return -ENOSYS;
32}
33
34static inline const char *hwconfig_arg_f(const char *opt, size_t *arglen,
35 char *buf)
36{
37 *arglen = 0;
38 return "";
39}
40
41static inline int hwconfig_arg_cmp_f(const char *opt, const char *arg,
42 char *buf)
43{
44 return -ENOSYS;
45}
46
47static inline int hwconfig_sub_f(const char *opt, const char *subopt, char *buf)
48{
49 return -ENOSYS;
50}
51
52static inline const char *hwconfig_subarg_f(const char *opt, const char *subopt,
53 size_t *subarglen, char *buf)
54{
55 *subarglen = 0;
56 return "";
57}
58
59static inline int hwconfig_subarg_cmp_f(const char *opt, const char *subopt,
60 const char *subarg, char *buf)
61{
62 return -ENOSYS;
63}
64
65#endif
66
67static inline int hwconfig(const char *opt)
68{
69 return hwconfig_f(opt, NULL);
70}
71
72static inline const char *hwconfig_arg(const char *opt, size_t *arglen)
73{
74 return hwconfig_arg_f(opt, arglen, NULL);
75}
76
77static inline int hwconfig_arg_cmp(const char *opt, const char *arg)
78{
79 return hwconfig_arg_cmp_f(opt, arg, NULL);
80}
81
82static inline int hwconfig_sub(const char *opt, const char *subopt)
83{
84 return hwconfig_sub_f(opt, subopt, NULL);
85}
86
87static inline const char *hwconfig_subarg(const char *opt, const char *subopt,
88 size_t *subarglen)
89{
90 return hwconfig_subarg_f(opt, subopt, subarglen, NULL);
91}
92
93static inline int hwconfig_subarg_cmp(const char *opt, const char *subopt,
94 const char *subarg)
95{
96 return hwconfig_subarg_cmp_f(opt, subopt, subarg, NULL);
97}
98
99#endif
100