Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2745852ybi; Sun, 26 May 2019 07:06:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpA36UsitYbZ92B3wY7TNzu57Ns9hO5TsOgUtKuLaX3lEdv6z2CnplTltsVRPiDIe4+ex7 X-Received: by 2002:a17:902:f081:: with SMTP id go1mr74534835plb.211.1558879602673; Sun, 26 May 2019 07:06:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558879602; cv=none; d=google.com; s=arc-20160816; b=zxMmXObzY+HI7WElWuQ/iRCCKrqFcSVI+abqgSAsrSmoWDwG14bLgcg9SkTdKMPg+U S9Q4m8lQd5/8dRUKTzL/8zFihFSLkK3OqUr+ie9MsjNoOUqZ2unz3iRwn3SNljGqXep3 K2XQP1swiCdVkSkJjZM+/pYR3cifUba7QG00rh/wMUZQuY9ej/EZuEaZQ3nxCGZ7SI9s yUtGFF8BNozIEKZDWskAmtwBebV8nUXE9uoBico81TcuGAAmgHAn+iN1iJ1IwheWctO/ XrhUqHDxVXn+mnwcOCzAZcboK0pqbHOyD6uUevsd5q7zmHfO0KyVnpCDG5T4pSIuT2n/ MxhQ== 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=uBL5AyU3pWMxEOrQnVK/jc1aezrEfNBKwrSKVnGGjxs=; b=zWJLw74OLg6cZ6bX0iLrnAnMMnjJbO4w0WHYwBr+fLO/J/N79rBZoZfSFAa9dfVXLt WT4cH4kFD+bDSlHk8akKaUY5TfK+BhdqyI5u4IsD+1EOrkzkidU6Q7vsAqYyMq50ib6u LjjcEK7vchmjhVX83lfF1zUFlcEG+DKCeZihYDD97dlPNHO2xRkZkfhH7VVlrBRvurv2 cVgLKjkkvaqkuTJiPlR+k2/VvwuVNEbnIhCKVFhv4Elorrdhh0HFeRKqhi2wgE3L+9Ug kBYUl+BAeeFV/BIreHS2BAVjjIiukZpMUucVY+mGs9bt0tiNPYKI5jS1lOmYuxJv/fuS aKDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ssKqD1K6; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si13656450pjs.67.2019.05.26.07.06.27; Sun, 26 May 2019 07:06:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ssKqD1K6; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727879AbfEZOFj (ORCPT + 99 others); Sun, 26 May 2019 10:05:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:34002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727767AbfEZOFj (ORCPT ); Sun, 26 May 2019 10:05:39 -0400 Received: from lore-desk-wlan.lan (unknown [151.66.36.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8579420863; Sun, 26 May 2019 14:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558879538; bh=WdhM3MZo2iIxOsg9rZ19IvSHSmhtIkZxZnwbm+UnTj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ssKqD1K6FaEIjpPv+gXo6TSMeTOBfj3bbD5TcdMz/Obbz6v2DZQ9sKKzV7LPwbc5p 9Z5QmRa+sAIh+xV4R+NeZND+A32+cV9mc4IcfKYE4zrQ52Nps98iZzTABfPYGhJ0E8 phu9WAyQVzGNuBf8liyGtxQWE60cm1NqsHgz8XtY= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, ryder.lee@mediatek.com, royluo@google.com Subject: [PATCH 4/4] mt76: mt7615: rearrange locking in mt7615_config Date: Sun, 26 May 2019 16:05:13 +0200 Message-Id: X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Since all the routines in mt7615_config grub mt76.mutex moves mutex_lock/mutex_unlock at the beginning/end of mt7615_config Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c index cedc4c25f34d..c8411750f62b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -191,31 +191,28 @@ static int mt7615_config(struct ieee80211_hw *hw, u32 changed) struct mt7615_dev *dev = hw->priv; int ret = 0; - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { - mutex_lock(&dev->mt76.mutex); + mutex_lock(&dev->mt76.mutex); + if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { ieee80211_stop_queues(hw); ret = mt7615_set_channel(dev, &hw->conf.chandef); ieee80211_wake_queues(hw); - - mutex_unlock(&dev->mt76.mutex); } if (changed & IEEE80211_CONF_CHANGE_POWER) ret = mt7615_mcu_set_tx_power(dev); if (changed & IEEE80211_CONF_CHANGE_MONITOR) { - mutex_lock(&dev->mt76.mutex); - if (!(hw->conf.flags & IEEE80211_CONF_MONITOR)) dev->mt76.rxfilter |= MT_WF_RFCR_DROP_OTHER_UC; else dev->mt76.rxfilter &= ~MT_WF_RFCR_DROP_OTHER_UC; mt76_wr(dev, MT_WF_RFCR, dev->mt76.rxfilter); - - mutex_unlock(&dev->mt76.mutex); } + + mutex_unlock(&dev->mt76.mutex); + return ret; } -- 2.21.0