From patchwork Sat Aug 25 10:40:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10576117 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 18B4114BD for ; Sat, 25 Aug 2018 10:42:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 093432AF1F for ; Sat, 25 Aug 2018 10:42:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1A812B009; Sat, 25 Aug 2018 10:42:04 +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=unavailable 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 991A02AF1F for ; Sat, 25 Aug 2018 10:42:04 +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=fVi9gQEsOWS7ZeJgEUWhFmkUoISHMDM2GtCPJOQqcfY=; b=XCU lIz32r1+OYJEPkUfNncM3QPMdL4FuCwUin8mO2kvQp7aXdYmQevSNeLo6JovWFAM0Uvx/cL03pdQv 39Z7OYR3sLneD0+7Un/N4BnvPgq0lAofkWn4BLIoNrM0lKneoOZdv1ZVvt5M4tUE84NZkATHb4TMP ezuIPe7mIjXhKgtG9AYU8YSABX/pHQ/yfXOMv64LXtdKoyTv/WE/mvMaW09/SfpsfVhK9N/sW344Z dt9zoR3QaAPqBWe4gPA6u1keRAp7x/Sw+d4hbmELfQBiXOaJwfqBgT83clNoVCfZFJcz/82sr8NRr xyuHUGAv3bWlc2l/EwL40mNh68ihhhA==; 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 1ftW13-0005Mz-6z for patchwork-linux-mediatek@patchwork.kernel.org; Sat, 25 Aug 2018 10:42:01 +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-0004wM-24 for linux-mediatek@lists.infradead.org; Sat, 25 Aug 2018 10:41:26 +0000 Received: by mail-wr1-f66.google.com with SMTP id v17-v6so9438479wrr.9 for ; Sat, 25 Aug 2018 03:41:15 -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=UhNCSpik5flN2EfpWI85iafBqxSTb5Oj9orcL2z5y5o=; b=lzZlGwU2vy1JTjW112QY9mvvPOYAMU9e2iGTusMaRvdtFOQcz/KZuuEbv79AXEIwal ulIj16HOVtjm+2YSBW8hr2nxm79gBPZn2Wvrao0sbE52VuakJQdlbEc+uXtcbzBWyytM uvUagvcv5qP4bgo6URVe5W9GJwMWqLcYLpQu7VyzbKSx2anPg9c5OGxACMHcD9NJ9ogx 9EW4uUyRNv9cVpwfd0XMZS0d/ZyaPd8TLgvz6NJtLC0ffU7XyemBevbs/JxwZVru7Nxa aKlb/G4a1wwTShfBEwgBGiNusf2zW9F/3h2Oklac/W2NSgr1celt4A5gSjusCQq8mqxL OmpQ== X-Gm-Message-State: APzg51DDJvTwvrLVnHD4AkkaI8OjFoSm7D9j7EaW1eWFCM5e/eQ1yXat DCT7F6j3U25/tQ9OzblKG03vDQ== X-Google-Smtp-Source: ANB0VdY8FcoKj5t2NJYd/6ZhkdTTJ9tDSv/l2lepZdQpQ+Y7m/iAJ+d+5+YTHxEdL9glfkQouylGMA== X-Received: by 2002:a5d:53cf:: with SMTP id a15-v6mr3692623wrw.151.1535193673879; Sat, 25 Aug 2018 03:41:13 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Aug 2018 03:41:13 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Subject: [PATCH 11/16] mt76x0: remove mt76x0_vendor_request routine Date: Sat, 25 Aug 2018 12:40:51 +0200 Message-Id: <20180825104056.9130-12-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_179733_EBF4D8F8 X-CRM114-Status: GOOD ( 10.95 ) 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_vendor_request routine and use mt76u_vendor_request utility function from mt76-usb layer in mt76x0_upload_firmware Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt76x0/mcu.c | 5 +-- .../net/wireless/mediatek/mt76/mt76x0/usb.c | 31 ------------------- .../net/wireless/mediatek/mt76/mt76x0/usb.h | 4 --- 3 files changed, 3 insertions(+), 37 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c index 3f985c1d45f0..7c2217307828 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c @@ -488,8 +488,9 @@ mt76x0_upload_firmware(struct mt76x0_dev *dev, const struct mt76_fw *fw) if (ret) goto error; - ret = mt76x0_vendor_request(dev, MT_VEND_DEV_MODE, USB_DIR_OUT, - 0x12, 0, ivb, sizeof(fw->ivb)); + ret = mt76u_vendor_request(&dev->mt76, MT_VEND_DEV_MODE, + USB_DIR_OUT | USB_TYPE_VENDOR, + 0x12, 0, ivb, sizeof(fw->ivb)); if (ret < 0) goto error; ret = 0; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c index fcca1e990475..e2b55d0d31da 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c @@ -93,37 +93,6 @@ int mt76x0_usb_submit_buf(struct mt76x0_dev *dev, int dir, int ep_idx, return ret; } -int mt76x0_vendor_request(struct mt76x0_dev *dev, const u8 req, - const u8 direction, const u16 val, const u16 offset, - void *buf, const size_t buflen) -{ - int i, ret; - struct usb_device *usb_dev = mt76x0_to_usb_dev(dev); - const u8 req_type = direction | USB_TYPE_VENDOR | USB_RECIP_DEVICE; - const unsigned int pipe = (direction == USB_DIR_IN) ? - usb_rcvctrlpipe(usb_dev, 0) : usb_sndctrlpipe(usb_dev, 0); - - for (i = 0; i < MT_VEND_REQ_MAX_RETRY; i++) { - ret = usb_control_msg(usb_dev, pipe, req, req_type, - val, offset, buf, buflen, - MT_VEND_REQ_TOUT_MS); - trace_mt76x0_vend_req(&dev->mt76, pipe, req, req_type, val, offset, - buf, buflen, ret); - - if (ret == -ENODEV) - set_bit(MT76_REMOVED, &dev->mt76.state); - if (ret >= 0 || ret == -ENODEV) - return ret; - - msleep(5); - } - - dev_err(dev->mt76.dev, "Vendor request req:%02x off:%04x failed:%d\n", - req, offset, ret); - - return ret; -} - void mt76x0_addr_wr(struct mt76x0_dev *dev, const u32 offset, const u8 *addr) { mt76_wr(dev, offset, get_unaligned_le32(addr)); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.h b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.h index 0d1ba95dcf2e..b4a5d98416ab 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.h @@ -50,8 +50,4 @@ int mt76x0_usb_submit_buf(struct mt76x0_dev *dev, int dir, int ep_idx, struct mt76x0_dma_buf *buf, gfp_t gfp, usb_complete_t complete_fn, void *context); -int mt76x0_vendor_request(struct mt76x0_dev *dev, const u8 req, - const u8 direction, const u16 val, const u16 offset, - void *buf, const size_t buflen); - #endif