Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754136Ab2KUJyM (ORCPT ); Wed, 21 Nov 2012 04:54:12 -0500 Received: from moutng.kundenserver.de ([212.227.17.8]:51625 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751051Ab2KUJyK (ORCPT ); Wed, 21 Nov 2012 04:54:10 -0500 From: Arnd Bergmann To: Stephen Warren Subject: Re: [PATCH V4 1/3] of: introduce for_each_matching_node_and_match() Date: Wed, 21 Nov 2012 09:53:20 +0000 User-Agent: KMail/1.12.2 (Linux/3.5.0; KDE/4.3.2; x86_64; ; ) Cc: John Stultz , Thomas Gleixner , Grant Likely , Rob Herring , Olof Johansson , Josh Cartwright , Thomas Petazzoni , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, Stephen Warren References: <1353453142-4973-1-git-send-email-swarren@wwwdotorg.org> In-Reply-To: <1353453142-4973-1-git-send-email-swarren@wwwdotorg.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201211210953.20552.arnd@arndb.de> X-Provags-ID: V02:K0:drhSzqT/w5s0SR4SIv1qM6LEx8BPgJHqJgKziMpPDq1 //4+cwBSUmFYgg2lXqPA17j1tNtOQ+v/RcldV9egVii3afc2Rj yjJ6U4v2kvWp4XAEzgLHX+klo/oR1bo/4dP5Pl/ytaM4+psmCh Rd/XyM/WwBpGlWqKKe/h1fmmVRJL2U3WCEKn17uCLw3xKkWy8F MsJOwvJehhP/C3vgvDC4F+B7wS/ptA8qp3/HNqkeXionr3zu3P rGv32KUI1+ZX/SDlYoEAjnPNqa0k+6A5GKGiH4W0Z2dQSLHfid FKcBWHGMNBjnSUqaZYih1gQNbuezzRifwPVPd16L756BukCjJU VQ5D+P7Mxd/0yLXal78s= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1002 Lines: 22 On Tuesday 20 November 2012, Stephen Warren wrote: > However, this results in iterating over table twice; the second time > inside of_match_node(). The implementation of for_each_matching_node() > already found the match, so this is redundant. Invent new function > of_find_matching_node_and_match() and macro > for_each_matching_node_and_match() to remove the double iteration, > thus transforming the above code to: > > for_each_matching_node_and_match(np, table, &match) > > Signed-off-by: Stephen Warren This look useful, but I wonder if the interface would make more sense if you make the last argument to the macro a normal pointer, rather than a pointer-to-pointer. You can take the reference as part of the macro. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/