Diff between 9a16b8bf7b4c19515d067485abb963447325a587 and 7ef54773240b901bbe8e331b74aca4312a960a62

Changed Files

File Additions Deletions Status
monitor/att.c +18 -17 modified

Full Patch

diff --git a/monitor/att.c b/monitor/att.c
index ea47312..eb73934 100644
--- a/monitor/att.c
+++ b/monitor/att.c
@@ -1712,7 +1712,7 @@ static bool ase_release_cmd(const struct l2cap_frame *frame)
 	.func = _func, \
 }
 
-struct ase_cmd {
+static const struct ase_cmd {
 	const char *desc;
 	bool (*func)(const struct l2cap_frame *frame);
 } ase_cmd_table[] = {
@@ -1734,7 +1734,7 @@ struct ase_cmd {
 	ASE_CMD(0x08, "Release", ase_release_cmd),
 };
 
-static struct ase_cmd *ase_get_cmd(uint8_t op)
+static const struct ase_cmd *ase_get_cmd(uint8_t op)
 {
 	if (op > ARRAY_SIZE(ase_cmd_table))
 		return NULL;
@@ -1745,7 +1745,7 @@ static struct ase_cmd *ase_get_cmd(uint8_t op)
 static void print_ase_cmd(const struct l2cap_frame *frame)
 {
 	uint8_t op, num, i;
-	struct ase_cmd *cmd;
+	const struct ase_cmd *cmd;
 
 	if (!l2cap_frame_get_u8((void *)frame, &op)) {
 		print_text(COLOR_ERROR, "opcode: invalid size");
@@ -1913,7 +1913,7 @@ static bool print_ase_cp_rsp_reason(const struct l2cap_frame *frame)
 static void print_ase_cp_rsp(const struct l2cap_frame *frame)
 {
 	uint8_t op, num, i;
-	struct ase_cmd *cmd;
+	const struct ase_cmd *cmd;
 
 	if (!l2cap_frame_get_u8((void *)frame, &op)) {
 		print_text(COLOR_ERROR, "    opcode: invalid size");
@@ -2163,7 +2163,7 @@ static bool vcs_absolute_cmd(const struct l2cap_frame *frame)
 	.func = _func, \
 }
 
-struct vcs_cmd {
+static const struct vcs_cmd {
 	const char *desc;
 	bool (*func)(const struct l2cap_frame *frame);
 } vcs_cmd_table[] = {
@@ -2183,7 +2183,7 @@ struct vcs_cmd {
 	VCS_CMD(0x06, "Mute", vcs_config_cmd),
 };
 
-static struct vcs_cmd *vcs_get_cmd(uint8_t op)
+static const struct vcs_cmd *vcs_get_cmd(uint8_t op)
 {
 	if (op > ARRAY_SIZE(vcs_cmd_table))
 		return NULL;
@@ -2194,7 +2194,7 @@ static struct vcs_cmd *vcs_get_cmd(uint8_t op)
 static void print_vcs_cmd(const struct l2cap_frame *frame)
 {
 	uint8_t op;
-	struct vcs_cmd *cmd;
+	const struct vcs_cmd *cmd;
 
 	if (!l2cap_frame_get_u8((void *)frame, &op)) {
 		print_text(COLOR_ERROR, "opcode: invalid size");
@@ -3137,7 +3137,7 @@ static void bcast_audio_scan_cp_remove_src_cmd(const struct l2cap_frame *frame)
 	print_field("    Source_ID: %u", id);
 }
 
-struct bcast_audio_scan_cp_cmd {
+static const struct bcast_audio_scan_cp_cmd {
 	const char *desc;
 	void (*func)(const struct l2cap_frame *frame);
 } bcast_audio_scan_cp_cmd_table[] = {
@@ -3159,7 +3159,8 @@ struct bcast_audio_scan_cp_cmd {
 					bcast_audio_scan_cp_remove_src_cmd),
 };
 
-static struct bcast_audio_scan_cp_cmd *bcast_audio_scan_cp_get_cmd(uint8_t op)
+static const struct bcast_audio_scan_cp_cmd *
+bcast_audio_scan_cp_get_cmd(uint8_t op)
 {
 	if (op > ARRAY_SIZE(bcast_audio_scan_cp_cmd_table))
 		return NULL;
@@ -3170,7 +3171,7 @@ static struct bcast_audio_scan_cp_cmd *bcast_audio_scan_cp_get_cmd(uint8_t op)
 static void print_bcast_audio_scan_cp_cmd(const struct l2cap_frame *frame)
 {
 	uint8_t op;
-	struct bcast_audio_scan_cp_cmd *cmd;
+	const struct bcast_audio_scan_cp_cmd *cmd;
 
 	if (!l2cap_frame_get_u8((void *)frame, &op)) {
 		print_text(COLOR_ERROR, "Opcode: invalid size");
@@ -3342,7 +3343,7 @@ static void bgr_features_read(const struct l2cap_frame *frame)
 	.notify = _notify \
 }
 
-struct gatt_handler {
+static const struct gatt_handler {
 	bt_uuid_t uuid;
 	void (*read)(const struct l2cap_frame *frame);
 	void (*write)(const struct l2cap_frame *frame);
@@ -3394,7 +3395,7 @@ struct gatt_handler {
 	GMAS
 };
 
-static struct gatt_handler *get_handler_uuid(const bt_uuid_t *uuid)
+static const struct gatt_handler *get_handler_uuid(const bt_uuid_t *uuid)
 {
 	size_t i;
 
@@ -3402,7 +3403,7 @@ static struct gatt_handler *get_handler_uuid(const bt_uuid_t *uuid)
 		return NULL;
 
 	for (i = 0; i < ARRAY_SIZE(gatt_handlers); i++) {
-		struct gatt_handler *handler = &gatt_handlers[i];
+		const struct gatt_handler *handler = &gatt_handlers[i];
 
 		if (!bt_uuid_cmp(&handler->uuid, uuid))
 			return handler;
@@ -3411,7 +3412,7 @@ static struct gatt_handler *get_handler_uuid(const bt_uuid_t *uuid)
 	return NULL;
 }
 
-static struct gatt_handler *get_handler(struct gatt_db_attribute *attr)
+static const struct gatt_handler *get_handler(struct gatt_db_attribute *attr)
 {
 	return get_handler_uuid(gatt_db_attribute_get_type(attr));
 }
@@ -3582,7 +3583,7 @@ static void queue_read(const struct l2cap_frame *frame, bt_uuid_t *uuid,
 	struct att_conn_data *data;
 	struct att_read *read;
 	struct gatt_db_attribute *attr = NULL;
-	struct gatt_handler *handler;
+	const struct gatt_handler *handler;
 
 	if (handle) {
 		attr = get_attribute(frame, handle, false);
@@ -3763,7 +3764,7 @@ static void print_write(const struct l2cap_frame *frame, uint16_t handle,
 							size_t len)
 {
 	struct gatt_db_attribute *attr;
-	struct gatt_handler *handler;
+	const struct gatt_handler *handler;
 
 	print_handle(frame, handle, false);
 
@@ -3839,7 +3840,7 @@ static void print_notify(const struct l2cap_frame *frame, uint16_t handle,
 								size_t len)
 {
 	struct gatt_db_attribute *attr;
-	struct gatt_handler *handler;
+	const struct gatt_handler *handler;
 	struct l2cap_frame clone;
 
 	print_handle(frame, handle, true);