Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2514279pxa; Mon, 17 Aug 2020 11:31:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxH01fsIFxxlBsvtqIGMxE+5Cd6yvNgHYpfi/2x2rh0Hp/ATTza6rhhaQ55RmH5XPFlHF+P X-Received: by 2002:a17:906:289a:: with SMTP id o26mr16109192ejd.309.1597689087123; Mon, 17 Aug 2020 11:31:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597689087; cv=none; d=google.com; s=arc-20160816; b=MZuL/SgOo73NwRVarnO5zjHcfDcxMqCM+P4qfOdELVngWi7E0szO3RQiEfyowikUvH Fxq0W2P5y3X/6/L9+GKFZCBEqD9+geLdih9iDZa2eca819OgNd7v/+V8dFfuYjIXbekk m3fM3u+u3q1eBjjBFlZ0KiKiMFdLq95AS00gUfw76EuCWuawVo3Ci4XJ55EYmbuE5DkI uwxdQJACf9RlGcapg3CLPoVvVTI4MwcYAB7Muqb3DBzAtiULTzkK3c3F3RO9LFMOG9NV qwUhjmwAtrHdlmGHXjjEzEG0b7vPNAJVCYRxw/SU8B7UwqP6yLFYuAnMzeZP/neDPWK5 wYOg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=AnbulxYHbbnMaTcW3IL3aMkMxlNLTYvtJz6E5z89MZ0=; b=zr2MkRy+Z0CLOxPXpBSr2mP6OeFrmeMQ+R45U9Qyz7OMbdbL3bdhEFXE6MHT9TTM26 ieLzX8UMWOikTktprvNQhZ+vjN0cv3taIevUMyTK4oafgHasLShBBWmmHuAubuLgo2oI tFNYC+Jys4WLGdrwTJOPLNJ2V3wuHfWjdisoKvzDJxR8i5ktLoEj31Pc+N7jZlPS2TfR ppqaXKakoSEOTt/N6uYwLgddM8PGDb6F2DyO73rKSj7IhjvtArDCFTib3UdCz1E4R/VM CYIwmrfxCFCjCSypLgPcV7M32jqiRkxezBglOacAnQVYOfjYKN2Z2TY7gnrU5raKlOJY u35Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=d9WWd1dn; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y16si12646589ejk.128.2020.08.17.11.31.03; Mon, 17 Aug 2020 11:31:27 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=d9WWd1dn; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391027AbgHQS3m (ORCPT + 99 others); Mon, 17 Aug 2020 14:29:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391020AbgHQS3g (ORCPT ); Mon, 17 Aug 2020 14:29:36 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECF05C061389; Mon, 17 Aug 2020 11:29:35 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id m20so13119783eds.2; Mon, 17 Aug 2020 11:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=AnbulxYHbbnMaTcW3IL3aMkMxlNLTYvtJz6E5z89MZ0=; b=d9WWd1dnBCzwRF16kWp9hvc0xJxGTyz5ckoCLK1aKlfQrYg0xfdeK+baSKaLkKxKNt M5QNPYjgAi/qZJ7P217XJtkMZy0cpksNysozDoqyh+YUVtc2vHgZtHAc4gcdyxCh5FOS ltyuafyKBdUoCXfJ5blqRYqX6RMjE+dOphK5+3uoCM6UCvjtoB0gZKUrkb0GyN1z4I1H RUPvnnlLCpLTidoQBrn1gynd0p88bap8mSGzZsmhd+LlHcHHvsA72bu8OYI4gdbVZHmF F5VxFI25xTMPHrfaJjhozsctZafPdAAW/yTRb5utTNYn9f27gwVVNK57rlK7i4ukBv07 wRSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=AnbulxYHbbnMaTcW3IL3aMkMxlNLTYvtJz6E5z89MZ0=; b=TA2C9X1cp3R9EtOdhUx3dPagETSiVhFY/NfwBxBqFtpAy680krYQY8J8BcrBj9PhCe uZvWftUas0fWXfRftBOLBum9Hcjf5NVpR1/OJBRqvAnAAKvujYY+7/3F3O9v5aQYEOAt vqF0rnKV+gAkVUVF7yQldsTJA7q+mXB5PaLBULptlmShFy8CHfE6g8pvW4awKN24j78c Yf5G+zQ/ckCSROWuDxgXJakd2ipnusprcxmIbXqRbx5GYaCl8EZu+c3o9Fh4xFOsitlQ i1RwaKkZ5njSJZ7IMAOAVPWkxzipEHdNGVVE7RdYcjyzojjOR6cPCYnmatv0g2aDwPXO gKig== X-Gm-Message-State: AOAM530SLE8A40IYAU7goPjdNHZhNG17r8gk6TyLVxXzjMGV+uD5HYrn MxcfGFF3QMVUu/KeQ/6wJwk= X-Received: by 2002:a05:6402:7c7:: with SMTP id u7mr14042288edy.283.1597688974574; Mon, 17 Aug 2020 11:29:34 -0700 (PDT) Received: from debian64.daheim (pd9e293c0.dip0.t-ipconnect.de. [217.226.147.192]) by smtp.gmail.com with ESMTPSA id 1sm14758452ejn.50.2020.08.17.11.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 11:29:33 -0700 (PDT) Received: from localhost.daheim ([127.0.0.1]) by debian64.daheim with esmtp (Exim 4.94) (envelope-from ) id 1k7jsz-000522-3Y; Mon, 17 Aug 2020 20:29:33 +0200 Subject: Re: [PATCH 08/30] net: wireless: ath: carl9170: Mark 'ar9170_qmap' as __maybe_unused To: Kalle Valo , Rasmus Villemoes Cc: Lee Jones , davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org, Christian Lamparter , Johannes Berg , linux-wireless@vger.kernel.org, netdev@vger.kernel.org References: <20200814113933.1903438-1-lee.jones@linaro.org> <20200814113933.1903438-9-lee.jones@linaro.org> <7ef231f2-e6d3-904f-dc3a-7ef82beda6ef@gmail.com> <9776eb47-6b83-a891-f057-dd34d14ea16e@rasmusvillemoes.dk> <87eeo5mnr0.fsf@codeaurora.org> From: Christian Lamparter Message-ID: Date: Mon, 17 Aug 2020 20:29:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <87eeo5mnr0.fsf@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2020-08-17 14:59, Kalle Valo wrote: > Rasmus Villemoes writes: > >> On 14/08/2020 17.14, Christian Lamparter wrote: >>> On 2020-08-14 13:39, Lee Jones wrote: >>>> 'ar9170_qmap' is used in some source files which include carl9170.h, >>>> but not all of them.  Mark it as __maybe_unused to show that this is >>>> not only okay, it's expected. >>>> >>>> Fixes the following W=1 kernel build warning(s) >>> >>> Is this W=1 really a "must" requirement? I find it strange having >>> __maybe_unused in header files as this "suggests" that the >>> definition is redundant. >> >> In this case it seems one could replace the table lookup with a >> >> static inline u8 ar9170_qmap(u8 idx) { return 3 - idx; } >> >> gcc doesn't warn about unused static inline functions (or one would have >> a million warnings to deal with). Just my $0.02. > > Yeah, this is much better. Yes, this is much better than just adding __maybe_unused :). To be on the safe side (and to get rid of a & in tx.c:666), the "3 - idx" should be something like "return (3 - idx) & CARL9170_TX_STATUS_QUEUE". I think its also possible to just use clamp_t (or min_t since the u8 has no negative values) or make use of a switch statement [analogues what was done in ath10k commit: 91493e8e10 "ath10k: fix recent bandwidth conversion bug" (just to be clear. Yes this ath10k commit has nothing to do with queues, but it is a nice, atomic switch-case static inline function example).] > And I think that static variables should not even be in the header > files. Doesn't it mean that there's a local copy of the variable > everytime the .h file is included? Sure, in this case the overhead is > small (4 bytes per include) but still it's wrong. Seems to be "sort of". I compiled both, the current vanilla carl9170 and with Lee Jones' patch on Debian's current gcc 10.2.0 (Debian 10.2.0-5) and gnu ld 2.35. The ar9170_qmap symbol is only present in the object file if ar9170_qmap is used by the source. In the final module file (carl9170.ko), there are two ar9170_qmap symboles in the module's .rodata section (one is coming from main.o code and the other from tx.o). (The use of __maybe_unused didn't make any difference. Same overall section and file sizes). Cheers, Christian