diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2018-05-02 19:16:49 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-05-02 16:02:05 +0200 |
commit | b8f78234aa6a180db9b29da5b48c18d26c06ecc2 (patch) | |
tree | bfdbbb4f0848350ca5a3a6041ec5820f01c8e218 /sound/firewire/dice/dice-midi.c | |
parent | afa617f219761473881ace59f31bd6713fed1833 (diff) | |
download | linux-stable-b8f78234aa6a180db9b29da5b48c18d26c06ecc2.tar.gz linux-stable-b8f78234aa6a180db9b29da5b48c18d26c06ecc2.tar.bz2 linux-stable-b8f78234aa6a180db9b29da5b48c18d26c06ecc2.zip |
ALSA: dice: use stream formats to add MIDI substreams
In former commits, proxy structure gets members for cache of stream
formats. The cache can be used to count the number of MIDI substreams
to add.
This commit uses the cache for this purpose.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/dice/dice-midi.c')
-rw-r--r-- | sound/firewire/dice/dice-midi.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/sound/firewire/dice/dice-midi.c b/sound/firewire/dice/dice-midi.c index 8ff6da3c51f7..84eca8a51a02 100644 --- a/sound/firewire/dice/dice-midi.c +++ b/sound/firewire/dice/dice-midi.c @@ -101,27 +101,18 @@ int snd_dice_create_midi(struct snd_dice *dice) .close = midi_close, .trigger = midi_playback_trigger, }; - __be32 reg; struct snd_rawmidi *rmidi; struct snd_rawmidi_str *str; unsigned int midi_in_ports, midi_out_ports; + int i; int err; - /* - * Use the number of MIDI conformant data channel at current sampling - * transfer frequency. - */ - err = snd_dice_transaction_read_tx(dice, TX_NUMBER_MIDI, - ®, sizeof(reg)); - if (err < 0) - return err; - midi_in_ports = be32_to_cpu(reg); - - err = snd_dice_transaction_read_rx(dice, RX_NUMBER_MIDI, - ®, sizeof(reg)); - if (err < 0) - return err; - midi_out_ports = be32_to_cpu(reg); + midi_in_ports = 0; + midi_out_ports = 0; + for (i = 0; i < MAX_STREAMS; ++i) { + midi_in_ports = max(midi_in_ports, dice->tx_midi_ports[i]); + midi_out_ports = max(midi_out_ports, dice->rx_midi_ports[i]); + } if (midi_in_ports + midi_out_ports == 0) return 0; |