Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp808048rdh; Wed, 23 Aug 2023 16:08:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECO6/K6abVqNTk1/sfx3SVAAa4nqbUqbz3unRxHC5jkr2sqsy+6OrnpQi2mtkGY/9YzGl7 X-Received: by 2002:aa7:de12:0:b0:523:45df:55c with SMTP id h18-20020aa7de12000000b0052345df055cmr9619859edv.41.1692832101517; Wed, 23 Aug 2023 16:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692832101; cv=none; d=google.com; s=arc-20160816; b=z+KgAARXgzoc8aG5wJeW1OEijR+E0dNA3KvttVK5ZiYTVugPLJUGqiCo+qO39P3JjM uise4w7IoFULNR+QynOzTc0zPfOrM0F9kTSDIDQ1LokPDTkbEWc/tOYxEcoPNMj51o8J EAFek0+54w4ggLIZmV38My95N2XvuG5rcNZtEIBmzukkj1xV0iim5WuKw4fQBIXyOgHd zW4Y7cDgFC1zng1Uus8pYE5opVnCHD99ssg9EEuBMc1ZYR/GCzdASWpw9gJtXGRolh9u OuZ0hYPtsJRM5hkMDFEizBhMC82rMm49T0KwBOkzCoyZQcDRZf+dRT81ubhZVfQRje8T A0Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dkim-signature; bh=Pyxe9/RaloSKpvQ9LSGZxo/kGhNGBQgxfxC8lNtg8oE=; fh=yRoUGgO4LohBJmHBpJyoSTSHSDeyX68p/2gfhrBI5gA=; b=uWnXT83OC/gqsTQ6fowGMozDJiHTt31yE1hGNrhtz7ehgbcwri+q6uu6VmATGffeGu uVX1IKmzBquEcDVXj6DlGnRg5m9KhTHV8gSibO92MzXwi1fT+Az2ymb0r1kwqTlLLysi 7ldlWm28Rm8ZE3d+yaL4g3mp28s3b9FXKull0HtkOPaNC+WyL7x8of1pIP+f7OQXYe30 ri7hi5r/Is5mYOnENEs/4pjaV98t6jK4wE+1RamQW9Xm5T2NQnAl0IoaWy0CvwNCWYtg AvkRq3eFSEDyF+YymFVxvtdyWORJqKHLmH9l6T28SU5jUhivYG8SAYZq4MfRPkhQ8M91 J4SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="O/7IdDqg"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u23-20020aa7d557000000b005231f38ea66si9513146edr.680.2023.08.23.16.08.02; Wed, 23 Aug 2023 16:08:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="O/7IdDqg"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234974AbjHWOQq (ORCPT + 55 others); Wed, 23 Aug 2023 10:16:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235135AbjHWOQq (ORCPT ); Wed, 23 Aug 2023 10:16:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 933B110D5; Wed, 23 Aug 2023 07:16:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0380D66029; Wed, 23 Aug 2023 14:16:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83B95C433C8; Wed, 23 Aug 2023 14:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692800186; bh=DwblRXD6m9eIyN8zoYD7uuOYKE0IACRN+MXuDnwh9FM=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=O/7IdDqg83TzmzT2Xyv8WFenhvoYt95gTfhv7jrSe4hrMFQpZRh9cRbZOya4N2Nrn 6k+vDISw6wis98y8w9azDrmV1DgtjwYD9/LgywIQ68iSeAB7N2M2syj/u94lvVJDzH 89A3zMDaLDpO3lqHUtMUctIEItctTBratk4onh744T593Gi6N6sQLi+epV2ZgU/mR+ GVgwM2jOPTUXdgzy9FxTB10mnMvIYkR2iBH1k8SVQtrMhhAv7BnP2kMzN6vZrzNsxi oliTIGa/ZnXVDwgwJ3pVEp5zXSRkH6xxa7PdzkmR0U3cackoxwoNPJh0qccH/mBYF+ pdzlHkbdxWDHA== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH v2] ath5k: fix WARNING opportunity for swap. From: Kalle Valo In-Reply-To: <20230815040819.649455-1-mahmoudmatook.mm@gmail.com> References: <20230815040819.649455-1-mahmoudmatook.mm@gmail.com> To: Mahmoud Maatuq Cc: jirislaby@kernel.org, mickflemm@gmail.com, mcgrof@kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Mahmoud Maatuq User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <169280018252.1336947.9195494625523438821.kvalo@kernel.org> Date: Wed, 23 Aug 2023 14:16:24 +0000 (UTC) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 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 Mahmoud Maatuq wrote: > coccinielle reported the following: > ./drivers/net/wireless/ath/ath5k/phy.c:1573:25-26: WARNING opportunity for swap() > > while trying to fix the above warning, it reveals that ath5k_hw_get_median_noise_floor() > had open-coded sort() functionality. Since ath5k_hw_get_median_noise_floor() only > executes once every 10 seconds, any extra overhead due to sort() calling > its "compare" and "swap" functions can be ignored, so replace the > existing logic with a call to sort(). > > Signed-off-by: Mahmoud Maatuq > Suggested-by: Jiri Slaby > Signed-off-by: Kalle Valo Patch applied to ath-next branch of ath.git, thanks. e10ec6ea612c wifi: ath5k: ath5k_hw_get_median_noise_floor(): use swap() -- https://patchwork.kernel.org/project/linux-wireless/patch/20230815040819.649455-1-mahmoudmatook.mm@gmail.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches