Page MenuHomeFreeBSD

sound: Simplify unit fetching in dsp_oss_audioinfo()
ClosedPublic

Authored by christos on Apr 18 2024, 6:39 PM.
Tags
None
Referenced Files
F102634764: D44855.diff
Fri, Nov 15, 3:14 AM
Unknown Object (File)
Wed, Nov 13, 11:37 AM
Unknown Object (File)
Wed, Oct 30, 4:46 PM
Unknown Object (File)
Wed, Oct 30, 4:45 PM
Unknown Object (File)
Oct 3 2024, 8:52 AM
Unknown Object (File)
Oct 2 2024, 6:34 PM
Unknown Object (File)
Sep 30 2024, 2:59 PM
Unknown Object (File)
Sep 27 2024, 2:51 PM
Subscribers

Details

Summary

"i" keeps the value of the current unit, so we do not have to call
PCMUNIT() and device_get_unit() to fetch it.

In the mixer case, I think it is more correct to do it like this, since
mixer and DSP device units have a 1-1 relationship (i.e the mixer unit
is always the same as the corresponding DSP device one) and that
way we can make this more clear.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Diff Detail

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

Event Timeline

sys/dev/sound/pcm/dsp.c
2201

IMO it would be clearer to just make unit the loop variable.

sys/dev/sound/pcm/dsp.c
2201

"i" is also used for some inner loops here (we should use a different variable probably but it doesn't hurt in this case), so unit wouldn't make much sense without introducing another loop variable for the inner loops.

sys/dev/sound/pcm/dsp.c
2201

AFAICS the use of i in the inner loops is unrelated to the use of i in the outer loop, so why can't we use unit in the outer loop and continue to use i in the inner loops?

sys/dev/sound/pcm/dsp.c
2201

I thought you meant to just rename i to unit and use it everywhere we currently have i. My bad.

christos marked 2 inline comments as done.

Address Mark's comments.

This revision is now accepted and ready to land.Apr 18 2024, 8:22 PM