Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2939792rwb; Mon, 15 Aug 2022 14:28:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Wm6K6spcN5o+5ERPMNSvVaC2BYyKLZpHK5QoeClwDyUcnUfyWec4H5fmVei0S+LJneuCF X-Received: by 2002:a05:6402:40c3:b0:442:d798:48ad with SMTP id z3-20020a05640240c300b00442d79848admr16164987edb.154.1660598931408; Mon, 15 Aug 2022 14:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598931; cv=none; d=google.com; s=arc-20160816; b=H9vteIoPjpETSjxbq3GVJ8rN0Jx4XrpK0EiQTqlGxVeqblYDNo4LOOyXCCecqKgraP LohBdcIvudXtIkiHikpB657M+OP11mvJq6HGEzytngBw0IhQPuiJ/yRxvxQPBkyfsPs3 155PtK+AGRWc7/giL6OoQ0IKVkSr9aDQNuKq9XSGkSKHsoM6bwWAIWtpz0xLsirrgXnz uyITDAhkf9mnpGruzJcjLFLF/gTnAGZ4zGoEbLA5rx8NnIFe9y6sxYlWCteOHQtk9gsL tjv3AzgUUTmTR5n/aPJxy/eFOvwAS144KgK372C7dYMs92Bd3zMiP3Ck+G3A0eIwV6wI FwCQ== 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=Aba6OJAJu+HmbL+CpqsKn3vrzCpijv0Se2vJR18Tp5+VN4SS7PruIdSBhTVtG7Jpm2 KSfW1Nat3ueA/qrrf9CxqdhN5GBTqkO+61cdrh9OxgN2r9vUozfo/IDGm9kaYi/tkbah W+msXcdTm3h9MLPfwYHmD6WlsC73XuVRWimRj9YsJQntDA8VZij8Yrp8+b1zhzSoeko8 Az88sPZ1WhP5RohK4Cl1xfgZjbGkCCRZz99Ui20W+VDJg9pAghEysGOpA7q+PRJtSNdh IoqiwRQ8IsixPGX0B/cCfVL73M25zi/qcaZ+FFzyC/s7xN3MKPx3PdwF0bUnRFS05M3R 0R2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i8WcICYC; 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 w2-20020a1709061f0200b0072f4b12916fsi7187448ejj.395.2022.08.15.14.27.57; Mon, 15 Aug 2022 14:28:51 -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=i8WcICYC; 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 S1346259AbiHOVYZ (ORCPT + 99 others); Mon, 15 Aug 2022 17:24:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345934AbiHOVSA (ORCPT ); Mon, 15 Aug 2022 17:18:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AEEA59273; Mon, 15 Aug 2022 12:21:15 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 27DDA60EF0; Mon, 15 Aug 2022 19:21:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16797C433D6; Mon, 15 Aug 2022 19:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591274; bh=rrQeGSVgnu2T3cpBdnktpWmYUw4Kt7wbOPiN/PrBLLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i8WcICYCRchjkgS7aY0V+hvl4ikBnqakFd3aYQjtHnHYp1NLjxLeh03j5CSDJ2W/8 Y1zJ2VpshAKyV9NpAv69JCxxzIMW61WoixRHSkfz5CfgWeipvqC+/YI/3WHIAA0YZ9 E+LWXYNYZsPiYKoPp8BUVKNtXgB8KVlGorvssK3k= 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.18 0500/1095] Bluetooth: Add default wakeup callback for HCI UART driver Date: Mon, 15 Aug 2022 19:58:19 +0200 Message-Id: <20220815180450.218033541@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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