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
F114867232: D46549.id145082.diff
Thu, Apr 17, 9:41 PM
Unknown Object (File)
Mar 16 2025, 11:04 PM
Unknown Object (File)
Mar 11 2025, 7:32 AM
Unknown Object (File)
Feb 27 2025, 10:47 PM
Unknown Object (File)
Feb 19 2025, 7:04 PM
Unknown Object (File)
Feb 11 2025, 5:37 AM
Unknown Object (File)
Jan 27 2025, 4:55 PM
Unknown Object (File)
Jan 18 2025, 9:28 PM
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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

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

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.