linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ahmed S. Darwish" <darwish.07@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.20 2/2] OSS: Use ARRAY_SIZE macro when appropriate
Date: Tue, 6 Feb 2007 18:05:39 +0200	[thread overview]
Message-ID: <20070206160539.GG8991@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>
---
I couldn't compile-test this patch with `allyesconfig' or `allmodconfig'.

 au1550_ac97.c   |    4 ++--
 nec_vrc5477.c   |    4 ++--
 swarm_cs4297a.c |    3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c
index 2197951..a339f0c 100644
--- a/sound/oss/au1550_ac97.c
+++ b/sound/oss/au1550_ac97.c
@@ -1354,11 +1354,11 @@ au1550_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 		((file->f_mode & FMODE_READ) && s->dma_adc.mapped);
 
 #ifdef DEBUG
-	for (count=0; count<sizeof(ioctl_str)/sizeof(ioctl_str[0]); count++) {
+	for (count = 0; count < ARRAY_SIZE(ioctl_str); count++) {
 		if (ioctl_str[count].cmd == cmd)
 			break;
 	}
-	if (count < sizeof(ioctl_str) / sizeof(ioctl_str[0]))
+	if (count < ARRAY_SIZE(ioctl_str))
 		pr_debug("ioctl %s, arg=0x%lxn", ioctl_str[count].str, arg);
 	else
 		pr_debug("ioctl 0x%x unknown, arg=0x%lx\n", cmd, arg);
diff --git a/sound/oss/nec_vrc5477.c b/sound/oss/nec_vrc5477.c
index da9728e..d459bdb 100644
--- a/sound/oss/nec_vrc5477.c
+++ b/sound/oss/nec_vrc5477.c
@@ -1381,11 +1381,11 @@ static int vrc5477_ac97_ioctl(struct inode *inode, struct file *file,
 	int val, ret;
 
 #ifdef VRC5477_AC97_DEBUG
-	for (count=0; count<sizeof(ioctl_str)/sizeof(ioctl_str[0]); count++) {
+	for (count = 0; count < ARRAY_SIZE(ioctl_str); count++) {
 		if (ioctl_str[count].cmd == cmd)
 			break;
 	}
-	if (count < sizeof(ioctl_str)/sizeof(ioctl_str[0]))
+	if (count < ARRAY_SIZE(ioctl_str))
 		printk(KERN_INFO PFX "ioctl %s\n", ioctl_str[count].str);
 	else
 		printk(KERN_INFO PFX "ioctl unknown, 0x%x\n", cmd);
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c
index 471c274..9f7e5f5 100644
--- a/sound/oss/swarm_cs4297a.c
+++ b/sound/oss/swarm_cs4297a.c
@@ -77,6 +77,7 @@
 #include <linux/poll.h>
 #include <linux/smp_lock.h>
 #include <linux/mutex.h>
+#include <linux/kernel.h>
 
 #include <asm/byteorder.h>
 #include <asm/dma.h>
@@ -2676,7 +2677,7 @@ static int __init cs4297a_init(void)
 #if 0
                 val = SOUND_MASK_LINE;
                 mixer_ioctl(s, 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;
                         mixer_ioctl(s, initvol[i].mixch, (unsigned long) &val);
                 }

-- 
Ahmed S. Darwish
http://darwish-07.blogspot.com

  parent reply	other threads:[~2007-02-06 16:06 UTC|newest]

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 ` [PATCH 2.6.20 1/2] OSS: " Ahmed S. Darwish
2007-02-06 16:05 ` Ahmed S. Darwish [this message]
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=20070206160539.GG8991@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).