Page MenuHomeFreeBSD

sound: Sort channels by unit number as well
ClosedPublic

Authored by christos on Sep 5 2024, 8:00 PM.
Tags
None
Referenced Files
F122587218: D46549.id145082.diff
Sun, Jul 6, 11:48 AM
Unknown Object (File)
Sun, Jun 29, 9:05 AM
Unknown Object (File)
Sat, Jun 28, 5:28 AM
Unknown Object (File)
Sat, Jun 21, 9:59 PM
Unknown Object (File)
Fri, Jun 20, 11:04 AM
Unknown Object (File)
Fri, Jun 13, 6:18 PM
Unknown Object (File)
Fri, Jun 13, 5:50 PM
Unknown Object (File)
Tue, Jun 10, 2:22 AM
Subscribers

Details

Summary

This makes the channel list easier to parse, as the channels are also
sorted by unit number.

Sponsored by: The FreeBSD Foundation
MFC after: 2 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59497
Build 56384: arc lint + arc unit

Event Timeline

What happens when (y)->type == t->type

sys/dev/sound/pcm/channel.h
227–237

This does not sort correctly. It can prematurely break out of the loop as soon as (y)->unit w t->unit isn't satisfied, thus inserting the channel among the wrong channel type. You probably want to prioritize one partial order (type) over the other (unit).

christos marked an inline comment as done.

Fix.

I think this is correct, but overly complicated. The classic sorting comparison would be:

if (((y)->type w t->type) || 
    (((y)->type == t->type) && ((y)->unit w t->unit)))
        a = t;
else
        break;
This revision is now accepted and ready to land.Sep 16 2024, 12:58 AM
This revision was automatically updated to reflect the committed changes.