Browse Source

qcacmn: Add API to check the value is in range of bool type

Since there is user case to check the input value is in range of bool
type, add API to support it.

Change-Id: I03b225210768506e53ca60a0dd71af58e4f142a9
CRs-Fixed: 2350740
Wu Gao 6 years ago
parent
commit
e416a99c8a
2 changed files with 3 additions and 1 deletions
  1. 1 1
      cfg/inc/cfg_define.h
  2. 2 0
      cfg/inc/cfg_ucfg_api.h

+ 1 - 1
cfg/inc/cfg_define.h

@@ -58,7 +58,7 @@ enum cfg_fallback_behavior {
 #define CFG_INI_UINT(name, min, max, def, fallback, desc) \
 	(INI, UINT, uint32_t, name, min, max, fallback, desc, def)
 #define CFG_INI_BOOL(name, def, desc) \
-	(INI, BOOL, bool, name, -1, -1, -1, desc, def)
+	(INI, BOOL, bool, name, false, true, -1, desc, def)
 #define CFG_INI_STRING(name, min_len, max_len, def, desc) \
 	(INI, STRING, char *, name, min_len, max_len, -1, desc, def)
 #define CFG_INI_MAC(name, def, desc) \

+ 2 - 0
cfg/inc/cfg_ucfg_api.h

@@ -240,6 +240,8 @@ cfg_string_in_range(const char *value, qdf_size_t min_len, qdf_size_t max_len)
 #define __cfg_UINT_in_range(value, min, max) (value >= min && value <= max)
 #define __cfg_STRING_in_range(value, min_len, max_len) \
 	cfg_string_in_range(value, min_len, max_len)
+#define __cfg_BOOL_in_range(value, min, max) \
+	((value == min) || (value == max))
 
 #define __cfg_in_range(id, value, mtype) \
 	__cfg_ ## mtype ## _in_range(value, cfg_min(id), cfg_max(id))