From patchwork Mon Nov 12 21:58:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Mikityanskiy X-Patchwork-Id: 1731381 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7C0923FCDE for ; Mon, 12 Nov 2012 21:59:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753992Ab2KLV7Z (ORCPT ); Mon, 12 Nov 2012 16:59:25 -0500 Received: from mail-ee0-f46.google.com ([74.125.83.46]:49658 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753901Ab2KLV7L (ORCPT ); Mon, 12 Nov 2012 16:59:11 -0500 Received: by mail-ee0-f46.google.com with SMTP id b15so3644080eek.19 for ; Mon, 12 Nov 2012 13:59:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=nDh0lGJi4hYQpENqKDUqyr1/s+qCSCD72/oaDXq5J18=; b=SpNMSyOR4zNL3Od+bObwCTtN9ZX/GY7nXPdEGBPtkWehKk7JuJFe4Gea8xct+fwJw8 S5UXTvGrRFtbgSTNedwbH7QnsxvqmoFtMCzODevFRNgsbn9FNEmAX/TE56nwS/39vwWF iMKUSW2oAiSMIC8IfuQE2Ni8wvj53blY5TC5VCmrSNyVBzmLycqgKZEQHzp6J3KwuMox fQ7Ew+fNEyYoTiwpW4K8tG8HAg/LgzvMRwZnOQT+s5bDsjcH+zGmugRiGwlfQJH7c6/p NtICn5SDkYvFLaXmCnXEH3k1HBuR61RxJh2wchqy5OxpVzcBAoG4LQZlbRMcyZPSDf4G Pi9Q== Received: by 10.14.205.65 with SMTP id i41mr62000260eeo.2.1352757550967; Mon, 12 Nov 2012 13:59:10 -0800 (PST) Received: from laptop.olymp.linuxd.org (63-85-92-178.pool.ukrtel.net. [178.92.85.63]) by mx.google.com with ESMTPS id f3sm18449256eeo.13.2012.11.12.13.59.09 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Nov 2012 13:59:10 -0800 (PST) From: Maxim Mikityanskiy To: greg@kroah.com, linux-wireless@vger.kernel.org Cc: Maxim Mikityanskiy Subject: [PATCH 13/17] Use ARRAY_SIZE instead of in-code constants Date: Mon, 12 Nov 2012 23:58:27 +0200 Message-Id: <1352757511-26957-14-git-send-email-maxtram95@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1352757511-26957-1-git-send-email-maxtram95@gmail.com> References: <1352757511-26957-1-git-send-email-maxtram95@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Signed-off-by: Maxim Mikityanskiy --- r8180_rtl8225z2.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/r8180_rtl8225z2.c b/r8180_rtl8225z2.c index eba9786..c592f79 100644 --- a/r8180_rtl8225z2.c +++ b/r8180_rtl8225z2.c @@ -132,7 +132,7 @@ static const u16 rtl8225z2_rxgain[] = { 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d, 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3, - 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb + 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb }; @@ -431,8 +431,8 @@ void rtl8225z2_rf_init(struct net_device *dev) struct r8180_priv *priv = ieee80211_priv(dev); int i; short channel = 1; - u16 brsr; - u32 data, addr; + u16 brsr; + u32 data; priv->chan = channel; @@ -473,8 +473,8 @@ void rtl8225z2_rf_init(struct net_device *dev) write_rtl8225(dev, 0x0, 0x1b7); - for (i = 0; i < 95; i++) { - write_rtl8225(dev, 0x1, (u8)(i + 1)); + for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) { + write_rtl8225(dev, 0x1, i + 1); write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]); } @@ -504,14 +504,12 @@ void rtl8225z2_rf_init(struct net_device *dev) write_rtl8225(dev, 0x0, 0x2bf); - for (i = 0; i < 128; i++) { - data = rtl8225_agc[i]; - - addr = i + 0x80; /* enable writing AGC table */ - write_phy_ofdm(dev, 0xb, data); + for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) { + write_phy_ofdm(dev, 0xb, rtl8225_agc[i]); mdelay(1); - write_phy_ofdm(dev, 0xa, addr); + /* enable writing AGC table */ + write_phy_ofdm(dev, 0xa, i + 0x80); mdelay(1); }