Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3929495rdh; Tue, 28 Nov 2023 07:28:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTyR7vQpces4IxU0rYyRDmWRYZlb/dXPtGPq5oAI60TLB45DNxpR7zSDBpUatyvzA//mFZ X-Received: by 2002:a05:620a:6087:b0:777:2aeb:7df5 with SMTP id dx7-20020a05620a608700b007772aeb7df5mr21387953qkb.3.1701185328753; Tue, 28 Nov 2023 07:28:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701185328; cv=none; d=google.com; s=arc-20160816; b=H2eIhRAUxprmgn0YVdhRMPwtNauw5BnYX0ycznPbcirMnHKgbeZ86bIhZvgajX22Mb qECxZTmHX2FvuzIkzK5h/Yja9Uz2ygRm0kDzIjfMhVZMHNs7C6Sy/IBFyfhdKVGGJ+cB tK72MXziTopXc+bzsIqARZHqWCFOgocSPo94rr5XV+TfdCdI/SR835GkPhU4rIB04PCu 0rVnPaw48j3ESITg3uBUnOIS3vuwijPJdA8OfeqajvzIJnOM15vTIIiMWAwu5HexLogW 8jD2nmFJh8NHqdgsf29eZERyoBkiwY1yPxKH7LhcWId0xpjXn71EwyiRYeHNHWmOpqS1 lUoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=9Zv7hq1AH16bnPc19IonLtbuxJzvavyDhkPsM0yiosw=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=nXwR5T97gd2srQi6L3bSSAaxyMirFgFnkwoCWxOdMex53O7vZrRCmn+46u9LjpJBFY dE0pAeo0x2qHuRM333aaBq1zQww7Su4hN6PfcEoFwhCeNqQM3RP/prj4W34oWlaz1Q6+ RKlAYWF+Qi+7c96QPKslKP99tEyjzcfhvOJCxctE4cXx6c2gAmqNyJgfPBRwSdhbE4SA tmI7m27tug25FmUgob8JX2AHlFK9tNzWlli9QGQBFm2pnPlVaa6fy2oyuYU8sHTKnngR qlj+g/Agvvf+WQYMhhGG2qHQ370kPJCNC0oNANhAfqUgpAwrOQkdzUXBdrMs+rgvtDQk hBeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DJ4T90Tr; spf=pass (google.com: domain of linux-bluetooth+bounces-268-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-268-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z27-20020a05620a261b00b0077d793155e0si10858035qko.492.2023.11.28.07.28.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 07:28:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-268-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DJ4T90Tr; spf=pass (google.com: domain of linux-bluetooth+bounces-268-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-268-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 765BD1C20E00 for ; Tue, 28 Nov 2023 15:28:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C0F95E0A8; Tue, 28 Nov 2023 15:28:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DJ4T90Tr" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 480E410CA for ; Tue, 28 Nov 2023 07:28:39 -0800 (PST) Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3b2ec9a79bdso3730851b6e.3 for ; Tue, 28 Nov 2023 07:28:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701185317; x=1701790117; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=9Zv7hq1AH16bnPc19IonLtbuxJzvavyDhkPsM0yiosw=; b=DJ4T90TrVtQvZiHAN3A1VMCeGhhnxTE8k844T0JRskywFbuROf+Oz3xVutWCIhXdzt TzDOaVRdCNLAeeBddySRXfoxpeEZoost8NbsRFxB8vaEvWpXbQ5fqI5MVJjEbN/wHc5u 6y6DhtxsbuAbW33bVA4mbQjMqUYPAOL460QxJjLyGVMWb1w4pNdsP8aYQ29Mpv8HjzOA /FAhSaly3pSPiI5w9YmJGGHGviu7a3lHSKa4mhGKOKWCqpqXb5sQzA8yNtTl8xGdBh4G 6QDI0XO8LnQHi2Yw/Sh0htBy+rDvO1wPUiBRhYZCm7MWAsVN64bdEjJTUVRzSHrHz+cg IbcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701185317; x=1701790117; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9Zv7hq1AH16bnPc19IonLtbuxJzvavyDhkPsM0yiosw=; b=sVB82TLOKLJ+zxT6Aa7/pVjuzq59R54p22uS/Ln64eB+1fchuHAUckLlL7pGC4x58/ XolkYOf3XWEqYhgLQzEJ6UUWiYNY2O/n6RpoyEd3aoKJoid+OVYjtxVmrnbwL1h8aDjK wwB3DQcnXbjYZLVFb8+EygAqBRiqFgyTV/mxBxrRCFoRpGNSNAmb9e2AG3+GJ93LgHov Ar7DDzHH40E7ZjuK6Tg1ewJPe/XrEcIRvaJZW+WF79EO5Nou9R2e1jyLFb75OE7WotXo g5itl1a9I3rg4N/T7+flq2tQ4FWi8W36Qs05b0OZV+StUCKUXgPw3gABhERfZwy5EDxR 8akg== X-Gm-Message-State: AOJu0Yx5myIyrXHKxjeUinxEWTBwixkjxdeUUDLuAr8bG0qvZHIGrW1m 2VEnsNp4YXZZtRQJ1QxL9e5NcdlvDV6vfg== X-Received: by 2002:a05:6358:291e:b0:16d:bc0b:836 with SMTP id y30-20020a056358291e00b0016dbc0b0836mr15681130rwb.19.1701185317153; Tue, 28 Nov 2023 07:28:37 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id bf9-20020a056130054900b0079a1018d185sm1660644uab.31.2023.11.28.07.28.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 07:28:35 -0800 (PST) From: Luiz Augusto von Dentz 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 Message-ID: <20231128152832.1730901-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231128152832.1730901-1-luiz.dentz@gmail.com> References: <20231128152832.1730901-1-luiz.dentz@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz 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