summaryrefslogtreecommitdiff
path: root/mesh/model.c
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2019-12-06 12:57:48 -0800
committerBrian Gix <brian.gix@intel.com>2019-12-10 09:57:11 -0800
commite289b30b58e0366beb33bd9a2972fa7a28318634 (patch)
tree03efecdf2df679ff442141e283138940b81f773b /mesh/model.c
parent3ee0672f52a0dd5549b815f54f8fb0b78059767e (diff)
downloadbluez-e289b30b58e0366beb33bd9a2972fa7a28318634.tar.gz
mesh: Clean up node.c
This change makes the node initialization a bit easier to follow. Replace if-else with switch when processing request type, descriptive function names, more predictable code flow.
Diffstat (limited to 'mesh/model.c')
-rw-r--r--mesh/model.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/mesh/model.c b/mesh/model.c
index 4091881ec..acdd94f7b 100644
--- a/mesh/model.c
+++ b/mesh/model.c
@@ -1249,7 +1249,7 @@ void mesh_model_free(void *data)
l_free(mod);
}
-static struct mesh_model *model_new(uint8_t ele_idx, uint32_t id)
+struct mesh_model *mesh_model_new(uint8_t ele_idx, uint32_t id)
{
struct mesh_model *mod = l_new(struct mesh_model, 1);
@@ -1259,19 +1259,6 @@ static struct mesh_model *model_new(uint8_t ele_idx, uint32_t id)
return mod;
}
-struct mesh_model *mesh_model_new(uint8_t ele_idx, uint16_t id)
-{
- return model_new(ele_idx, id | VENDOR_ID_MASK);
-}
-
-struct mesh_model *mesh_model_vendor_new(uint8_t ele_idx, uint16_t vendor_id,
- uint16_t mod_id)
-{
- uint32_t id = mod_id | (vendor_id << 16);
-
- return model_new(ele_idx, id);
-}
-
/* Internal models only */
static void restore_model_state(struct mesh_model *mod)
{
@@ -1600,7 +1587,7 @@ struct mesh_model *mesh_model_setup(struct mesh_node *node, uint8_t ele_idx,
return NULL;
}
- mod = model_new(ele_idx, db_mod->vendor ? db_mod->id :
+ mod = mesh_model_new(ele_idx, db_mod->vendor ? db_mod->id :
db_mod->id | VENDOR_ID_MASK);
/* Implicitly bind config server model to device key */