Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bluetooth: MGMT: convert timeouts to secs_to_jiffies()

Commit b35108a51cf7 ("jiffies: Define secs_to_jiffies()") introduced
secs_to_jiffies(). As the value here is a multiple of 1000, use
secs_to_jiffies() instead of msecs_to_jiffies to avoid the multiplication.

This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with
the following Coccinelle rules:

@depends on patch@
expression E;
@@

-msecs_to_jiffies(E * 1000)
+secs_to_jiffies(E)

-msecs_to_jiffies(E * MSEC_PER_SEC)
+secs_to_jiffies(E)

Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Easwar Hariharan and committed by
Luiz Augusto von Dentz
e3e627e6 a9d5131e

+4 -4
+1 -1
net/bluetooth/hci_sync.c
··· 1910 1910 hdev->adv_instance_timeout = timeout; 1911 1911 queue_delayed_work(hdev->req_workqueue, 1912 1912 &hdev->adv_instance_expire, 1913 - msecs_to_jiffies(timeout * 1000)); 1913 + secs_to_jiffies(timeout)); 1914 1914 } 1915 1915 1916 1916 /* If we're just re-scheduling the same instance again then do not
+3 -3
net/bluetooth/mgmt.c
··· 1533 1533 1534 1534 if (hci_dev_test_flag(hdev, HCI_DISCOVERABLE) && 1535 1535 hdev->discov_timeout > 0) { 1536 - int to = msecs_to_jiffies(hdev->discov_timeout * 1000); 1536 + int to = secs_to_jiffies(hdev->discov_timeout); 1537 1537 queue_delayed_work(hdev->req_workqueue, &hdev->discov_off, to); 1538 1538 } 1539 1539 ··· 1641 1641 hdev->discov_timeout = timeout; 1642 1642 1643 1643 if (cp->val && hdev->discov_timeout > 0) { 1644 - int to = msecs_to_jiffies(hdev->discov_timeout * 1000); 1644 + int to = secs_to_jiffies(hdev->discov_timeout); 1645 1645 queue_delayed_work(hdev->req_workqueue, 1646 1646 &hdev->discov_off, to); 1647 1647 } ··· 2534 2534 skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cp->opcode), 2535 2535 le16_to_cpu(cp->params_len), cp->params, 2536 2536 cp->event, cp->timeout ? 2537 - msecs_to_jiffies(cp->timeout * 1000) : 2537 + secs_to_jiffies(cp->timeout) : 2538 2538 HCI_CMD_TIMEOUT); 2539 2539 if (IS_ERR(skb)) { 2540 2540 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_HCI_CMD_SYNC,