]> err.no Git - linux-2.6/blobdiff - sound/core/init.c
Merge branch 'splice' of git://brick.kernel.dk/data/git/linux-2.6-block
[linux-2.6] / sound / core / init.c
index 17fbd6c14fb879c7f51edabd59ebac1d19e7a2c2..39ed2e5bb0af1b4a5c4320d7f14300f08bc40b8e 100644 (file)
@@ -169,11 +169,44 @@ struct snd_card *snd_card_new(int idx, const char *xid,
        return NULL;
 }
 
+static loff_t snd_disconnect_llseek(struct file *file, loff_t offset, int orig)
+{
+       return -ENODEV;
+}
+
+static ssize_t snd_disconnect_read(struct file *file, char __user *buf,
+                                  size_t count, loff_t *offset)
+{
+       return -ENODEV;
+}
+
+static ssize_t snd_disconnect_write(struct file *file, const char __user *buf,
+                                   size_t count, loff_t *offset)
+{
+       return -ENODEV;
+}
+
 static unsigned int snd_disconnect_poll(struct file * file, poll_table * wait)
 {
        return POLLERR | POLLNVAL;
 }
 
+static long snd_disconnect_ioctl(struct file *file,
+                                unsigned int cmd, unsigned long arg)
+{
+       return -ENODEV;
+}
+
+static int snd_disconnect_mmap(struct file *file, struct vm_area_struct *vma)
+{
+       return -ENODEV;
+}
+
+static int snd_disconnect_fasync(int fd, struct file *file, int on)
+{
+       return -ENODEV;
+}
+
 /**
  *  snd_card_disconnect - disconnect all APIs from the file-operations (user space)
  *  @card: soundcard structure
@@ -190,7 +223,8 @@ int snd_card_disconnect(struct snd_card *card)
        struct snd_monitor_file *mfile;
        struct file *file;
        struct snd_shutdown_f_ops *s_f_ops;
-       struct file_operations *f_ops, *old_f_ops;
+       struct file_operations *f_ops;
+       const struct file_operations *old_f_ops;
        int err;
 
        spin_lock(&card->files_lock);
@@ -224,7 +258,16 @@ int snd_card_disconnect(struct snd_card *card)
                memset(f_ops, 0, sizeof(*f_ops));
                f_ops->owner = file->f_op->owner;
                f_ops->release = file->f_op->release;
+               f_ops->llseek = snd_disconnect_llseek;
+               f_ops->read = snd_disconnect_read;
+               f_ops->write = snd_disconnect_write;
                f_ops->poll = snd_disconnect_poll;
+               f_ops->unlocked_ioctl = snd_disconnect_ioctl;
+#ifdef CONFIG_COMPAT
+               f_ops->compat_ioctl = snd_disconnect_ioctl;
+#endif
+               f_ops->mmap = snd_disconnect_mmap;
+               f_ops->fasync = snd_disconnect_fasync;
 
                s_f_ops->next = card->s_f_ops;
                card->s_f_ops = s_f_ops;
@@ -679,13 +722,12 @@ int snd_card_file_remove(struct snd_card *card, struct file *file)
  *  snd_power_wait - wait until the power-state is changed.
  *  @card: soundcard structure
  *  @power_state: expected power state
- *  @file: file structure for the O_NONBLOCK check (optional)
  *
  *  Waits until the power-state is changed.
  *
  *  Note: the power lock must be active before call.
  */
-int snd_power_wait(struct snd_card *card, unsigned int power_state, struct file *file)
+int snd_power_wait(struct snd_card *card, unsigned int power_state)
 {
        wait_queue_t wait;
        int result = 0;
@@ -702,12 +744,6 @@ int snd_power_wait(struct snd_card *card, unsigned int power_state, struct file
                }
                if (snd_power_get_state(card) == power_state)
                        break;
-#if 0 /* block all devices */
-               if (file && (file->f_flags & O_NONBLOCK)) {
-                       result = -EAGAIN;
-                       break;
-               }
-#endif
                set_current_state(TASK_UNINTERRUPTIBLE);
                snd_power_unlock(card);
                schedule_timeout(30 * HZ);