From patchwork Sat Aug 25 10:40:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10576075 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 5BEAF14BD for ; Sat, 25 Aug 2018 10:41:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D7062AE30 for ; Sat, 25 Aug 2018 10:41:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40F2D2AEE7; Sat, 25 Aug 2018 10:41:14 +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 E3CD32AE30 for ; Sat, 25 Aug 2018 10:41:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726969AbeHYOTq (ORCPT ); Sat, 25 Aug 2018 10:19:46 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42618 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726624AbeHYOTq (ORCPT ); Sat, 25 Aug 2018 10:19:46 -0400 Received: by mail-wr1-f68.google.com with SMTP id v17-v6so9438398wrr.9 for ; Sat, 25 Aug 2018 03:41:11 -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=gNkdiaeAgblVxBSNA7XpWLi3ngMQwYaEXpzFeTQ+vvw=; b=fmt3KwlIymRFvNr8Poi/mto5Y+eO+qCTYx7P/jMnT1OMM0IxWDZhUxAwXgeJLVukVk qx2BnoInI3zkJg0+XxptDu2LVKj6IbZwtuheF2+xqIPYJRAicHb6MRkDQnDN6heJEe1B DCQh7cDr5AdkRwkooXeMMtjOzZ8HbHctREG5C5Qec8sKxeEsLqEGU5dCGNMRNNSlHdP8 NDoEML2K5V7iwTKM3mmjIxXfK8Vpk7eJN+wZ06UJh31W0Vf2YMJp1/D7fEW/KEjb6Hrp gBlbQnPHrtJ05Zp+9QrsbfWQ9EfVUtJclmkvlssMzTB/++6jOkHVdOHYHqtVzVpyGGOc rq3g== X-Gm-Message-State: APzg51AgHNHqYlzjR2Fg8/Hr6GSQ+CN4uCAefAiBumMcZfQ9cEQqCWSr cv1MG9zBYHqN0iVgOHTDIEtiXA== X-Google-Smtp-Source: ANB0VdZQcQGwLqzVyIAXtLiaBcE5L1nvkExmq/RlopNBo0PTQm3PD/oy9CE407VGqQgTX/FUOBO4wQ== X-Received: by 2002:adf:b243:: with SMTP id y3-v6mr3540157wra.90.1535193670625; Sat, 25 Aug 2018 03:41:10 -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.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Aug 2018 03:41:10 -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 08/16] mt76x0: remove mt76x0_mcu_msg_alloc routine Date: Sat, 25 Aug 2018 12:40:48 +0200 Message-Id: <20180825104056.9130-9-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 Remove mt76x0_mcu_msg_alloc duplicated routine and use mt76u_mcu_msg_alloc utility function for usb mcu message allocation Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt76x0/mcu.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c index cf3acee12dc3..8a258fa33c2a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c @@ -59,21 +59,6 @@ static inline void trace_mt76x0_mcu_msg_send_cs(struct mt76_dev *dev, trace_mt76x0_mcu_msg_send(dev, skb, csum, need_resp); } -static struct sk_buff * -mt76x0_mcu_msg_alloc(struct mt76x0_dev *dev, const void *data, int len) -{ - struct sk_buff *skb; - - WARN_ON(len % 4); /* if length is not divisible by 4 we need to pad */ - - skb = alloc_skb(len + MT_DMA_HDR_LEN + 4, GFP_KERNEL); - if (skb) { - skb_reserve(skb, MT_DMA_HDR_LEN); - memcpy(skb_put(skb, len), data, len); - } - return skb; -} - static void mt76x0_read_resp_regs(struct mt76x0_dev *dev, int len) { int i; @@ -217,7 +202,7 @@ int mt76x0_mcu_function_select(struct mt76x0_dev *dev, .value = cpu_to_le32(val), }; - skb = mt76x0_mcu_msg_alloc(dev, &msg, sizeof(msg)); + skb = mt76u_mcu_msg_alloc(&msg, sizeof(msg)); if (!skb) return -ENOMEM; return mt76x0_mcu_msg_send(dev, skb, CMD_FUN_SET_OP, func == 5); @@ -235,7 +220,7 @@ mt76x0_mcu_calibrate(struct mt76x0_dev *dev, enum mcu_calibrate cal, u32 val) .value = cpu_to_le32(val), }; - skb = mt76x0_mcu_msg_alloc(dev, &msg, sizeof(msg)); + skb = mt76u_mcu_msg_alloc(&msg, sizeof(msg)); if (!skb) return -ENOMEM; return mt76x0_mcu_msg_send(dev, skb, CMD_CALIBRATION_OP, true);