From patchwork Mon Apr 30 14:12:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10371845 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A67916038F for ; Mon, 30 Apr 2018 14:12:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97E1F27CF3 for ; Mon, 30 Apr 2018 14:12:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BDEA27E01; Mon, 30 Apr 2018 14:12:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 257D227CF3 for ; Mon, 30 Apr 2018 14:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753731AbeD3OMx (ORCPT ); Mon, 30 Apr 2018 10:12:53 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:40112 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753172AbeD3OMw (ORCPT ); Mon, 30 Apr 2018 10:12:52 -0400 Received: by mail-wr0-f195.google.com with SMTP id v60-v6so8183631wrc.7 for ; Mon, 30 Apr 2018 07:12:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CQMq9VkFPsXpzaxdK1+uD8uL0WyjisMRtux7DkLmBeo=; b=tvFG6geYXTipgJVs574aCUeg7j+XxvHLLeCgBWpyTp4pPnpWJtZDRTBnLhHyXZI+sw UHhhAmor5PNO52BJSlCa9ULxA7PceQU7jLwwan2k2lEoN7XFgJGTMVfsstRhJtwmoKuS EYeB2DtKWsfrJ6A942OtZPaOi7PmmkOHyOwq2S7XDwyzScaWew7QGCr8i+J7oaqepqNy 4KxJhGQ2AB6pHltLEb5fr/FdGyCxB4aZAbHHgWD0P2FV+5vFuTPnSvfo9w/qv8LoO6q9 bx92yH3qbmCO+wxnWOPGTxJt+URvbcBiNa6mE2rQzZsLLDVYSRCeb5snF9QL9CpLrElH 0MtQ== X-Gm-Message-State: ALQs6tD8OKU1S4CJS+p8AJm01KPDjFUMEnL8wNsT8q9lujX2wCdFfd5v rfvF8nr6CJNMxR8EEu7bqfBPaP8aUvo= X-Google-Smtp-Source: AB8JxZrN3OhuKDXn+q9MfGHLj4CHRWhK+UpTfhz2Vsp43HsmtnZfJtQhJQiJvDlqmbi5Dcpp9YgKMg== X-Received: by 2002:adf:9893:: with SMTP id w19-v6mr9566140wrb.34.1525097571486; Mon, 30 Apr 2018 07:12:51 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id f83sm10207105wmh.32.2018.04.30.07.12.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Apr 2018 07:12:51 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, sgruszka@redhat.com Subject: [RFC 01/18] mt76x2: use completion instead of wait_queue for mcu rx queue Date: Mon, 30 Apr 2018 16:12:16 +0200 Message-Id: <1a04d20c7e6199311f5b0179359be666beeab345.1525096206.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to reuse mcu related code supporting mt76x2u based devices, use completion instead of wait_queue for mcu responses queue Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x2.h | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2_dma.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2.h b/drivers/net/wireless/mediatek/mt76/mt76x2.h index a5d1255e4b9c..a31602d9310e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x2.h @@ -47,7 +47,7 @@ struct mt76x2_mcu { struct mutex mutex; - wait_queue_head_t wait; + struct completion resp_cmpl; struct sk_buff_head res_q; u32 msg_seq; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c b/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c index fd1ec4743e0b..ab71b6e6c6dc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_dma.c @@ -74,7 +74,7 @@ void mt76x2_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, if (q == MT_RXQ_MCU) { skb_queue_tail(&dev->mcu.res_q, skb); - wake_up(&dev->mcu.wait); + complete(&dev->mcu.resp_cmpl); return; } @@ -139,7 +139,7 @@ int mt76x2_dma_init(struct mt76x2_dev *dev) mt76_dma_attach(&dev->mt76); - init_waitqueue_head(&dev->mcu.wait); + init_completion(&dev->mcu.resp_cmpl); skb_queue_head_init(&dev->mcu.res_q); tasklet_init(&dev->tx_tasklet, mt76x2_tx_tasklet, (unsigned long) dev); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c index dfd36d736b06..3e2a7216ffdd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mcu.c @@ -61,8 +61,7 @@ mt76x2_mcu_get_response(struct mt76x2_dev *dev, unsigned long expires) return NULL; timeout = expires - jiffies; - wait_event_timeout(dev->mcu.wait, !skb_queue_empty(&dev->mcu.res_q), - timeout); + wait_for_completion_timeout(&dev->mcu.resp_cmpl, timeout); return skb_dequeue(&dev->mcu.res_q); }