From patchwork Sat Aug 25 10:40:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10576077 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-2.web.codeaurora.org (Postfix) with ESMTP id A8A9E14BD for ; Sat, 25 Aug 2018 10:41:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9915E2AE30 for ; Sat, 25 Aug 2018 10:41:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D62F2AEE7; Sat, 25 Aug 2018 10:41:15 +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 2F8B72AE30 for ; Sat, 25 Aug 2018 10:41:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727020AbeHYOTr (ORCPT ); Sat, 25 Aug 2018 10:19:47 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:38508 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726842AbeHYOTr (ORCPT ); Sat, 25 Aug 2018 10:19:47 -0400 Received: by mail-wm0-f68.google.com with SMTP id t25-v6so3834039wmi.3 for ; Sat, 25 Aug 2018 03:41:12 -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; bh=n1HxunubKdlHSAAzpaKjGyCviuccAzkp06wP867cUSY=; b=qPWt+j+yVFVZCfSRBZwj+507JQm78XAzJ9QV8h3+DLLlgIQMEMkT9AomknlMtNnkk1 oE3o4b89oNOdKdEvM2KUnBWl//2nec2WFvidieg3wxoNu3iefAHTSct6L6GbFtAAcbOY QCaX/fexIRJasnc4ogMilxtKFmXv5k+8Li9EHLDlvu6rnRcIyHGnKjJFT6dTzF/xIh5M ftncheGllmTa5u+l1YsTQT1XobSNNs7IkJn//C1SYb/AnWCANaW6FLMj7bM8cgpSyRL0 sN32S7j2R6ivPqXt09OqdSsALMdAuOCY1Z4obtaKrOrhB7PW6Kz5OLUkmWe+dm6Vw2rE GZoQ== X-Gm-Message-State: APzg51Bizea3nZHZlAtYtV6RpPrsxgPb0SqOFMU93xx8MhjKbFBUhnDs aM4d07JLftbROhycVASLIhgFY+MlLN8= X-Google-Smtp-Source: ANB0VdaZ5vF5++gJ+9qnZt2gh6gZmDAD3s+4w17X2CHfmrbndZ0kq/cZEkTlRkXjZ79KBfdChjKRSw== X-Received: by 2002:a1c:200c:: with SMTP id g12-v6mr938626wmg.102.1535193671646; Sat, 25 Aug 2018 03:41:11 -0700 (PDT) Received: from localhost.localdomain ([151.66.53.29]) by smtp.gmail.com with ESMTPSA id l18-v6sm16391708wru.75.2018.08.25.03.41.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Aug 2018 03:41:11 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: sgruszka@redhat.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 09/16] mt76x0: use shared mt76 usb mcu completion Date: Sat, 25 Aug 2018 12:40:49 +0200 Message-Id: <20180825104056.9130-10-lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.18.0 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 Use mt76 usb shared completion data structure in mt76x0_mcu_wait_resp routine and remove mt76x0 private one Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c | 11 ++++++----- drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c index 8a258fa33c2a..bfaabe018216 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c @@ -93,11 +93,12 @@ static void mt76x0_read_resp_regs(struct mt76x0_dev *dev, int len) static int mt76x0_mcu_wait_resp(struct mt76x0_dev *dev, u8 seq) { struct urb *urb = dev->mcu.resp.urb; + struct mt76_usb *usb = &dev->mt76.usb; u32 rxfce; int urb_status, ret, try = 5; while (try--) { - if (!wait_for_completion_timeout(&dev->mcu.resp_cmpl, + if (!wait_for_completion_timeout(&usb->mcu.cmpl, msecs_to_jiffies(300))) { dev_warn(dev->mt76.dev, "Warning: %s retrying\n", __func__); continue; @@ -113,7 +114,7 @@ static int mt76x0_mcu_wait_resp(struct mt76x0_dev *dev, u8 seq) ret = mt76x0_usb_submit_buf(dev, USB_DIR_IN, MT_EP_IN_CMD_RESP, &dev->mcu.resp, GFP_KERNEL, mt76x0_complete_urb, - &dev->mcu.resp_cmpl); + &usb->mcu.cmpl); if (ret) return ret; @@ -151,7 +152,7 @@ __mt76x0_mcu_msg_send(struct mt76x0_dev *dev, struct sk_buff *skb, mt76x0_dma_skb_wrap_cmd(skb, seq, cmd); - if (dev->mcu.resp_cmpl.done) + if (&usb->mcu.cmpl.done) dev_err(dev->mt76.dev, "Error: MCU response pre-completed!\n"); trace_mt76x0_mcu_msg_send_cs(&dev->mt76, skb, wait_resp); @@ -609,13 +610,13 @@ int mt76x0_mcu_init(struct mt76x0_dev *dev) int mt76x0_mcu_cmd_init(struct mt76x0_dev *dev) { + struct mt76_usb *usb = &dev->mt76.usb; int ret; ret = mt76x0_mcu_function_select(dev, Q_SELECT, 1); if (ret) return ret; - init_completion(&dev->mcu.resp_cmpl); if (mt76x0_usb_alloc_buf(dev, MCU_RESP_URB_SIZE, &dev->mcu.resp)) { mt76x0_usb_free_buf(dev, &dev->mcu.resp); return -ENOMEM; @@ -623,7 +624,7 @@ int mt76x0_mcu_cmd_init(struct mt76x0_dev *dev) ret = mt76x0_usb_submit_buf(dev, USB_DIR_IN, MT_EP_IN_CMD_RESP, &dev->mcu.resp, GFP_KERNEL, - mt76x0_complete_urb, &dev->mcu.resp_cmpl); + mt76x0_complete_urb, &usb->mcu.cmpl); if (ret) { mt76x0_usb_free_buf(dev, &dev->mcu.resp); return ret; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h index a694cc46fac8..298b7af31911 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h @@ -55,7 +55,6 @@ struct mt76x0_mcu { u8 msg_seq; struct mt76x0_dma_buf resp; - struct completion resp_cmpl; struct mt76_reg_pair *reg_pairs; unsigned int reg_pairs_len;