Lines Matching refs:ff

18 static bool has_msg(struct snd_ff *ff)  in has_msg()  argument
20 if (ff->spec->protocol->has_msg) in has_msg()
21 return ff->spec->protocol->has_msg(ff); in has_msg()
29 struct snd_ff *ff = hwdep->private_data; in hwdep_read() local
32 spin_lock_irq(&ff->lock); in hwdep_read()
34 while (!ff->dev_lock_changed && !has_msg(ff)) { in hwdep_read()
35 prepare_to_wait(&ff->hwdep_wait, &wait, TASK_INTERRUPTIBLE); in hwdep_read()
36 spin_unlock_irq(&ff->lock); in hwdep_read()
38 finish_wait(&ff->hwdep_wait, &wait); in hwdep_read()
41 spin_lock_irq(&ff->lock); in hwdep_read()
44 if (ff->dev_lock_changed && count >= sizeof(struct snd_firewire_event_lock_status)) { in hwdep_read()
47 .status = (ff->dev_lock_count > 0), in hwdep_read()
50 ff->dev_lock_changed = false; in hwdep_read()
52 spin_unlock_irq(&ff->lock); in hwdep_read()
57 } else if (has_msg(ff)) { in hwdep_read()
60 count = ff->spec->protocol->copy_msg_to_user(ff, buf, count); in hwdep_read()
61 spin_unlock_irq(&ff->lock); in hwdep_read()
63 spin_unlock_irq(&ff->lock); in hwdep_read()
74 struct snd_ff *ff = hwdep->private_data; in hwdep_poll() local
77 poll_wait(file, &ff->hwdep_wait, wait); in hwdep_poll()
79 spin_lock_irq(&ff->lock); in hwdep_poll()
80 if (ff->dev_lock_changed || has_msg(ff)) in hwdep_poll()
84 spin_unlock_irq(&ff->lock); in hwdep_poll()
89 static int hwdep_get_info(struct snd_ff *ff, void __user *arg) in hwdep_get_info() argument
91 struct fw_device *dev = fw_parent_device(ff->unit); in hwdep_get_info()
108 static int hwdep_lock(struct snd_ff *ff) in hwdep_lock() argument
112 spin_lock_irq(&ff->lock); in hwdep_lock()
114 if (ff->dev_lock_count == 0) { in hwdep_lock()
115 ff->dev_lock_count = -1; in hwdep_lock()
121 spin_unlock_irq(&ff->lock); in hwdep_lock()
126 static int hwdep_unlock(struct snd_ff *ff) in hwdep_unlock() argument
130 spin_lock_irq(&ff->lock); in hwdep_unlock()
132 if (ff->dev_lock_count == -1) { in hwdep_unlock()
133 ff->dev_lock_count = 0; in hwdep_unlock()
139 spin_unlock_irq(&ff->lock); in hwdep_unlock()
146 struct snd_ff *ff = hwdep->private_data; in hwdep_release() local
148 spin_lock_irq(&ff->lock); in hwdep_release()
149 if (ff->dev_lock_count == -1) in hwdep_release()
150 ff->dev_lock_count = 0; in hwdep_release()
151 spin_unlock_irq(&ff->lock); in hwdep_release()
159 struct snd_ff *ff = hwdep->private_data; in hwdep_ioctl() local
163 return hwdep_get_info(ff, (void __user *)arg); in hwdep_ioctl()
165 return hwdep_lock(ff); in hwdep_ioctl()
167 return hwdep_unlock(ff); in hwdep_ioctl()
184 int snd_ff_create_hwdep_devices(struct snd_ff *ff) in snd_ff_create_hwdep_devices() argument
196 err = snd_hwdep_new(ff->card, ff->card->driver, 0, &hwdep); in snd_ff_create_hwdep_devices()
200 strcpy(hwdep->name, ff->card->driver); in snd_ff_create_hwdep_devices()
203 hwdep->private_data = ff; in snd_ff_create_hwdep_devices()