aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2015-10-20 10:46:57 -0400
committerTakashi Iwai <tiwai@suse.de>2015-10-20 11:49:14 -0400
commitb7ab614f301741ae3cb61fb6a90e290083d3b95d (patch)
tree62cccb35111a2214e1c5760093abc2dd74803ccb
parent516a30615635fdec6a298d7b7cedca1270bc641c (diff)
ALSA: firewire-tascam: use better name for local variables to describe their intension
In the callback function of asynchronous MIDI port, the intension of some local variables are not clear. This commit improves them. The 'len' variable is used to calculate the number of MIDI bytes including in the transaction. The 'consume' variable is used to return the actual number of consumed bytes in ALSA MIDI buffer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/firewire/tascam/tascam-transaction.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sound/firewire/tascam/tascam-transaction.c b/sound/firewire/tascam/tascam-transaction.c
index 7c8068469f57..ea88655e7e08 100644
--- a/sound/firewire/tascam/tascam-transaction.c
+++ b/sound/firewire/tascam/tascam-transaction.c
@@ -65,14 +65,14 @@ static int fill_message(struct snd_rawmidi_substream *substream, u8 *buf)
65 int i, len, consume; 65 int i, len, consume;
66 u8 status; 66 u8 status;
67 67
68 len = snd_rawmidi_transmit_peek(substream, buf + 1, 3); 68 consume = snd_rawmidi_transmit_peek(substream, buf + 1, 3);
69 if (len == 0) 69 if (consume == 0)
70 return 0; 70 return 0;
71 71
72 /* On exclusive message. */ 72 /* On exclusive message. */
73 if (tscm->on_sysex[port]) { 73 if (tscm->on_sysex[port]) {
74 /* Seek the end of exclusives. */ 74 /* Seek the end of exclusives. */
75 for (i = 1; i < 4 || i < len; ++i) { 75 for (i = 1; i < 4 || i < consume; ++i) {
76 if (buf[i] == 0xf7) { 76 if (buf[i] == 0xf7) {
77 tscm->on_sysex[port] = false; 77 tscm->on_sysex[port] = false;
78 break; 78 break;
@@ -81,14 +81,14 @@ static int fill_message(struct snd_rawmidi_substream *substream, u8 *buf)
81 81
82 /* At the end of exclusive message, use label 0x07. */ 82 /* At the end of exclusive message, use label 0x07. */
83 if (!tscm->on_sysex[port]) { 83 if (!tscm->on_sysex[port]) {
84 len = i; 84 consume = i;
85 buf[0] = (port << 4) | 0x07; 85 buf[0] = (port << 4) | 0x07;
86 /* During exclusive message, use label 0x04. */ 86 /* During exclusive message, use label 0x04. */
87 } else if (len == 3) { 87 } else if (consume == 3) {
88 buf[0] = (port << 4) | 0x04; 88 buf[0] = (port << 4) | 0x04;
89 /* We need to fill whole 3 bytes. Go to next change. */ 89 /* We need to fill whole 3 bytes. Go to next change. */
90 } else { 90 } else {
91 len = 0; 91 consume = 0;
92 } 92 }
93 } else { 93 } else {
94 /* The beginning of exclusives. */ 94 /* The beginning of exclusives. */
@@ -104,8 +104,8 @@ static int fill_message(struct snd_rawmidi_substream *substream, u8 *buf)
104 status = buf[1]; 104 status = buf[1];
105 105
106 /* Calculate consume bytes. */ 106 /* Calculate consume bytes. */
107 consume = calculate_message_bytes(status); 107 len = calculate_message_bytes(status);
108 if (consume <= 0) 108 if (len <= 0)
109 return 0; 109 return 0;
110 110
111 /* On running-status. */ 111 /* On running-status. */
@@ -119,16 +119,16 @@ static int fill_message(struct snd_rawmidi_substream *substream, u8 *buf)
119 } 119 }
120 120
121 /* Confirm length. */ 121 /* Confirm length. */
122 if (len < consume) 122 if (consume < len)
123 return 0; 123 return 0;
124 if (len > consume) 124 if (consume > len)
125 len = consume; 125 consume = len;
126 } 126 }
127 127
128 buf[0] = (port << 4) | (buf[1] >> 4); 128 buf[0] = (port << 4) | (buf[1] >> 4);
129 } 129 }
130 130
131 return len; 131 return consume;
132} 132}
133 133
134static void handle_midi_tx(struct fw_card *card, struct fw_request *request, 134static void handle_midi_tx(struct fw_card *card, struct fw_request *request,