Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4527745pxk; Wed, 30 Sep 2020 05:28:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyV9PR78ytkLs+q6LkG2rKKKxt1kCGQNf3uoRLociNDT7MilLi2qgQaJa22dMBw9ONRvGhc X-Received: by 2002:a17:906:e18:: with SMTP id l24mr2517624eji.334.1601468888316; Wed, 30 Sep 2020 05:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601468888; cv=none; d=google.com; s=arc-20160816; b=fZJYH25MIz0Gq/bq0OVqOBMmjAbSJrKNoufPMchOkHE9Grg0NX/lpd2CDdxoeCnbIO LYzp0JvRT+P2GVyAwl8Yvmv/mNq30q8yH/cbV8Qh6P1EWekBquK2av3OP3Xwld5be8Fd semqJM5cXO/bXTVZNj/qaHuL6yWkze/lAy+knsOP7Qx/mQ7sNMnt1PfRXGgijbuI25SV 59aMJa2Qs0W8EmzLUai/wgYVn80rUVYN0pBsQBUjGcmG8WMtJdywrFyTvXdhYA0LBR1h YHygvyGJuYEn0kdMNKa4iw/HAjtCI4TigVAKptXw15wETahNMuBp4ekBdTLp83uwr4AO 9XOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5A7Dv3EgpEii8hsCTrA9+wseQDQJnBLziksdXx/lwRk=; b=PU2FWCMLiaFii4pYKV9OyhrbP5iifKVgTEIrzsKHKbsHpYNvkAY5bUSOWjHs2fZDFl sTyDJwgCGp6SJaq+l1uLtLuYT1AdA9qzbXdT0CdOJX4VI2swVzk66q/Cbv5kCDidvUMg j37wOoEWhf2UaqRD++EwP+Lm27rmY+R5Cq2lxh5wLZYWSZscMhUucXup7O6bFqz+TVnB cIRjRY/HLbREJPwyRkIxJ9BvP5HlB+AkIYOUxkHGWzoL58s7RrhZqryiKmcnDFVW7641 LtDAfUyQK65vOIS3EdvALdLwWUf7t+tSsUlGUgq6m364cwwZWG3svqTOZtKKlkxdwbOq CTLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=aYxpVXYI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qx8si1062669ejb.175.2020.09.30.05.27.44; Wed, 30 Sep 2020 05:28:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=aYxpVXYI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729890AbgI3MZA (ORCPT + 99 others); Wed, 30 Sep 2020 08:25:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727997AbgI3MYp (ORCPT ); Wed, 30 Sep 2020 08:24:45 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C51FC0613D0 for ; Wed, 30 Sep 2020 05:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=5A7Dv3EgpEii8hsCTrA9+wseQDQJnBLziksdXx/lwRk=; b=aYxpVXYICbEsIGC9/UPU3Z2Jlv 9B8tTNvN/kVH6Kqibr2uf8BxiWPalnh8zwJctJbOu9A0nFHHcZb2Qfj2dXJFkZWL7YYEIBap5vfyv xxuy/zqRzGpqChfTSyexLnpJN4PXmGPhN8Jr+z3hPz6HRGoRsqbwFzPx+OLF+weHcJG8=; Received: from p4ff134da.dip0.t-ipconnect.de ([79.241.52.218] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.89) (envelope-from ) id 1kNbA4-0005MT-5F for linux-wireless@vger.kernel.org; Wed, 30 Sep 2020 14:24:44 +0200 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 07/10] mt76: mt7603: switch to .mcu_skb_send_msg Date: Wed, 30 Sep 2020 14:24:38 +0200 Message-Id: <20200930122441.64523-7-nbd@nbd.name> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200930122441.64523-1-nbd@nbd.name> References: <20200930122441.64523-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Reduces code duplication Signed-off-by: Felix Fietkau --- .../net/wireless/mediatek/mt76/mt7603/mcu.c | 43 +++---------------- 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c index f787c9d3088e..b2ccfe6772ce 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c @@ -36,14 +36,16 @@ mt7603_mcu_parse_response(struct mt76_dev *mdev, int cmd, } static int -__mt7603_mcu_msg_send(struct mt7603_dev *dev, struct sk_buff *skb, - int cmd, int *wait_seq) +mt7603_mcu_skb_send_msg(struct mt76_dev *mdev, struct sk_buff *skb, + int cmd, int *wait_seq) { + struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76); int hdrlen = dev->mcu_running ? sizeof(struct mt7603_mcu_txd) : 12; - struct mt76_dev *mdev = &dev->mt76; struct mt7603_mcu_txd *txd; u8 seq; + mdev->mcu.timeout = 3 * HZ; + seq = ++mdev->mcu.msg_seq & 0xf; if (!seq) seq = ++mdev->mcu.msg_seq & 0xf; @@ -74,39 +76,6 @@ __mt7603_mcu_msg_send(struct mt7603_dev *dev, struct sk_buff *skb, return mt76_tx_queue_skb_raw(dev, MT_TXQ_MCU, skb, 0); } -static int -mt7603_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data, - int len, bool wait_resp) -{ - struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76); - unsigned long expires = jiffies + 3 * HZ; - struct sk_buff *skb; - int ret, seq; - - skb = mt76_mcu_msg_alloc(mdev, data, len); - if (!skb) - return -ENOMEM; - - mutex_lock(&mdev->mcu.mutex); - - ret = __mt7603_mcu_msg_send(dev, skb, cmd, &seq); - if (ret) - goto out; - - while (wait_resp) { - skb = mt76_mcu_get_response(&dev->mt76, expires); - ret = mt7603_mcu_parse_response(mdev, cmd, skb, seq); - dev_kfree_skb(skb); - if (ret != -EAGAIN) - break; - } - -out: - mutex_unlock(&mdev->mcu.mutex); - - return ret; -} - static int mt7603_mcu_init_download(struct mt7603_dev *dev, u32 addr, u32 len) { @@ -271,7 +240,7 @@ int mt7603_mcu_init(struct mt7603_dev *dev) { static const struct mt76_mcu_ops mt7603_mcu_ops = { .headroom = sizeof(struct mt7603_mcu_txd), - .mcu_send_msg = mt7603_mcu_msg_send, + .mcu_skb_send_msg = mt7603_mcu_skb_send_msg, .mcu_parse_response = mt7603_mcu_parse_response, .mcu_restart = mt7603_mcu_restart, }; -- 2.28.0