Skip to content

Commit

Permalink
[MTD] drivers/mtd/maps/nettel.c: use ARRAY_SIZE
Browse files Browse the repository at this point in the history
ARRAY_SIZE is more concise to use when the size of an array is divided by
the size of its type or the size of its first element.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@i@
@@

#include <linux/kernel.h>

@depends on i using "paren.iso"@
type T;
T[] E;
@@

- (sizeof(E)/sizeof(E[...]))
+ ARRAY_SIZE(E)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Julia Lawall authored and David Woodhouse committed Dec 10, 2008
1 parent dcb3e13 commit 002f6aa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/mtd/maps/nettel.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,7 @@ static int __init nettel_init(void)

intel_mtd->owner = THIS_MODULE;

num_intel_partitions = sizeof(nettel_intel_partitions) /
sizeof(nettel_intel_partitions[0]);
num_intel_partitions = ARRAY_SIZE(nettel_intel_partitions);

if (intelboot) {
/*
Expand Down

0 comments on commit 002f6aa

Please sign in to comment.