Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp684678rdf; Tue, 21 Nov 2023 13:32:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGykxrMp2OGnVLIeHBInaWmPkQ1UC4eYtncVlDAKuIPQ5OyTJubj8DYrFMgPpkeQVwvl/Zn X-Received: by 2002:a05:6808:2193:b0:3b2:db61:ff8e with SMTP id be19-20020a056808219300b003b2db61ff8emr753764oib.33.1700602339731; Tue, 21 Nov 2023 13:32:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700602339; cv=none; d=google.com; s=arc-20160816; b=UQUSLXyDyMKq9LlH3xCT0PKT7ot/fa6gem2KXt36tgKK4rNAJu+hkALviHXfPlV0c3 10BRPEMDcWuVkKjiCEegE6UHKMUu0WtTHZBC5rRZcPu3o1JUFpbuH+cODqYYgoUDmcIp 2wDv/IWNvZItk3Simc2qpTd/UNlXSv4Dh6nwzinroTCiqgWkwE1xvf0SDFw1opvhKRFw okaxh4AcCXHnlXgWwz8/tJTJwrGvNylvV3yTidiJh+xPCYjh+nJBesvw1wdvV3JCaGcs 9nbEh0u4gNGzUOo/TgV4jr80iNeNgY0xPFwGfEECYGrrExqi1AlgnEwrlk6KXXssS2GD 39pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=9h8ucelJdNwtBQcUnogeNuYf+HCC5O/gwgK1/pOvvM4=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=PkIPx647Pqwz6FpXwUZVvyGwsk0eymYEzZ55maby9u/cXCuL7IjioeA/UK3OXxjm8m sN72kKiesXg12/I4hgsinEUmokD6HqBY43SpDuKLxIfIsHjpSiQt9BgIgfRBtNrpRy0G jAnDkwBTYTKuga6GApcmuNdNLCOOh4gQgySV9euYzkzc//oI7WZFhBYz4P/NtqJ4gmIs XPGBVa3nmdrRr7sp2IP4daweshOUGUq00tgb7QKi527KqzXJlvXEcH58tEy3fu0K0Tll FW2QiaGf+f3SOyFbbeE5PcA7l/ptYexWgIiTvk+vfs5FGEEa7k44DYIwN+D51fwJMMqf XWiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=D0kLcuer; spf=pass (google.com: domain of linux-bluetooth+bounces-156-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-156-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bx15-20020a056a02050f00b005b91536981csi12677312pgb.11.2023.11.21.13.32.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 13:32:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-156-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=D0kLcuer; spf=pass (google.com: domain of linux-bluetooth+bounces-156-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-156-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2AE7DB21A58 for ; Tue, 21 Nov 2023 21:32:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 431A76FCE; Tue, 21 Nov 2023 21:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D0kLcuer" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2664AB9 for ; Tue, 21 Nov 2023 13:32:04 -0800 (PST) Received: by mail-qk1-x72d.google.com with SMTP id af79cd13be357-77891c236fcso397548585a.3 for ; Tue, 21 Nov 2023 13:32:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700602322; x=1701207122; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=9h8ucelJdNwtBQcUnogeNuYf+HCC5O/gwgK1/pOvvM4=; b=D0kLcuerwPs49WZPzK4e+k7dpTAYyI5EUQ3Ti2OcN7WHtdfdQS+9WL8o7+14m9bQ8w AvnvY9M/en2ELo6zPSlL7Btk8CrAm+M/Nayiynr4h7XsLA0ZkiPcrFqyXRTQJsIMfmh8 yDYfx5AW37/m5a8SX+xqNbceBjSEp++f+NQkoDZY48A16s58hLN/1Aw+C0dNCkeoEm/e MHtXuDkME55612sIma3HbIO5tYdxGGc6Tq8z73AMOtbKMvAeyRzh0nBb1LvtM3O0+QSv dR12ecARABhiSl+AsW4q0jby44egQPbbMAJaCytzIErMROS3RhpsE217MT/QLC9sopy7 AUDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700602322; x=1701207122; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9h8ucelJdNwtBQcUnogeNuYf+HCC5O/gwgK1/pOvvM4=; b=FI6EtZCz6wQXlvL0tA2t7QdKZCcDGwqlPS/i+5ayEUQ1XZBqCEG+5EvceizXrCuF5p FAU6BOBE1fM32u6XztSCTasr2IOlVXKSjCJeqS7Q37rgsyHW0eTO4lJ8kf4tLwHys62C YMgbnRnoq3CAK1QHpvluemUq8U/h+RZ82xIg2BV2hOumTr62WOqQeawfXZDXG31Q5HDs YosT+ws0HXsqF61DDwJT0V2C8sjOOFSJf2xF2DyssW1RiXCdGpdMFfBrJ63hBFEYnWmk A5a/ZUBazPlppZ/3zrmFoE2Q6N8Gn2HgrVlY/vEjfJBtdIB0aQcjs5ZY4RymwXBmpaBa SoRQ== X-Gm-Message-State: AOJu0YzSbbv0XgwADFlvSIcSdq00OA/aGAGABcGgmU3T7OM20famXduB Qytpfmjjw7OpS1hmkfA1Qb9Phib3/zL1Rg== X-Received: by 2002:a05:6214:765:b0:65a:fc5b:bc87 with SMTP id f5-20020a056214076500b0065afc5bbc87mr377210qvz.58.1700602322130; Tue, 21 Nov 2023 13:32:02 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id o1-20020a056214180100b006624e9d51d9sm4291412qvw.76.2023.11.21.13.32.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 13:32:01 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [RESEND] Bluetooth: btusb: Don't suspend when there are connections Date: Tue, 21 Nov 2023 16:31:59 -0500 Message-ID: <20231121213200.680095-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz This checks if there are connections before suspending since that may disrupt the connections making it stop receiving any data if remote wakeup is not enabled. Signed-off-by: Luiz Augusto von Dentz --- drivers/bluetooth/btusb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index b8e9de887b5d..0926e4451802 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -4629,6 +4629,10 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message) BT_DBG("intf %p", intf); + /* Don't suspend if there are connections */ + if (hci_conn_count(data->hdev)) + return -EBUSY; + if (data->suspend_count++) return 0; -- 2.42.0