Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Apr 2009 17:17:40 +0300
From:      Andriy Gapon <avg@icyb.net.ua>
To:        freebsd-hackers@FreeBSD.org, freebsd-multimedia@FreeBSD.org
Subject:   ac97 interface q
Message-ID:  <49E5EC84.1080800@icyb.net.ua>

next in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49E5EC84.1080800>