Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4531501ybl; Tue, 20 Aug 2019 13:30:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7aP+i+DvxPvC/JJPcG3WdJ2q4E5NOZJY0Ly2Hlub1dRvRLg0U38i1Ci9O8KwRCOkmacxE X-Received: by 2002:a63:188:: with SMTP id 130mr25992438pgb.231.1566333007413; Tue, 20 Aug 2019 13:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566333007; cv=none; d=google.com; s=arc-20160816; b=meA43LAJ7ijBljnWilvZYzsCgTJfDVhObRofEiFZ+XTe8Ucy8K9a5ZAGrYqhJiNP8s 7hvz8BGkcrhBsm91rN94d/Wi5yOmnM6w5s+PPVjsPp/ezCx8yu6ueSKUJhC5qvjeG9yF lcnH75Qz0Sx8tqz8FWdve/Fqlz9RdO5a2UT+W180dVpnDRL4UmyK6uxa8dqa8suGgwSi fkcTznTOeqCEbeWGqMffEMIpaC800N6YAAaexPeUYx7McSSrQU6UjfLXPq1G5B/siCPq /QONAXeGmO/SalabeEf5j3UKP7zO9lKe5Adcv6IONr02voQEH7Y3k/BkIoTI3MCRJnKA YAqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=UWZQ1QiINWxuANfijDt3/M66L00qm5HbKeGLVePC2vE=; b=gabkd2awQXZ7LTMqZw8C3gxAmfXMhCmslyWzszUp0Xip0XzxcRUJ0wXkUUSzwbdcGa 35RFsG6U4czqVM2rfQnOs9urj6hvJdCN/B9YmcTM0elBw2s8f742Ma/vCipPciwc1G4+ SkUtRxLVoMsAITouWDe1LsA04IiCAFsifg1ipXTkll29zZeM/qY3JRYwsZvZFgqFT69p XqCxStGeL6E+2dk/NJYD2gGffgq7G7QoCwTo3V1SOJr8P/0WGARu9l2xrVc75TdjEKUL eTCwAliP3o1I8nyPejQ2oO5e8J51S6sVZgd1v6c8dPdL/FBWUhtIdOcVzki9z0XafVMW aorA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j62si12807777pgd.170.2019.08.20.13.29.52; Tue, 20 Aug 2019 13:30:07 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730515AbfHTU3r (ORCPT + 99 others); Tue, 20 Aug 2019 16:29:47 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:43536 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727358AbfHTU3r (ORCPT ); Tue, 20 Aug 2019 16:29:47 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1i0AlC-0007yy-UV; Tue, 20 Aug 2019 22:29:43 +0200 Message-ID: Subject: Re: [PATCH 46/49] ath11k: add wmi.h From: Johannes Berg To: Kalle Valo , linux-wireless@vger.kernel.org Cc: ath11k@lists.infradead.org, devicetree@vger.kernel.org Date: Tue, 20 Aug 2019 22:29:41 +0200 In-Reply-To: <1566316095-27507-47-git-send-email-kvalo@codeaurora.org> (sfid-20190820_181541_270184_9285B240) References: <1566316095-27507-1-git-send-email-kvalo@codeaurora.org> <1566316095-27507-47-git-send-email-kvalo@codeaurora.org> (sfid-20190820_181541_270184_9285B240) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, 2019-08-20 at 18:48 +0300, Kalle Valo wrote: > > +enum wmi_cmd_group { > + /* 0 to 2 are reserved */ > + WMI_GRP_START = 0x3, > + WMI_GRP_SCAN = WMI_GRP_START, /* 0x3 */ > + WMI_GRP_PDEV, /* 0x4 */ If you're going to spell out the numbers anyway, why not do it in C rather than a comment? WMI_GRP_PDEV = 0x4, would tell you just as much, and be much less error-prone. > +struct wmi_pdev_set_hw_mode_cmd_param { > + u32 tlv_header; > + u32 pdev_id; > + u32 hw_mode_index; > + u32 num_band_to_mac; > +} __packed; Does it really makes sense for something to be using "u32" (i.e. host endian) but then __packed (kinda tagging it as "I am using this with the hardware, don't change the layout")? That really applies to a lot of the things here. > +struct channel_param { > + u8 chan_id; > + u8 pwr; > + u32 mhz; > + u32 half_rate:1, > + quarter_rate:1, > + dfs_set:1, > + dfs_set_cfreq2:1, > + is_chan_passive:1, > + allow_ht:1, > + allow_vht:1, > + set_agile:1; > + u32 phy_mode; > + u32 cfreq1; > + u32 cfreq2; > + char maxpower; > + char minpower; > + char maxregpower; > + u8 antennamax; > + u8 reg_class_id; > +} __packed; Bitfields in FW structs are even less likely to work right, I'd avoid that. (and if you have this copy engine do endian conversion, then the u8 fields won't work right since that ending seems to be working on u32s?) That probably all applies elsewhere too, but the file is pretty long ;-) Personally, I'd also consider splitting internal driver usage stuff and FW API into different files, but that's your decision. I just find it lets me understand it better even when I'm looking at it myself. johannes