Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3088533rwb; Mon, 15 Aug 2022 17:50:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR45SWP4e5PIJmOZiYDU4jAte78DQakPx1sESQaUWgO6Mg2GsJIqO6zi1yVGF2PDaBxEf49b X-Received: by 2002:a17:907:969f:b0:730:b649:ff90 with SMTP id hd31-20020a170907969f00b00730b649ff90mr11982343ejc.337.1660611055258; Mon, 15 Aug 2022 17:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611055; cv=none; d=google.com; s=arc-20160816; b=q28K78KYd7HlquWwwnXCWWn06Gn8rnAo+KIZWbFuRDgC4bistzPaztgcpOKUL0v7s/ wDFDbOKz5pUkT8UDFgKqCXHDIYtAzBp4EurRFNIBXWrqGotZDRcTexhvEZy7MOFZdfjV 4Ajhv5MKRaWuDOKL3ITE89KnrOpuo+iVnMacr31rdh8ZVox+BwPGSqc4NcvwjJ10QIg1 8/ldaAf99G2Mi15Dv0hyW4Alby4ErZyODHGpjuknEZI9Iv7aMCWPhfeaqeBq5Ws9E+lH 061KZeQ6qG/YdF0JGE6lOQ8PlexJBNnL5cjz3DzdZoPD8y2PsumrYo9vhJ6T6934SdGL 0HXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HHk17ZYfXKmzTdWet+apOmdJv6KRjcksnwdWohGLFdk=; b=GrJKB8oqMtvGgv/QVqtuYpqVN2VPxw2ntS4iz3hBOcA+27y4hmyTbY5pHjmfLEu2Hz l/1F3WZYm+mmOkjjqTyS6FmvYoBl4K1ff42vEAAT062UGeu8zoAUhit3ZwD1i9XekfC1 yE3sqcu1ptv16AvCek18VY5AkgV83pgG/i82H+cJRLq7W1xyQDrnCW03nYAVcn/5zXBp OoNU9WY/D8xfTpwolSV7GAV/2wTiJgT/Jg/sZ1GRjtay7NDQYY+Hl+Wrgjrkyk2mPi71 xbydaAhNVFb+KplWPLDeg7whKy/fSUgc8KMRUWITHY54yhoZwrnc4bjaTyZBKVObqEud 4K6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iiAekdqi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a17090699c300b00738466b687dsi4037770ejn.318.2022.08.15.17.50.28; Mon, 15 Aug 2022 17:50:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iiAekdqi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355710AbiHPABS (ORCPT + 99 others); Mon, 15 Aug 2022 20:01:18 -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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } +/* 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 = hci_uart_flush; hdev->send = hci_uart_send_frame; hdev->setup = hci_uart_setup; + if (!hdev->wakeup) + hdev->wakeup = hci_uart_wakeup; SET_HCIDEV_DEV(hdev, &hu->serdev->dev); if (test_bit(HCI_UART_NO_SUSPEND_NOTIFIER, &hu->flags)) -- 2.35.1