Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7527602yba; Thu, 2 May 2019 11:25:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7PzaGrpq33AcoUhpSrmPHpdbelyEilejBJaxwRNmgZCpJLqGbhjeiknwYNDMGg0qIuw/T X-Received: by 2002:a62:b61a:: with SMTP id j26mr5605073pff.203.1556821546081; Thu, 02 May 2019 11:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556821546; cv=none; d=google.com; s=arc-20160816; b=PdDGiyVvfNcZb0PvUc0P7qg1X7quLUL03eiWEXWvXqlvTtOv2RJgdlx6RIKUZDeH92 RJWdgnwT1HZQxWOllCcw/KDlRXXkfv3CS4j+1c8PQ2Xi2Rhn9dSJjVBuvJYiZcU0XyMX FkZ5ACxNU9lv/ahyVDEMKibvUAWgIKzu0UBel/LXvhOjnf95oufrErEJqQK0iG9EtgFp eUCfcUoLJLMNUwnNtxDnGaT0gktu9q+d1YCXwAgSr4nEf+NQYylYd346LZ04VLY8BzNa AqW5Ifdogib+qyDAx5zPHUCYqArPvByxmmkdi33IsBrXbelvZtjGqqQfKBvEQyY5r0YJ WruA== 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:dkim-signature; bh=n+j627VNtYu9oTIOSNUI61HYi4gX8hdlesITEjnAgcc=; b=efDW1eTQdATX3hR0Qmh3c6s+YKrzPG4YMaFnLfcOuj2MZBeNFFo/QohyRdxRuvFT8D mxaEzbrSB60awZsQ89XGpcKOErUPOPgubIBLmFHyA5rXVaLdiVxB+2bqMEruhKXYWC8N 6dCruxsETChrogpfErvRVF1RKU7bKyKd+xmk93NME5WsztHVR8mYbU9QXDxgBRPQdyvW 1jNfVrGjAxQq/NH6U/4dV+hD6rHG2/vD2ewriko7zTHuIya2+LPeeewSnLDRQDH+LMc8 ETpKS9DQVf1D0MSFqeee0/ZIjfkBWsOamSUfaFZbkCFJpn+IvdtvSSXi/SxIJgE0FE8/ gRVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=e2DXXOcn; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si42402254pgh.516.2019.05.02.11.25.30; Thu, 02 May 2019 11:25:46 -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; dkim=pass header.i=@chromium.org header.s=google header.b=e2DXXOcn; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726120AbfEBSYN (ORCPT + 99 others); Thu, 2 May 2019 14:24:13 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:37823 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725962AbfEBSYN (ORCPT ); Thu, 2 May 2019 14:24:13 -0400 Received: by mail-lf1-f65.google.com with SMTP id h126so2613557lfh.4 for ; Thu, 02 May 2019 11:24:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=n+j627VNtYu9oTIOSNUI61HYi4gX8hdlesITEjnAgcc=; b=e2DXXOcnaOQdTc8G1Ffgclt3BIrHSiZK7pNjYbYL9UkogyY3SqnJPWabSYkyrgT8vi 7/koh8Vd4xDT198WPDBmWETwJcTq/GcpJWUwGYVL6/tf5fZ0lShHtXph0xhxN45HQRFm VTbhoP2SaZbfKTL0rRc0EK+gnJfsVt6Rx4v1o= 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=n+j627VNtYu9oTIOSNUI61HYi4gX8hdlesITEjnAgcc=; b=iQZ/PjbzfGGo9oqKAbFLzSfgcpTGi8EaSUO9Kya8FsLBw6SR9S4/k0Wc14VfQMw6Ku x7FhwfeblZ1ZabhzgnySI/FnKUPVbcOF/3D5cDzB8U+Y4yIxRsRRRWPn7nHTrAIikq90 3bEIYS9NGIrCtaUtVZiZtG1iltY0EOI5DQPOFEnbWo+xOaJiJhteqFeIq4jwNYxNUWt6 08m+wWnsZcYGYc/ONtOoQCdz4TKu/X21r7+EjgIdFz/FZknDLRgZJ7u/ZlxXp5mWD27K XPflzsY5Z5JSU1AgKvIYFK+oXOiy8I9XrSppPH8z2HKFBQn/LgqXNmQ313pqfNwqE+2Y Bh1Q== X-Gm-Message-State: APjAAAUiidxbcOenU0G1D/Fh4s596I0bHTpAjYFLD7t1Hz28elsvqetu v+fBqf1iGPMvvbhraeNSTWTlSi3L5Pg= X-Received: by 2002:ac2:4205:: with SMTP id y5mr2733434lfh.15.1556821450485; Thu, 02 May 2019 11:24:10 -0700 (PDT) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id j27sm9554951lfk.97.2019.05.02.11.24.08 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 02 May 2019 11:24:09 -0700 (PDT) Received: by mail-lj1-f176.google.com with SMTP id e18so3090431lja.5 for ; Thu, 02 May 2019 11:24:08 -0700 (PDT) X-Received: by 2002:a2e:3e18:: with SMTP id l24mr2673440lja.68.1556821448424; Thu, 02 May 2019 11:24:08 -0700 (PDT) MIME-Version: 1.0 References: <1555653004-1795-1-git-send-email-yhchuang@realtek.com> <1555653004-1795-5-git-send-email-yhchuang@realtek.com> <87bm0npsp7.fsf@kamboji.qca.qualcomm.com> <04c534eb-af32-adfc-62bb-90d83526af1a@lwfinger.net> <87a7g6ni31.fsf@kamboji.qca.qualcomm.com> In-Reply-To: <87a7g6ni31.fsf@kamboji.qca.qualcomm.com> From: Brian Norris Date: Thu, 2 May 2019 11:23:56 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9 04/14] rtw88: trx files To: Kalle Valo Cc: Larry Finger , Tony Chuang , linux-wireless , Johannes Berg , Pkshih , Andy Huang , Stanislaw Gruszka , Greg Kroah-Hartman 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 On Wed, May 1, 2019 at 11:30 AM Kalle Valo wrote: > My comment was about handling firmware commands and events as a byte > array, not about bitfields. So that instead of accessing 'index + 1' and > 'index + 4' you should create a proper struct for the command and access > it using 'cmd->foo' and 'cmd->bar'. Sure, bitfields you still need to > access using FIELD_GET() or similar but having a struct for commands is > a lot cleaner approach. And most upstream drivers do this: ath10k, > ath6kl, iwlwifi, p54 and whatnot. I think I pushed Tony away from the bitfields (he was using a struct plus some ugly bitfields / #ifdefs pre-v8), and he ended up with this (in v8). I noted on the v8 cover letter that one can still use a struct, but just avoid using bitfields -- so you would still have 'u8' and '__le32' fields (or similar), and do the right le32_to_cpu() accessors (sparse will help you) plus FIELD_GET() (for any necessary bitfields). Brian