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: 10576111 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 AB8EC14BD for ; Sat, 25 Aug 2018 10:41:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BAC22AF1F for ; Sat, 25 Aug 2018 10:41:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FC552B009; Sat, 25 Aug 2018 10:41: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3DE902AF1F for ; Sat, 25 Aug 2018 10:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=0efJ19Ww5KBjxbrQHJTOLne/xI456YhxCkAo8sVJtlQ=; b=ad+ Ig60yhpBhqrcOhDXQ41xezH8YFqoGj5ZrCBp875pETK9Q+5sUsNFD1kY7urUUCODfdXcL/vCLB1lX fur+jqcZMu4EbxUdBr3uw0ZYDAlJcb6EBwu6egAl/PNzw0hd1ZaNLqgah4P03Zem1FPaDa9UF0AX9 sS5hGkUKDDqepJt6P5nevdzMo1NMP6RBQO6aiOM63Cm0AA9ZXLon7sAt/ewuPloxBPAMD8RAOf67R 4cp33mPH781aexp9wLulGNiFTQxmbNggrEarT98FTKomnTw8unyrvTBEaHUSnDmgmEz6kfxyWjxsS TYn8aiVvQmtMi5s9Pe8jN1Yq7YoGdFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftW0u-0005HY-45 for patchwork-linux-mediatek@patchwork.kernel.org; Sat, 25 Aug 2018 10:41:52 +0000 Received: from mail-wr1-f66.google.com ([209.85.221.66]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftW0O-0004vq-2i for linux-mediatek@lists.infradead.org; Sat, 25 Aug 2018 10:41:23 +0000 Received: by mail-wr1-f66.google.com with SMTP id v90-v6so9470017wrc.0 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=DfcS2asrf8MVAAcASCIV5hqIWvk8TJDFaiuyQfw0Hjk0WyQDz2VV8EyAMME9xX2yOp 85ial0OGesG215sVKhv2SssVRUCyaYnssO86b69EkArzLjISnW3D93UwgQLJLsDSaKvY YOKmIHn1ojEx4mkwBq8mN6y1tsVWpwbmX4vwvC06uQA523sZjp5+d1kaHOgKca3ERZ4o ETrFXSWEvTL9oG68erDI2DJTVCLEAn4vEiMJL2rGxqrHeEatcDVK1+SEnWO2h+1Z1Utj iAaet2cP5RPpZI+R32NZL8W0JaUFrnzDuCqJFX4SN7wg54Hq1uPCWBpT7HmsqO1Ix5ou JkpA== X-Gm-Message-State: APzg51Ck3h2bm+lbca/VUq4f/AYVxQDn87jCMDM7RrnwzEwXjtflyZaN QfIeaKOJqOghv2yKBsv4e1mUMA== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180825_034120_181404_27EE445F X-CRM114-Status: UNSURE ( 9.19 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org, sgruszka@redhat.com MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.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);