ALSA: ASoC Blackfin: add I2S DAI support for AD73311
[safe/jmp/linux-2.6] / sound / core / info.c
index e43662b..527b207 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Information interface for ALSA driver
- *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  *
  *
  *   This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,9 @@
  *
  */
 
-#include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/time.h>
+#include <linux/mm.h>
 #include <linux/smp_lock.h>
 #include <linux/string.h>
 #include <sound/core.h>
@@ -120,7 +120,10 @@ int snd_iprintf(struct snd_info_buffer *buffer, char *fmt,...)
        len = buffer->len - buffer->size;
        va_start(args, fmt);
        for (;;) {
-               res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, args);
+               va_list ap;
+               va_copy(ap, args);
+               res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, ap);
+               va_end(ap);
                if (res < len)
                        break;
                err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE);
@@ -214,7 +217,8 @@ static ssize_t snd_info_entry_read(struct file *file, char __user *buffer,
        loff_t pos;
 
        data = file->private_data;
-       snd_assert(data != NULL, return -ENXIO);
+       if (snd_BUG_ON(!data))
+               return -ENXIO;
        pos = *offset;
        if (pos < 0 || (long) pos != pos || (ssize_t) count < 0)
                return -EIO;
@@ -255,7 +259,8 @@ static ssize_t snd_info_entry_write(struct file *file, const char __user *buffer
        loff_t pos;
 
        data = file->private_data;
-       snd_assert(data != NULL, return -ENXIO);
+       if (snd_BUG_ON(!data))
+               return -ENXIO;
        entry = data->entry;
        pos = *offset;
        if (pos < 0 || (long) pos != pos || (ssize_t) count < 0)
@@ -485,7 +490,7 @@ static long snd_info_entry_ioctl(struct file *file, unsigned int cmd,
 
 static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma)
 {
-       struct inode *inode = file->f_dentry->d_inode;
+       struct inode *inode = file->f_path.dentry->d_inode;
        struct snd_info_private_data *data;
        struct snd_info_entry *entry;
 
@@ -504,7 +509,7 @@ static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma)
        return -ENXIO;
 }
 
-static struct file_operations snd_info_entry_operations =
+static const struct file_operations snd_info_entry_operations =
 {
        .owner =                THIS_MODULE,
        .llseek =               snd_info_entry_llseek,
@@ -542,7 +547,7 @@ int __init snd_info_init(void)
 {
        struct proc_dir_entry *p;
 
-       p = snd_create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, &proc_root);
+       p = snd_create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL);
        if (p == NULL)
                return -ENOMEM;
        snd_proc_root = p;
@@ -592,7 +597,7 @@ int __exit snd_info_done(void)
 #ifdef CONFIG_SND_OSSEMUL
                snd_info_free_entry(snd_oss_root);
 #endif
-               snd_remove_proc_entry(&proc_root, snd_proc_root);
+               snd_remove_proc_entry(NULL, snd_proc_root);
        }
        return 0;
 }
@@ -611,7 +616,8 @@ int snd_info_card_create(struct snd_card *card)
        char str[8];
        struct snd_info_entry *entry;
 
-       snd_assert(card != NULL, return -ENXIO);
+       if (snd_BUG_ON(!card))
+               return -ENXIO;
 
        sprintf(str, "card%i", card->number);
        if ((entry = snd_info_create_module_entry(card->module, str, NULL)) == NULL)
@@ -633,7 +639,8 @@ int snd_info_card_register(struct snd_card *card)
 {
        struct proc_dir_entry *p;
 
-       snd_assert(card != NULL, return -ENXIO);
+       if (snd_BUG_ON(!card))
+               return -ENXIO;
 
        if (!strcmp(card->id, card->proc_root->name))
                return 0;
@@ -651,7 +658,8 @@ int snd_info_card_register(struct snd_card *card)
  */
 void snd_info_card_disconnect(struct snd_card *card)
 {
-       snd_assert(card != NULL, return);
+       if (!card)
+               return;
        mutex_lock(&info_mutex);
        if (card->proc_root_link) {
                snd_remove_proc_entry(snd_proc_root, card->proc_root_link);
@@ -668,7 +676,8 @@ void snd_info_card_disconnect(struct snd_card *card)
  */
 int snd_info_card_free(struct snd_card *card)
 {
-       snd_assert(card != NULL, return -ENXIO);
+       if (!card)
+               return 0;
        snd_info_free_entry(card->proc_root);
        card->proc_root = NULL;
        return 0;
@@ -846,7 +855,7 @@ static void snd_info_disconnect(struct snd_info_entry *entry)
                return;
        list_del_init(&entry->list);
        root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
-       snd_assert(root, return);
+       snd_BUG_ON(!root);
        snd_remove_proc_entry(root, entry->p);
        entry->p = NULL;
 }
@@ -944,7 +953,8 @@ int snd_info_register(struct snd_info_entry * entry)
 {
        struct proc_dir_entry *root, *p = NULL;
 
-       snd_assert(entry != NULL, return -ENXIO);
+       if (snd_BUG_ON(!entry))
+               return -ENXIO;
        root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
        mutex_lock(&info_mutex);
        p = snd_create_proc_entry(entry->name, entry->mode, root);