Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp415678pxk; Fri, 11 Sep 2020 10:15:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7JIzb++W3C0bGRUNvB335PhjAjvA/0/+uUiuDiQK3TV3ZdLPP4LCYr1NhWdRzmU9irLs8 X-Received: by 2002:aa7:d747:: with SMTP id a7mr3144759eds.304.1599844541483; Fri, 11 Sep 2020 10:15:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599844541; cv=none; d=google.com; s=arc-20160816; b=IZOUC2vhO/EgZsP2Rsw5gUq9VihWo4KxoGb1CLmt1/gRAgmALgKwxEl1ymx38AD1CU 7Xy+4abcxoshmx5OLKArG07XPYQNjTIr/ZCKQdVNiAAqz2yjTKK5FOvtiYJMMqwmoC/l t4+5iIR4Eb0yVoHV+GCDUCm7h+Aymdb3kizSbQj0a9f8rdNrqyhaS5w8Po5Ma5idmeeN HUTWbq91yW8bfF6olPeGkcmFD4DLzpJANvnhmiQpMRuZ/F6l7tcMO+V00bYLj2PTh9X7 8pnqwsmAkV97o6VKyeCa6e8hefj6PEMLma2Cm5DQLUoHm4/1/Pg4cq1TOvbWBydc3dRH Dk1A== 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=14bPozYieqfHUM2JtvGo8R2UBkHMLrvThIi182GvG+I=; b=S7UVWpPAKkbGaYh3XrcuDGBUwZhI8HmF5fC8bMxxaUl2hrTRCZH58VNpNI8niRGY6l l056ZRTErcxmLqlTLb03FXrZrEOZHPFFbemELQ6ytytA2S2RUa/CgGu88bv6PVE2oHMA +QcqHQ/H/Wj3TE2QTTSbFiaNzqQJfaEMbDIJerRMBP/jtMQd+a9Z9pKAe5oqyd+zLCfE B/anyXbzmjtfyEBeuXkGU1gnSu/eGRzQe4jt1/HdueqD9l/zN9sNSQ2mlkQ59M0XuwTF 2ek+OJ37ySz9VUETIbSVZugDlgIrbiELHVxXyqaJNeuLsphe5EWI5zx/8UWS9dwsoERx gR/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bZvtE3Qr; 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 u10si1594179ejx.142.2020.09.11.10.15.14; Fri, 11 Sep 2020 10:15:41 -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=bZvtE3Qr; 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 S1726194AbgIKRPF (ORCPT + 99 others); Fri, 11 Sep 2020 13:15:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725710AbgIKRNT (ORCPT ); Fri, 11 Sep 2020 13:13:19 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE6CCC06179A for ; Fri, 11 Sep 2020 10:13:13 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id b17so2003605pji.1 for ; Fri, 11 Sep 2020 10:13:13 -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=14bPozYieqfHUM2JtvGo8R2UBkHMLrvThIi182GvG+I=; b=bZvtE3QrEvm8CZ8XtYT0Y3OLqPKCw+nNi8kIGhMnpxuYkmxoyoqIipKuS9Eb/YR4H6 8/qdKimJJ9GnwRRgF0C64ME4K3+1hGiLEqHCg5uqkP0vF8bbt2r9VBiSKZejlhIgJfT0 /fQ7Wqe0XuM/zM1zWhY8w3Ju63GauXLQn34Vg= 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=14bPozYieqfHUM2JtvGo8R2UBkHMLrvThIi182GvG+I=; b=NYbUIj4YZQRbD/D+F4inqcMwfF4fKgPeuzrUTYvJKNi2zU9d4XDocm0371ZCNMskX0 Of/5dxEghk9vT8VKbMWXSacOBDWNHVpxVQN57EesiQlRTrUIBOqWze7lXhi7ABhKkBgC MdeY2g+ep/qJy7lKm8Xdw381yoiKPyOlqeuG547xtIpJnAjEjdAggYUwxsHXQFhYr16+ SgIGujA5cW4Cy9X7Gj7hhlOYxh5uyaajjI9iJkn5MkrZKTfnFIC1sqQSp+tbHNBYDkwl b42nNTjrfn33qzBbO23wLtd4vtw1V5pgfod0PbVERnwHwYqt6+QDF/OyeG0USRP8EWg/ zXVg== X-Gm-Message-State: AOAM532D91NtFMm+x1ojEX4ZaD1RhU0dg8LBgrOnZWVbrNFAY84VK09n SudRzW7Pv8x8ME55Y2To9hpmew== X-Received: by 2002:a17:90a:4803:: with SMTP id a3mr3088770pjh.192.1599844393419; Fri, 11 Sep 2020 10:13:13 -0700 (PDT) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:7220:84ff:fe09:2b94]) by smtp.gmail.com with ESMTPSA id h9sm2787452pfc.28.2020.09.11.10.13.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2020 10:13:12 -0700 (PDT) From: Abhishek Pandit-Subedi To: marcel@holtmann.org, luiz.dentz@gmail.com Cc: chromeos-bluetooth-upstreaming@chromium.org, linux-bluetooth@vger.kernel.org, Abhishek Pandit-Subedi , Miao-chen Chou , Sonny Sasaka , "David S. Miller" , Johan Hedberg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jakub Kicinski Subject: [RESEND PATCH 2/3] Bluetooth: Add suspend reason for device disconnect Date: Fri, 11 Sep 2020 10:13:05 -0700 Message-Id: <20200911101255.RESEND.2.Ib9bb75b65362d32104df86ffad479761680bb2cb@changeid> X-Mailer: git-send-email 2.28.0.618.gf4bc123cb7-goog In-Reply-To: <20200911171306.3758642-1-abhishekpandit@chromium.org> References: <20200911171306.3758642-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 Update device disconnect event with reason 0x5 to indicate that device disconnected because the controller is suspending. Signed-off-by: Abhishek Pandit-Subedi Reviewed-by: Miao-chen Chou Reviewed-by: Sonny Sasaka --- include/net/bluetooth/mgmt.h | 1 + net/bluetooth/mgmt.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index e19e33c7b65c34..a4b8935e0db97a 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h @@ -842,6 +842,7 @@ struct mgmt_ev_device_connected { #define MGMT_DEV_DISCONN_LOCAL_HOST 0x02 #define MGMT_DEV_DISCONN_REMOTE 0x03 #define MGMT_DEV_DISCONN_AUTH_FAILURE 0x04 +#define MGMT_DEV_DISCONN_LOCAL_HOST_SUSPEND 0x05 #define MGMT_EV_DEVICE_DISCONNECTED 0x000C struct mgmt_ev_device_disconnected { diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 1475a47edb080b..e33f45e20ed1e7 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -8268,6 +8268,10 @@ void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, ev.addr.type = link_to_bdaddr(link_type, addr_type); ev.reason = reason; + /* Report disconnects due to suspend */ + if (hdev->suspended) + ev.reason = MGMT_DEV_DISCONN_LOCAL_HOST_SUSPEND; + mgmt_event(MGMT_EV_DEVICE_DISCONNECTED, hdev, &ev, sizeof(ev), sk); if (sk) -- 2.28.0.618.gf4bc123cb7-goog