Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp176963ybk; Tue, 12 May 2020 19:21:27 -0700 (PDT) X-Google-Smtp-Source: APiQypJLIE4ZfY9X2+HhPFJkTm38SLtlcFWQjPxdkz1bap6F0l52O9IRQQHgzrXJPtYn25eAcL1m X-Received: by 2002:a50:e80a:: with SMTP id e10mr20473888edn.204.1589336487581; Tue, 12 May 2020 19:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589336487; cv=none; d=google.com; s=arc-20160816; b=v/6GBPvLekKIuF1jij2lQmtd8JUfbyzYvW6tZaqkvom/g25B+E1NII5vX2H0OKBGHK ZHRQ2ItMcle63BKtBgQ9KAxwJsNcg1Ty5lFKyMR/R02anYIn4FebmD4PsoOioYksKWXZ iQvoaPJdYAGBiJuHN2QOIf4TuGhzJQDOOG48+LILopjKE8zLUW7wPCweklrbS9hW0iBI 1fDBYWJK4Ck/KyOrNCjM7iXKAmTFIIEed3jXDD0SAkmSBQV9iXiNDzbcNQGQ0llUu4ov TBsBrB4YAuHCylW1dOhvVkk09N6RE7wZOBNxYPIUC8fXvq8Lm2pRb83S5XVRqNrGTM7U w6hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XY9o4PMaJYaO2R8EhFQqhMvaTSOOlIIvMuAUeMmeUOI=; b=TcVKVV1S+izIK6pJCXbRMDeDr2AcmQz6aFdvWFSBrZTy7luLRRvUvPvXlRy2MWHvmu fI3eJi97CK2/3Dwwcpyakj5g9yr1PRGOiuRQcJJeTrgZ36VOcEBpHwSwtju2Zvx74ZWz ViH+Is9740wG2PMaSrUfqDm538dzNLRxc7knPPUz1AyD/ueP2v/YXMhGTFclruXV9Le7 j+hx0iHlqiUHi6XPfnUFoTPslhbANQoA4xv4i03EV5xTKrJNyPL5+ryeCWlZuHcN0cZ7 sd0huwpeBBcR8LdoCvyxV9YvICt/nIgh4++Qlr7mP52cOLrNDdWJN6A0W1tSgUTex8lB Zr/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=C8Aco4ES; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y12si8522328edv.154.2020.05.12.19.21.03; Tue, 12 May 2020 19:21:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=C8Aco4ES; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728481AbgEMCTu (ORCPT + 99 others); Tue, 12 May 2020 22:19:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728534AbgEMCTg (ORCPT ); Tue, 12 May 2020 22:19:36 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A723C061A0E for ; Tue, 12 May 2020 19:19:36 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id t11so7088432pgg.2 for ; Tue, 12 May 2020 19:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XY9o4PMaJYaO2R8EhFQqhMvaTSOOlIIvMuAUeMmeUOI=; b=C8Aco4ESAdgnHiLfDM2byt4dDD+oa/T+cWmKnu8BQYbhBo6LRp9U1jMyyluLEMl2cJ sxeleYRnu1D4cNv6opkhro4gi0u/jMF3bwtdRz/kOMwIwaQEBeQVXNq25/YQTHF9VEAW jDUT22MkDElv7Dhtkr+wbPANacbcs1eITwizU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XY9o4PMaJYaO2R8EhFQqhMvaTSOOlIIvMuAUeMmeUOI=; b=cC+qSxg/YqK4DTEDJccSDXCP5aJzpBt63UdrDb8+8+cfsKJjVJXGHsE5osRbf2xuGt uWxTujXWgkoFsqavM04smO/28FPDqRpHKZH9lHIYZv5ZnyewzrEDON+aV6NKxNIVxa7g V3uQwg4iP318wG4j3SoaNKUPuwtzgoD0/V7epqKmvduV08gNc1EqNjuxqwr7rZ3zS+NT lVDP2iWnd6/podRnN1ijOTbPIJ6QFSLy5PUrvOAJjVcF9tpcCyl/OifksQ+IsUsnQNDB Db6ePxY/I3XRTLWkZxdk5uxgiFmbGUJLjhL0xAl/k1VvUramzZhEor801C2EeLP+cNz0 UDyg== X-Gm-Message-State: AGi0PuYReYmYletYm9HrEmsBF1TVNKvPIoGpVLD8xsmhihDzoLmOgU1k ifnjeyU6V3YakbuTndBNcjDedQ== X-Received: by 2002:a63:d60a:: with SMTP id q10mr22951807pgg.37.1589336375736; Tue, 12 May 2020 19:19:35 -0700 (PDT) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:e09a:8d06:a338:aafb]) by smtp.gmail.com with ESMTPSA id w2sm14170600pja.53.2020.05.12.19.19.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2020 19:19:35 -0700 (PDT) From: Abhishek Pandit-Subedi To: marcel@holtmann.org, linux-bluetooth@vger.kernel.org Cc: chromeos-bluetooth-upstreaming@chromium.org, Abhishek Pandit-Subedi , Alain Michaud , Johan Hedberg , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] Bluetooth: btusb: Implement hdev->prevent_wake Date: Tue, 12 May 2020 19:19:27 -0700 Message-Id: <20200512191838.3.Ic08447a6d2fa9668ae0f2f485db5c3c5d1bee39e@changeid> X-Mailer: git-send-email 2.26.2.645.ge9eca65c58-goog In-Reply-To: <20200513021927.115700-1-abhishekpandit@chromium.org> References: <20200513021927.115700-1-abhishekpandit@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Implement the prevent_wake hook by checking device_may_wakeup on the usb interface. This prevents the Bluetooth core from enabling scanning when the device isn't expected to wake from suspend. Signed-off-by: Abhishek Pandit-Subedi Reviewed-by: Alain Michaud --- drivers/bluetooth/btusb.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 8ae3ad7a60131..c17359c0e3201 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -3698,6 +3698,13 @@ static void btusb_check_needs_reset_resume(struct usb_interface *intf) interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME; } +static bool btusb_prevent_wake(struct hci_dev *hdev) +{ + struct btusb_data *data = hci_get_drvdata(hdev); + + return !device_may_wakeup(&data->udev->dev); +} + static int btusb_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -3831,6 +3838,7 @@ static int btusb_probe(struct usb_interface *intf, hdev->flush = btusb_flush; hdev->send = btusb_send_frame; hdev->notify = btusb_notify; + hdev->prevent_wake = btusb_prevent_wake; #ifdef CONFIG_PM err = btusb_config_oob_wake(hdev); -- 2.26.2.645.ge9eca65c58-goog