[PATCH] introduce fmode_t, do annotations
[sfrench/cifs-2.6.git] / sound / oss / swarm_cs4297a.c
index 9f7e5f59ac82b3560d1717b8840aa0e2d840b789..41562ecde5bbd9fcc6cc41a1b0c5ec1b5f14a181 100644 (file)
@@ -75,7 +75,6 @@
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/poll.h>
-#include <linux/smp_lock.h>
 #include <linux/mutex.h>
 #include <linux/kernel.h>
 
@@ -296,7 +295,7 @@ struct cs4297a_state {
        struct mutex open_mutex;
        struct mutex open_sem_adc;
        struct mutex open_sem_dac;
-       mode_t open_mode;
+       fmode_t open_mode;
        wait_queue_head_t open_wait;
        wait_queue_head_t open_wait_adc;
        wait_queue_head_t open_wait_dac;
@@ -616,25 +615,23 @@ static int init_serdma(serdma_t *dma)
 
         /* Descriptors */
         dma->ringsz = DMA_DESCR;
-        dma->descrtab = kmalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL);
+        dma->descrtab = kzalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL);
         if (!dma->descrtab) {
-                printk(KERN_ERR "cs4297a: kmalloc descrtab failed\n");
+                printk(KERN_ERR "cs4297a: kzalloc descrtab failed\n");
                 return -1;
         }
-        memset(dma->descrtab, 0, dma->ringsz * sizeof(serdma_descr_t));
         dma->descrtab_end = dma->descrtab + dma->ringsz;
        /* XXX bloddy mess, use proper DMA API here ...  */
        dma->descrtab_phys = CPHYSADDR((long)dma->descrtab);
         dma->descr_add = dma->descr_rem = dma->descrtab;
 
         /* Frame buffer area */
-        dma->dma_buf = kmalloc(DMA_BUF_SIZE, GFP_KERNEL);
+        dma->dma_buf = kzalloc(DMA_BUF_SIZE, GFP_KERNEL);
         if (!dma->dma_buf) {
-                printk(KERN_ERR "cs4297a: kmalloc dma_buf failed\n");
+                printk(KERN_ERR "cs4297a: kzalloc dma_buf failed\n");
                 kfree(dma->descrtab);
                 return -1;
         }
-        memset(dma->dma_buf, 0, DMA_BUF_SIZE);
         dma->dma_buf_phys = CPHYSADDR((long)dma->dma_buf);
 
         /* Samples buffer area */
@@ -1583,7 +1580,7 @@ static int cs4297a_ioctl_mixdev(struct inode *inode, struct file *file,
 // ******************************************************************************************
 //   Mixer file operations struct.
 // ******************************************************************************************
-static /*const */ struct file_operations cs4297a_mixer_fops = {
+static const struct file_operations cs4297a_mixer_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .ioctl          = cs4297a_ioctl_mixdev,
@@ -2494,7 +2491,7 @@ static int cs4297a_open(struct inode *inode, struct file *file)
 // ******************************************************************************************
 //   Wave (audio) file operations struct.
 // ******************************************************************************************
-static /*const */ struct file_operations cs4297a_audio_fops = {
+static const struct file_operations cs4297a_audio_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .read           = cs4297a_read,
@@ -2619,12 +2616,11 @@ static int __init cs4297a_init(void)
         udelay(100);
 #endif
 
-       if (!(s = kmalloc(sizeof(struct cs4297a_state), GFP_KERNEL))) {
+       if (!(s = kzalloc(sizeof(struct cs4297a_state), GFP_KERNEL))) {
                CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR
                      "cs4297a: probe() no memory for state struct.\n"));
                return -1;
        }
-       memset(s, 0, sizeof(struct cs4297a_state));
         s->magic = CS4297a_MAGIC;
        init_waitqueue_head(&s->dma_adc.wait);
        init_waitqueue_head(&s->dma_dac.wait);