From patchwork Mon Sep 12 22:18:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12974175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B7180C6FA82 for ; Mon, 12 Sep 2022 22:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gOBWTS4xugh82iE+iVZ2feiJQnVLRL/GOJqIkU88mfM=; b=nR+fwr/4sxCrS5kK3KUxWr9Eta eax8OfMB04YfPa8Tlkd+caoZVCsb4VUtv43cR26YOCrXq4rNwDoeQlUZwkE4KcKCe4cK6yeIn1F/k joY6NvZ+a0k6WlJsgYbzNrHcJYm65GFYZmzAR8psC1QIWipvHvfNOHBU1SoPKUgqzDs0b+MHuf0hi 4dMHEYRrllyhszFRXefsoXDbmgBp0OKZBa+It5HwplcWWxei/Aawox7pr3q1n6nrZUCuWkCKk7CnT vbXTNZwu8jLpaIB7NL+qFZ0sr2hniupLV1CaT6g8/sJKkqpJk2jJwVNRVXIt0uhq8Wq8DFA3n0RXQ pZBCC3BQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXrlH-00Ei0Z-U8; Mon, 12 Sep 2022 22:18:39 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oXrlD-00Ehsc-Vu for linux-mediatek@lists.infradead.org; Mon, 12 Sep 2022 22:18:38 +0000 X-UUID: a71cdf98af884814a543973b31228a64-20220912 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=gOBWTS4xugh82iE+iVZ2feiJQnVLRL/GOJqIkU88mfM=; b=F2URJptcaTsdutuRPbn3NGr2Z3nlw66/AhLjScg5rE++PIXC85lkPRxgWhn0xBMpNecwqKysPkPnknmN1LyhhjgfH8BNfpRSuPo+7RGTQQzzQIS0RkKoCOgBL6GE5WDb294BMfhLtrYJMS7AE5OjvtUI0kH4LMBp6svE92zQLz0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.10,REQID:65c790c4-31d9-4d64-877a-6450e5181236,OB:0,L OB:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_ Ham,ACTION:release,TS:0 X-CID-META: VersionHash:84eae18,CLOUDID:474023f6-6e85-48d9-afd8-0504bbfe04cb,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:11|1,File: nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: a71cdf98af884814a543973b31228a64-20220912 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 338286374; Mon, 12 Sep 2022 15:18:22 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Tue, 13 Sep 2022 06:18:20 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 13 Sep 2022 06:18:19 +0800 From: To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH 3/4] Bluetooth: btusb: mediatek: reset the device as WMT failed Date: Tue, 13 Sep 2022 06:18:12 +0800 Message-ID: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <43b68b1f48c20b1dfcd7e6663c3dcb38e4e0648c.1663020936.git.objelf@gmail.com> References: <43b68b1f48c20b1dfcd7e6663c3dcb38e4e0648c.1663020936.git.objelf@gmail.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220912_151836_234043_42712BB0 X-CRM114-Status: GOOD ( 10.67 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Reset the BT device whenever the driver detected any WMT failure happened to recover such kind of system-level error as soon as possible. Signed-off-by: Sean Wang --- drivers/bluetooth/btusb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 653f57a98233..dc86726c8271 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2576,6 +2576,10 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev, data->evt_skb = NULL; err_free_wc: kfree(wc); + + if (err < 0) + btmtk_reset_sync(hdev); + return err; }