From owner-cvs-all@FreeBSD.ORG Sat Jan 14 23:35:46 2006 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 867ED16A41F; Sat, 14 Jan 2006 23:35:46 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.FreeBSD.org (Postfix) with ESMTP id E6F0243D46; Sat, 14 Jan 2006 23:35:45 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.48.2]) by phk.freebsd.dk (Postfix) with ESMTP id CF4C2BC74; Sat, 14 Jan 2006 23:35:43 +0000 (UTC) To: Nate Lawson From: "Poul-Henning Kamp" In-Reply-To: Your message of "Sat, 14 Jan 2006 12:47:39 PST." <43C9636B.6070500@root.org> Date: Sun, 15 Jan 2006 00:35:43 +0100 Message-ID: <33479.1137281743@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern subr_bus.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2006 23:35:46 -0000 In message <43C9636B.6070500@root.org>, Nate Lawson writes: >Poul-Henning Kamp wrote: >> Index: src/sys/kern/subr_bus.c >> diff -u src/sys/kern/subr_bus.c:1.187 src/sys/kern/subr_bus.c:1.188 >> --- src/sys/kern/subr_bus.c:1.187 Tue Oct 4 22:25:14 2005 >> +++ src/sys/kern/subr_bus.c Sat Jan 14 09:41:35 2006 >> @@ -2820,7 +2820,7 @@ >> { >> struct resource_list_entry *rle; >> >> - STAILQ_FOREACH(rle, rl, link) { >> + while ((rle = STAILQ_FIRST(rl)) != NULL) { >> if (rle->res) >> bus_release_resource(rman_get_device(rle->res), >> rle->type, rle->rid, rle->res); > >Isn't that what the STAILQ_FOREACH_SAFE() macro is for? List traversal >with deletion? Your approach is also fine. In this case we empty the entire list, so this should be marginally faster, which is probably irrelevevant, and maybe a tiny bit clearer on the intent. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.