Lines Matching refs:dice
15 struct snd_dice *dice = hwdep->private_data; in hwdep_read() local
19 spin_lock_irq(&dice->lock); in hwdep_read()
21 while (!dice->dev_lock_changed && dice->notification_bits == 0) { in hwdep_read()
22 prepare_to_wait(&dice->hwdep_wait, &wait, TASK_INTERRUPTIBLE); in hwdep_read()
23 spin_unlock_irq(&dice->lock); in hwdep_read()
25 finish_wait(&dice->hwdep_wait, &wait); in hwdep_read()
28 spin_lock_irq(&dice->lock); in hwdep_read()
32 if (dice->dev_lock_changed) { in hwdep_read()
34 event.lock_status.status = dice->dev_lock_count > 0; in hwdep_read()
35 dice->dev_lock_changed = false; in hwdep_read()
41 event.dice_notification.notification = dice->notification_bits; in hwdep_read()
42 dice->notification_bits = 0; in hwdep_read()
47 spin_unlock_irq(&dice->lock); in hwdep_read()
58 struct snd_dice *dice = hwdep->private_data; in hwdep_poll() local
61 poll_wait(file, &dice->hwdep_wait, wait); in hwdep_poll()
63 spin_lock_irq(&dice->lock); in hwdep_poll()
64 if (dice->dev_lock_changed || dice->notification_bits != 0) in hwdep_poll()
68 spin_unlock_irq(&dice->lock); in hwdep_poll()
73 static int hwdep_get_info(struct snd_dice *dice, void __user *arg) in hwdep_get_info() argument
75 struct fw_device *dev = fw_parent_device(dice->unit); in hwdep_get_info()
92 static int hwdep_lock(struct snd_dice *dice) in hwdep_lock() argument
96 spin_lock_irq(&dice->lock); in hwdep_lock()
98 if (dice->dev_lock_count == 0) { in hwdep_lock()
99 dice->dev_lock_count = -1; in hwdep_lock()
105 spin_unlock_irq(&dice->lock); in hwdep_lock()
110 static int hwdep_unlock(struct snd_dice *dice) in hwdep_unlock() argument
114 spin_lock_irq(&dice->lock); in hwdep_unlock()
116 if (dice->dev_lock_count == -1) { in hwdep_unlock()
117 dice->dev_lock_count = 0; in hwdep_unlock()
123 spin_unlock_irq(&dice->lock); in hwdep_unlock()
130 struct snd_dice *dice = hwdep->private_data; in hwdep_release() local
132 spin_lock_irq(&dice->lock); in hwdep_release()
133 if (dice->dev_lock_count == -1) in hwdep_release()
134 dice->dev_lock_count = 0; in hwdep_release()
135 spin_unlock_irq(&dice->lock); in hwdep_release()
143 struct snd_dice *dice = hwdep->private_data; in hwdep_ioctl() local
147 return hwdep_get_info(dice, (void __user *)arg); in hwdep_ioctl()
149 return hwdep_lock(dice); in hwdep_ioctl()
151 return hwdep_unlock(dice); in hwdep_ioctl()
168 int snd_dice_create_hwdep(struct snd_dice *dice) in snd_dice_create_hwdep() argument
180 err = snd_hwdep_new(dice->card, "DICE", 0, &hwdep); in snd_dice_create_hwdep()
186 hwdep->private_data = dice; in snd_dice_create_hwdep()