From patchwork Fri Dec 2 08:12:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 28759 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp709689wrr; Fri, 2 Dec 2022 00:13:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf69qmQw0vqCdlDWlE8DAiH9dN/Bj74kLFeQdVlK/8ZqXcGUJ0qjmQDCrQtwnEae+5+Uj4eO X-Received: by 2002:a17:906:19d0:b0:7c0:a7e3:cf10 with SMTP id h16-20020a17090619d000b007c0a7e3cf10mr7888750ejd.587.1669968835410; Fri, 02 Dec 2022 00:13:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669968835; cv=none; d=google.com; s=arc-20160816; b=st3OIpUmnqeLyQMQgKonGsAkpUp2+Oeji0t/jGgIrE9Wt2YhrZb7oemDlwXKTE/hbG eYAirWzrRT02KuucCDhYqXMta9cXWDE26uMxuaDs1e0QZjOQ+ymE7z9T6MZLflcyjwa6 BcgRz/0U+Uslr+TvkCV0ctGK3bD9WVnulGuqFZ99Sc4h2M2AJn5JMBQYJVIxgcGVF6Qa 9jye42N+VlxSlbFeNS0pmypc53w0VjZPZAuAsXezmyZSBlTT26m5XzgGWcFDmA/u/AXA kJln7nNIW532r6YOnEtvgYV3HH9BnE3orCL5ZU4Y5Y7+YtdVXWVA4LEKx8rmyi1+LJBO JxvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=W71Z4DgAJwIfcK2lngFiNusawWAEf45YYdXx1irGIpk=; b=KsHyiZeMnK4z1y2j5Q25qlAppOQT7BZT3Acfuf+IkaAw1KC0YVBI68BqBCdbQGwpk3 JNehk7EbFWW20jDwvdPIIFJs//nwQZMjuuO5zNxExoQufHXQipWJKnikB4mWM2onlmWq LbHwf40BqA5OExHgDLRaS/oCOI9tszOhAQh5QunTMczI8nV6O84bdcMKVqlrg6tAVJVJ Ed3OhCCBwt7h4HEXSAaxMGDl5JUqSsZ/18LxE3wWRFpcgIqRJo5yBDQ1dRjmeoDS6+j+ EmPEkw1yq17m2HD0U6Odlwzpa/rUTt+QEVrOsD0tL4460KckTR1UWwHUIfK07iwQh1f3 ZjvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz1-20020a1709072ce100b0073306ff26besi6036901ejc.969.2022.12.02.00.13.31; Fri, 02 Dec 2022 00:13:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232717AbiLBINE (ORCPT + 99 others); Fri, 2 Dec 2022 03:13:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232621AbiLBIMk (ORCPT ); Fri, 2 Dec 2022 03:12:40 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6087DF79 for ; Fri, 2 Dec 2022 00:12:37 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p119p-0005AT-Ti; Fri, 02 Dec 2022 09:12:29 +0100 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1p119o-001lGv-ES; Fri, 02 Dec 2022 09:12:29 +0100 Received: from sha by dude02.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1p119m-00BfDm-Rg; Fri, 02 Dec 2022 09:12:26 +0100 From: Sascha Hauer To: linux-wireless@vger.kernel.org Cc: Neo Jou , Hans Ulli Kroll , Ping-Ke Shih , Yan-Hsuan Chuang , Kalle Valo , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Blumenstingl , kernel@pengutronix.de, Alexander Hochbaum , Da Xue , Po-Hao Huang , Viktor Petrenko , Sascha Hauer Subject: [PATCH v5 05/11] wifi: rtw88: Drop coex mutex Date: Fri, 2 Dec 2022 09:12:18 +0100 Message-Id: <20221202081224.2779981-6-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221202081224.2779981-1-s.hauer@pengutronix.de> References: <20221202081224.2779981-1-s.hauer@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751089241379067378?= X-GMAIL-MSGID: =?utf-8?q?1751089241379067378?= coex->mutex is used in rtw_coex_info_request() only. Most callers of this function hold rtwdev->mutex already, except for one callsite in the debugfs code. The debugfs code alone doesn't justify the extra lock, so acquire rtwdev->mutex there as well and drop the now unnecessary spinlock. Signed-off-by: Sascha Hauer --- drivers/net/wireless/realtek/rtw88/coex.c | 3 +-- drivers/net/wireless/realtek/rtw88/debug.c | 2 ++ drivers/net/wireless/realtek/rtw88/main.c | 2 -- drivers/net/wireless/realtek/rtw88/main.h | 2 -- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/coex.c b/drivers/net/wireless/realtek/rtw88/coex.c index 6276ad6242991..38697237ee5f0 100644 --- a/drivers/net/wireless/realtek/rtw88/coex.c +++ b/drivers/net/wireless/realtek/rtw88/coex.c @@ -633,7 +633,7 @@ static struct sk_buff *rtw_coex_info_request(struct rtw_dev *rtwdev, struct rtw_coex *coex = &rtwdev->coex; struct sk_buff *skb_resp = NULL; - mutex_lock(&coex->mutex); + lockdep_assert_held(&rtwdev->mutex); rtw_fw_query_bt_mp_info(rtwdev, req); @@ -650,7 +650,6 @@ static struct sk_buff *rtw_coex_info_request(struct rtw_dev *rtwdev, } out: - mutex_unlock(&coex->mutex); return skb_resp; } diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c index f5b8a77ebc67b..fa3d73b333ba0 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -841,7 +841,9 @@ static int rtw_debugfs_get_coex_info(struct seq_file *m, void *v) struct rtw_debugfs_priv *debugfs_priv = m->private; struct rtw_dev *rtwdev = debugfs_priv->rtwdev; + mutex_lock(&rtwdev->mutex); rtw_coex_display_coex_info(rtwdev, m); + mutex_unlock(&rtwdev->mutex); return 0; } diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index c98e56890401c..0a2ce7f50f412 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -2071,7 +2071,6 @@ int rtw_core_init(struct rtw_dev *rtwdev) spin_lock_init(&rtwdev->tx_report.q_lock); mutex_init(&rtwdev->mutex); - mutex_init(&rtwdev->coex.mutex); mutex_init(&rtwdev->hal.tx_power_mutex); init_waitqueue_head(&rtwdev->coex.wait); @@ -2143,7 +2142,6 @@ void rtw_core_deinit(struct rtw_dev *rtwdev) } mutex_destroy(&rtwdev->mutex); - mutex_destroy(&rtwdev->coex.mutex); mutex_destroy(&rtwdev->hal.tx_power_mutex); } EXPORT_SYMBOL(rtw_core_deinit); diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h index 4b57542bef1e9..77fd48b6cc453 100644 --- a/drivers/net/wireless/realtek/rtw88/main.h +++ b/drivers/net/wireless/realtek/rtw88/main.h @@ -1501,8 +1501,6 @@ struct rtw_coex_stat { }; struct rtw_coex { - /* protects coex info request section */ - struct mutex mutex; struct sk_buff_head queue; wait_queue_head_t wait;