Lines Matching refs:dice
14 struct snd_dice *dice = hwdep->private_data; in hwdep_read() local
18 spin_lock_irq(&dice->lock); in hwdep_read()
20 while (!dice->dev_lock_changed && dice->notification_bits == 0) { in hwdep_read()
21 prepare_to_wait(&dice->hwdep_wait, &wait, TASK_INTERRUPTIBLE); in hwdep_read()
22 spin_unlock_irq(&dice->lock); in hwdep_read()
24 finish_wait(&dice->hwdep_wait, &wait); in hwdep_read()
27 spin_lock_irq(&dice->lock); in hwdep_read()
31 if (dice->dev_lock_changed) { in hwdep_read()
33 event.lock_status.status = dice->dev_lock_count > 0; in hwdep_read()
34 dice->dev_lock_changed = false; in hwdep_read()
40 event.dice_notification.notification = dice->notification_bits; in hwdep_read()
41 dice->notification_bits = 0; in hwdep_read()
46 spin_unlock_irq(&dice->lock); in hwdep_read()
57 struct snd_dice *dice = hwdep->private_data; in hwdep_poll() local
60 poll_wait(file, &dice->hwdep_wait, wait); in hwdep_poll()
62 spin_lock_irq(&dice->lock); in hwdep_poll()
63 if (dice->dev_lock_changed || dice->notification_bits != 0) in hwdep_poll()
67 spin_unlock_irq(&dice->lock); in hwdep_poll()
72 static int hwdep_get_info(struct snd_dice *dice, void __user *arg) in hwdep_get_info() argument
74 struct fw_device *dev = fw_parent_device(dice->unit); in hwdep_get_info()
91 static int hwdep_lock(struct snd_dice *dice) in hwdep_lock() argument
95 spin_lock_irq(&dice->lock); in hwdep_lock()
97 if (dice->dev_lock_count == 0) { in hwdep_lock()
98 dice->dev_lock_count = -1; in hwdep_lock()
104 spin_unlock_irq(&dice->lock); in hwdep_lock()
109 static int hwdep_unlock(struct snd_dice *dice) in hwdep_unlock() argument
113 spin_lock_irq(&dice->lock); in hwdep_unlock()
115 if (dice->dev_lock_count == -1) { in hwdep_unlock()
116 dice->dev_lock_count = 0; in hwdep_unlock()
122 spin_unlock_irq(&dice->lock); in hwdep_unlock()
129 struct snd_dice *dice = hwdep->private_data; in hwdep_release() local
131 spin_lock_irq(&dice->lock); in hwdep_release()
132 if (dice->dev_lock_count == -1) in hwdep_release()
133 dice->dev_lock_count = 0; in hwdep_release()
134 spin_unlock_irq(&dice->lock); in hwdep_release()
142 struct snd_dice *dice = hwdep->private_data; in hwdep_ioctl() local
146 return hwdep_get_info(dice, (void __user *)arg); in hwdep_ioctl()
148 return hwdep_lock(dice); in hwdep_ioctl()
150 return hwdep_unlock(dice); in hwdep_ioctl()
167 int snd_dice_create_hwdep(struct snd_dice *dice) in snd_dice_create_hwdep() argument
179 err = snd_hwdep_new(dice->card, "DICE", 0, &hwdep); in snd_dice_create_hwdep()
185 hwdep->private_data = dice; in snd_dice_create_hwdep()