• Home
  • Raw
  • Download

Lines Matching refs:runtime

91 	struct snd_rawmidi_runtime *runtime = substream->runtime;  in snd_rawmidi_ready()  local
92 return runtime->avail >= runtime->avail_min; in snd_rawmidi_ready()
98 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_ready_append() local
99 return runtime->avail >= runtime->avail_min && in snd_rawmidi_ready_append()
100 (!substream->append || runtime->avail >= count); in snd_rawmidi_ready_append()
105 struct snd_rawmidi_runtime *runtime = in snd_rawmidi_input_event_work() local
107 if (runtime->event) in snd_rawmidi_input_event_work()
108 runtime->event(runtime->substream); in snd_rawmidi_input_event_work()
112 static inline void snd_rawmidi_buffer_ref(struct snd_rawmidi_runtime *runtime) in snd_rawmidi_buffer_ref() argument
114 runtime->buffer_ref++; in snd_rawmidi_buffer_ref()
117 static inline void snd_rawmidi_buffer_unref(struct snd_rawmidi_runtime *runtime) in snd_rawmidi_buffer_unref() argument
119 runtime->buffer_ref--; in snd_rawmidi_buffer_unref()
124 struct snd_rawmidi_runtime *runtime; in snd_rawmidi_runtime_create() local
126 if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL) in snd_rawmidi_runtime_create()
128 runtime->substream = substream; in snd_rawmidi_runtime_create()
129 spin_lock_init(&runtime->lock); in snd_rawmidi_runtime_create()
130 init_waitqueue_head(&runtime->sleep); in snd_rawmidi_runtime_create()
131 INIT_WORK(&runtime->event_work, snd_rawmidi_input_event_work); in snd_rawmidi_runtime_create()
132 runtime->event = NULL; in snd_rawmidi_runtime_create()
133 runtime->buffer_size = PAGE_SIZE; in snd_rawmidi_runtime_create()
134 runtime->avail_min = 1; in snd_rawmidi_runtime_create()
136 runtime->avail = 0; in snd_rawmidi_runtime_create()
138 runtime->avail = runtime->buffer_size; in snd_rawmidi_runtime_create()
139 if ((runtime->buffer = kzalloc(runtime->buffer_size, GFP_KERNEL)) == NULL) { in snd_rawmidi_runtime_create()
140 kfree(runtime); in snd_rawmidi_runtime_create()
143 runtime->appl_ptr = runtime->hw_ptr = 0; in snd_rawmidi_runtime_create()
144 substream->runtime = runtime; in snd_rawmidi_runtime_create()
150 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_runtime_free() local
152 kfree(runtime->buffer); in snd_rawmidi_runtime_free()
153 kfree(runtime); in snd_rawmidi_runtime_free()
154 substream->runtime = NULL; in snd_rawmidi_runtime_free()
171 cancel_work_sync(&substream->runtime->event_work); in snd_rawmidi_input_trigger()
177 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_drop_output() local
180 runtime->drain = 0; in snd_rawmidi_drop_output()
181 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_drop_output()
182 runtime->appl_ptr = runtime->hw_ptr = 0; in snd_rawmidi_drop_output()
183 runtime->avail = runtime->buffer_size; in snd_rawmidi_drop_output()
184 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_drop_output()
193 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_drain_output() local
196 runtime->drain = 1; in snd_rawmidi_drain_output()
197 timeout = wait_event_interruptible_timeout(runtime->sleep, in snd_rawmidi_drain_output()
198 (runtime->avail >= runtime->buffer_size), in snd_rawmidi_drain_output()
202 if (runtime->avail < runtime->buffer_size && !timeout) { in snd_rawmidi_drain_output()
205 (long)runtime->avail, (long)runtime->buffer_size); in snd_rawmidi_drain_output()
208 runtime->drain = 0; in snd_rawmidi_drain_output()
224 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_drain_input() local
227 runtime->drain = 0; in snd_rawmidi_drain_input()
228 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_drain_input()
229 runtime->appl_ptr = runtime->hw_ptr = 0; in snd_rawmidi_drain_input()
230 runtime->avail = 0; in snd_rawmidi_drain_input()
231 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_drain_input()
457 if (rawmidi_file->input && rawmidi_file->input->runtime) in snd_rawmidi_open()
458 rawmidi_file->input->runtime->oss = (maj == SOUND_MAJOR); in snd_rawmidi_open()
459 if (rawmidi_file->output && rawmidi_file->output->runtime) in snd_rawmidi_open()
460 rawmidi_file->output->runtime->oss = (maj == SOUND_MAJOR); in snd_rawmidi_open()
499 if (substream->runtime->private_free) in close_substream()
500 substream->runtime->private_free(substream); in close_substream()
652 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_output_params() local
663 if (params->buffer_size != runtime->buffer_size) { in snd_rawmidi_output_params()
667 spin_lock_irq(&runtime->lock); in snd_rawmidi_output_params()
668 if (runtime->buffer_ref) { in snd_rawmidi_output_params()
669 spin_unlock_irq(&runtime->lock); in snd_rawmidi_output_params()
673 oldbuf = runtime->buffer; in snd_rawmidi_output_params()
674 runtime->buffer = newbuf; in snd_rawmidi_output_params()
675 runtime->buffer_size = params->buffer_size; in snd_rawmidi_output_params()
676 runtime->avail = runtime->buffer_size; in snd_rawmidi_output_params()
677 runtime->appl_ptr = runtime->hw_ptr = 0; in snd_rawmidi_output_params()
678 spin_unlock_irq(&runtime->lock); in snd_rawmidi_output_params()
681 runtime->avail_min = params->avail_min; in snd_rawmidi_output_params()
691 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_input_params() local
700 if (params->buffer_size != runtime->buffer_size) { in snd_rawmidi_input_params()
704 spin_lock_irq(&runtime->lock); in snd_rawmidi_input_params()
705 oldbuf = runtime->buffer; in snd_rawmidi_input_params()
706 runtime->buffer = newbuf; in snd_rawmidi_input_params()
707 runtime->buffer_size = params->buffer_size; in snd_rawmidi_input_params()
708 runtime->appl_ptr = runtime->hw_ptr = 0; in snd_rawmidi_input_params()
709 spin_unlock_irq(&runtime->lock); in snd_rawmidi_input_params()
712 runtime->avail_min = params->avail_min; in snd_rawmidi_input_params()
720 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_output_status() local
724 spin_lock_irq(&runtime->lock); in snd_rawmidi_output_status()
725 status->avail = runtime->avail; in snd_rawmidi_output_status()
726 spin_unlock_irq(&runtime->lock); in snd_rawmidi_output_status()
733 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_input_status() local
737 spin_lock_irq(&runtime->lock); in snd_rawmidi_input_status()
738 status->avail = runtime->avail; in snd_rawmidi_input_status()
739 status->xruns = runtime->xruns; in snd_rawmidi_input_status()
740 runtime->xruns = 0; in snd_rawmidi_input_status()
741 spin_unlock_irq(&runtime->lock); in snd_rawmidi_input_status()
914 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_receive() local
918 if (runtime->buffer == NULL) { in snd_rawmidi_receive()
923 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_receive()
926 if (runtime->avail < runtime->buffer_size) { in snd_rawmidi_receive()
927 runtime->buffer[runtime->hw_ptr++] = buffer[0]; in snd_rawmidi_receive()
928 runtime->hw_ptr %= runtime->buffer_size; in snd_rawmidi_receive()
929 runtime->avail++; in snd_rawmidi_receive()
932 runtime->xruns++; in snd_rawmidi_receive()
936 count1 = runtime->buffer_size - runtime->hw_ptr; in snd_rawmidi_receive()
939 if (count1 > (int)(runtime->buffer_size - runtime->avail)) in snd_rawmidi_receive()
940 count1 = runtime->buffer_size - runtime->avail; in snd_rawmidi_receive()
941 memcpy(runtime->buffer + runtime->hw_ptr, buffer, count1); in snd_rawmidi_receive()
942 runtime->hw_ptr += count1; in snd_rawmidi_receive()
943 runtime->hw_ptr %= runtime->buffer_size; in snd_rawmidi_receive()
944 runtime->avail += count1; in snd_rawmidi_receive()
950 if (count1 > (int)(runtime->buffer_size - runtime->avail)) { in snd_rawmidi_receive()
951 count1 = runtime->buffer_size - runtime->avail; in snd_rawmidi_receive()
952 runtime->xruns += count - count1; in snd_rawmidi_receive()
955 memcpy(runtime->buffer, buffer, count1); in snd_rawmidi_receive()
956 runtime->hw_ptr = count1; in snd_rawmidi_receive()
957 runtime->avail += count1; in snd_rawmidi_receive()
963 if (runtime->event) in snd_rawmidi_receive()
964 schedule_work(&runtime->event_work); in snd_rawmidi_receive()
966 wake_up(&runtime->sleep); in snd_rawmidi_receive()
968 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_receive()
979 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_kernel_read1() local
983 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_kernel_read1()
984 snd_rawmidi_buffer_ref(runtime); in snd_rawmidi_kernel_read1()
985 while (count > 0 && runtime->avail) { in snd_rawmidi_kernel_read1()
986 count1 = runtime->buffer_size - runtime->appl_ptr; in snd_rawmidi_kernel_read1()
989 if (count1 > (int)runtime->avail) in snd_rawmidi_kernel_read1()
990 count1 = runtime->avail; in snd_rawmidi_kernel_read1()
993 appl_ptr = runtime->appl_ptr; in snd_rawmidi_kernel_read1()
994 runtime->appl_ptr += count1; in snd_rawmidi_kernel_read1()
995 runtime->appl_ptr %= runtime->buffer_size; in snd_rawmidi_kernel_read1()
996 runtime->avail -= count1; in snd_rawmidi_kernel_read1()
999 memcpy(kernelbuf + result, runtime->buffer + appl_ptr, count1); in snd_rawmidi_kernel_read1()
1001 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_kernel_read1()
1003 runtime->buffer + appl_ptr, count1)) in snd_rawmidi_kernel_read1()
1005 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_kernel_read1()
1013 snd_rawmidi_buffer_unref(runtime); in snd_rawmidi_kernel_read1()
1014 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_kernel_read1()
1033 struct snd_rawmidi_runtime *runtime; in snd_rawmidi_read() local
1039 runtime = substream->runtime; in snd_rawmidi_read()
1043 spin_lock_irq(&runtime->lock); in snd_rawmidi_read()
1047 spin_unlock_irq(&runtime->lock); in snd_rawmidi_read()
1051 add_wait_queue(&runtime->sleep, &wait); in snd_rawmidi_read()
1053 spin_unlock_irq(&runtime->lock); in snd_rawmidi_read()
1055 remove_wait_queue(&runtime->sleep, &wait); in snd_rawmidi_read()
1060 if (!runtime->avail) in snd_rawmidi_read()
1062 spin_lock_irq(&runtime->lock); in snd_rawmidi_read()
1064 spin_unlock_irq(&runtime->lock); in snd_rawmidi_read()
1086 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_transmit_empty() local
1090 if (runtime->buffer == NULL) { in snd_rawmidi_transmit_empty()
1095 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_transmit_empty()
1096 result = runtime->avail >= runtime->buffer_size; in snd_rawmidi_transmit_empty()
1097 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_transmit_empty()
1114 struct snd_rawmidi_runtime *runtime = substream->runtime; in __snd_rawmidi_transmit_peek() local
1116 if (runtime->buffer == NULL) { in __snd_rawmidi_transmit_peek()
1122 if (runtime->avail >= runtime->buffer_size) { in __snd_rawmidi_transmit_peek()
1127 *buffer = runtime->buffer[runtime->hw_ptr]; in __snd_rawmidi_transmit_peek()
1130 count1 = runtime->buffer_size - runtime->hw_ptr; in __snd_rawmidi_transmit_peek()
1133 if (count1 > (int)(runtime->buffer_size - runtime->avail)) in __snd_rawmidi_transmit_peek()
1134 count1 = runtime->buffer_size - runtime->avail; in __snd_rawmidi_transmit_peek()
1135 memcpy(buffer, runtime->buffer + runtime->hw_ptr, count1); in __snd_rawmidi_transmit_peek()
1139 if (count > (int)(runtime->buffer_size - runtime->avail - count1)) in __snd_rawmidi_transmit_peek()
1140 count = runtime->buffer_size - runtime->avail - count1; in __snd_rawmidi_transmit_peek()
1141 memcpy(buffer + count1, runtime->buffer, count); in __snd_rawmidi_transmit_peek()
1167 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_transmit_peek() local
1171 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_transmit_peek()
1173 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_transmit_peek()
1187 struct snd_rawmidi_runtime *runtime = substream->runtime; in __snd_rawmidi_transmit_ack() local
1189 if (runtime->buffer == NULL) { in __snd_rawmidi_transmit_ack()
1194 snd_BUG_ON(runtime->avail + count > runtime->buffer_size); in __snd_rawmidi_transmit_ack()
1195 runtime->hw_ptr += count; in __snd_rawmidi_transmit_ack()
1196 runtime->hw_ptr %= runtime->buffer_size; in __snd_rawmidi_transmit_ack()
1197 runtime->avail += count; in __snd_rawmidi_transmit_ack()
1200 if (runtime->drain || snd_rawmidi_ready(substream)) in __snd_rawmidi_transmit_ack()
1201 wake_up(&runtime->sleep); in __snd_rawmidi_transmit_ack()
1220 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_transmit_ack() local
1224 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_transmit_ack()
1226 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_transmit_ack()
1244 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_transmit() local
1248 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_transmit()
1258 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_transmit()
1270 struct snd_rawmidi_runtime *runtime = substream->runtime; in snd_rawmidi_kernel_write1() local
1275 if (snd_BUG_ON(!runtime->buffer)) in snd_rawmidi_kernel_write1()
1279 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_kernel_write1()
1281 if ((long)runtime->avail < count) { in snd_rawmidi_kernel_write1()
1282 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_kernel_write1()
1286 snd_rawmidi_buffer_ref(runtime); in snd_rawmidi_kernel_write1()
1287 while (count > 0 && runtime->avail > 0) { in snd_rawmidi_kernel_write1()
1288 count1 = runtime->buffer_size - runtime->appl_ptr; in snd_rawmidi_kernel_write1()
1291 if (count1 > (long)runtime->avail) in snd_rawmidi_kernel_write1()
1292 count1 = runtime->avail; in snd_rawmidi_kernel_write1()
1295 appl_ptr = runtime->appl_ptr; in snd_rawmidi_kernel_write1()
1296 runtime->appl_ptr += count1; in snd_rawmidi_kernel_write1()
1297 runtime->appl_ptr %= runtime->buffer_size; in snd_rawmidi_kernel_write1()
1298 runtime->avail -= count1; in snd_rawmidi_kernel_write1()
1301 memcpy(runtime->buffer + appl_ptr, in snd_rawmidi_kernel_write1()
1304 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_kernel_write1()
1305 if (copy_from_user(runtime->buffer + appl_ptr, in snd_rawmidi_kernel_write1()
1307 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_kernel_write1()
1311 spin_lock_irqsave(&runtime->lock, flags); in snd_rawmidi_kernel_write1()
1317 count1 = runtime->avail < runtime->buffer_size; in snd_rawmidi_kernel_write1()
1318 snd_rawmidi_buffer_unref(runtime); in snd_rawmidi_kernel_write1()
1319 spin_unlock_irqrestore(&runtime->lock, flags); in snd_rawmidi_kernel_write1()
1338 struct snd_rawmidi_runtime *runtime; in snd_rawmidi_write() local
1343 runtime = substream->runtime; in snd_rawmidi_write()
1345 if (substream->append && count > runtime->buffer_size) in snd_rawmidi_write()
1349 spin_lock_irq(&runtime->lock); in snd_rawmidi_write()
1353 spin_unlock_irq(&runtime->lock); in snd_rawmidi_write()
1357 add_wait_queue(&runtime->sleep, &wait); in snd_rawmidi_write()
1359 spin_unlock_irq(&runtime->lock); in snd_rawmidi_write()
1361 remove_wait_queue(&runtime->sleep, &wait); in snd_rawmidi_write()
1366 if (!runtime->avail && !timeout) in snd_rawmidi_write()
1368 spin_lock_irq(&runtime->lock); in snd_rawmidi_write()
1370 spin_unlock_irq(&runtime->lock); in snd_rawmidi_write()
1381 spin_lock_irq(&runtime->lock); in snd_rawmidi_write()
1382 while (runtime->avail != runtime->buffer_size) { in snd_rawmidi_write()
1384 unsigned int last_avail = runtime->avail; in snd_rawmidi_write()
1386 add_wait_queue(&runtime->sleep, &wait); in snd_rawmidi_write()
1388 spin_unlock_irq(&runtime->lock); in snd_rawmidi_write()
1390 remove_wait_queue(&runtime->sleep, &wait); in snd_rawmidi_write()
1393 if (runtime->avail == last_avail && !timeout) in snd_rawmidi_write()
1395 spin_lock_irq(&runtime->lock); in snd_rawmidi_write()
1397 spin_unlock_irq(&runtime->lock); in snd_rawmidi_write()
1405 struct snd_rawmidi_runtime *runtime; in snd_rawmidi_poll() local
1410 runtime = rfile->input->runtime; in snd_rawmidi_poll()
1412 poll_wait(file, &runtime->sleep, wait); in snd_rawmidi_poll()
1415 runtime = rfile->output->runtime; in snd_rawmidi_poll()
1416 poll_wait(file, &runtime->sleep, wait); in snd_rawmidi_poll()
1447 struct snd_rawmidi_runtime *runtime; in snd_rawmidi_proc_info_read() local
1465 runtime = substream->runtime; in snd_rawmidi_proc_info_read()
1470 runtime->oss ? "OSS compatible" : "native", in snd_rawmidi_proc_info_read()
1471 (unsigned long) runtime->buffer_size, in snd_rawmidi_proc_info_read()
1472 (unsigned long) runtime->avail); in snd_rawmidi_proc_info_read()
1489 runtime = substream->runtime; in snd_rawmidi_proc_info_read()
1494 (unsigned long) runtime->buffer_size, in snd_rawmidi_proc_info_read()
1495 (unsigned long) runtime->avail, in snd_rawmidi_proc_info_read()
1496 (unsigned long) runtime->xruns); in snd_rawmidi_proc_info_read()
1761 if (s->runtime) in snd_rawmidi_dev_disconnect()
1762 wake_up(&s->runtime->sleep); in snd_rawmidi_dev_disconnect()