Blame view

include/hwconfig.h 2.37 KB
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
1
2
3
4
  /*
   * An inteface for configuring a hardware via u-boot environment.
   *
   * Copyright (c) 2009  MontaVista Software, Inc.
dd50af251   Kumar Gala   powerpc/8xxx: Add...
5
   * Copyright 2011 Freescale Semiconductor, Inc.
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
6
7
8
   *
   * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
   *
1a4596601   Wolfgang Denk   Add GPL-2.0+ SPDX...
9
   * SPDX-License-Identifier:	GPL-2.0+
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
10
11
12
13
14
15
   */
  
  #ifndef _HWCONFIG_H
  #define _HWCONFIG_H
  
  #include <linux/types.h>
1221ce459   Masahiro Yamada   treewide: replace...
16
  #include <linux/errno.h>
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
17
18
  
  #ifdef CONFIG_HWCONFIG
dd50af251   Kumar Gala   powerpc/8xxx: Add...
19
20
21
22
23
24
25
26
  extern int hwconfig_f(const char *opt, char *buf);
  extern const char *hwconfig_arg_f(const char *opt, size_t *arglen, char *buf);
  extern int hwconfig_arg_cmp_f(const char *opt, const char *arg, char *buf);
  extern int hwconfig_sub_f(const char *opt, const char *subopt, char *buf);
  extern const char *hwconfig_subarg_f(const char *opt, const char *subopt,
  				     size_t *subarglen, char *buf);
  extern int hwconfig_subarg_cmp_f(const char *opt, const char *subopt,
  				 const char *subarg, char *buf);
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
27
  #else
dd50af251   Kumar Gala   powerpc/8xxx: Add...
28
  static inline int hwconfig_f(const char *opt, char *buf)
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
29
30
31
  {
  	return -ENOSYS;
  }
dd50af251   Kumar Gala   powerpc/8xxx: Add...
32
33
  static inline const char *hwconfig_arg_f(const char *opt, size_t *arglen,
  					 char *buf)
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
34
35
36
37
  {
  	*arglen = 0;
  	return "";
  }
dd50af251   Kumar Gala   powerpc/8xxx: Add...
38
39
  static inline int hwconfig_arg_cmp_f(const char *opt, const char *arg,
  				     char *buf)
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
40
41
42
  {
  	return -ENOSYS;
  }
dd50af251   Kumar Gala   powerpc/8xxx: Add...
43
  static inline int hwconfig_sub_f(const char *opt, const char *subopt, char *buf)
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
44
45
46
  {
  	return -ENOSYS;
  }
dd50af251   Kumar Gala   powerpc/8xxx: Add...
47
48
  static inline const char *hwconfig_subarg_f(const char *opt, const char *subopt,
  					    size_t *subarglen, char *buf)
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
49
50
51
52
  {
  	*subarglen = 0;
  	return "";
  }
dd50af251   Kumar Gala   powerpc/8xxx: Add...
53
54
  static inline int hwconfig_subarg_cmp_f(const char *opt, const char *subopt,
  					const char *subarg, char *buf)
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
55
56
57
58
59
  {
  	return -ENOSYS;
  }
  
  #endif /* CONFIG_HWCONFIG */
dd50af251   Kumar Gala   powerpc/8xxx: Add...
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
  static inline int hwconfig(const char *opt)
  {
  	return hwconfig_f(opt, NULL);
  }
  
  static inline const char *hwconfig_arg(const char *opt, size_t *arglen)
  {
  	return hwconfig_arg_f(opt, arglen, NULL);
  }
  
  static inline int hwconfig_arg_cmp(const char *opt, const char *arg)
  {
  	return hwconfig_arg_cmp_f(opt, arg, NULL);
  }
  
  static inline int hwconfig_sub(const char *opt, const char *subopt)
  {
  	return hwconfig_sub_f(opt, subopt, NULL);
  }
  
  static inline const char *hwconfig_subarg(const char *opt, const char *subopt,
  					  size_t *subarglen)
  {
  	return hwconfig_subarg_f(opt, subopt, subarglen, NULL);
  }
  
  static inline int hwconfig_subarg_cmp(const char *opt, const char *subopt,
  				      const char *subarg)
  {
  	return hwconfig_subarg_cmp_f(opt, subopt, subarg, NULL);
  }
93f9dcf9e   Anton Vorontsov   Add simple hwconf...
91
  #endif /* _HWCONFIG_H */