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
Unknown Object (File)
Thu, Nov 14, 11:00 PM
Unknown Object (File)
Tue, Nov 12, 5:04 PM
Unknown Object (File)
Mon, Nov 11, 1:59 PM
Unknown Object (File)
Fri, Nov 8, 6:46 PM
Unknown Object (File)
Tue, Nov 5, 7:09 PM
Unknown Object (File)
Mon, Oct 21, 8:02 AM
Unknown Object (File)
Oct 18 2024, 9:51 AM
Unknown Object (File)
Oct 15 2024, 8:16 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 59323
Build 56210: arc lint + arc unit

Event Timeline

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

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

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.