Skip to content

Commit 43fff76

Browse files
l1kholtmann
authored andcommitted
Bluetooth: hci_bcm: Streamline runtime PM code
This driver seeks to force the Bluetooth device on for the duration of 5 seconds when the Bluetooth device has woken the host and after a complete packet has been received. It does that by calling: pm_runtime_get(); pm_runtime_mark_last_busy(); pm_runtime_put_autosuspend(); The same can be achieved more succinctly with: pm_request_resume(); That's because after runtime resuming the device, rpm_resume() invokes pm_runtime_mark_last_busy() followed by rpm_idle(), which will cause the device to be suspended after expiration of the autosuspend_delay. No functional change intended. Cc: Frédéric Danis <frederic.danis.oss@gmail.com> Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 27378f4 commit 43fff76

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/bluetooth/hci_bcm.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ static irqreturn_t bcm_host_wake(int irq, void *data)
191191

192192
bt_dev_dbg(bdev, "Host wake IRQ");
193193

194-
pm_runtime_get(bdev->dev);
195-
pm_runtime_mark_last_busy(bdev->dev);
196-
pm_runtime_put_autosuspend(bdev->dev);
194+
pm_request_resume(bdev->dev);
197195

198196
return IRQ_HANDLED;
199197
}
@@ -512,11 +510,8 @@ static int bcm_recv(struct hci_uart *hu, const void *data, int count)
512510
} else if (!bcm->rx_skb) {
513511
/* Delay auto-suspend when receiving completed packet */
514512
mutex_lock(&bcm_device_lock);
515-
if (bcm->dev && bcm_device_exists(bcm->dev)) {
516-
pm_runtime_get(bcm->dev->dev);
517-
pm_runtime_mark_last_busy(bcm->dev->dev);
518-
pm_runtime_put_autosuspend(bcm->dev->dev);
519-
}
513+
if (bcm->dev && bcm_device_exists(bcm->dev))
514+
pm_request_resume(bcm->dev->dev);
520515
mutex_unlock(&bcm_device_lock);
521516
}
522517

0 commit comments

Comments
 (0)