From: Giedrius Date: Fri, 16 Mar 2018 16:14:31 +0000 (+0200) Subject: Fix for Pisound's MIDI Input getting blocked for a while in rare cases. X-Git-Tag: archive/raspbian/4.9.82-1+deb9u3+rpi1_jessie~5^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c3d756d8350be4630c2dbfbfd45e74c3313a7df3;p=linux-4.9.git Fix for Pisound's MIDI Input getting blocked for a while in rare cases. There was a possible race condition which could lead to Input's FIFO queue to be underflown, causing high amount of processing in the worker thread for some period of time. Signed-off-by: Giedrius Trainavicius --- diff --git a/sound/soc/bcm/pisound.c b/sound/soc/bcm/pisound.c index 00ae628acdd2..ab9ea1f32931 100644 --- a/sound/soc/bcm/pisound.c +++ b/sound/soc/bcm/pisound.c @@ -56,6 +56,12 @@ static const char *pisnd_spi_get_version(void); static int pisnd_midi_init(struct snd_card *card); static void pisnd_midi_uninit(void); +enum task_e { + TASK_PROCESS = 0, +}; + +static void pisnd_schedule_process(enum task_e task); + #define PISOUND_LOG_PREFIX "pisound: " #ifdef PISOUND_DEBUG @@ -129,7 +135,7 @@ static void pisnd_input_trigger(struct snd_rawmidi_substream *substream, int up) { if (up) { pisnd_spi_set_callback(pisnd_midi_recv_callback, substream); - pisnd_midi_recv_callback(substream); + pisnd_schedule_process(TASK_PROCESS); } else { pisnd_spi_set_callback(NULL, NULL); } @@ -258,10 +264,6 @@ static bool pisnd_spi_has_more(void) return gpiod_get_value(data_available); } -enum task_e { - TASK_PROCESS = 0, -}; - static void pisnd_schedule_process(enum task_e task) { if (pisnd_spi_device != NULL &&