Page MenuHomeFreeBSD

sound: Simplify unit fetching in dsp_oss_audioinfo()
ClosedPublic

Authored by christos on Thu, Apr 18, 6:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 2:43 PM
Unknown Object (File)
Tue, Apr 30, 12:51 PM
Unknown Object (File)
Tue, Apr 30, 8:43 AM
Unknown Object (File)
Sat, Apr 27, 4:38 AM
Unknown Object (File)
Fri, Apr 26, 3:56 PM
Unknown Object (File)
Fri, Apr 26, 1:21 AM
Unknown Object (File)
Sat, Apr 20, 6:03 PM
Unknown Object (File)
Fri, Apr 19, 12:12 AM
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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/dev/sound/pcm/dsp.c
2199–2200

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

sys/dev/sound/pcm/dsp.c
2199–2200

"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
2199–2200

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
2199–2200

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.Thu, Apr 18, 8:22 PM