5252#define PROXY_BUF_LEN_MAX 30
5353
5454#if defined(CONFIG_BT_MESH_PB_GATT )
55- #define PROXY_MSG_FIRST_BUF_LEN PB_GATT_BUF_LEN_MAX
55+ #define PROXY_MSG_BUF_LEN PB_GATT_BUF_LEN_MAX
5656#else
57- #define PROXY_MSG_FIRST_BUF_LEN PROXY_BUF_LEN_MAX
57+ #define PROXY_MSG_BUF_LEN PROXY_BUF_LEN_MAX
5858#endif
5959
60- static uint8_t __noinit bufs [PROXY_MSG_FIRST_BUF_LEN +
61- ((CONFIG_BT_MAX_CONN - 1 ) * PROXY_BUF_LEN_MAX )];
60+ static uint8_t __noinit bufs [CONFIG_BT_MAX_CONN * PROXY_MSG_BUF_LEN ];
6261
6362static struct bt_mesh_proxy_role roles [CONFIG_BT_MAX_CONN ];
6463
@@ -194,9 +193,6 @@ int bt_mesh_proxy_msg_send(struct bt_mesh_proxy_role *role, uint8_t type,
194193
195194static void proxy_msg_init (struct bt_mesh_proxy_role * role )
196195{
197- uint8_t i , len ;
198- uint8_t * buf ;
199-
200196 /* Check if buf has been allocated, in this way, we no longer need
201197 * to repeat the operation.
202198 */
@@ -205,16 +201,9 @@ static void proxy_msg_init(struct bt_mesh_proxy_role *role)
205201 return ;
206202 }
207203
208- i = bt_conn_index (role -> conn );
209- if (!i ) {
210- len = PROXY_MSG_FIRST_BUF_LEN ;
211- buf = bufs ;
212- } else {
213- len = PROXY_BUF_LEN_MAX ;
214- buf = & bufs [PROXY_MSG_FIRST_BUF_LEN + (PROXY_BUF_LEN_MAX * (i - 1 ))];
215- }
216-
217- net_buf_simple_init_with_data (& role -> buf , buf , len );
204+ net_buf_simple_init_with_data (& role -> buf ,
205+ & bufs [bt_conn_index (role -> conn ) * PROXY_MSG_BUF_LEN ],
206+ PROXY_MSG_BUF_LEN );
218207
219208 net_buf_simple_reset (& role -> buf );
220209
0 commit comments