Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1546193yba; Sun, 5 May 2019 08:36:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqx5yEk88uOi6woW8zPjjUhW0Q1BEEN8B4TP/m4AVrkrr7UxL7v6p+r1IOikfcPwDY2azcoB X-Received: by 2002:a17:902:820c:: with SMTP id x12mr24934460pln.199.1557070586552; Sun, 05 May 2019 08:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557070586; cv=none; d=google.com; s=arc-20160816; b=cNJt6uOLnkTxG9h34W3mffqOKdrETkNwD1Va6afGwPDgfyxiF8rU2SomOveRzHPY4K X6E0ChxYqC5OZnkVsKJJYia7IyeVmUtkqNwbY8CKr/Lk5mqKmOqaXO50ysAHZ6O7H98B 6aYBc7lnycrgBgGH9jBnCaO1XEN3rhgE0hTfcLCwg2tCzWRnFfJbplpSRsT3JeMB8Gz+ fpbYrq7ZbhKqtFnLhDKj4+DyXYVJd4qs0ua+ikZnOPJi1JxcJdPuKWQGz8L28bbYKu9b Ah7SE/Dh4G5SPLy19jtGBrw6ZpFBUfTQOe4roCuDl8IvBsDSFi7ZEbq8nYrxJIOv5lDS WGzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=FVBEW6sKfQcD98so0LtUodd/t1sSW5W7Xo/OMbea+DE=; b=WDKcauEefjsAuHGtZYQNwb3lBU+ycd42e4/lgUf5Fs1B5wEd42h/Mxd6S1TSHEMZ69 ABWCpe3i5g2TKESr0t+XtKaJA80pnZnGHK3PZGQ4Dco4fpO9amoK0BQW8FZjN5H2LNrx XBb9x8JSr5I7NqzDMT8dqFZNkTcy8JbT/3Tz/Jk/XoHe7mO+FJM3Do8K5tYDH1UwWKd8 pOtbFpXOppw21tvi46hrRXUcWQz9DxxdvoObS5vgFs5wPvQEuUEmmMrNolJ3pCxBOCKw MClzNH8MDTARbfy7EO+j4STlfPekfM43q8iaDV4RJr9PsoKuh1IIL0hLmUaGSHhVJCXF xDUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si11410657plb.282.2019.05.05.08.36.12; Sun, 05 May 2019 08:36:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727864AbfEEPVz (ORCPT + 99 others); Sun, 5 May 2019 11:21:55 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:46210 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727816AbfEEPVy (ORCPT ); Sun, 5 May 2019 11:21:54 -0400 Received: by mail-io1-f66.google.com with SMTP id m14so9063003ion.13 for ; Sun, 05 May 2019 08:21:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FVBEW6sKfQcD98so0LtUodd/t1sSW5W7Xo/OMbea+DE=; b=ZQZW/6MmNXWmNLQh1WeUIYR3m7mstrr0c2hKUN6E8skC3SwrW5WVsr5xHbwf97LTxj npOukYzZXPzLjn17sR9qaz7BleeuXL7+o5Uf6WdKxEyCYBb9mf+Nk4iq7dU8Qa+UjHOL X/aD1Ty1Eq+8sB1E95aCnDW5n2hxB7hJwn0lH7GPbngE2sBCrekCItMI2AmhosjNtQ8H vG1YWNsh9bmqMlJOzfELC12m3zTU8yK7mZtQNWsFZvbMiSGKDoa53r2oL5RlS+hyquE4 frkCEoeuJhIfemRyYiI4jvD+cAWoqjR7JoEyA55OlIYrVwhgnuDv3kdD1aBrTph7zhfh QBcA== X-Gm-Message-State: APjAAAWiiVZJOShxjhdes+D2HXzTwE7mr9TViW5dzjQNfeOTssH4HS+0 iKhKCBWIDR3a/O7aR7eonSoKJJ7CXL6k+lAc8eoYLg== X-Received: by 2002:a6b:4f07:: with SMTP id d7mr13015226iob.228.1557069713894; Sun, 05 May 2019 08:21:53 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Lorenzo Bianconi Date: Sun, 5 May 2019 17:21:43 +0200 Message-ID: Subject: Re: [PATCH 12/17] mt7615: mcu: do not use function pointers whenever possible To: Felix Fietkau Cc: linux-wireless , Ryder Lee , royluo@google.com Content-Type: text/plain; charset="UTF-8" Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org > > Remove function pointers in mt7615_mcu_set_bss_info and run function > directly. Moreover remove __mt7615_mcu_set_bss_info since it is run just > by mt7615_mcu_set_bss_info and remove duplicated istructions > > Signed-off-by: Lorenzo Bianconi > --- > .../net/wireless/mediatek/mt76/mt7615/mcu.c | 220 +++++++++--------- > 1 file changed, 105 insertions(+), 115 deletions(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c > index 0e82fcb34e07..0632b506dd57 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c > @@ -676,154 +676,107 @@ int mt7615_mcu_set_dev_info(struct mt7615_dev *dev, > return mt7615_mcu_msg_send(dev, skb, MCU_EXT_CMD_DEV_INFO_UPDATE); > } > [...] > @@ -832,15 +785,52 @@ int mt7615_mcu_set_bss_info(struct mt7615_dev *dev, > WARN_ON(1); > break; > } > - memcpy(bss_info.bssid, vif->bss_conf.bssid, ETH_ALEN); > > - if (en) { > - bss_info.feature |= BIT(BSS_INFO_OMAC); > - if (mvif->omac_idx > EXT_BSSID_START) > - bss_info.feature |= BIT(BSS_INFO_EXT_BSS); > + buf = kzalloc(len, GFP_KERNEL); > + if (!buf) > + return -ENOMEM; > + > + hdr = (struct req_hdr *)buf; > + hdr->bss_idx = mvif->idx; > + hdr->tlv_num = cpu_to_le16(ntlv); > + hdr->is_tlv_append = 1; > + > + data = buf + sizeof(*hdr); > + for (i = 0; i < BSS_INFO_MAX_NUM; i++) { > + int tag = max_t(int, ffs(features & BIT(i)) - 1, 0); > + Ops, I found an issue here, it should be: int tag = ffs(features & BIT(i)) - 1; @Felix: do I need to resubmit the whole series or just a fix for this patch? Regards, Lorenzo > + switch (tag) { > + case BSS_INFO_OMAC: > + mt7615_mcu_bss_info_omac_header(mvif, data, > + conn_type); > + data += sizeof(struct bss_info_omac); > + break; > + case BSS_INFO_BASIC: > + mt7615_mcu_bss_info_basic_header(vif, data, net_type, > + tx_wlan_idx, en); > + data += sizeof(struct bss_info_basic); > + break; > + case BSS_INFO_EXT_BSS: > + mt7615_mcu_bss_info_ext_header(mvif, data); > + data += sizeof(struct bss_info_ext_bss); > + break; > + default: > + break; > + } > + } > + > + skb = mt7615_mcu_msg_alloc(buf, len); > + if (!skb) { > + ret = -ENOMEM; > + goto out; > } > > - return __mt7615_mcu_set_bss_info(dev, &bss_info); > + ret = mt7615_mcu_msg_send(dev, skb, MCU_EXT_CMD_BSS_INFO_UPDATE); > + > +out: > + kfree(buf); > + > + return ret; > } > > static int > -- > 2.20.1 >