Skip to contentSkip to conversation

Bluetooth: btintel_pcie: avoid unguarded 64-bit division

PATCH In review Arnd Bergmann 3 participants 3 messages Jul 25, 2025 – Jul 26, 2025 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: btintel_pcie: avoid unguarded 64-bit division

From: Arnd Bergmann <[email protected]>

Directly dividing a 64-bit value is not allowed on 32-bit architectures in the kernel.

arm-linux-gnueabi/bin/arm-linux-gnueabi-ld: drivers/bluetooth/btintel_pcie.o: in function `btintel_pcie_suspend_late':
btintel_pcie.c:(.text+0x224): undefined reference to `__aeabi_ldivmod'

Since this is a ktime_t value and dividing by 1000 gives a microsecond number, just convert it into microseconds using the appropriate helper.

Fixes 33bb9b1ce6f6 ("Bluetooth: btintel_pcie: Add support for _suspend() / _resume()")
---
 drivers/bluetooth/btintel_pcie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bluetooth/btintel_pcie.c +2 -2
index 9792a49886ff..4dfd5365bb4e 100644
@@ -2607,7 +2607,7 @@ static int btintel_pcie_suspend_late(struct device *dev, pm_message_t mesg)
 	btintel_pcie_wr_sleep_cntrl(data, dxstate);
 	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
 				 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
-	delta = ktime_to_ns(ktime_get() - start) / 1000;
+	delta = ktime_to_us(ktime_get() - start);
 
 	if (err == 0) {
 		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt for D3 entry",
@@ -2651,7 +2651,7 @@ static int btintel_pcie_resume(struct device *dev)
 	btintel_pcie_wr_sleep_cntrl(data, BTINTEL_PCIE_STATE_D0);
 	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
 				 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
-	delta = ktime_to_ns(ktime_get() - start) / 1000;
+	delta = ktime_to_us(ktime_get() - start);
 
 	if (err == 0) {
 		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt for D0 entry",
Signature · 1 line
2.39.5
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=985878

---Test result---

Test Summary:

CheckPatch                    PENDING   0.42 seconds
GitLint                       PENDING   0.25 seconds
SubjectPrefix                 PASS      0.08 seconds
BuildKernel                   PASS      23.74 seconds
CheckAllWarning               PASS      26.41 seconds
CheckSparse                   PASS      29.88 seconds
BuildKernel32                 PASS      24.13 seconds
TestRunnerSetup               PASS      474.09 seconds
TestRunner_l2cap-tester       PASS      24.68 seconds
TestRunner_iso-tester         PASS      44.39 seconds
TestRunner_bnep-tester        PASS      5.90 seconds
TestRunner_mgmt-tester        FAIL      131.31 seconds
TestRunner_rfcomm-tester      PASS      9.35 seconds
TestRunner_sco-tester         PASS      14.81 seconds
TestRunner_ioctl-tester       PASS      10.09 seconds
TestRunner_mesh-tester        FAIL      13.65 seconds
TestRunner_smp-tester         PASS      8.61 seconds
TestRunner_userchan-tester    PASS      6.29 seconds
IncrementalBuild              PENDING   0.48 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 490, Passed: 485 (99.0%), Failed: 1, Not Run: 4

Failed Test Cases
LL Privacy - Start Discovery 2 (Disable RL) Failed 0.205 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0

Failed Test Cases

Mesh - Send cancel - 1                               Timed out    1.962 seconds
Mesh - Send cancel - 2                               Timed out    1.995 seconds

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Arnd Bergmann

Hi Arnd,

Thanks for the patch. I would like to amend this patch with - https://patchwork.kernel.org/project/bluetooth/patch/[email protected]/

I will include your name as part of Signed-off-by tag.

Quoted 54 lines

-----Original Message-----
From: Arnd Bergmann <[email protected]>
Sent: Friday, July 25, 2025 2:37 PM
To: Marcel Holtmann <[email protected]>; Luiz Augusto von Dentz <[email protected]>; Devegowda, Chandrashekar <[email protected]>; K, Kiran <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Vijay Satija <[email protected]>; Aluvala Sai Teja <[email protected]>; linux- [email protected]; [email protected]
Subject: [PATCH] Bluetooth: btintel_pcie: avoid unguarded 64-bit division

From: Arnd Bergmann <[email protected]>

Directly dividing a 64-bit value is not allowed on 32-bit architectures in the kernel.

arm-linux-gnueabi/bin/arm-linux-gnueabi-ld: drivers/bluetooth/btintel_pcie.o:
in function `btintel_pcie_suspend_late':
btintel_pcie.c:(.text+0x224): undefined reference to `__aeabi_ldivmod'

Since this is a ktime_t value and dividing by 1000 gives a microsecond number, just convert it into microseconds using the appropriate helper.

Fixes 33bb9b1ce6f6 ("Bluetooth: btintel_pcie: Add support for _suspend() /

_resume()")

---
drivers/bluetooth/btintel_pcie.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bluetooth/btintel_pcie.c +1 -1
index 9792a49886ff..4dfd5365bb4e 100644
@@ -2607,7 +2607,7 @@ static int btintel_pcie_suspend_late(struct device
 *dev, pm_message_t mesg)
 	btintel_pcie_wr_sleep_cntrl(data, dxstate);
 	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
 
 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
-	delta = ktime_to_ns(ktime_get() - start) / 1000;
+	delta = ktime_to_us(ktime_get() - start);
 
	if (err == 0) {
		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt
for D3 entry", @@ -2651,7 +2651,7 @@ static int btintel_pcie_resume(struct
device *dev)
	btintel_pcie_wr_sleep_cntrl(data, BTINTEL_PCIE_STATE_D0);
	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

drivers/bluetooth/btintel_pcie.c +1 -1
-	delta = ktime_to_ns(ktime_get() - start) / 1000;
+	delta = ktime_to_us(ktime_get() - start);
Quoted 5 lines
	if (err == 0) {
		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt

for D0 entry",
--
2.39.5

Thanks,
Kiran