From owner-svn-src-head@freebsd.org Thu May 26 18:01:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 908CAB4B3CB; Thu, 26 May 2016 18:01:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 492D519EC; Thu, 26 May 2016 18:01:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QI13iq051784; Thu, 26 May 2016 18:01:03 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QI13ui051783; Thu, 26 May 2016 18:01:03 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605261801.u4QI13ui051783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 26 May 2016 18:01:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300760 - head/sys/dev/siba X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2016 18:01:04 -0000 Author: adrian Date: Thu May 26 18:01:03 2016 New Revision: 300760 URL: https://svnweb.freebsd.org/changeset/base/300760 Log: [siba] use the generic bus methods where appropriate. Submitted by: jhibbits Differential Revision: https://reviews.freebsd.org/D802 Modified: head/sys/dev/siba/siba_bwn.c Modified: head/sys/dev/siba/siba_bwn.c ============================================================================== --- head/sys/dev/siba/siba_bwn.c Thu May 26 17:06:43 2016 (r300759) +++ head/sys/dev/siba/siba_bwn.c Thu May 26 18:01:03 2016 (r300760) @@ -177,43 +177,17 @@ siba_bwn_detach(device_t dev) } static int -siba_bwn_shutdown(device_t dev) -{ - device_t *devlistp; - int devcnt, error = 0, i; - - error = device_get_children(dev, &devlistp, &devcnt); - if (error != 0) - return (error); - - for (i = 0 ; i < devcnt ; i++) - device_shutdown(devlistp[i]); - free(devlistp, M_TEMP); - return (0); -} - -static int siba_bwn_suspend(device_t dev) { struct siba_bwn_softc *ssc = device_get_softc(dev); struct siba_softc *siba = &ssc->ssc_siba; - device_t *devlistp; - int devcnt, error = 0, i, j; + int error; + + error = bus_generic_suspend(dev); - error = device_get_children(dev, &devlistp, &devcnt); if (error != 0) return (error); - for (i = 0 ; i < devcnt ; i++) { - error = DEVICE_SUSPEND(devlistp[i]); - if (error) { - for (j = 0; j < i; j++) - DEVICE_RESUME(devlistp[j]); - free(devlistp, M_TEMP); - return (error); - } - } - free(devlistp, M_TEMP); return (siba_core_suspend(siba)); } @@ -222,20 +196,14 @@ siba_bwn_resume(device_t dev) { struct siba_bwn_softc *ssc = device_get_softc(dev); struct siba_softc *siba = &ssc->ssc_siba; - device_t *devlistp; - int devcnt, error = 0, i; + int error; error = siba_core_resume(siba); if (error != 0) return (error); - error = device_get_children(dev, &devlistp, &devcnt); - if (error != 0) - return (error); + bus_generic_resume(dev); - for (i = 0 ; i < devcnt ; i++) - DEVICE_RESUME(devlistp[i]); - free(devlistp, M_TEMP); return (0); } @@ -410,7 +378,7 @@ static device_method_t siba_bwn_methods[ DEVMETHOD(device_probe, siba_bwn_probe), DEVMETHOD(device_attach, siba_bwn_attach), DEVMETHOD(device_detach, siba_bwn_detach), - DEVMETHOD(device_shutdown, siba_bwn_shutdown), + DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, siba_bwn_suspend), DEVMETHOD(device_resume, siba_bwn_resume),