Module Name: src Committed By: macallan Date: Wed Jan 24 17:21:03 UTC 2018
Modified Files: src/sys/arch/macppc/dev: ki2c.c Log Message: note to self: OF_getprop() returns -1 on error now this works properly on sevan's iMac G4 To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/macppc/dev/ki2c.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/macppc/dev/ki2c.c diff -u src/sys/arch/macppc/dev/ki2c.c:1.23 src/sys/arch/macppc/dev/ki2c.c:1.24 --- src/sys/arch/macppc/dev/ki2c.c:1.23 Wed Sep 27 22:10:19 2017 +++ src/sys/arch/macppc/dev/ki2c.c Wed Jan 24 17:21:03 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ki2c.c,v 1.23 2017/09/27 22:10:19 macallan Exp $ */ +/* $NetBSD: ki2c.c,v 1.24 2018/01/24 17:21:03 macallan Exp $ */ /* Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp */ /*- @@ -151,15 +151,15 @@ ki2c_attach(device_t parent, device_t se devs = OF_child(i2cbus); while (devs != 0) { - if (OF_getprop(devs, "name", name, 32) == 0) + if (OF_getprop(devs, "name", name, 32) <= 0) goto skip; - if (OF_getprop(devs, "compatible", compat, 256) == 0) { + if (OF_getprop(devs, "compatible", compat, 256) <= 0) { /* some i2c device nodes don't have 'compatible' */ memset(compat, 0, 256); strncpy(compat, name, 256); } - if (OF_getprop(devs, "reg", &addr, 4) == 0) - if (OF_getprop(devs, "i2c-address", &addr, 4) == 0) + if (OF_getprop(devs, "reg", &addr, 4) <= 0) + if (OF_getprop(devs, "i2c-address", &addr, 4) <= 0) goto skip; addr = (addr & 0xff) >> 1; DPRINTF("-> %s@%x\n", name, addr);