From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CAFCC4167B for ; Fri, 16 Dec 2022 11:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230474AbiLPLQ6 (ORCPT ); Fri, 16 Dec 2022 06:16:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230463AbiLPLQl (ORCPT ); Fri, 16 Dec 2022 06:16:41 -0500 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CC9B566F2; Fri, 16 Dec 2022 03:16:41 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 0790732005B5; Fri, 16 Dec 2022 06:16:39 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Fri, 16 Dec 2022 06:16:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1671189399; x= 1671275799; bh=urmZCaqP5uUKG9f3w/5JTsr/NxjJLfj/bS5O5zJbL3k=; b=B P9QPaWyUZsW0J7NWwNNXiRe/NP294gh+txwjjTkkU7clAeWF6FQVMwjQPV++4p1G 7zFWR2NZpqnvdtedG0DPxcX0WJ5f1gT450S+q96g0V7/x8i1qpxhKnnQFLO3QAfS sKp/ijlHu1aKWKhWG3rt6l42y1GQxjdALSSObWQH1iPo+1dEBoF/J+lr7N8Sst32 fNnN98J8FL767UA7dMHFGUxba6wuqILe4HlKqwngxvEWCfCWVoA70R13rKvAytDa pvY//qtyEeKZvD7dtLw5bG/u6lJl0g/uUEn3PC2rmoremmWGeEnCoTKj+5YVTHuX NTpScNCJLj0Veh/qWENzg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1671189399; x= 1671275799; bh=urmZCaqP5uUKG9f3w/5JTsr/NxjJLfj/bS5O5zJbL3k=; b=h JIGQ2wRfu8pouckzEfxNWbPfRSPaO6SywY5VipBipFb0SYlKTf2BU8rQETn7goSG ZuxIpeT9eDYAza2ft8WopgRVO8PQsRJYejVHzw1l/7WrzETdahgwh1dqKoj8gRhk zjKxAnrdOQH1s8vgq1Pcxjf4LkpU1pxVakRPnprG+IurIzY8pMXgmCGII3trEqqF wtuZRnlvP7SXRhNZr4ShfO+zGsYmWpdBQipfyMVfY+BJvoquqpC8ms4Bz6gxQvE6 NP/fQPmjyv2ZKdpMCJS1XRSfC0CSylaOVKRkDIK9Ojy1bZad6S25sf36DPHbsl8B kBY6Jv0MDpVr6tNR8VcBQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejgddvgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepgeefjeehvdelvdffieejieejiedvvdfhleeivdelveehjeelteegudektdfg jeevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id D009AB60086; Fri, 16 Dec 2022 06:16:38 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1185-g841157300a-fm-20221208.002-g84115730 Mime-Version: 1.0 Message-Id: <486f9bc9-408f-4c29-b675-cbd61673f58c@app.fastmail.com> In-Reply-To: <87k02sd1uz.fsf@toke.dk> References: <20221215165553.1950307-1-arnd@kernel.org> <87k02sd1uz.fsf@toke.dk> Date: Fri, 16 Dec 2022 12:16:17 +0100 From: "Arnd Bergmann" To: =?UTF-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , "Arnd Bergmann" , "Kalle Valo" , "Pavel Skripkin" Cc: "David S . Miller" , "Eric Dumazet" , "Jakub Kicinski" , "Paolo Abeni" , "Tetsuo Handa" , linux-wireless@vger.kernel.org, Netdev , linux-kernel@vger.kernel.org Subject: Re: [PATCH] ath9k: use proper statements in conditionals Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 15, 2022, at 18:16, Toke H=C3=B8iland-J=C3=B8rgensen wrote: >> index 30f0765fb9fd..237f4ec2cffd 100644 >> --- a/drivers/net/wireless/ath/ath9k/htc.h >> +++ b/drivers/net/wireless/ath/ath9k/htc.h >> @@ -327,9 +327,9 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB= (struct sk_buff *skb) >> } >> =20 >> #ifdef CONFIG_ATH9K_HTC_DEBUGFS >> -#define __STAT_SAFE(hif_dev, expr) ((hif_dev)->htc_handle->drv_priv = ? (expr) : 0) >> -#define CAB_STAT_INC(priv) ((priv)->debug.tx_stats.cab_queued++) >> -#define TX_QSTAT_INC(priv, q) ((priv)->debug.tx_stats.queue_stats[q= ]++) >> +#define __STAT_SAFE(hif_dev, expr) do { ((hif_dev)->htc_handle->drv_= priv ? (expr) : 0); } while (0) >> +#define CAB_STAT_INC(priv) do { ((priv)->debug.tx_stats.cab_queued+= +); } while (0) >> +#define TX_QSTAT_INC(priv, q) do { ((priv)->debug.tx_stats.queue_st= ats[q]++); } while (0) > > Hmm, is it really necessary to wrap these in do/while constructs? AFAI= CT > they're all simple statements already? It's generally safer to do the same thing on both side of the #ifdef. The "do { } while (0)" is an empty statement that is needed to fix the bug on the #else side. The expressions you have on the #ifdef side can be used as values, and wrapping them in do{}while(0) turns them into statements (without a value) as well, so fewer things can go wrong when you only test one side. I suppose the best solution would be to just use inline functions for all of them and get rid of the macros. Arnd