From: "Ahmed S. Darwish" <darwish.07@gmail.com> To: linux-kernel@vger.kernel.org Subject: [PATCH 2.6.20 1/2] OSS: Use ARRAY_SIZE macro when appropriate Date: Tue, 6 Feb 2007 18:05:20 +0200 Message-ID: <20070206160520.GF8991@Ahmed> (raw) In-Reply-To: <20070206160204.GA8991@Ahmed> Hi all, A patch to use ARRAY_SIZE macro already defined in kernel.h Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com> --- [PATCH 1/2] compile-tested [PATCH 2/2] couldn't be compile-tested (orphaned hardware ?) diff --git a/sound/oss/es1371.c b/sound/oss/es1371.c index cc282a0..e1fbcca 100644 --- a/sound/oss/es1371.c +++ b/sound/oss/es1371.c @@ -131,6 +131,7 @@ #include <linux/dma-mapping.h> #include <linux/mutex.h> #include <linux/mm.h> +#include <linux/kernel.h> #include <asm/io.h> #include <asm/page.h> @@ -2998,7 +2999,7 @@ static int __devinit es1371_probe(struct pci_dev *pcidev, const struct pci_devic set_fs(KERNEL_DS); val = SOUND_MASK_LINE; mixdev_ioctl(s->codec, SOUND_MIXER_WRITE_RECSRC, (unsigned long)&val); - for (i = 0; i < sizeof(initvol)/sizeof(initvol[0]); i++) { + for (i = 0; i < ARRAY_SIZE(initvol); i++) { val = initvol[i].vol; mixdev_ioctl(s->codec, initvol[i].mixch, (unsigned long)&val); } diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index a89108c..b92c8cd 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c @@ -32,6 +32,7 @@ #include <linux/ctype.h> #include <linux/stddef.h> #include <linux/kmod.h> +#include <linux/kernel.h> #include <asm/dma.h> #include <asm/io.h> #include <linux/wait.h> @@ -557,7 +558,7 @@ static int __init oss_init(void) /* Protecting the innocent */ sound_dmap_flag = (dmabuf > 0 ? 1 : 0); - for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { + for (i = 0; i < ARRAY_SIZE(dev_list); i++) { device_create(sound_class, NULL, MKDEV(SOUND_MAJOR, dev_list[i].minor), "%s", dev_list[i].name); @@ -581,7 +582,7 @@ static void __exit oss_cleanup(void) { int i, j; - for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { + for (i = 0; i < ARRAY_SIZE(dev_list); i++) { device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor)); if (!dev_list[i].num) continue; -- Ahmed S. Darwish http://darwish-07.blogspot.com
next prev parent reply index Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-02-06 16:02 [PATCH 00] A series of patches to use ARRAY_SIZE macro Ahmed S. Darwish 2007-02-06 16:03 ` [PATCH 2.6.20] DVB: Use ARRAY_SIZE macro when appropriate Ahmed S. Darwish 2007-02-06 16:03 ` [PATCH 2.6.20] KVM: " Ahmed S. Darwish 2007-02-06 16:56 ` Dor Laor 2007-02-06 16:04 ` [PATCH 2.6.20] isdn-eicon: " Ahmed S. Darwish 2007-02-06 16:04 ` [PATCH 2.6.20] isdn-capi: " Ahmed S. Darwish 2007-02-06 17:52 ` Joe Perches 2007-02-06 20:41 ` Ahmed S. Darwish 2007-02-06 21:18 ` Philippe De Muyter 2007-02-07 19:41 ` Ahmed S. Darwish 2007-02-07 21:02 ` Philippe De Muyter 2007-02-08 15:53 ` Bill Davidsen 2007-02-08 16:02 ` Kai Germaschewski 2007-02-06 16:05 ` Ahmed S. Darwish [this message] 2007-02-06 16:05 ` [PATCH 2.6.20 2/2] OSS: " Ahmed S. Darwish 2007-02-06 16:06 ` [PATCH 2.6.20] atm: " Ahmed S. Darwish 2007-02-06 16:06 ` [PATCH 2.6.20] drivers/md.c: " Ahmed S. Darwish 2007-02-06 16:07 ` [PATCH 2.6.20] infinband: " Ahmed S. Darwish 2007-02-06 18:57 ` Roland Dreier 2007-02-06 16:07 ` [PATCH 2.6.20] s390-drivers: " Ahmed S. Darwish 2007-02-07 6:32 ` Cornelia Huck 2007-02-06 16:08 ` [PATCH 2.6.20] rcutorture: " Ahmed S. Darwish 2007-02-07 18:29 ` Josh Triplett 2007-02-06 16:08 ` [PATCH 2.6.20] intel-agp: " Ahmed S. Darwish 2007-02-06 16:08 ` [PATCH 2.6.20] reiserfs: " Ahmed S. Darwish 2007-02-06 16:09 ` [PATCH 2.6.20] toshiba-acpi: " Ahmed S. Darwish 2007-02-06 16:09 ` [PATCH 2.6.20] w1: " Ahmed S. Darwish 2007-02-06 16:19 ` Evgeniy Polyakov 2007-02-06 16:10 ` [PATCH 2.6.20] drm: " Ahmed S. Darwish
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20070206160520.GF8991@Ahmed \ --to=darwish.07@gmail.com \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lkml.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lkml.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lkml.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lkml.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lkml.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lkml.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lkml.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lkml.kernel.org/lkml/7 lkml/git/7.git git clone --mirror https://lkml.kernel.org/lkml/8 lkml/git/8.git git clone --mirror https://lkml.kernel.org/lkml/9 lkml/git/9.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lkml.kernel.org/lkml \ linux-kernel@vger.kernel.org public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git