linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v2 2/3] util: Make debugger arg of util_debug_ltv const
Date: Tue, 28 Nov 2023 10:28:31 -0500	[thread overview]
Message-ID: <20231128152832.1730901-2-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20231128152832.1730901-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This makes the debugger argument of util_debug_ltv const as they are not
suppose to change during its call.
---
 src/shared/bap-debug.c |  6 +++---
 src/shared/util.c      | 10 +++++-----
 src/shared/util.h      |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/shared/bap-debug.c b/src/shared/bap-debug.c
index 62bcde969377..495a22c44126 100644
--- a/src/shared/bap-debug.c
+++ b/src/shared/bap-debug.c
@@ -184,7 +184,7 @@ done:
 					user_data);
 }
 
-struct util_ltv_debugger pac_cap_table[] = {
+static const struct util_ltv_debugger pac_cap_table[] = {
 	UTIL_LTV_DEBUG(0x01, pac_debug_freq),
 	UTIL_LTV_DEBUG(0x02, pac_debug_duration),
 	UTIL_LTV_DEBUG(0x03, pac_debug_channels),
@@ -413,7 +413,7 @@ done:
 				user_data);
 }
 
-struct util_ltv_debugger ase_cc_table[] = {
+static const struct util_ltv_debugger ase_cc_table[] = {
 	UTIL_LTV_DEBUG(0x01, ase_debug_freq),
 	UTIL_LTV_DEBUG(0x02, ase_debug_duration),
 	UTIL_LTV_DEBUG(0x03, ase_debug_location),
@@ -527,7 +527,7 @@ done:
 				user_data);
 }
 
-struct util_ltv_debugger ase_metadata_table[] = {
+static const struct util_ltv_debugger ase_metadata_table[] = {
 	UTIL_LTV_DEBUG(0x01, ase_debug_preferred_context),
 	UTIL_LTV_DEBUG(0x02, ase_debug_context),
 	UTIL_LTV_DEBUG(0x03, ase_debug_program_info),
diff --git a/src/shared/util.c b/src/shared/util.c
index cebb02cc3ee4..34491f4e5a56 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -157,8 +157,8 @@ uint64_t util_debug_bit(const char *label, uint64_t val,
 	return mask;
 }
 
-static struct util_ltv_debugger*
-ltv_debugger(struct util_ltv_debugger *debugger, size_t num, uint8_t type)
+static const struct util_ltv_debugger*
+ltv_debugger(const struct util_ltv_debugger *debugger, size_t num, uint8_t type)
 {
 	size_t i;
 
@@ -166,7 +166,7 @@ ltv_debugger(struct util_ltv_debugger *debugger, size_t num, uint8_t type)
 		return NULL;
 
 	for (i = 0; i < num; i++) {
-		struct util_ltv_debugger *debug = &debugger[i];
+		const struct util_ltv_debugger *debug = &debugger[i];
 
 		if (debug->type == type)
 			return debug;
@@ -177,7 +177,7 @@ ltv_debugger(struct util_ltv_debugger *debugger, size_t num, uint8_t type)
 
 /* Helper to print debug information of LTV entries */
 bool util_debug_ltv(const uint8_t *data, uint8_t len,
-			struct util_ltv_debugger *debugger, size_t num,
+			const struct util_ltv_debugger *debugger, size_t num,
 			util_debug_func_t function, void *user_data)
 {
 	struct iovec iov;
@@ -188,7 +188,7 @@ bool util_debug_ltv(const uint8_t *data, uint8_t len,
 
 	for (i = 0; iov.iov_len; i++) {
 		uint8_t l, t, *v;
-		struct util_ltv_debugger *debug;
+		const struct util_ltv_debugger *debug;
 
 		if (!util_iov_pull_u8(&iov, &l)) {
 			util_debug(function, user_data,
diff --git a/src/shared/util.h b/src/shared/util.h
index 44205d7d35d5..6698d00415de 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -135,7 +135,7 @@ struct util_ltv_debugger {
 };
 
 bool util_debug_ltv(const uint8_t *data, uint8_t len,
-			struct util_ltv_debugger *debugger, size_t num,
+			const struct util_ltv_debugger *debugger, size_t num,
 			util_debug_func_t function, void *user_data);
 
 unsigned char util_get_dt(const char *parent, const char *name);
-- 
2.43.0


  reply	other threads:[~2023-11-28 15:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 15:28 [PATCH BlueZ v2 1/3] iso-tester: Add tests for GMAP broadcast QoS presets Luiz Augusto von Dentz
2023-11-28 15:28 ` Luiz Augusto von Dentz [this message]
2023-11-28 15:28 ` [PATCH BlueZ v2 3/3] monitor: Add proper decoding of TLV for BASE Luiz Augusto von Dentz
2023-11-28 16:43 ` [BlueZ,v2,1/3] iso-tester: Add tests for GMAP broadcast QoS presets bluez.test.bot
2023-11-28 17:40 ` [PATCH BlueZ v2 1/3] " patchwork-bot+bluetooth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231128152832.1730901-2-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).