Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3082567yba; Sat, 11 May 2019 03:22:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+2GZmZcu2Mbtz40dEBW+/Oi+fOIPwGO+OW4GWnZun1Ad5G+321chyi7djPI05ZG0oBpfC X-Received: by 2002:a62:7608:: with SMTP id r8mr20606552pfc.190.1557570131783; Sat, 11 May 2019 03:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557570131; cv=none; d=google.com; s=arc-20160816; b=RabuHSKUyY4C7qhHygko1Zsfw9K5r2J9s7+2OBC/C2txNzcT7f0EDQzysz4Rq9LBTL Ej7tyZJryAUHHb0YZHfiwXtm1aHkyS8HZSwYnVUseQ+IkGKOTy60cZGFy3U10CDSSAxX qj6esDvarCEKCBhxa37kwboe8LG3yZCItNHFCZ6sLeRqfYa6aOO/C3dc97wRnsxedTzq 6EiRwlgYfAJWfL6NoE2cXq12sPZ5LXMwIO5i4lMBrsshkuLsNEV0kPa045Moo47s491a w5qNgBuiDcNwtA6no7ka1ouAIcDq30RhcYFOgoWqFV7MGV3ZHJ4f2LF92pFl9LXd39Xv Jo8A== 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=HrzFsqROCHxHwIXqAVmjpFb4LR6rLOjPnu/XmvLENJ8=; b=WCBrdgzd0gSdIaoiApqROTpEGqGq1KKWgKgEWRruyLwv33deEEuSnl4c8O5O5dA/ay fLEjGOCAGLNcUtjx54nGq3Qij5u5ZPJPvF7CfDXrPQSiuReiMDpr2BCIMT/w/QJ7CuU6 avpm0297KnV6PLNQRIhU7qLFXh1X4sSzXbCb205Xu41qrrq8Brosl9fTpLtpnVIHmMd4 ghK/fc5tc75Qd9+jBUFGVHYvl+LS8L2Uc6Xmvpylt65svHhJ89vxNcgrbXwbsFmRdEye jWhv9WftOn1ZIb4siIq8N5uuyunPiFwW1QkE6Lv74U/7p7wBsNc9mHrSvuQ5C2SHIlXf lfIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EB4ZT6nz; 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 31si10860216pli.390.2019.05.11.03.21.56; Sat, 11 May 2019 03:22:11 -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=EB4ZT6nz; 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 S1728558AbfEKKSZ (ORCPT + 99 others); Sat, 11 May 2019 06:18:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:36884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfEKKSY (ORCPT ); Sat, 11 May 2019 06:18:24 -0400 Received: from localhost.localdomain (unknown [151.66.17.19]) (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 12608217D6; Sat, 11 May 2019 10:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557569904; bh=pv0kdXkV/3VWKDOn3NdE7Ugd4BmGXe07DN7I1MYp3mA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EB4ZT6nzN8KOT4D/oh/sbqlq7mvGPZwq2OjcS4ieJk/gfQJkkj2eNIH7SqKGogE+6 MU1s3wMmOVcGYwMmfBz3lcGmrTZLOlKmtRM6lk516fJ9KhGbk/HnJZOxi6VkArMlXl F0lnYyzvladtHHmIP2F+Y+rkmOJXmgDF+54WNrMc= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, sgruszka@redhat.com Subject: [PATCH 3/4] mt76: mt76x2: move mutex_lock inside mt76x2_set_channel Date: Sat, 11 May 2019 12:17:53 +0200 Message-Id: <1527e88fc4a307aa218f515811f2f2c15786caec.1557567465.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.20.1 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 This is a preliminary patch to run mt76x02_edcca_init atomically Signed-off-by: Lorenzo Bianconi --- .../wireless/mediatek/mt76/mt76x2/pci_main.c | 16 ++++++++------ .../wireless/mediatek/mt76/mt76x2/usb_main.c | 22 ++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c index e416eee6a306..3a1467326f4d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c @@ -54,14 +54,14 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef) int ret; cancel_delayed_work_sync(&dev->cal_work); + tasklet_disable(&dev->mt76.pre_tbtt_tasklet); + tasklet_disable(&dev->dfs_pd.dfs_tasklet); + mutex_lock(&dev->mt76.mutex); set_bit(MT76_RESET, &dev->mt76.state); mt76_set_channel(&dev->mt76); - tasklet_disable(&dev->mt76.pre_tbtt_tasklet); - tasklet_disable(&dev->dfs_pd.dfs_tasklet); - mt76x2_mac_stop(dev, true); ret = mt76x2_phy_set_channel(dev, chandef); @@ -72,10 +72,12 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef) mt76x02_dfs_init_params(dev); mt76x2_mac_resume(dev); - tasklet_enable(&dev->dfs_pd.dfs_tasklet); - tasklet_enable(&dev->mt76.pre_tbtt_tasklet); clear_bit(MT76_RESET, &dev->mt76.state); + mutex_unlock(&dev->mt76.mutex); + + tasklet_enable(&dev->dfs_pd.dfs_tasklet); + tasklet_enable(&dev->mt76.pre_tbtt_tasklet); mt76_txq_schedule_all(&dev->mt76); @@ -111,14 +113,14 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed) } } + mutex_unlock(&dev->mt76.mutex); + if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { ieee80211_stop_queues(hw); ret = mt76x2_set_channel(dev, &hw->conf.chandef); ieee80211_wake_queues(hw); } - mutex_unlock(&dev->mt76.mutex); - return ret; } diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c index 3351b736603d..e4dfc3bea3c5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c @@ -48,21 +48,23 @@ mt76x2u_set_channel(struct mt76x02_dev *dev, int err; cancel_delayed_work_sync(&dev->cal_work); + dev->beacon_ops->pre_tbtt_enable(dev, false); + + mutex_lock(&dev->mt76.mutex); set_bit(MT76_RESET, &dev->mt76.state); mt76_set_channel(&dev->mt76); - dev->beacon_ops->pre_tbtt_enable(dev, false); - mt76x2_mac_stop(dev, false); err = mt76x2u_phy_set_channel(dev, chandef); mt76x2_mac_resume(dev); - dev->beacon_ops->pre_tbtt_enable(dev, true); - clear_bit(MT76_RESET, &dev->mt76.state); + mutex_unlock(&dev->mt76.mutex); + + dev->beacon_ops->pre_tbtt_enable(dev, true); mt76_txq_schedule_all(&dev->mt76); return err; @@ -84,12 +86,6 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed) mt76_wr(dev, MT_RX_FILTR_CFG, dev->mt76.rxfilter); } - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { - ieee80211_stop_queues(hw); - err = mt76x2u_set_channel(dev, &hw->conf.chandef); - ieee80211_wake_queues(hw); - } - if (changed & IEEE80211_CONF_CHANGE_POWER) { dev->mt76.txpower_conf = hw->conf.power_level * 2; @@ -102,6 +98,12 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed) mutex_unlock(&dev->mt76.mutex); + if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { + ieee80211_stop_queues(hw); + err = mt76x2u_set_channel(dev, &hw->conf.chandef); + ieee80211_wake_queues(hw); + } + return err; } -- 2.20.1