linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: nbd@nbd.name
Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org,
	Sean.Wang@mediatek.com
Subject: [PATCH v3 07/18] mt76: mt76u: move mcu buffer allocation in mt76x02u drivers
Date: Wed, 15 Jan 2020 11:58:47 +0100	[thread overview]
Message-ID: <e4ade54ae6913dcab5aa4ec1793587226ddafadb.1579085367.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1579085367.git.lorenzo@kernel.org>

Move mcu buffer allocation in mt76x2u/mt76x0u drivers since newer
chipsets (e.g. mt7663u) does not rely on synchronous mcu communication

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt76x0/usb.c      | 6 ++++++
 drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c | 6 ++++++
 drivers/net/wireless/mediatek/mt76/usb.c             | 5 -----
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
index abf0a19ee70e..78ceb14fe5d3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
@@ -172,8 +172,14 @@ static int mt76x0u_init_hardware(struct mt76x02_dev *dev, bool reset)
 static int mt76x0u_register_device(struct mt76x02_dev *dev)
 {
 	struct ieee80211_hw *hw = dev->mt76.hw;
+	struct mt76_usb *usb = &dev->mt76.usb;
 	int err;
 
+	usb->mcu.data = devm_kmalloc(dev->mt76.dev, MCU_RESP_URB_SIZE,
+				     GFP_KERNEL);
+	if (!usb->mcu.data)
+		return -ENOMEM;
+
 	err = mt76u_alloc_queues(&dev->mt76);
 	if (err < 0)
 		goto out_err;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
index 62e5e89baf23..2a576618b76e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
@@ -190,6 +190,7 @@ int mt76x2u_init_hardware(struct mt76x02_dev *dev)
 int mt76x2u_register_device(struct mt76x02_dev *dev)
 {
 	struct ieee80211_hw *hw = mt76_hw(dev);
+	struct mt76_usb *usb = &dev->mt76.usb;
 	int err;
 
 	INIT_DELAYED_WORK(&dev->cal_work, mt76x2u_phy_calibrate);
@@ -199,6 +200,11 @@ int mt76x2u_register_device(struct mt76x02_dev *dev)
 	if (err < 0)
 		return err;
 
+	usb->mcu.data = devm_kmalloc(dev->mt76.dev, MCU_RESP_URB_SIZE,
+				     GFP_KERNEL);
+	if (!usb->mcu.data)
+		return -ENOMEM;
+
 	err = mt76u_alloc_queues(&dev->mt76);
 	if (err < 0)
 		goto fail;
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 678720c53886..96269e8eb170 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -605,14 +605,9 @@ mt76u_submit_rx_buffers(struct mt76_dev *dev, enum mt76_rxq_id qid)
 
 static int mt76u_alloc_rx(struct mt76_dev *dev)
 {
-	struct mt76_usb *usb = &dev->usb;
 	struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
 	int i, err;
 
-	usb->mcu.data = devm_kmalloc(dev->dev, MCU_RESP_URB_SIZE, GFP_KERNEL);
-	if (!usb->mcu.data)
-		return -ENOMEM;
-
 	spin_lock_init(&q->lock);
 	q->entry = devm_kcalloc(dev->dev,
 				MT_NUM_RX_ENTRIES, sizeof(*q->entry),
-- 
2.21.1


  parent reply	other threads:[~2020-01-15 10:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 10:58 [PATCH v3 00/18] rework mt76u layer to support new devices Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 01/18] mt76: mt76u: check tx_status_data pointer in mt76u_tx_tasklet Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 02/18] mt76: mt76u: add mt76u_process_rx_queue utility routine Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 03/18] mt76: mt76u: add mt76_queue to mt76u_get_next_rx_entry signature Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 04/18] mt76: mt76u: add mt76_queue to mt76u_refill_rx signature Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 05/18] mt76: mt76u: use mt76_queue as mt76u_complete_rx context Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 06/18] mt76: mt76u: add queue id parameter to mt76u_submit_rx_buffers Lorenzo Bianconi
2020-01-15 10:58 ` Lorenzo Bianconi [this message]
2020-01-15 10:58 ` [PATCH v3 08/18] mt76: mt76u: introduce mt76u_free_rx_queue utility routine Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 09/18] mt76: mt76u: stop/free all possible rx queues Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 10/18] mt76: mt76u: add mt76u_alloc_rx_queue utility routine Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 11/18] mt76: mt76u: add queue parameter to mt76u_rx_urb_alloc Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 12/18] mt76: mt76u: resume all rx queue in mt76u_resume_rx Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 13/18] mt76: mt76u: introduce mt76u_alloc_mcu_queue utility routine Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 14/18] mt76: mt76u: add {read/write}_extended utility routines Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 15/18] mt76: mt76u: take into account different queue mapping for 7663 Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 16/18] mt76: mt76u: introduce mt76u_skb_dma_info routine Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 17/18] mt76: mt76u: add endpoint to mt76u_bulk_msg signature Lorenzo Bianconi
2020-01-15 10:58 ` [PATCH v3 18/18] mt76: mt76u: introduce MT_DRV_RX_DMA_HDR flag Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e4ade54ae6913dcab5aa4ec1793587226ddafadb.1579085367.git.lorenzo@kernel.org \
    --to=lorenzo@kernel.org \
    --cc=Sean.Wang@mediatek.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).