[PATCH] OSS: Use ARRAY_SIZE macro when appropriate

2007-02-12 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b322f4095056d6849c49412eb3e36637a062e9c0
Commit: b322f4095056d6849c49412eb3e36637a062e9c0
Parent: 9d0094de6dfda8209241787d99f531356469d0f5
Author: Ahmed S. Darwish [EMAIL PROTECTED]
AuthorDate: Mon Feb 12 00:52:07 2007 -0800
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Mon Feb 12 09:48:28 2007 -0800

[PATCH] OSS: Use ARRAY_SIZE macro when appropriate

Use ARRAY_SIZE macro already defined in kernel.h

Signed-off-by: Ahmed S. Darwish [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 sound/oss/es1371.c|3 ++-
 sound/oss/soundcard.c |5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

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;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] OSS: Use ARRAY_SIZE macro when appropriate (2)

2007-02-12 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8b5925fd5461c9f1ac77ede48945ca1945202ddb
Commit: 8b5925fd5461c9f1ac77ede48945ca1945202ddb
Parent: b322f4095056d6849c49412eb3e36637a062e9c0
Author: Ahmed S. Darwish [EMAIL PROTECTED]
AuthorDate: Mon Feb 12 00:52:08 2007 -0800
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Mon Feb 12 09:48:29 2007 -0800

[PATCH] OSS: Use ARRAY_SIZE macro when appropriate (2)

Use ARRAY_SIZE macro already defined in kernel.h

Signed-off-by: Ahmed S. Darwish [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 sound/oss/au1550_ac97.c   |4 ++--
 sound/oss/nec_vrc5477.c   |4 ++--
 sound/oss/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; countsizeof(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; countsizeof(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);
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html