Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753345AbbF3FMs (ORCPT ); Tue, 30 Jun 2015 01:12:48 -0400 Received: from smtprelay0020.hostedemail.com ([216.40.44.20]:48909 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750771AbbF3FMl (ORCPT ); Tue, 30 Jun 2015 01:12:41 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3866:3871:4250:4321:5007:6119:6261:6742:7875:10004:10400:10848:11026:11232:11473:11657:11658:11914:12043:12114:12296:12438:12517:12519:12740:13019:13069:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: list59_16ebe0ca38a2a X-Filterd-Recvd-Size: 2370 Message-ID: <1435641156.6661.1.camel@perches.com> Subject: Re: [PATCH 1/1] igb: Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0]) From: Joe Perches To: Maninder Singh Cc: jeffrey.t.kirsher@intel.com, jesse.brandeburg@intel.com, shannon.nelson@intel.com, carolyn.wyborny@intel.com, donald.c.skidmore@intel.com, matthew.vick@intel.com, john.ronciak@intel.com, mitch.a.williams@intel.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, pankaj.m@samsung.com Date: Mon, 29 Jun 2015 22:12:36 -0700 In-Reply-To: <1435640130-1466-1-git-send-email-maninder1.s@samsung.com> References: <1435640130-1466-1-git-send-email-maninder1.s@samsung.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1477 Lines: 36 On Tue, 2015-06-30 at 10:25 +0530, Maninder Singh wrote: > Use ARRAY_SIZE instead fo sizeof(a)/sizeof(a[0]) I think all of these #defines should be removed instead as they are all used only once. > diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c [] > @@ -37,8 +37,7 @@ static s32 igb_set_master_slave_mode(struct e1000_hw *hw); > static const u16 e1000_m88_cable_length_table[] = { > 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED }; > #define M88E1000_CABLE_LENGTH_TABLE_SIZE \ > - (sizeof(e1000_m88_cable_length_table) / \ > - sizeof(e1000_m88_cable_length_table[0])) > + ARRAY_SIZE(e1000_m88_cable_length_table) > > static const u16 e1000_igp_2_cable_length_table[] = { > 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, > @@ -50,8 +49,7 @@ static const u16 e1000_igp_2_cable_length_table[] = { > 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124, > 104, 109, 114, 118, 121, 124}; > #define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \ > - (sizeof(e1000_igp_2_cable_length_table) / \ > - sizeof(e1000_igp_2_cable_length_table[0])) > + ARRAY_SIZE(e1000_igp_2_cable_length_table) > > /** > * igb_check_reset_block - Check if PHY reset is blocked -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/