Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2286568pxp; Mon, 21 Mar 2022 15:56:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJCRx0MSTLsNsObmnCLC01S0d3oepIO2m48CYzU49JyxgRQU1HUmeutaU0bPb8c1mfwwly X-Received: by 2002:a17:903:2ce:b0:150:4197:7cf4 with SMTP id s14-20020a17090302ce00b0015041977cf4mr15766898plk.132.1647903384082; Mon, 21 Mar 2022 15:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647903384; cv=none; d=google.com; s=arc-20160816; b=K6CZ3s3JIPEfxupEk5cfcWI3wL9Aq2XiGiqDy3xzp/U+7SvxjwXcSTVAlq9Q0czyfE cKAWEINp06q3FqvtVj+Ai/RLEDMwiR+RlA44wFuVGCuO3DwC3rhJuMPJ+7B/EGLJg/WG BmwbBRRM3vsfhu8I4uUBnUBRwgelsdTajr7AdZq8gWhRf3uZ6OvX4F2F0Wm6ElHui4sd oSEV4Jxmn2lCEIfyoAWirXCVhAEyXRMoz0UNFykLCTjpWvsBGHItXKkv9Uqq0trqNfSm JIAkUccBJOMt7++oSTrR4P9aLhKi4FXXrVz6FQw+nokHPsIcP0DGdzbPczhC6KpSWyPZ sebQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=FFCRAYBmgNJzy2PeOWOkk3qJlecr9YOOh+DlBDsRogk=; b=Tc15oxLmiVDrwa60Zmy/JhJpmX/B9WYer+oA04S1KJKjDrGbf4zfeUDgQUibxokYMD 1/9vWGXs+X6t/4GfTJqhffU+6UQ+qxdzWKwj/0O9jVvj6/lWkoBx4CC081zrBHAxRjs1 hHgiB/hW7cCFs/Q1WE81tErJmaSx9gsKvHIvH5KaGMRu281oPoi/OUs1j+bfMqLl1CeB E1CMHEXc73A7nLYLeLQjG29gIlsbf4FzRuBFAkexPqlHTRas8okxliDx7br3wHwj2B/y jGxBafG6+uBrN6K9rmUZY0gX7r4oSe0TDHuNp0PDh9kiFWjIlRPqePB28lINC+uG8SUq YnOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 25-20020a631659000000b003816043ee51si13502322pgw.70.2022.03.21.15.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A4BDE36272F; Mon, 21 Mar 2022 15:07:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245451AbiCTQSA (ORCPT + 70 others); Sun, 20 Mar 2022 12:18:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235541AbiCTQRz (ORCPT ); Sun, 20 Mar 2022 12:17:55 -0400 Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED5324EA1D for ; Sun, 20 Mar 2022 09:16:30 -0700 (PDT) Received: from omf08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 404E023056; Sun, 20 Mar 2022 16:16:29 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf08.hostedemail.com (Postfix) with ESMTPA id A183320029; Sun, 20 Mar 2022 16:16:27 +0000 (UTC) Message-ID: Subject: Re: [PATCH] ath9k: initialize arrays at compile time From: Joe Perches To: trix@redhat.com, toke@toke.dk, kvalo@kernel.org, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sun, 20 Mar 2022 09:16:26 -0700 In-Reply-To: <20220320152028.2263518-1-trix@redhat.com> References: <20220320152028.2263518-1-trix@redhat.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.4-1ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Stat-Signature: dy9osjm7z8ziecmef8cxoawwx5f8z8fy X-Rspamd-Server: rspamout06 X-Rspamd-Queue-Id: A183320029 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+fRE9F4p8U535woQ4iQkf2ESmX4XbbijM= X-HE-Tag: 1647792987-69043 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 On Sun, 2022-03-20 at 08:20 -0700, trix@redhat.com wrote: > From: Tom Rix > > Early clearing of arrays with > memset(array, 0, size); > is equivilent to initializing the array in its decl with > array[size] = { 0 }; This is true. (typo of equivalent btw) > Since compile time is preferred over runtime, > convert the memsets to initializations. But this is not. These aren't static but are stack declarations so these can not be "initialized at compile time". Both are zeroed at runtime, perhaps with different instructions. Sometimes with smaller code, sometimes larger. Sometimes faster, sometimes not. Anyway, I think the patch is good, but the commit description is not. > diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c [] > @@ -891,10 +891,9 @@ static void ar9003_hw_tx_iq_cal_outlier_detection(struct ath_hw *ah, > { > int i, im, nmeasurement; > int magnitude, phase; > - u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS]; > + u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS] = { 0 }; > struct ath9k_hw_cal_data *caldata = ah->caldata; > > - memset(tx_corr_coeff, 0, sizeof(tx_corr_coeff)); etc...