Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1192503rwd; Thu, 25 May 2023 09:09:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ62bo/RCXykt4H1U9hdrvorGQW/IVKqdVkeGKw6kBEHrvLnQrpYssHwZOE1XkhWh9PasqU4 X-Received: by 2002:a05:6a20:938e:b0:10b:7400:cef0 with SMTP id x14-20020a056a20938e00b0010b7400cef0mr17239748pzh.39.1685030971245; Thu, 25 May 2023 09:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685030971; cv=none; d=google.com; s=arc-20160816; b=U2Tdz22b3ePKEBAtOAuqO4U1syYurjRUXNEu78pX0AkXmz57WiTTwI6G6k2LPkaHP1 MIVmjNRlx0U+6jTX3iqb8YQVSs3WRiMvh7NCrlRYeRnDk07qIR45tzi0hb1d46UXWeh2 9bUtbh+ZelwFgUfb7neTS9XTh8c/6PUiSPhO3jpfl419rplZDOJTzisCgsd2uFumlVqv JzmYk5nuZqVE5GW+9V5QOknDDsfxw6MsfSrQ3AfUWbo4zWU01KDtp9n2om/RWTy5ek7y 9wFvvEo9T5Ek8OMFUd4A0fOGK7vdfryPDGVYfYNYxPoTOdVW9IYLEkeVA7a4pHszLNNp 9RIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=vwBp8MAi5/b3XV8Cn6pCEKXSUkiayqL+gkta+tvYdHc=; b=Xn7WZFrIVwq8D22C2KtQQx5UjSlW9M/F5YCwh9q5uboc8G0orXi2aF67flO4h2woWU 5xH8yRr4qEjKs27HXMdqcnG38snY+q3S4mfL8HmbhYvUehpt8Xuln79gbPznoq8pxRy8 sH/NbgmBGlceFHLn/86GzHugbUNKrHN5xmseBnCqDeN8ksxI8/Nvuaq5FKl/a24Gyns5 nLZXSEK9e2V3mxxIaXdWtrvJ8UMsO9/9239ni5hpcE/4CD63PugpwS6yWoWizVLeMdqE 3YOwPiV91VXyVyCM8fADzB4Cr3IxGeXiIypkGkP/K85Um6HOSxxzk0B0GngdAhIUgf9b 6INA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kMPJEV4C; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv9-20020a632e09000000b0052883ac6949si1522453pgb.13.2023.05.25.09.09.23; Thu, 25 May 2023 09:09:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kMPJEV4C; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231542AbjEYQIJ (ORCPT + 63 others); Thu, 25 May 2023 12:08:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236207AbjEYQH5 (ORCPT ); Thu, 25 May 2023 12:07:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37F96E57 for ; Thu, 25 May 2023 09:07:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C199F6473E for ; Thu, 25 May 2023 16:07:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 929EBC433EF; Thu, 25 May 2023 16:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685030855; bh=cgi9jL7KeOFxvFfDYxt1/yJP6pVi7GYwh5qEAHiiARM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=kMPJEV4C5m4UGm5B4P/XQ2Ybsak6LDmDGG7Z1j+tQsRzKmo9NlddTF60lLsLz0SzW EDsNC93PX3uvPC//8i1Kj1hjUMVwigWICbW8KGAzQkOWuzxrof3gQ13NB88ZcvTkcL 4FRNcJIxGhuvjVdHkAFSPsO2nw7gbJRCiRCjefIfJIxfngyyyChnvh8/rPHzMhZ78B tB/lA1J6Vi2P9KPVAO/MuzoX8nsLUhe3djIvgxvtDltUfxSsFXeLpBZvrGKg8vNbvF boIKg9c5ydSBCuw3V29CLxfib4rX0u1a7OxMDFlW1Kl1RP9GhIxFDUgF0G2GBu1c3L cxjieVu9TL8Fw== From: Kalle Valo To: Ping-Ke Shih Cc: Subject: Re: [PATCH 5/5] wifi: rtw89: use struct to access register-based H2C/C2H References: <20230522122513.13559-1-pkshih@realtek.com> <20230522122513.13559-6-pkshih@realtek.com> Date: Thu, 25 May 2023 19:07:30 +0300 In-Reply-To: <20230522122513.13559-6-pkshih@realtek.com> (Ping-Ke Shih's message of "Mon, 22 May 2023 20:25:13 +0800") Message-ID: <87cz2ol7i5.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Ping-Ke Shih writes: > The register-based H2C/C2H are used to exchange commands and events with > firmware. The exchange data is limited, but it is relatively simple, > because it can work before HCI initialization. To make these code clean, > use struct to access them. This patch doesn't change logic at all. > > Signed-off-by: Ping-Ke Shih [...] > --- a/drivers/net/wireless/realtek/rtw89/fw.h > +++ b/drivers/net/wireless/realtek/rtw89/fw.h > @@ -18,15 +18,51 @@ enum rtw89_fw_dl_status { > RTW89_FWDL_WCPU_FW_INIT_RDY = 7 > }; > > -#define RTW89_GET_C2H_HDR_FUNC(info) \ > - u32_get_bits(info, GENMASK(6, 0)) > -#define RTW89_GET_C2H_HDR_LEN(info) \ > - u32_get_bits(info, GENMASK(11, 8)) > +struct rtw89_c2hreg_hdr { > + u32 w0; > +}; Why this is u32? Shouldn't it be __le32? > +#define RTW89_C2HREG_HDR_FUNC_MASK GENMASK(6, 0) > +#define RTW89_C2HREG_HDR_ACK BIT(7) > +#define RTW89_C2HREG_HDR_LEN_MASK GENMASK(11, 8) > +#define RTW89_C2HREG_HDR_SEQ_MASK GENMASK(15, 12) > + > +struct rtw89_c2hreg_phycap { > + u32 w0; > + u32 w1; > + u32 w2; > + u32 w3; > +} __packed; Here as well? And I saw more in the patch. Of course these were already there so isn't a problem introduced by this patchset, but I started wondering if we are missing some little endian types? -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches