diff options
author | nsouch <nsouch@FreeBSD.org> | 1999-02-13 17:57:19 +0000 |
---|---|---|
committer | nsouch <nsouch@FreeBSD.org> | 1999-02-13 17:57:19 +0000 |
commit | b54915a02a005ac44ae03d3389cbd4bb9eb36eb0 (patch) | |
tree | 37871233440dda9b3049179b011bef26a64be298 /sys/dev/smbus/smbconf.c | |
parent | 9c9f54385422ba14291ad62aa195016e871d5b8a (diff) | |
download | FreeBSD-src-b54915a02a005ac44ae03d3389cbd4bb9eb36eb0.zip FreeBSD-src-b54915a02a005ac44ae03d3389cbd4bb9eb36eb0.tar.gz |
Fix smbus allocation and add the alsmb (see alpm(4)) driver.
Diffstat (limited to 'sys/dev/smbus/smbconf.c')
-rw-r--r-- | sys/dev/smbus/smbconf.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/dev/smbus/smbconf.c b/sys/dev/smbus/smbconf.c index 458916f..1e7d8c4 100644 --- a/sys/dev/smbus/smbconf.c +++ b/sys/dev/smbus/smbconf.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: smbconf.c,v 1.3 1998/11/22 22:01:42 nsouch Exp $ + * $Id: smbconf.c,v 1.4 1999/01/09 18:08:23 nsouch Exp $ * */ #include <sys/param.h> @@ -104,16 +104,12 @@ smbus_request_bus(device_t bus, device_t dev, int how) int s, error = 0; /* first, ask the underlying layers if the request is ok */ - do { - error = SMBUS_CALLBACK(device_get_parent(bus), - SMB_REQUEST_BUS, (caddr_t)&how); - if (error) - error = smbus_poll(sc, how); - } while (error); + error = SMBUS_CALLBACK(device_get_parent(bus), SMB_REQUEST_BUS, + (caddr_t)&how); while (!error) { s = splhigh(); - if (sc->owner) { + if (sc->owner && sc->owner != dev) { splx(s); error = smbus_poll(sc, how); @@ -123,6 +119,11 @@ smbus_request_bus(device_t bus, device_t dev, int how) splx(s); return (0); } + + /* free any allocated resource */ + if (error) + SMBUS_CALLBACK(device_get_parent(bus), SMB_RELEASE_BUS, + (caddr_t)&how); } return (error); |