Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Miles Krause via B4 Relay <devnull+mileskrause5200.gmail.com@kernel.org>
To: Marcel Holtmann <marcel@holtmann.org>,
	 Johan Hedberg <johan.hedberg@gmail.com>,
	 Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	 Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-bluetooth@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-mediatek@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	 Miles Krause <mileskrause5200@gmail.com>
Subject: [PATCH] Bluetooth: btmtk: use bool for first_block
Date: Fri, 10 Jul 2026 01:17:18 -0400	[thread overview]
Message-ID: <20260710-btmtk-first-block-bool-v1-1-e6ac61d918e4@gmail.com> (raw)

From: Miles Krause <mileskrause5200@gmail.com>

first_block is reset for each firmware section and is never used outside
the section loop. Declare it as a bool inside the loop to limit its scope
and make its two-state purpose explicit.

No functional change.

Signed-off-by: Miles Krause <mileskrause5200@gmail.com>
---
Compile-tested on x86_64 with:

  make O=out allmodconfig
  make O=out W=1 drivers/bluetooth/btmtk.o

Sparse-tested with:

  make O=out-sparse allmodconfig
  make O=out-sparse C=1 CHECK=sparse drivers/bluetooth/btmtk.o
---
 drivers/bluetooth/btmtk.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index 809762d64fc6..b809eb82fc73 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -63,7 +63,7 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
 	const u8 *fw_ptr;
 	const u8 *fw_bin_ptr;
 	int err, dlen, i, status;
-	u8 flag, first_block, retry;
+	u8 flag, retry;
 	u32 section_num, dl_size, section_offset;
 	u8 cmd[64];
 
@@ -79,7 +79,7 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
 	section_num = le32_to_cpu(globaldesc->section_num);
 
 	for (i = 0; i < section_num; i++) {
-		first_block = 1;
+		bool first_block = true;
 		fw_ptr = fw_bin_ptr;
 		sectionmap = (struct btmtk_section_map *)(fw_ptr + MTK_FW_ROM_PATCH_HEADER_SIZE +
 			      MTK_FW_ROM_PATCH_GD_SIZE + MTK_FW_ROM_PATCH_SEC_MAP_SIZE * i);
@@ -132,9 +132,9 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
 
 			while (dl_size > 0) {
 				dlen = min_t(int, 250, dl_size);
-				if (first_block == 1) {
+				if (first_block) {
 					flag = 1;
-					first_block = 0;
+					first_block = false;
 				} else if (dl_size - dlen <= 0) {
 					flag = 3;
 				} else {

---
base-commit: 64b5c4c8e79c131fe8f135bab5e5dfaa245c5776
change-id: 20260710-btmtk-first-block-bool-bd047b970821

Best regards,
--  
Miles Krause <mileskrause5200@gmail.com>




             reply	other threads:[~2026-07-10  5:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10  5:17 Miles Krause via B4 Relay [this message]
     [not found] <20260710-btmtk-first-block-bool-v1-1-3602688ec523@gmail.com>
2026-07-11  2:41 ` [PATCH] Bluetooth: btmtk: use bool for first_block Miles Krause

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=20260710-btmtk-first-block-bool-v1-1-e6ac61d918e4@gmail.com \
    --to=devnull+mileskrause5200.gmail.com@kernel.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mileskrause5200@gmail.com \
    /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