Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp526893imm; Wed, 22 Aug 2018 08:13:17 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzQYFj4v/qzjQ5vi2ShTPAeWALf0r7IEJRhSTj8t7UCF6wqq53FTf/UDzpHFtAmMINxUKvK X-Received: by 2002:a17:902:9a83:: with SMTP id w3-v6mr55299266plp.75.1534950797047; Wed, 22 Aug 2018 08:13:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534950797; cv=none; d=google.com; s=arc-20160816; b=yDeURL/BMp5BsdnHgrO9FjkvYeODmgH9Uhu0JfA3utK35KcFBJrN8WLjSeVqE690aP 40poeIcSOfO8OnPvi/pFDLoXWUbe3WxTDvKUJkSm4zxkLV/6I6Nd0vJlCzuIu3J7Eo0B PeM9xh1Xzt2NrafGEBMGYkZCDeqX1AG1Wo/w3Xth6jkko9rqxgmXZg9ruoEMFzchLOcI HMFjJ0+l/5giKj/aPdmEZT5IIdJdDKLZ1z6QpJgJxT9hmivmybYwmVCA2JYzUifN1MhM bWZ9iIH576AwaHlVlWU3AWbul1vVzHvtELPiPyDkTVeTi+ExzDZ61V8uSyU34uA8QLKz HqmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=9OL/QoC1Iaj0cbqFFq+OVBzZO3JS44FDpH5yUyUdkFc=; b=etCJNg9ukQpQNhJ8EvZyZTL4bCY6TqzQ9hfWICecvcfOZ1wrajHRrtUBshDrTRfjxI 1GHtDcT/AT2P/9xvo45v/FXqBgQkD86ToMPSwaAtQSBcyNAgmeH/jzRRoZyrRkuKIuce V/2+z/dJP1AbdCZNM5nX9SaFm8jJcaiMsn44JXJBbFX+QJZnsl/JwNh1Vz3suNiqR3X1 Jt0CLqaKQOayWxRaL/fc+0XQTHqZHxXo81z3qDbx+0Z16rd3//XfcnCZLCd9r7AtKSoS pasVfQwRiwA/qPhu2Z3EIBhcYNNJZ5pKsBz61N54prf9FLim3IytdCZCfI56LqFr0GWM 6vxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QBqNDmsg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e185-v6si1907789pgc.318.2018.08.22.08.13.00; Wed, 22 Aug 2018 08:13:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QBqNDmsg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729212AbeHVSMI (ORCPT + 99 others); Wed, 22 Aug 2018 14:12:08 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36799 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728207AbeHVSMH (ORCPT ); Wed, 22 Aug 2018 14:12:07 -0400 Received: by mail-lj1-f194.google.com with SMTP id u7-v6so1660271lji.3; Wed, 22 Aug 2018 07:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9OL/QoC1Iaj0cbqFFq+OVBzZO3JS44FDpH5yUyUdkFc=; b=QBqNDmsgbWGNMvvqtBn0PHlDqXKozfJIZTxcmCWApbTsds4v8zdtlv4nySUrBHu61h OwL4Z3iAFVyiORiUQ7UQ0WuSX7aTY083kqJrNFIaiGsffIWpoBhUR9V7UZoE+h8v/2xU VPNsrOPHm1EWa+22+0H8SuHsu+opZrLAWMaN1oiDJpqFRAXkOvlz2egwXJ9n53KQEqkA gGsRKkdr+rk7F6F3cGJ653lwgOS8QF5c22Gzp/zBztavvh0I2Pj0J00INKcKbqHbTy/a CDo4OBQXcybo/PHBmPp2t9h/fMi32xkAxXlH5FneohU60LC1+GfS+Z1yGpvWAWD1GOsQ yJyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=9OL/QoC1Iaj0cbqFFq+OVBzZO3JS44FDpH5yUyUdkFc=; b=G1pdYi+/ZY6EjQx/69HD+94iV/5M1X8TiChXCYxY7R7tRov+575Z+s8fREWg5WrWBp WFCIg/2yFk0CJefezpqyRXdyByefRh+wJt/VlcPzIyI396mcZOGc92hoNNrSEI6Hyt6P jYfman/9ZxljrfXQdOMHmdpsJIciQ/EHPMed00pa8yb2cQmLU246E2Y55RBI3Zbplrs+ PloDd04jWRcqVZWgt9uPnyGe7VXWuNgAMnUa8zkT8HvDlo623GCd0byg+RaI2oj8iTjf bdSXh5eF+a2Ze7Oub5cHTll72fe9CrTW1HgquAEkLEK3sVgU7qR5plK6o2z+Horiwl91 byNg== X-Gm-Message-State: AOUpUlHBldngCvpC6JFywxKNO5ljeKn7Cnz3J5tEK45muG9FBRRCfgEn U+dw8bNBXq4tqmpM6WmUApg= X-Received: by 2002:a2e:4401:: with SMTP id r1-v6mr39681641lja.21.1534949214507; Wed, 22 Aug 2018 07:46:54 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id g87-v6sm348789lfh.92.2018.08.22.07.46.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Aug 2018 07:46:53 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1fsUPQ-0006Yw-0M; Wed, 22 Aug 2018 16:46:56 +0200 Date: Wed, 22 Aug 2018 16:46:55 +0200 From: Johan Hovold To: Rob Herring Cc: Johan , Greg Kroah-Hartman , Frank Rowand , devicetree@vger.kernel.org, Linux Kernel Mailing List , ck.hu@mediatek.com, p.zabel@pengutronix.de, Rob Clark , airlied@linux.ie, Ulf Hansson , rainyfeeling@outlook.com, boris.brezillon@bootlin.com, opendmb@gmail.com, Florian Fainelli , davem@davemloft.net, peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, sameo@linux.intel.com, sre@kernel.org Subject: Re: [PATCH 0/9] of: fix compatible-child-node lookups Message-ID: <20180822144655.GO14967@localhost> References: <20180822105547.9634-1-johan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 22, 2018 at 09:32:11AM -0500, Rob Herring wrote: > On Wed, Aug 22, 2018 at 5:57 AM Johan Hovold wrote: > > > > Several drivers currently use of_find_compatible_node() to lookup child > > nodes while failing to notice that the of_find_ functions search the > > entire tree depth-first and therefore can match unrelated (non-child) > > nodes. > > That is not quite right. It searches all nodes following 'from', so > not the entire tree unless 'from' is NULL. The purpose of 'from' is to > iterate to find all compatible nodes. But you are correct that anyone > calling of_find_compatible_node directly with from != NULL is wrong. Yeah, sorry, I guess I could have been more specific. I just find qualifying "searching the entire tree" with "starting from the node specified in the first argument" to be too cumbersome to write. And it's sort of implicit as the functions *are* iterators meant for searching the entire tree (passing NULL as the first argument the first time). > > This is related to the fixes I posted about a year ago, which addressed > > a similar anti-pattern when looking up child nodes by name. Since it > > took me more than a year to get all those fixes into Linus' tree (one > > fix is still pending), and as these fixes depend on the new helper, I'm > > suggesting that these all go in through Rob's or Greg's trees. > > I'm happy to take them or apply the dependency now and then anything > not picked up by sub-maintainers for 4.20. Thanks, let's see if what the others prefer. Johan