From owner-svn-src-all@FreeBSD.ORG Thu Jan 15 23:14:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63BEB106566B; Thu, 15 Jan 2009 23:14:59 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51BF18FC0A; Thu, 15 Jan 2009 23:14:59 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0FNEx3j090164; Thu, 15 Jan 2009 23:14:59 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0FNExe5090163; Thu, 15 Jan 2009 23:14:59 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200901152314.n0FNExe5090163@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 15 Jan 2009 23:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187321 - head/sys/dev/iicbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jan 2009 23:15:00 -0000 Author: nwhitehorn Date: Thu Jan 15 23:14:59 2009 New Revision: 187321 URL: http://svn.freebsd.org/changeset/base/187321 Log: Revert revision 186833 and try a different strategy to allow this device to work when the bus attaches its own children. Instead of hardcoding a unit number and returning BUS_PROBE_NOWILDCARD, which will break multiple iicbus systems, check in the probe routine whether the device address is 0. Real I2C devices will never have this address, but devices added with BUS_ADD_CHILD() will. Requested by: jhb Reviewed by: jhb Modified: head/sys/dev/iicbus/iic.c Modified: head/sys/dev/iicbus/iic.c ============================================================================== --- head/sys/dev/iicbus/iic.c Thu Jan 15 23:11:02 2009 (r187320) +++ head/sys/dev/iicbus/iic.c Thu Jan 15 23:14:59 2009 (r187321) @@ -110,14 +110,18 @@ iic_identify(driver_t *driver, device_t { if (device_find_child(parent, "iic", -1) == NULL) - BUS_ADD_CHILD(parent, 0, "iic", 0); + BUS_ADD_CHILD(parent, 0, "iic", -1); } static int iic_probe(device_t dev) { + if (iicbus_get_addr(dev) > 0) + return (ENXIO); + device_set_desc(dev, "I2C generic I/O"); - return (BUS_PROBE_NOWILDCARD); + + return (0); } static int