ac97 interface q

Andriy Gapon avg at icyb.net.ua
Wed Apr 15 07:31:25 PDT 2009


ac97_if.m defines 'read' method to return int and 'write' method to take u_int32_t
data and return int.

Calls to AC97_READ and AC97_WRITE are present only in ac97.c and from those calls
it is evident that the calling code expects u_int16_t from 'read' and it also
passes u_int16_t to 'write', return value of 'write' is discarded.

Seems like the interface is richer than what its caller actually uses.

And it seems that implementations of the interface do not always have the exact
signature - they have the same number of parameters, but the types are varying.
Some implementations are closer to the interface contract, e.g. returning -1 from
'read' in case of error. Some are closer to the caller's expectations, e.g. having
void return type in 'write'.

What are your opinions - should the calling code be enhanced to use the interface
properly (i.e. attempt to detect error conditions) or should the interface be
dumbed down to its caller's expectations?

My ultimate goal is to make all implementations have exactly the signature
mandated by the interface.

-- 
Andriy Gapon


More information about the freebsd-multimedia mailing list