Lines Matching refs:efw

23 hwdep_read_resp_buf(struct snd_efw *efw, char __user *buf, long remained,  in hwdep_read_resp_buf()  argument
41 while (efw->resp_queues > 0) { in hwdep_read_resp_buf()
42 t = (struct snd_efw_transaction *)(efw->pull_ptr); in hwdep_read_resp_buf()
52 (unsigned int)(efw->pull_ptr - efw->resp_buf); in hwdep_read_resp_buf()
55 if (copy_to_user(buf, efw->pull_ptr, till_end)) in hwdep_read_resp_buf()
58 efw->pull_ptr += till_end; in hwdep_read_resp_buf()
59 if (efw->pull_ptr >= efw->resp_buf + in hwdep_read_resp_buf()
61 efw->pull_ptr -= snd_efw_resp_buf_size; in hwdep_read_resp_buf()
69 efw->resp_queues--; in hwdep_read_resp_buf()
76 hwdep_read_locked(struct snd_efw *efw, char __user *buf, long count, in hwdep_read_locked() argument
84 event.lock_status.status = (efw->dev_lock_count > 0); in hwdep_read_locked()
85 efw->dev_lock_changed = false; in hwdep_read_locked()
99 struct snd_efw *efw = hwdep->private_data; in hwdep_read() local
102 spin_lock_irq(&efw->lock); in hwdep_read()
104 while ((!efw->dev_lock_changed) && (efw->resp_queues == 0)) { in hwdep_read()
105 prepare_to_wait(&efw->hwdep_wait, &wait, TASK_INTERRUPTIBLE); in hwdep_read()
106 spin_unlock_irq(&efw->lock); in hwdep_read()
108 finish_wait(&efw->hwdep_wait, &wait); in hwdep_read()
111 spin_lock_irq(&efw->lock); in hwdep_read()
114 if (efw->dev_lock_changed) in hwdep_read()
115 count = hwdep_read_locked(efw, buf, count, offset); in hwdep_read()
116 else if (efw->resp_queues > 0) in hwdep_read()
117 count = hwdep_read_resp_buf(efw, buf, count, offset); in hwdep_read()
119 spin_unlock_irq(&efw->lock); in hwdep_read()
128 struct snd_efw *efw = hwdep->private_data; in hwdep_write() local
147 if (snd_efw_transaction_cmd(efw->unit, buf, count) < 0) in hwdep_write()
157 struct snd_efw *efw = hwdep->private_data; in hwdep_poll() local
160 poll_wait(file, &efw->hwdep_wait, wait); in hwdep_poll()
162 spin_lock_irq(&efw->lock); in hwdep_poll()
163 if (efw->dev_lock_changed || (efw->resp_queues > 0)) in hwdep_poll()
167 spin_unlock_irq(&efw->lock); in hwdep_poll()
173 hwdep_get_info(struct snd_efw *efw, void __user *arg) in hwdep_get_info() argument
175 struct fw_device *dev = fw_parent_device(efw->unit); in hwdep_get_info()
193 hwdep_lock(struct snd_efw *efw) in hwdep_lock() argument
197 spin_lock_irq(&efw->lock); in hwdep_lock()
199 if (efw->dev_lock_count == 0) { in hwdep_lock()
200 efw->dev_lock_count = -1; in hwdep_lock()
206 spin_unlock_irq(&efw->lock); in hwdep_lock()
212 hwdep_unlock(struct snd_efw *efw) in hwdep_unlock() argument
216 spin_lock_irq(&efw->lock); in hwdep_unlock()
218 if (efw->dev_lock_count == -1) { in hwdep_unlock()
219 efw->dev_lock_count = 0; in hwdep_unlock()
225 spin_unlock_irq(&efw->lock); in hwdep_unlock()
233 struct snd_efw *efw = hwdep->private_data; in hwdep_release() local
235 spin_lock_irq(&efw->lock); in hwdep_release()
236 if (efw->dev_lock_count == -1) in hwdep_release()
237 efw->dev_lock_count = 0; in hwdep_release()
238 spin_unlock_irq(&efw->lock); in hwdep_release()
247 struct snd_efw *efw = hwdep->private_data; in hwdep_ioctl() local
251 return hwdep_get_info(efw, (void __user *)arg); in hwdep_ioctl()
253 return hwdep_lock(efw); in hwdep_ioctl()
255 return hwdep_unlock(efw); in hwdep_ioctl()
282 int snd_efw_create_hwdep_device(struct snd_efw *efw) in snd_efw_create_hwdep_device() argument
287 err = snd_hwdep_new(efw->card, "Fireworks", 0, &hwdep); in snd_efw_create_hwdep_device()
293 hwdep->private_data = efw; in snd_efw_create_hwdep_device()