Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753672AbaFWIlR (ORCPT ); Mon, 23 Jun 2014 04:41:17 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:51471 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753584AbaFWIkn (ORCPT ); Mon, 23 Jun 2014 04:40:43 -0400 MIME-Version: 1.0 In-Reply-To: <20140616201004.GA18240@himangi-Dell> References: <20140616201004.GA18240@himangi-Dell> Date: Mon, 23 Jun 2014 10:40:41 +0200 X-Google-Sender-Auth: 6huBeMCH5iyty1KKVxR7RGcr7pE Message-ID: Subject: Re: [PATCH] zorro: use ARRAY_SIZE From: Geert Uytterhoeven To: Himangi Saraogi Cc: linux-m68k , "linux-kernel@vger.kernel.org" , Julia Lawall Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 16, 2014 at 10:10 PM, Himangi Saraogi wrote: > 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 Coccinelle semantic patch that makes this change is as follows: > > // > @@ > type T; > T[] E; > @@ > > - (sizeof(E)/sizeof(T)) > + ARRAY_SIZE(E) > // > > > Signed-off-by: Himangi Saraogi Thanks! Will apply and queue for v3.17. I also converted the MANUF definition a few lines above: -#define MANUF( manuf, name ) { 0x##manuf, sizeof(__prods_##manuf) / sizeof(struct zorro_prod_info), __manufstr_##manuf, __prods_##manuf }, +#define MANUF( manuf, name ) { 0x##manuf, ARRAY_SIZE(__prods_##manuf), __manufstr_##manuf, __prods_##manuf }, > --- > drivers/zorro/names.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/zorro/names.c b/drivers/zorro/names.c > index 6f3fd99..4ccbcc9 100644 > --- a/drivers/zorro/names.c > +++ b/drivers/zorro/names.c > @@ -52,7 +52,7 @@ static struct zorro_manuf_info __initdata zorro_manuf_list[] = { > #include "devlist.h" > }; > > -#define MANUFS (sizeof(zorro_manuf_list)/sizeof(struct zorro_manuf_info)) > +#define MANUFS ARRAY_SIZE(zorro_manuf_list) > > void __init zorro_name_device(struct zorro_dev *dev) > { Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- 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/