From patchwork Thu Apr 28 14:45:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Schaa X-Patchwork-Id: 8971391 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 34EA39F39D for ; Thu, 28 Apr 2016 14:46:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA6D7202C8 for ; Thu, 28 Apr 2016 14:46:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 156BD2027D for ; Thu, 28 Apr 2016 14:46:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522AbcD1OqJ (ORCPT ); Thu, 28 Apr 2016 10:46:09 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34170 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751801AbcD1OqH (ORCPT ); Thu, 28 Apr 2016 10:46:07 -0400 Received: by mail-wm0-f67.google.com with SMTP id n129so14751051wmn.1 for ; Thu, 28 Apr 2016 07:46:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TKKA9yygjw+oXW5TccvxVKqxjy/P7UF4nZPddebDN30=; b=xyTDnIdRS3jypd2xJ96FeoKjKpnzW8hxGRWUa+HbL+O3226YA/5UE+++/paO7x7XjP FHYh8nVkQDkFN1yjNpy+i+mcST99a2rbnwB70uszGmgrpec9l0ZcpApQgqb3V+i5HB0c 8mOwQRSb2G4IG1VjjBzrcsII4ezFj0e+ga0e0N4nLyGpHC4TON7ra/pPgX70nBMK129e UVGvxkqErSbuu9A3DbyqjLHRiyhpunv9uGbOarh5YM78AGxcBMnoCDc8ECk2qo3roWeS o39DfbQPmP/KN7FEmHVa4TVzCOeviBVNVvB0OMXYZKdpCpQ2mJQLnC6/FucNcVj4ec9S bd/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TKKA9yygjw+oXW5TccvxVKqxjy/P7UF4nZPddebDN30=; b=mcpcUgizpvhVK5Lu+oZamQF35/DLAmVB29ndL0U8ppNzmUbEqOvu4F32WjTKds3hoe GWRP3S4GEjmxBi5zU+bczxxosJoD8h9xAua0p9/E8cG9EMO//agdwPXFegIwS5ZYeaAu rT3C9qR6NveSE9ovmRdxBfI5C9/SJ2HZJDNZd0NxepoA/CLHtQmfee3jrpkKI79a9CZa zNcZmmDaWAccmiVTmquBDVpFtlSSHWXfNYSznujroXoIqlSlIjfqthlOLWD6gDvxuLYJ GaJtdSsebhT21RidltFGbL8eNyeIbx+12nKw33vMuAuVj27mYhz7cQQJl9LVbiROl3ky ogTA== X-Gm-Message-State: AOPr4FULHj3fJrKHVv1fJzBAei7AEplJ84caB7dmxBkM7RTOd6I+bPiNJzliyf3j1CtQKg== X-Received: by 10.194.120.135 with SMTP id lc7mr4121629wjb.34.1461854766469; Thu, 28 Apr 2016 07:46:06 -0700 (PDT) Received: from hschaa-desktop.site ([5.158.136.57]) by smtp.gmail.com with ESMTPSA id 63sm1645341wmz.5.2016.04.28.07.46.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Apr 2016 07:46:05 -0700 (PDT) From: Helmut Schaa To: linux-wireless@vger.kernel.org Cc: ath9k-devel@lists.ath9k.org, kvalo@qca.qualcomm.com, ath9k-devel@qca.qualcomm.com, Helmut Schaa Subject: [PATCH 3/3] ath9k: Simplify ar9003_hw_tx99_set_txpower Date: Thu, 28 Apr 2016 16:45:06 +0200 Message-Id: <1461854706-10494-3-git-send-email-helmut.schaa@googlemail.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1461854706-10494-1-git-send-email-helmut.schaa@googlemail.com> References: <1461854706-10494-1-git-send-email-helmut.schaa@googlemail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There's no need to keep the same for loop twice in the code. Move the txpower cap before the loop to reduce code complexity. Signed-off-by: Helmut Schaa --- drivers/net/wireless/ath/ath9k/ar9003_phy.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 2f15cbc..81ab3ca 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c @@ -1844,13 +1844,9 @@ static void ar9003_hw_tx99_set_txpower(struct ath_hw *ah, u8 txpower) static u8 p_pwr_array[ar9300RateSize] = { 0 }; unsigned int i; - if (txpower <= MAX_RATE_POWER) { - for (i = 0; i < ar9300RateSize; i++) - p_pwr_array[i] = txpower; - } else { - for (i = 0; i < ar9300RateSize; i++) - p_pwr_array[i] = MAX_RATE_POWER; - } + txpower = txpower <= MAX_RATE_POWER ? txpower : MAX_RATE_POWER; + for (i = 0; i < ar9300RateSize; i++) + p_pwr_array[i] = txpower; ar9003_hw_tx_power_regwrite(ah, p_pwr_array); }