Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4302289ybx; Mon, 4 Nov 2019 11:05:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxZNfXhypXx4TR3TVpV0VgnIE6axX6QJn8FAmhughVDBGMmlNGQ6Go4SYZbyZC86yHtfe8A X-Received: by 2002:a17:906:3053:: with SMTP id d19mr26112653ejd.109.1572894319512; Mon, 04 Nov 2019 11:05:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572894319; cv=none; d=google.com; s=arc-20160816; b=XMTqkf7DVZ9FaDA1xIy2eAGFqRTH8vxBn3NYK4Cur9nt9kkJ4TQ6t3qL2q2iYULklS QKuq4Wc0EY7H+udTr5AVet5DuiRcYoAAAKhUZAJZMK/cTDly+KMDnHrqLDGZicLah8wd /GcCvbCNWUMuZyq/N3CKdi68f+GYMaWZm+lzwafLHw8p9LGfloX9PsZrk1TJezPd87Ws 5/3edoO9N/mlgshXU/YzEITfgwOHgHSyTG+Fw5IJptP2owVVPzqKvF0VjSl7AHzeZTdQ UZoV1URqhvv2gY4P4t8Y0Sms5jbdUcJaL5kEQcCxBcr7o8uWHhs6KLJlrluH8Ey7/sRz TW6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VHvMybYCPvLOcRHqCBZyxUzdSqz4vFyRg5UuR2Ahyew=; b=hzhXjuqzOAqewiWGdVL7DILyCtsBREapcx5kKxa7dHexgpk7Xz44/DIO9hy220dBbb u9JfCbZrq7XgyxU5CLR7A6BnzUk5t09N2CxeYSCFHRZn/6JKtnuMzshS7n2S269kayDk +7n0n+uwZ4+dWAtRZY8HbZRCKMgfpc0EC3hK+NoQYwIVPL4I6tvpOcN115S1kNFllsQ2 V3wKxj1dGib/O88Ydeto+y7I3q5X25f1LWCijXOBxCcWiIRIFaLYsu77wwF6lU3VQeGc amCG0HwTBQ9PDTeG4qPz3MzrAVA625AxqSiD8XNApODrUgXrrhUDWfp6mGuG8aGXrGlm 1F4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Yp07K186; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r18si12183440eji.95.2019.11.04.11.04.53; Mon, 04 Nov 2019 11:05:19 -0800 (PST) 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=pass header.i=@google.com header.s=20161025 header.b=Yp07K186; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729091AbfKDTCW (ORCPT + 99 others); Mon, 4 Nov 2019 14:02:22 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:35638 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728898AbfKDTCV (ORCPT ); Mon, 4 Nov 2019 14:02:21 -0500 Received: by mail-oi1-f196.google.com with SMTP id n16so15133311oig.2 for ; Mon, 04 Nov 2019 11:02:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VHvMybYCPvLOcRHqCBZyxUzdSqz4vFyRg5UuR2Ahyew=; b=Yp07K186DuxwZHZLbvAqheApB9VC785SKUV264EeioFCjyGfcjLdY6R/3zrMgomkf6 iAZvA//p0ACWZZZ3ru+YoQPAaSdy/Xlgq54DG1DBJstqJwrKEytiSDPVksn0ov45SfdD BCFimiCInTI1x7cgvt5ZjyaN1j8gS0PElAUlt0ZdXktta6B1w1k9aWa0G//JRs4OPz/w uFfV+z0dtmAsPluS3BtHOHYUih5RlVD/Iye9TuroC7Idm1Sf9+t+oXEiqGh9H42x39OC Yn/yxRPTZP0PZnBKSsF3rABozZBCYGOdtbSQvyphlHyFlPtmDv33p5yAYOiS4SBY7HAV 1vAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VHvMybYCPvLOcRHqCBZyxUzdSqz4vFyRg5UuR2Ahyew=; b=auQaVQ+jwKeGLXIWr2X9wG0O5NtsKU+yzxwTrCjGXWmqUTNXC2sOsgWyHP4ZG/0sen PeSSdeJ18bOZEBJK8EIwgdBQAhCH9l8ZVUhc/jS2pPBEiG9Ffl2EKX6GW1K8RbHIwyK5 ytRxYGntPlt+Y72hE+UQ4DCYON0o4fyQ7EUFZ+/TSBzgNCgKVbtKt9IgDToZMUmV85WM sKo6TkiRA4hH5TNIodiUljhVcR2mo5eLdnd16xMbMA02ZCKEYakxpJ6yuxPK6OZsJrQO pOD3SB0V4HRLPEfLlS/XK08uvBm/+DOkpIruQjIvp0HASdPRFm6nT1xlunMyL8uNBEr0 bP1Q== X-Gm-Message-State: APjAAAVKSEVapU9b64FazaGYarRo4aZ6SH4JHvTMBegEzD/hyjm7XVd+ 4RXj6OcVIVMslDeLvUszqtpBZLLvl/JDjbtB/wJAlQ== X-Received: by 2002:aca:f408:: with SMTP id s8mr482330oih.69.1572894140243; Mon, 04 Nov 2019 11:02:20 -0800 (PST) MIME-Version: 1.0 References: <20191028220027.251605-1-saravanak@google.com> <20191028220027.251605-6-saravanak@google.com> In-Reply-To: From: Saravana Kannan Date: Mon, 4 Nov 2019 11:01:44 -0800 Message-ID: Subject: Re: [PATCH v1 5/5] of: property: Skip adding device links to suppliers that aren't devices To: Rob Herring Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Frank Rowand , Len Brown , Android Kernel Team , "linux-kernel@vger.kernel.org" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-acpi@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 4, 2019 at 7:18 AM Rob Herring wrote: > > On Mon, Oct 28, 2019 at 5:00 PM Saravana Kannan wrote: > > > > Some devices need to be initialized really early and can't wait for > > driver core or drivers to be functional. These devices are typically > > initialized without creating a struct device for their device nodes. > > > > If a supplier ends up being one of these devices, skip trying to add > > device links to them. > > > > Signed-off-by: Saravana Kannan > > --- > > drivers/of/property.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/of/property.c b/drivers/of/property.c > > index f16f85597ccc..21c9d251318a 100644 > > --- a/drivers/of/property.c > > +++ b/drivers/of/property.c > > @@ -1038,6 +1038,7 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np, > > struct device *sup_dev; > > int ret = 0; > > struct device_node *tmp_np = sup_np; > > + int is_populated; > > > > of_node_get(sup_np); > > /* > > @@ -1062,9 +1063,10 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np, > > return -EINVAL; > > } > > sup_dev = get_dev_from_fwnode(&sup_np->fwnode); > > + is_populated = of_node_check_flag(sup_np, OF_POPULATED); > > of_node_put(sup_np); > > if (!sup_dev) > > - return -EAGAIN; > > + return is_populated ? 0 : -EAGAIN; > > You're only using the flag in one spot and a comment would be good > here, so I'd just do: > > if (of_node_check_flag(sup_np, OF_POPULATED)) > return 0; /* Early device without a struct device */ Hi Rob, Thanks for the review. I'm using the flag to keep the error handling code simple/cleaner. I can't do the check like that after I do a put on the sup_np. Yeah, I was actually planning to add a dev_dbg() message when this happens and returning a -EINVAL (that'll be ignored by the caller) instead of -EAGAIN (that's NOT ignored by the caller). Looks like these changes go pulled into driver-core-next. So I'll send a delta patch to add the dbg message and also address you nit on the other patch. Thanks, Saravana