[PATCH v4 5/13] Use ARRAY_SIZE to iterate over firmware_features_table array

Stephen Rothwell sfr at canb.auug.org.au
Fri Apr 26 13:08:44 EST 2013


Hi Nathan,

On Wed, 24 Apr 2013 10:55:08 -0500 Nathan Fontenot <nfont at linux.vnet.ibm.com> wrote:
>
> When iterating over the entries in firmware_features_table we only need
> to go over the actual number of entries in the array instead of declaring
> it to be bigger and checking to make sure there is a valid entry in every
> slot.
> 
> This patch removes the FIRMWARE_MAX_FEATURES #define and replaces the
> array looping with the use of ARRAY_SIZE().
> 

Suggested-by: Stephen Rothwell <sfr at canb.auug.org.au>

> Signed-off-by: Nathan Fontenot <nfont at linux.vnet.ibm.com>
> @@ -77,12 +77,10 @@
>  	pr_debug(" -> fw_feature_init()\n");
>  
>  	for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) {
> -		for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) {
> +		for (i = 0; i < ARRAY_SIZE(firmware_features_table); i++) {

You should explicitly include linux/kernel.h to use ARRAY_SIZE().

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20130426/fecba262/attachment.sig>


More information about the Linuxppc-dev mailing list