Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp555467pxk; Fri, 11 Sep 2020 14:10:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjo/jZ6Kw53KwyD6P6pQJ+AK230ho4OWYK4A4KLPzKgl2sg5yYHzx8e7miRJ9Ww/8HAwtE X-Received: by 2002:aa7:c419:: with SMTP id j25mr4561313edq.109.1599858624948; Fri, 11 Sep 2020 14:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599858624; cv=none; d=google.com; s=arc-20160816; b=xoIMvPn7GzTVKAv6DGWg00TzcwbWzcpgPqqrDOM/GXFh78TDkyo6UJ7q2goU7FLMAv H78Ka+2cXxUaWIhfIzI6cRIp6fcTpVdjrKjHp5CrixwK/boK5eCQk/owMftflbj/OikN BDfdk3BnVH013w39mMxWhU3vGemYpim0NyI5z67Aa6bN7iYhdbusJClRb5LITN3RHF7H BXT/YHMBTF1tQkO8y+ULxp09bhveBHfUWznaxKwflUJAfo4n3RVvWg2AulryZ/FQzRVo uU16grqfQC08jq7Zj/piuHQ8mxe4ENX14k5wVYgVGvNumxoVZ1uRyO/3H2wJcZZBFRKM JNxA== 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=wU19sqHhymvGkZ+Wtm/wcCxdG23VTDS4BHk0Ix+WsKo=; b=kGY0PiH4pugPhiDYI8DP8oaZafSnOj7LDTjS7r1aZe8V4v7VFbECytVixtf2Az3JhK 7zR2bG2Ss4D0LhYg0DFX1hKXl0C/uuTsCar4Ip8k7lSrtAWGdLmuff6YQBl7GYj57+bZ H5pnBkDUtxSN2mL6/GARgGdhTDvnqTLbuhQRdL2loZkYFDUJOvM06nfFExfqTu33vYT6 ZX9NndIPObnLgAMT1W2AJIoQGegIEp1tQykmncir2j/KI33EdVeTMPd1p5u8B+B6ngXC C8JrZrFwmvBdB5uLZMJLuzWUXKJCBrDdhyrYU7NfoiqNufW3G6010naJpQcfQl8Rjx38 92sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QbdSpYW3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 m18si2026979eje.64.2020.09.11.14.10.01; Fri, 11 Sep 2020 14:10:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=QbdSpYW3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1725921AbgIKVIE (ORCPT + 99 others); Fri, 11 Sep 2020 17:08:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725835AbgIKVH0 (ORCPT ); Fri, 11 Sep 2020 17:07:26 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58053C061799 for ; Fri, 11 Sep 2020 14:07:25 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id u9so1452596plk.4 for ; Fri, 11 Sep 2020 14:07:25 -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=wU19sqHhymvGkZ+Wtm/wcCxdG23VTDS4BHk0Ix+WsKo=; b=QbdSpYW3TXnEKB1YFeOgVyVcBLHQoeZiyQf7i9l3sXc4VLJHTkYvR7c7H9uYAuWWBj UZJ3YN62xrHi+9wyGU6TSokv41guE5JvLIBEBOqay24uPoEsKKAgS56Ih3uB9iClsK2K KxrAZ222wjojTh5F5FgRBc4DwX6LdiUJcfQ5k= 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=wU19sqHhymvGkZ+Wtm/wcCxdG23VTDS4BHk0Ix+WsKo=; b=LGJZ8slNsVr948rPG+ZqtSxU5lxV7tVXag2RU29lpojcVutbOK2+/iaknltGNfzDph 9fSUArYbscQUZf+Bf/qgm3okCMFgO2OhGQF5WQQ46phI41mMY4I2gE1IVwfryh2XvCba 2ajeZC6xhQHVN13XUZHt33dDcJpD4I0yyOz5OOYUHwAZR3vwqwGicyo49NBECzHkxn/Y CS9xRbAja0KRSq4ufcVYN2Z1FAb+z6PR13sXl1agYwSS/e0uK18/GrCj0nCxHjarBO/M SlF3ONgnSQzoBUYQBkQtjMrei9cd1lwuA3CtJ8K7pUY7Rfl//zby88EYNULhiQFfYB1+ eudw== X-Gm-Message-State: AOAM530dLlIoU/Z9vcCuWsU2GI3u43dfQ/IqZpmtRPhhh3nMedoJ0d2c tH50ULQb1JzSnAofYejE7N4AnA== X-Received: by 2002:a17:90b:2347:: with SMTP id ms7mr3835734pjb.135.1599858444876; Fri, 11 Sep 2020 14:07:24 -0700 (PDT) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:7220:84ff:fe09:2b94]) by smtp.gmail.com with ESMTPSA id c128sm3308764pfb.126.2020.09.11.14.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2020 14:07:24 -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: [PATCH v2 2/3] Bluetooth: Add suspend reason for device disconnect Date: Fri, 11 Sep 2020 14:07:12 -0700 Message-Id: <20200911140700.v2.2.Ib9bb75b65362d32104df86ffad479761680bb2cb@changeid> X-Mailer: git-send-email 2.28.0.618.gf4bc123cb7-goog In-Reply-To: <20200911210713.4066465-1-abhishekpandit@chromium.org> References: <20200911210713.4066465-1-abhishekpandit@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- Changes in v2: None 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 db48ee3c213cbd..0b711ad80f6bd1 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -8270,6 +8270,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