From patchwork Tue Nov 22 14:52:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 24420 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2252649wrr; Tue, 22 Nov 2022 06:56:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Jm3o7Ip3aKJVmr6uouxch6iC6t8B3ZlubbagJ0pdSBCMFkHLykWTmH537G6rhrH3tKKa7 X-Received: by 2002:a50:ff0d:0:b0:461:c6e8:452e with SMTP id a13-20020a50ff0d000000b00461c6e8452emr11388319edu.298.1669128988316; Tue, 22 Nov 2022 06:56:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669128988; cv=none; d=google.com; s=arc-20160816; b=xSuhlkEh9Vmk5MwIwJFpj7hXWOKxCK3m6/Aoiwo4EAZ+lwbzaD9M0P2QLWHEQesdmn YrWETAQernliAKSBV3OgIqpmRnBDdCMTfEvDPi4G9a+1v24+aP/zdGvSOXqeK2hcY2j+ qdtrbAVbRdiCoWCWZ+kxiZa1IKn0J3XPCIHt/jq8RG+PuEgJsbXLsyDX/8eZtHLTOnz7 070jWxJ1jJokFKCxjr8GLBx+GgNrQkT6b+9CnDvDjHco5h3NmiZ8BiG8klLv7LpNVtL3 ejV2uOiON1UAoY5Wp2pvZwfdxMR2W7KGZySgu/hWW9rEjWjKlQ6GmdJXWCIO5wZouQRQ 0nDQ== 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=cjsnW4qZgUGWhRALntejqqlv21PWSV+H8h/eERE7IGfDsux0m/eq4HZ2Vq09sgLbVH mzRQzacGLSJ7gDNk2voGMo7XQW0fhMe4zhrJcM8S+nDVyIX4MMZB2dMcP8sZ+3Y3bT02 HvJzI0h0EsvS4U469d8bogCFPTLRLujvfyBP7Mom7Sji6F8kPGsPL284oOK2xHjp8Nik 8cwthQUXeTBmqx4fiwknv7k2Vauvo8xIBqiRHLCXKCb6HAdNhIYHkQ/kvwtWrQXRo3OH DWzkeS90BBmYKRFLr1x2EzWT/W7H/ePrhyeI2LXuUfQVM1PRT5QnY0q1E4QAZWzafZ0v iegw== 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 q1-20020a056402248100b0046178c62b6asi1579696eda.477.2022.11.22.06.56.03; Tue, 22 Nov 2022 06:56:28 -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 S233418AbiKVOxs (ORCPT + 99 others); Tue, 22 Nov 2022 09:53:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232762AbiKVOxD (ORCPT ); Tue, 22 Nov 2022 09:53:03 -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 41FAA1928F for ; Tue, 22 Nov 2022 06:52:54 -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 1oxUdc-0006Lm-4w; Tue, 22 Nov 2022 15:52:40 +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 1oxUdY-005s7k-RO; Tue, 22 Nov 2022 15:52:37 +0100 Received: from sha by dude02.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1oxUdX-00H3ki-MD; Tue, 22 Nov 2022 15:52:35 +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, Johannes Berg , Alexander Hochbaum , Da Xue , Po-Hao Huang , Viktor Petrenko , Sascha Hauer Subject: [PATCH v3 05/11] rtw88: Drop coex mutex Date: Tue, 22 Nov 2022 15:52:20 +0100 Message-Id: <20221122145226.4065843-6-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221122145226.4065843-1-s.hauer@pengutronix.de> References: <20221122145226.4065843-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?1750208598245398025?= X-GMAIL-MSGID: =?utf-8?q?1750208598245398025?= 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;