9d77f45a93d36218cd991a199d2d839d0fb16873
[openwrt/staging/luka.git] /
1 From a845f23bddcb2b0e48e8158bb06b0990c4760e7e Mon Sep 17 00:00:00 2001
2 From: Giedrius <giedrius@blokas.io>
3 Date: Fri, 16 Mar 2018 18:14:31 +0200
4 Subject: [PATCH 254/454] Fix for Pisound's MIDI Input getting blocked for a
5 while in rare cases.
6
7 There was a possible race condition which could lead to Input's FIFO queue
8 to be underflown, causing high amount of processing in the worker thread for
9 some period of time.
10
11 Signed-off-by: Giedrius Trainavicius <giedrius@blokas.io>
12 ---
13 sound/soc/bcm/pisound.c | 12 +++++++-----
14 1 file changed, 7 insertions(+), 5 deletions(-)
15
16 --- a/sound/soc/bcm/pisound.c
17 +++ b/sound/soc/bcm/pisound.c
18 @@ -56,6 +56,12 @@ static const char *pisnd_spi_get_version
19 static int pisnd_midi_init(struct snd_card *card);
20 static void pisnd_midi_uninit(void);
21
22 +enum task_e {
23 + TASK_PROCESS = 0,
24 +};
25 +
26 +static void pisnd_schedule_process(enum task_e task);
27 +
28 #define PISOUND_LOG_PREFIX "pisound: "
29
30 #ifdef PISOUND_DEBUG
31 @@ -129,7 +135,7 @@ static void pisnd_input_trigger(struct s
32 {
33 if (up) {
34 pisnd_spi_set_callback(pisnd_midi_recv_callback, substream);
35 - pisnd_midi_recv_callback(substream);
36 + pisnd_schedule_process(TASK_PROCESS);
37 } else {
38 pisnd_spi_set_callback(NULL, NULL);
39 }
40 @@ -258,10 +264,6 @@ static bool pisnd_spi_has_more(void)
41 return gpiod_get_value(data_available);
42 }
43
44 -enum task_e {
45 - TASK_PROCESS = 0,
46 -};
47 -
48 static void pisnd_schedule_process(enum task_e task)
49 {
50 if (pisnd_spi_device != NULL &&