No need for using a void pointer here. Add const qualifier to passed mesh_prov_node_info. --- mesh/manager.c | 2 +- mesh/mesh.c | 2 +- mesh/node.c | 9 +++++---- mesh/node.h | 4 +++- mesh/provision.h | 4 ++-- mesh/remprv-server.c | 2 +- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/mesh/manager.c b/mesh/manager.c index 63551b4ee4c7..3786f7a8f4cd 100644 --- a/mesh/manager.c +++ b/mesh/manager.c @@ -177,7 +177,7 @@ static void send_add_failed(const char *owner, const char *path, } static bool add_cmplt(void *user_data, uint8_t status, - struct mesh_prov_node_info *info) + const struct mesh_prov_node_info *info) { struct prov_remote_data *pending = user_data; struct mesh_node *node = pending->node; diff --git a/mesh/mesh.c b/mesh/mesh.c index 50059adbed57..354aabaf388e 100644 --- a/mesh/mesh.c +++ b/mesh/mesh.c @@ -455,7 +455,7 @@ static void prov_join_complete_reply_cb(struct l_dbus_message *msg, } static bool prov_complete_cb(void *user_data, uint8_t status, - struct mesh_prov_node_info *info) + const struct mesh_prov_node_info *info) { struct l_dbus *dbus = dbus_get_bus(); struct l_dbus_message *msg; diff --git a/mesh/node.c b/mesh/node.c index a85814727d40..65161b7afb3d 100644 --- a/mesh/node.c +++ b/mesh/node.c @@ -1412,8 +1412,9 @@ static void save_pages(void *data, void *user_data) } static bool add_local_node(struct mesh_node *node, uint16_t unicast, bool kr, - bool ivu, uint32_t iv_idx, uint8_t dev_key[16], - uint16_t net_key_idx, uint8_t net_key[16]) + bool ivu, uint32_t iv_idx, + const uint8_t dev_key[16], + uint16_t net_key_idx, const uint8_t net_key[16]) { if (!nodes) nodes = l_queue_new(); @@ -2493,9 +2494,9 @@ const char *node_get_element_path(struct mesh_node *node, uint8_t ele_idx) return ele->path; } -bool node_add_pending_local(struct mesh_node *node, void *prov_node_info) +bool node_add_pending_local(struct mesh_node *node, + const struct mesh_prov_node_info *info) { - struct mesh_prov_node_info *info = prov_node_info; bool kr = !!(info->flags & PROV_FLAG_KR); bool ivu = !!(info->flags & PROV_FLAG_IVU); diff --git a/mesh/node.h b/mesh/node.h index 4f31c5056dfd..cba51cb93bbb 100644 --- a/mesh/node.h +++ b/mesh/node.h @@ -14,6 +14,7 @@ struct mesh_io; struct mesh_agent; struct mesh_config; struct mesh_config_node; +struct mesh_prov_node_info; typedef void (*node_ready_func_t) (void *user_data, int status, struct mesh_node *node); @@ -71,7 +72,8 @@ uint8_t node_friend_mode_get(struct mesh_node *node); const char *node_get_element_path(struct mesh_node *node, uint8_t ele_idx); const char *node_get_owner(struct mesh_node *node); const char *node_get_app_path(struct mesh_node *node); -bool node_add_pending_local(struct mesh_node *node, void *info); +bool node_add_pending_local(struct mesh_node *node, + const struct mesh_prov_node_info *info); void node_attach_io_all(struct mesh_io *io); void node_attach_io(struct mesh_node *node, struct mesh_io *io); void node_attach(const char *app_root, const char *sender, uint64_t token, diff --git a/mesh/provision.h b/mesh/provision.h index cfeb6debab53..3982c8703882 100644 --- a/mesh/provision.h +++ b/mesh/provision.h @@ -91,7 +91,7 @@ struct mesh_prov_node_info { typedef bool (*mesh_prov_acceptor_complete_func_t)(void *user_data, uint8_t status, - struct mesh_prov_node_info *info); + const struct mesh_prov_node_info *info); typedef void (*mesh_prov_initiator_start_func_t)(void *user_data, int err); @@ -100,7 +100,7 @@ typedef bool (*mesh_prov_initiator_data_req_func_t)(void *user_data, typedef bool (*mesh_prov_initiator_complete_func_t)(void *user_data, uint8_t status, - struct mesh_prov_node_info *info); + const struct mesh_prov_node_info *info); typedef void (*mesh_prov_initiator_scan_result_t)(void *user_data, uint16_t server, bool extended, diff --git a/mesh/remprv-server.c b/mesh/remprv-server.c index 53c764f8626a..20a3da343b26 100644 --- a/mesh/remprv-server.c +++ b/mesh/remprv-server.c @@ -514,7 +514,7 @@ bool register_nppi_acceptor(mesh_prov_open_func_t open_cb, } static bool nppi_cmplt(void *user_data, uint8_t status, - struct mesh_prov_node_info *info) + const struct mesh_prov_node_info *info) { struct rem_prov_data *prov = user_data; -- 2.43.0