Slightly fix bidirectional stream number allocation.

This logic is still imperfect, since it allows at most 15 bidirectional
streams out of 30 allowed by specification, but at least now those should
work better.  On the other side I don't remember I ever saw controller
supporting the bidirectional streams, so this is likely a nop change.

MFC after:	1 month
This commit is contained in:
Alexander Motin 2017-11-25 09:42:14 +00:00
parent 216f72f141
commit 3228add807

View File

@ -1801,7 +1801,7 @@ hdac_find_stream(struct hdac_softc *sc, int dir, int stream)
int i, ss;
ss = -1;
/* Allocate ISS/BSS first. */
/* Allocate ISS/OSS first. */
if (dir == 0) {
for (i = 0; i < sc->num_iss; i++) {
if (sc->streams[i].stream == stream) {
@ -1869,7 +1869,7 @@ hdac_stream_alloc(device_t dev, device_t child, int dir, int format, int stripe,
/* Allocate stream number */
if (ss >= sc->num_iss + sc->num_oss)
stream = 15 - (ss - sc->num_iss + sc->num_oss);
stream = 15 - (ss - sc->num_iss - sc->num_oss);
else if (ss >= sc->num_iss)
stream = ss - sc->num_iss + 1;
else