[PATCH BlueZ 1/3] mesh: Delete unused function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This removes node_parse_composition() implementation as it is not used
anywhere in the rest of the code base.
---
 mesh/node.c | 131 ----------------------------------------------------
 mesh/node.h |   1 -
 2 files changed, 132 deletions(-)

diff --git a/mesh/node.c b/mesh/node.c
index 7b4ee0505..b8c30c30a 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -994,137 +994,6 @@ element_done:
 	return n;
 }
 
-
-#define MIN_COMPOSITION_LEN 16
-
-bool node_parse_composition(struct mesh_node *node, uint8_t *data,
-								uint16_t len)
-{
-	struct node_composition *comp;
-	uint16_t features;
-	uint8_t num_ele;
-	bool mode;
-
-	if (!len)
-		return false;
-
-	/* Skip page -- We only support Page Zero */
-	data++;
-	len--;
-
-	if (len < MIN_COMPOSITION_LEN)
-		return false;
-
-	comp = l_new(struct node_composition, 1);
-	if (!comp)
-		return false;
-
-	node->elements = l_queue_new();
-	if (!node->elements) {
-		l_free(comp);
-		return false;
-	}
-
-	node->comp = l_new(struct node_composition, 1);
-	comp->cid = l_get_le16(&data[0]);
-	comp->pid = l_get_le16(&data[2]);
-	comp->vid = l_get_le16(&data[4]);
-	comp->crpl = l_get_le16(&data[6]);
-	features = l_get_le16(&data[8]);
-	data += 10;
-	len -= 10;
-
-	mode = !!(features & FEATURE_PROXY);
-	node->proxy = mode ? MESH_MODE_DISABLED : MESH_MODE_UNSUPPORTED;
-
-	mode = !!(features & FEATURE_LPN);
-	node->lpn = mode ? MESH_MODE_DISABLED : MESH_MODE_UNSUPPORTED;
-
-	mode = !!(features & FEATURE_FRIEND);
-	node->friend = mode ? MESH_MODE_DISABLED : MESH_MODE_UNSUPPORTED;
-
-	mode = !!(features & FEATURE_RELAY);
-	node->relay.mode = mode ? MESH_MODE_DISABLED : MESH_MODE_UNSUPPORTED;
-
-	num_ele = 0;
-
-	do {
-		uint8_t m, v;
-		uint16_t mod_id;
-		uint16_t vendor_id;
-		struct node_element *ele;
-		struct mesh_model *mod;
-
-		ele = l_new(struct node_element, 1);
-		if (!ele)
-			return false;
-
-		ele->idx = num_ele;
-		ele->location = l_get_le16(data);
-		len -= 2;
-		data += 2;
-
-		m = *data++;
-		v = *data++;
-		len -= 2;
-
-		/* Parse SIG models */
-		while (len >= 2 && m--) {
-			mod_id = l_get_le16(data);
-			mod = mesh_model_new(ele->idx, mod_id);
-			if (!mod || !element_add_model(ele, mod)) {
-				mesh_model_free(mod);
-				element_free(ele);
-				goto fail;
-			}
-
-			data += 2;
-			len -= 2;
-		}
-
-		if (v && len < 4) {
-			element_free(ele);
-			goto fail;
-		}
-
-		/* Parse vendor models */
-		while (len >= 4 && v--) {
-			mod_id = l_get_le16(data + 2);
-			vendor_id = l_get_le16(data);
-			mod_id |= (vendor_id << 16);
-			mod = mesh_model_vendor_new(ele->idx, vendor_id,
-									mod_id);
-			if (!mod || !element_add_model(ele, mod)) {
-				mesh_model_free(mod);
-				element_free(ele);
-				goto fail;
-			}
-
-			data += 4;
-			len -= 4;
-		}
-
-		num_ele++;
-		l_queue_push_tail(node->elements, ele);
-
-	} while (len >= 6);
-
-	/* Check the consistency for the remote node */
-	if (node->num_ele > num_ele)
-		goto fail;
-
-	node->comp = comp;
-	node->num_ele = num_ele;
-
-	return true;
-
-fail:
-	l_queue_destroy(node->elements, element_free);
-	l_free(comp);
-
-	return false;
-}
-
 static void attach_io(void *a, void *b)
 {
 	struct mesh_node *node = a;
diff --git a/mesh/node.h b/mesh/node.h
index be57d5e67..7448756ae 100644
--- a/mesh/node.h
+++ b/mesh/node.h
@@ -50,7 +50,6 @@ void node_set_device_key(struct mesh_node *node, uint8_t key[16]);
 const uint8_t *node_get_device_key(struct mesh_node *node);
 void node_set_num_elements(struct mesh_node *node, uint8_t num_ele);
 uint8_t node_get_num_elements(struct mesh_node *node);
-bool node_parse_composition(struct mesh_node *node, uint8_t *buf, uint16_t len);
 bool node_add_binding(struct mesh_node *node, uint8_t ele_idx,
 			uint32_t model_id, uint16_t app_idx);
 bool node_del_binding(struct mesh_node *node, uint8_t ele_idx,
-- 
2.21.0




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux