Skip to content
Permalink
Browse files

net: lwm2m: remove unused multi_max_count field from obj_field

The multi_max_count is no longer used and can be removed from the
obj_field structure if we change all of the OBJ_FIELD() macros to
use OBJ_FIELD_DATA() instead.

Technically, OBJ_FIELD() and OBJ_FIELD_DATA() are now the same, but
we're keeping them both for the time being.  In the future, more
fields may be added to the obj_field structure and we can use the
OBJ_FIELD() macro again if that's the case.

Signed-off-by: Michael Scott <mike@foundries.io>
  • Loading branch information...
mike-scott authored and jukkar committed Jul 29, 2019
1 parent ad01c03 commit 30f31fb4e17134d519147b9c8f7b7b0614569e51
@@ -92,15 +92,12 @@ static struct lwm2m_engine_obj_field fields[] = {
OBJ_FIELD_DATA(DEVICE_FIRMWARE_VERSION_ID, R_OPT, STRING),
OBJ_FIELD_EXECUTE_OPT(DEVICE_REBOOT_ID),
OBJ_FIELD_EXECUTE_OPT(DEVICE_FACTORY_DEFAULT_ID),
OBJ_FIELD(DEVICE_AVAILABLE_POWER_SOURCES_ID, R_OPT, U8,
DEVICE_PWRSRC_MAX),
OBJ_FIELD(DEVICE_POWER_SOURCE_VOLTAGE_ID, R_OPT, S32,
DEVICE_PWRSRC_MAX),
OBJ_FIELD(DEVICE_POWER_SOURCE_CURRENT_ID, R_OPT, S32,
DEVICE_PWRSRC_MAX),
OBJ_FIELD_DATA(DEVICE_AVAILABLE_POWER_SOURCES_ID, R_OPT, U8),
OBJ_FIELD_DATA(DEVICE_POWER_SOURCE_VOLTAGE_ID, R_OPT, S32),
OBJ_FIELD_DATA(DEVICE_POWER_SOURCE_CURRENT_ID, R_OPT, S32),
OBJ_FIELD_DATA(DEVICE_BATTERY_LEVEL_ID, R_OPT, U8),
OBJ_FIELD_DATA(DEVICE_MEMORY_FREE_ID, R_OPT, S32),
OBJ_FIELD(DEVICE_ERROR_CODE_ID, R, U8, DEVICE_ERROR_CODE_MAX),
OBJ_FIELD_DATA(DEVICE_ERROR_CODE_ID, R, U8),
OBJ_FIELD_EXECUTE_OPT(DEVICE_RESET_ERROR_CODE_ID),
OBJ_FIELD_DATA(DEVICE_CURRENT_TIME_ID, RW_OPT, TIME),
OBJ_FIELD_DATA(DEVICE_UTC_OFFSET_ID, RW_OPT, STRING),
@@ -111,7 +108,7 @@ static struct lwm2m_engine_obj_field fields[] = {
OBJ_FIELD_DATA(DEVICE_SOFTWARE_VERSION_ID, R_OPT, STRING),
OBJ_FIELD_DATA(DEVICE_BATTERY_STATUS_ID, R_OPT, U8),
OBJ_FIELD_DATA(DEVICE_MEMORY_TOTAL_ID, R_OPT, S32),
OBJ_FIELD(DEVICE_EXT_DEV_INFO_ID, R_OPT, S32, 0)
OBJ_FIELD_DATA(DEVICE_EXT_DEV_INFO_ID, R_OPT, S32)
};

static struct lwm2m_engine_obj_inst inst;
@@ -45,14 +45,14 @@ static char package_uri[PACKAGE_URI_LEN];
/* only 1 instance of firmware object exists */
static struct lwm2m_engine_obj firmware;
static struct lwm2m_engine_obj_field fields[] = {
OBJ_FIELD(FIRMWARE_PACKAGE_ID, W, OPAQUE, 0),
OBJ_FIELD(FIRMWARE_PACKAGE_URI_ID, RW, STRING, 0),
OBJ_FIELD_DATA(FIRMWARE_PACKAGE_ID, W, OPAQUE),
OBJ_FIELD_DATA(FIRMWARE_PACKAGE_URI_ID, RW, STRING),
OBJ_FIELD_EXECUTE(FIRMWARE_UPDATE_ID),
OBJ_FIELD_DATA(FIRMWARE_STATE_ID, R, U8),
OBJ_FIELD_DATA(FIRMWARE_UPDATE_RESULT_ID, R, U8),
OBJ_FIELD_DATA(FIRMWARE_PACKAGE_NAME_ID, R_OPT, STRING),
OBJ_FIELD_DATA(FIRMWARE_PACKAGE_VERSION_ID, R_OPT, STRING),
OBJ_FIELD(FIRMWARE_UPDATE_PROTO_SUPPORT_ID, R_OPT, U8, 0),
OBJ_FIELD_DATA(FIRMWARE_UPDATE_PROTO_SUPPORT_ID, R_OPT, U8),
OBJ_FIELD_DATA(FIRMWARE_UPDATE_DELIV_METHOD_ID, R, U8)
};

@@ -148,23 +148,25 @@ struct lwm2m_obj_path {
u8_t level; /* 0/1/2/3/4 (4 = resource instance) */
};

#define OBJ_FIELD(res_id, perm, type, multi_max) \
{ res_id, LWM2M_PERM_ ## perm, LWM2M_RES_TYPE_ ## type, multi_max }
#define OBJ_FIELD(_id, _perm, _type) \
{ .res_id = _id, \
.permissions = LWM2M_PERM_ ## _perm, \
.data_type = LWM2M_RES_TYPE_ ## _type, }

/* Keep OBJ_FIELD_DATA around for historical reasons */
#define OBJ_FIELD_DATA(res_id, perm, type) \
OBJ_FIELD(res_id, perm, type, 1)
OBJ_FIELD(res_id, perm, type)

#define OBJ_FIELD_EXECUTE(res_id) \
OBJ_FIELD(res_id, X, NONE, 0)
OBJ_FIELD(res_id, X, NONE)

#define OBJ_FIELD_EXECUTE_OPT(res_id) \
OBJ_FIELD(res_id, X_OPT, NONE, 0)
OBJ_FIELD(res_id, X_OPT, NONE)

struct lwm2m_engine_obj_field {
u16_t res_id;
u8_t permissions;
u8_t data_type;
u8_t multi_max_count;
};

typedef struct lwm2m_engine_obj_inst *

0 comments on commit 30f31fb

Please sign in to comment.
You can’t perform that action at this time.