From nobody Mon Sep 29 21:22:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA726C28B2C for ; Tue, 16 Aug 2022 00:04:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355714AbiHPABT (ORCPT ); Mon, 15 Aug 2022 20:01:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356138AbiHOXxt (ORCPT ); Mon, 15 Aug 2022 19:53:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5921E15DFB8; Mon, 15 Aug 2022 13:18:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C80EEB81181; Mon, 15 Aug 2022 20:18:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21197C433D6; Mon, 15 Aug 2022 20:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594705; bh=rrQeGSVgnu2T3cpBdnktpWmYUw4Kt7wbOPiN/PrBLLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iiAekdqioJsN9giKbMfpp9yYY16U7A5Lt1fhw5v45B87G73kIn+wMUCx0aEhoE2MK 3Ssreyv56PphyDmc+8hWHVtPW48iNWn1fRGQQQnXXd7GEw0x6B6XxFIsZAeqVnP517 dZgEogwzg4/+X12rVv4m2cgLHM2oFnxCc7LsSlYM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ying Hsu , Alain Michaud , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.19 0532/1157] Bluetooth: Add default wakeup callback for HCI UART driver Date: Mon, 15 Aug 2022 19:58:08 +0200 Message-Id: <20220815180500.931122485@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ying Hsu [ Upstream commit bee5395ced44c5a312348557eb2dfb0c2a7bfaa2 ] Bluetooth HCI devices indicate if they are able to wakeup in the wakeup callback since 'commit 4539ca67fe8e ("Bluetooth: Rename driver .prevent_wake to .wakeup")'. This patch adds a default wakeup callback for Bluetooth HCI UAR devices. It assumes Bluetooth HCI UART devices are wakeable for backward compatibility. For those who need a customized behavior, one can override it before calling hci_uart_register_device(). Fixes: 4539ca67fe8e ("Bluetooth: Rename driver .prevent_wake to .wakeup") Signed-off-by: Ying Hsu Reviewed-by: Alain Michaud Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_serdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c index 4cda890ce647..c0e5f42ec6b7 100644 --- a/drivers/bluetooth/hci_serdev.c +++ b/drivers/bluetooth/hci_serdev.c @@ -231,6 +231,15 @@ static int hci_uart_setup(struct hci_dev *hdev) return 0; } =20 +/* Check if the device is wakeable */ +static bool hci_uart_wakeup(struct hci_dev *hdev) +{ + /* HCI UART devices are assumed to be wakeable by default. + * Implement wakeup callback to override this behavior. + */ + return true; +} + /** hci_uart_write_wakeup - transmit buffer wakeup * @serdev: serial device * @@ -342,6 +351,8 @@ int hci_uart_register_device(struct hci_uart *hu, hdev->flush =3D hci_uart_flush; hdev->send =3D hci_uart_send_frame; hdev->setup =3D hci_uart_setup; + if (!hdev->wakeup) + hdev->wakeup =3D hci_uart_wakeup; SET_HCIDEV_DEV(hdev, &hu->serdev->dev); =20 if (test_bit(HCI_UART_NO_SUSPEND_NOTIFIER, &hu->flags)) --=20 2.35.1