else
down_read(&rdev->filelist_sem);
list_for_each_entry(vmidi, &rdev->filelist, list) {
- if (!vmidi->trigger)
+ if (!READ_ONCE(vmidi->trigger))
continue;
if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {
if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
{
struct snd_virmidi *vmidi = substream->runtime->private_data;
- if (up) {
- vmidi->trigger = 1;
- } else {
- vmidi->trigger = 0;
- }
+ WRITE_ONCE(vmidi->trigger, !!up);
}
/* process rawmidi bytes and send events;
return;
}
- while (vmidi->trigger) {
+ while (READ_ONCE(vmidi->trigger)) {
if (snd_rawmidi_transmit(substream, &input, 1) != 1)
break;
if (snd_midi_event_encode_byte(vmidi->parser, input,
{
struct snd_virmidi *vmidi = substream->runtime->private_data;
- vmidi->trigger = !!up;
+ WRITE_ONCE(vmidi->trigger, !!up);
if (up)
queue_work(system_highpri_wq, &vmidi->output_work);
}
{
struct snd_virmidi *vmidi = substream->runtime->private_data;
- vmidi->trigger = 0; /* to be sure */
+ WRITE_ONCE(vmidi->trigger, false); /* to be sure */
cancel_work_sync(&vmidi->output_work);
snd_midi_event_free(vmidi->parser);
substream->runtime->private_data = NULL;