Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 2 | /* |
| 3 | * An inteface for configuring a hardware via u-boot environment. |
| 4 | * |
| 5 | * Copyright (c) 2009 MontaVista Software, Inc. |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 6 | * Copyright 2011 Freescale Semiconductor, Inc. |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 7 | * |
| 8 | * Author: Anton Vorontsov <avorontsov@ru.mvista.com> |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 9 | */ |
| 10 | |
Anton Vorontsov | 7b96373 | 2010-06-18 15:08:27 +0400 | [diff] [blame] | 11 | #ifndef HWCONFIG_TEST |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 12 | #include <config.h> |
Simon Glass | 5e6201b | 2019-08-01 09:46:51 -0600 | [diff] [blame] | 13 | #include <env.h> |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 14 | #include <exports.h> |
| 15 | #include <hwconfig.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 16 | #include <log.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 17 | #include <asm/global_data.h> |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 18 | #include <linux/types.h> |
| 19 | #include <linux/string.h> |
Anton Vorontsov | 7b96373 | 2010-06-18 15:08:27 +0400 | [diff] [blame] | 20 | #else |
| 21 | #include <stdio.h> |
| 22 | #include <stdlib.h> |
| 23 | #include <string.h> |
| 24 | #include <assert.h> |
| 25 | #define min(a, b) (((a) < (b)) ? (a) : (b)) |
| 26 | #endif /* HWCONFIG_TEST */ |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 27 | |
Kumar Gala | e916826 | 2010-10-22 03:18:13 -0500 | [diff] [blame] | 28 | DECLARE_GLOBAL_DATA_PTR; |
| 29 | |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 30 | static const char *hwconfig_parse(const char *opts, size_t maxlen, |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 31 | const char *opt, char *stopchs, char eqch, |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 32 | size_t *arglen) |
| 33 | { |
| 34 | size_t optlen = strlen(opt); |
| 35 | char *str; |
| 36 | const char *start = opts; |
| 37 | const char *end; |
| 38 | |
| 39 | next: |
| 40 | str = strstr(opts, opt); |
| 41 | end = str + optlen; |
| 42 | if (end - start > maxlen) |
| 43 | return NULL; |
| 44 | |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 45 | if (str && (str == opts || strpbrk(str - 1, stopchs) == str - 1) && |
| 46 | (strpbrk(end, stopchs) == end || *end == eqch || |
| 47 | *end == '\0')) { |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 48 | const char *arg_end; |
| 49 | |
| 50 | if (!arglen) |
| 51 | return str; |
| 52 | |
| 53 | if (*end != eqch) |
| 54 | return NULL; |
| 55 | |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 56 | arg_end = strpbrk(str, stopchs); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 57 | if (!arg_end) |
| 58 | *arglen = min(maxlen, strlen(str)) - optlen - 1; |
| 59 | else |
| 60 | *arglen = arg_end - end - 1; |
| 61 | |
| 62 | return end + 1; |
| 63 | } else if (str) { |
| 64 | opts = end; |
| 65 | goto next; |
| 66 | } |
| 67 | return NULL; |
| 68 | } |
| 69 | |
Kumar Gala | 6c97169 | 2010-11-30 15:01:28 -0600 | [diff] [blame] | 70 | const char cpu_hwconfig[] __attribute__((weak)) = ""; |
| 71 | const char board_hwconfig[] __attribute__((weak)) = ""; |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 72 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 73 | static const char *__hwconfig(const char *opt, size_t *arglen, |
| 74 | const char *env_hwconfig) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 75 | { |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 76 | const char *ret; |
Kumar Gala | e916826 | 2010-10-22 03:18:13 -0500 | [diff] [blame] | 77 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 78 | /* if we are passed a buffer use it, otherwise try the environment */ |
| 79 | if (!env_hwconfig) { |
Pali Rohár | 5ee4cac | 2022-08-07 21:06:04 +0200 | [diff] [blame] | 80 | if (!(gd->flags & GD_FLG_ENV_READY) && gd->env_valid != ENV_VALID) { |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 81 | printf("WARNING: Calling __hwconfig without a buffer " |
Wolfgang Denk | a4de835 | 2011-02-02 22:36:10 +0100 | [diff] [blame] | 82 | "and before environment is ready\n"); |
| 83 | return NULL; |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 84 | } |
Pali Rohár | 06c9e98 | 2022-04-03 00:24:25 +0200 | [diff] [blame] | 85 | #if CONFIG_IS_ENABLED(ENV_SUPPORT) |
Simon Glass | 64b723f | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 86 | env_hwconfig = env_get("hwconfig"); |
Pali Rohár | 06c9e98 | 2022-04-03 00:24:25 +0200 | [diff] [blame] | 87 | #endif |
Kumar Gala | e916826 | 2010-10-22 03:18:13 -0500 | [diff] [blame] | 88 | } |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 89 | |
Kumar Gala | adf5c24 | 2010-11-30 15:58:27 -0600 | [diff] [blame] | 90 | if (env_hwconfig) { |
| 91 | ret = hwconfig_parse(env_hwconfig, strlen(env_hwconfig), |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 92 | opt, ";", ':', arglen); |
Kumar Gala | adf5c24 | 2010-11-30 15:58:27 -0600 | [diff] [blame] | 93 | if (ret) |
| 94 | return ret; |
| 95 | } |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 96 | |
Kumar Gala | adf5c24 | 2010-11-30 15:58:27 -0600 | [diff] [blame] | 97 | ret = hwconfig_parse(board_hwconfig, strlen(board_hwconfig), |
Kumar Gala | 6c97169 | 2010-11-30 15:01:28 -0600 | [diff] [blame] | 98 | opt, ";", ':', arglen); |
Kumar Gala | adf5c24 | 2010-11-30 15:58:27 -0600 | [diff] [blame] | 99 | if (ret) |
| 100 | return ret; |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 101 | |
Kumar Gala | 6c97169 | 2010-11-30 15:01:28 -0600 | [diff] [blame] | 102 | return hwconfig_parse(cpu_hwconfig, strlen(cpu_hwconfig), |
| 103 | opt, ";", ':', arglen); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 107 | * hwconfig_f - query if a particular hwconfig option is specified |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 108 | * @opt: a string representing an option |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 109 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 110 | * |
| 111 | * This call can be used to find out whether U-Boot should configure |
| 112 | * a particular hardware option. |
| 113 | * |
| 114 | * Returns non-zero value if the hardware option can be used and thus |
| 115 | * should be configured, 0 otherwise. |
| 116 | * |
| 117 | * This function also returns non-zero value if CONFIG_HWCONFIG is |
| 118 | * undefined. |
| 119 | * |
| 120 | * Returning non-zero value without CONFIG_HWCONFIG has its crucial |
| 121 | * purpose: the hwconfig() call should be a "transparent" interface, |
| 122 | * e.g. if a board doesn't need hwconfig facility, then we assume |
| 123 | * that the board file only calls things that are actually used, so |
| 124 | * hwconfig() will always return true result. |
| 125 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 126 | int hwconfig_f(const char *opt, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 127 | { |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 128 | return !!__hwconfig(opt, NULL, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 132 | * hwconfig_arg_f - get hwconfig option's argument |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 133 | * @opt: a string representing an option |
| 134 | * @arglen: a pointer to an allocated size_t variable |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 135 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 136 | * |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 137 | * Unlike hwconfig_f() function, this function returns a pointer to the |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 138 | * start of the hwconfig arguments, if option is not found or it has |
| 139 | * no specified arguments, the function returns NULL pointer. |
| 140 | * |
| 141 | * If CONFIG_HWCONFIG is undefined, the function returns "", and |
| 142 | * arglen is set to 0. |
| 143 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 144 | const char *hwconfig_arg_f(const char *opt, size_t *arglen, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 145 | { |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 146 | return __hwconfig(opt, arglen, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 150 | * hwconfig_arg_cmp_f - compare hwconfig option's argument |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 151 | * @opt: a string representing an option |
| 152 | * @arg: a string for comparing an option's argument |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 153 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 154 | * |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 155 | * This call is similar to hwconfig_arg_f, but instead of returning |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 156 | * hwconfig argument and its length, it is comparing it to @arg. |
| 157 | * |
| 158 | * Returns non-zero value if @arg matches, 0 otherwise. |
| 159 | * |
| 160 | * If CONFIG_HWCONFIG is undefined, the function returns a non-zero |
| 161 | * value, i.e. the argument matches. |
| 162 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 163 | int hwconfig_arg_cmp_f(const char *opt, const char *arg, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 164 | { |
| 165 | const char *argstr; |
| 166 | size_t arglen; |
| 167 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 168 | argstr = hwconfig_arg_f(opt, &arglen, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 169 | if (!argstr || arglen != strlen(arg)) |
| 170 | return 0; |
| 171 | |
| 172 | return !strncmp(argstr, arg, arglen); |
| 173 | } |
| 174 | |
| 175 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 176 | * hwconfig_sub_f - query if a particular hwconfig sub-option is specified |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 177 | * @opt: a string representing an option |
| 178 | * @subopt: a string representing a sub-option |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 179 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 180 | * |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 181 | * This call is similar to hwconfig_f(), except that it takes additional |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 182 | * argument @subopt. In this example: |
Wolfgang Denk | 62fb2b4 | 2021-09-27 17:42:39 +0200 | [diff] [blame] | 183 | * "dr_usb:mode=peripheral" |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 184 | * "dr_usb" is an option, "mode" is a sub-option, and "peripheral" is its |
| 185 | * argument. |
| 186 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 187 | int hwconfig_sub_f(const char *opt, const char *subopt, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 188 | { |
| 189 | size_t arglen; |
| 190 | const char *arg; |
| 191 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 192 | arg = __hwconfig(opt, &arglen, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 193 | if (!arg) |
| 194 | return 0; |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 195 | return !!hwconfig_parse(arg, arglen, subopt, ",;", '=', NULL); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 199 | * hwconfig_subarg_f - get hwconfig sub-option's argument |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 200 | * @opt: a string representing an option |
| 201 | * @subopt: a string representing a sub-option |
| 202 | * @subarglen: a pointer to an allocated size_t variable |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 203 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 204 | * |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 205 | * This call is similar to hwconfig_arg_f(), except that it takes an |
| 206 | * additional argument @subopt, and so works with sub-options. |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 207 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 208 | const char *hwconfig_subarg_f(const char *opt, const char *subopt, |
| 209 | size_t *subarglen, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 210 | { |
| 211 | size_t arglen; |
| 212 | const char *arg; |
| 213 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 214 | arg = __hwconfig(opt, &arglen, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 215 | if (!arg) |
| 216 | return NULL; |
Anton Vorontsov | fe98ce9 | 2010-06-18 15:08:12 +0400 | [diff] [blame] | 217 | return hwconfig_parse(arg, arglen, subopt, ",;", '=', subarglen); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | /* |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 221 | * hwconfig_arg_cmp_f - compare hwconfig sub-option's argument |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 222 | * @opt: a string representing an option |
| 223 | * @subopt: a string representing a sub-option |
| 224 | * @subarg: a string for comparing an sub-option's argument |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 225 | * @buf: if non-NULL use this buffer to parse, otherwise try env |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 226 | * |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 227 | * This call is similar to hwconfig_arg_cmp_f, except that it takes an |
| 228 | * additional argument @subopt, and so works with sub-options. |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 229 | */ |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 230 | int hwconfig_subarg_cmp_f(const char *opt, const char *subopt, |
| 231 | const char *subarg, char *buf) |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 232 | { |
| 233 | const char *argstr; |
| 234 | size_t arglen; |
| 235 | |
Kumar Gala | 7230160 | 2011-01-09 11:37:00 -0600 | [diff] [blame] | 236 | argstr = hwconfig_subarg_f(opt, subopt, &arglen, buf); |
Anton Vorontsov | a73904e | 2009-06-10 00:25:27 +0400 | [diff] [blame] | 237 | if (!argstr || arglen != strlen(subarg)) |
| 238 | return 0; |
| 239 | |
| 240 | return !strncmp(argstr, subarg, arglen); |
| 241 | } |
Anton Vorontsov | 7b96373 | 2010-06-18 15:08:27 +0400 | [diff] [blame] | 242 | |
| 243 | #ifdef HWCONFIG_TEST |
| 244 | int main() |
| 245 | { |
| 246 | const char *ret; |
| 247 | size_t len; |
| 248 | |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 249 | env_set("hwconfig", "key1:subkey1=value1,subkey2=value2;key2:value3;;;;" |
Anton Vorontsov | 7b96373 | 2010-06-18 15:08:27 +0400 | [diff] [blame] | 250 | "key3;:,:=;key4", 1); |
| 251 | |
| 252 | ret = hwconfig_arg("key1", &len); |
| 253 | printf("%zd %.*s\n", len, (int)len, ret); |
| 254 | assert(len == 29); |
| 255 | assert(hwconfig_arg_cmp("key1", "subkey1=value1,subkey2=value2")); |
| 256 | assert(!strncmp(ret, "subkey1=value1,subkey2=value2", len)); |
| 257 | |
| 258 | ret = hwconfig_subarg("key1", "subkey1", &len); |
| 259 | printf("%zd %.*s\n", len, (int)len, ret); |
| 260 | assert(len == 6); |
| 261 | assert(hwconfig_subarg_cmp("key1", "subkey1", "value1")); |
| 262 | assert(!strncmp(ret, "value1", len)); |
| 263 | |
| 264 | ret = hwconfig_subarg("key1", "subkey2", &len); |
| 265 | printf("%zd %.*s\n", len, (int)len, ret); |
| 266 | assert(len == 6); |
| 267 | assert(hwconfig_subarg_cmp("key1", "subkey2", "value2")); |
| 268 | assert(!strncmp(ret, "value2", len)); |
| 269 | |
| 270 | ret = hwconfig_arg("key2", &len); |
| 271 | printf("%zd %.*s\n", len, (int)len, ret); |
| 272 | assert(len == 6); |
| 273 | assert(hwconfig_arg_cmp("key2", "value3")); |
| 274 | assert(!strncmp(ret, "value3", len)); |
| 275 | |
| 276 | assert(hwconfig("key3")); |
| 277 | assert(hwconfig_arg("key4", &len) == NULL); |
| 278 | assert(hwconfig_arg("bogus", &len) == NULL); |
| 279 | |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 280 | unenv_set("hwconfig"); |
Anton Vorontsov | 7b96373 | 2010-06-18 15:08:27 +0400 | [diff] [blame] | 281 | |
| 282 | assert(hwconfig(NULL) == 0); |
| 283 | assert(hwconfig("") == 0); |
| 284 | assert(hwconfig("key3") == 0); |
| 285 | |
| 286 | return 0; |
| 287 | } |
| 288 | #endif /* HWCONFIG_TEST */ |