Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp48693pxb; Tue, 14 Sep 2021 18:17:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7mBTk4E/v1g7qrYDVE28tTY7rpJrchyHkKVVoWkLKRDEewAwFXUO/H2XyLJA9s8ZWNud+ X-Received: by 2002:a92:6a06:: with SMTP id f6mr14388384ilc.16.1631668673799; Tue, 14 Sep 2021 18:17:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631668673; cv=none; d=google.com; s=arc-20160816; b=ywccV8a6xx+ClI6g1IprD+F1rwzfSIYTZ/wlU7JP6KkI94/MHor4Gb7zIBSROCCvMx M+h6ue/SL3KPRKgw0H927gVdSI1aTMBqgNvjOI+6I9O6PZaJoTXL2noW/fMrvnKyAVjX kS4yJwvnDvfRo5zejVJQBFD6U0RBiKVpXmaXld1nYJSs0yMJ0a9UKg/AX+7ZFge0uneE RWY9lYG8Im1upqNo1Lir4uItMWgVSmty9R50GLI9C52Gk0YMVhlXREu+0qCNxN43uDj8 EeCC4RmlrMa1AbmVtF/bMg1R8bNytYFs+vuE/zwRkFxBXP3fF+g5Gh8G7Xa2e+TQYpj1 uU1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=5RsDDt2OJSjoaLe6p5rAgee39wueeNH583UU725naUM=; b=NslzyM+1bwuo0Ym6ozIHIXE/emoMWYoyHfEpvr4DYQudLN3W33yfmzmmjkMMI1KcBB RgYJNEN0aQw34foTMeALPQedFT2ob+FRHWbF8F8sYHjTDjt9ARmAyz+Q6p2/V3OBdMLj 5IbIcBQXsSn2C9puYWkI/CgkCwa31U5zHyVM3NXBRRzoTFl9JXjGl/XwcJV5NKEaQyA7 lOlaZ5sjhU/Xl9X6Cl2OJCqQRHuMIGXUluZiCOcXGPdTUzTn5OoHVVK6ZKDMdFFqwd4K q96/dEMw4jYQDFeh9GEBfTxvUQIA8kZEjkSh/v3cU0iXeHvn/C9Zwh5W8+kvAuGxIKHI 8Ftw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si12484070ilt.54.2021.09.14.18.17.40; Tue, 14 Sep 2021 18:17:53 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232302AbhIOBQw (ORCPT + 99 others); Tue, 14 Sep 2021 21:16:52 -0400 Received: from mailgw01.mediatek.com ([216.200.240.184]:64858 "EHLO mailgw01.mediatek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231156AbhIOBQw (ORCPT ); Tue, 14 Sep 2021 21:16:52 -0400 X-UUID: 95b4d3eb944349a784f8472e946ed61f-20210914 X-UUID: 95b4d3eb944349a784f8472e946ed61f-20210914 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1756171188; Tue, 14 Sep 2021 18:15:31 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 14 Sep 2021 18:15:29 -0700 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 15 Sep 2021 09:15:29 +0800 From: To: , CC: , , , , , , , , , , , , , , , , , , Subject: [PATCH v1 09/16] mt76: mt7921: make all event parser resuable between mt7921s and mt7921e Date: Wed, 15 Sep 2021 09:14:42 +0800 Message-ID: <764759a9a2befe09000863f04676287665675555.1631667941.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang The longer event such as the event for mcu_get_nic_capability would hold the data in paged fragment skb for the SDIO device so we turn the skb to be linearized skb before accessing it to reuse the same event parser betweem mt7921s and mt7921e. Tested-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index f5a8f7fa4244..8e49df20a8cb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -458,7 +458,14 @@ mt7921_mcu_rx_unsolicited_event(struct mt7921_dev *dev, struct sk_buff *skb) void mt7921_mcu_rx_event(struct mt7921_dev *dev, struct sk_buff *skb) { - struct mt7921_mcu_rxd *rxd = (struct mt7921_mcu_rxd *)skb->data; + struct mt7921_mcu_rxd *rxd; + int ret; + + ret = skb_linearize(skb); + if (ret) + return; + + rxd = (struct mt7921_mcu_rxd *)skb->data; if (rxd->eid == 0x6) { mt76_mcu_rx_event(&dev->mt76, skb); -- 2.25.1