Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp496616pxy; Sat, 31 Jul 2021 14:42:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQ2WpTi0eSTTJjeM/UmIeM0iesvWWqRpUcetT/B70likLTU5g5xTe89HcYSBt8M3tEGhyt X-Received: by 2002:a05:6402:40f:: with SMTP id q15mr10881495edv.86.1627767731943; Sat, 31 Jul 2021 14:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627767731; cv=none; d=google.com; s=arc-20160816; b=jc3nII/nuedzjUF76s35fgUUMziQtPLvo9MecwkWq2VcGqEKkvlhn8W6oraa9ikpKC cz426H2tjjO/+h158+5fDxd7oHPeUCmFjSxbqx8dbGFyOKpMAY8HkahVe0vHKIKy8EOF iu3EaLghlbV4KjhCo3BsSPa85HJj9zQ93yXSa/AT0+q1b6ngGAe+pg4y2ELx8Bg74vVk P5b25wETmTTbtmmlyQ30qwfCfmFmEBrO3d7qoIvisViKZm2R2TY9J1P6XOmh5tTYJmnV 9LBqHLrrkShgmzZa7LdbTHk/q/FqI0FSeKptXIApUrU+com99fYTmegXS1TBEL53XCyJ 4Ksg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gpEgoANb95kLZ1B0ubUvGwiEQUfZz4kQSRm7QPVeBYk=; b=yrZYuSeSOKOhyKE4e2uBs74zSHTzV9mK5P2risSvx3fSdNtv9ptM/36CdKW2Fp6/vj F8BqPNpPkH8Ml3Er8yzxCxvtlKRX63FypB7wmI/1md+CrV9TgwoEZEPakYe7NKlPAzRG vVYpoETIwUcD8yRjwnFlkwNAQo3HEcIqMCDw5xWEE0G0YlRzMzE7vzYPPPH4APuo24qM Wh9WTAVueS5SqnOKv4/Ysj8rTHwWQd/ghZuGLY40RpBLWEo0W3IbNPn28k8Sv4u+YSd1 vruAu8cAPTZjBCR9gHwt855NKQ5QrrzpBsU6eZ6jgsxaKuxEx06neeFiNuQ/kVl0sl2W ydhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pgDfbxs+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e24si2451587edr.66.2021.07.31.14.41.20; Sat, 31 Jul 2021 14:42:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pgDfbxs+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231577AbhGaVgd (ORCPT + 99 others); Sat, 31 Jul 2021 17:36:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230350AbhGaVgc (ORCPT ); Sat, 31 Jul 2021 17:36:32 -0400 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A653C06175F for ; Sat, 31 Jul 2021 14:36:26 -0700 (PDT) Received: by mail-oi1-x236.google.com with SMTP id t128so18917431oig.1 for ; Sat, 31 Jul 2021 14:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gpEgoANb95kLZ1B0ubUvGwiEQUfZz4kQSRm7QPVeBYk=; b=pgDfbxs+zMvZMZyZ22s+4+TtYs12GGI1QvSYxdwOSOIQuwSbW+C/6Q1UeZnyrqr/qf KX+/0blc6QU6SHi829yqWemQ3Sjjd6ob464xqhOjxyrjs/Njt6ZWCBgYMjl34i8mPDJI 5K5AXOMNbmmqfsbUbg/e1+vJmdW2Aa4O9Wr9wm2fiXe+kgPrjnq3+JSMv1BpfM0F1FUD 02IGgY2+SXJ8DFAJx7lNiSTemWFlrD5NQH7cb31EbUS2rfoyVXf6+7ilBIWEQ9M+B+86 ud7aUhug7TSdC0fxmlUeZj0hXKJfQPTymC/wCcFYWxy/+bmStjGf/RxxAPGZVV1+G198 Soow== 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=gpEgoANb95kLZ1B0ubUvGwiEQUfZz4kQSRm7QPVeBYk=; b=IL69i9icVwrH+iaWXsxv/rIRCsFKd9PuNeE2pZ0Lw8Jihb0w8hqN/piprbwXjziD0X evDhQP17pUVOrEtm21bYBlmDqEPyPS8jYNH32n5Sd9ThMZZCTSjmT5Lj5be3gxD2KcOs Q7z1Jz1N1Sb+mREzbscIlACXqAL8eD6oNc3QOypqEEA03PGpbqYGi+kLcygzlAitWe1l xWkiX0CN4JZa69v9RSvEWGM1z4/vA1H2zxWTg/h3fHpF0c5rwGI9LXuVv94D77LVsuHq GGWy+koYghpi64tqfu1MmsYRP3Vp7BNIwLu+uqI/f6qgs7IDgKM+vb5o7x1CIkmTdvGA 6JFA== X-Gm-Message-State: AOAM533q310r4LYWcWD8ix8Q7bu01A844+/qbQwvdCN3ihIBYOzUzNMC 964PKp1j54QIPJQgYs31kH64Jb9mK4E1RF2kSBP3kfOR X-Received: by 2002:aca:c343:: with SMTP id t64mr5944212oif.67.1627767385425; Sat, 31 Jul 2021 14:36:25 -0700 (PDT) MIME-Version: 1.0 References: <20210722201929.3585671-1-djrscally@gmail.com> <20210722201929.3585671-2-djrscally@gmail.com> In-Reply-To: From: Daniel Scally Date: Sat, 31 Jul 2021 22:36:14 +0100 Message-ID: Subject: Re: [PATCH 1/2] device property: Check fwnode->secondary in fwnode_graph_get_next_endpoint() To: Andy Shevchenko Cc: Linux Kernel Mailing List , Greg Kroah-Hartman , "Rafael J. Wysocki" , Laurent Pinchart Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 30, 2021 at 12:34 PM Andy Shevchenko wrote: > > On Fri, Jul 23, 2021 at 02:04:59PM +0100, Daniel Scally wrote: > > > > On 23/07/2021 13:32, Andy Shevchenko wrote: > > > On Thu, Jul 22, 2021 at 09:19:28PM +0100, Daniel Scally wrote: > > >> Sensor drivers often check for an endpoint to make sure that they're > > >> connected to a consuming device like a CIO2 during .probe(). Some of > > >> those endpoints might be in the form of software_nodes assigned as > > >> a secondary to the device's fwnode_handle. Account for this possibility > > >> in fwnode_graph_get_next_endpoint() to avoid having to do it in the > > >> sensor drivers themselves. > > > ... > > > > > >> + ep = fwnode_call_ptr_op(parent, graph_get_next_endpoint, prev); > > >> + > > >> + if (IS_ERR_OR_NULL(ep) && !IS_ERR_OR_NULL(parent) && > > >> + !IS_ERR_OR_NULL(parent->secondary)) > > > Nit-pick, I would put it like: > > > > > > if (!IS_ERR_OR_NULL(parent->secondary) && !IS_ERR_OR_NULL(parent) && > > > IS_ERR_OR_NULL(ep)) > > > > > > or > > > > > > if (IS_ERR_OR_NULL(ep) && > > > !IS_ERR_OR_NULL(parent->secondary) && !IS_ERR_OR_NULL(parent)) > > > > > > for the sake of logical split. > > > > > > OK; I'll do the second one, feel like it's better to have ep as the > > first check. > > Fine, but also I have just noticed that parent should be checked before > parent->secondary. > > Something like this > > if (IS_ERR_OR_NULL(ep) && > !IS_ERR_OR_NULL(parent) && IS_ERR_OR_NULL(parent->secondary)) > > > >> + ep = fwnode_graph_get_next_endpoint(parent->secondary, NULL); Yes, no problem. I'll send a v2 when I can, It will likely be another week or so though, my computer's in a cardboard box. > > -- > With Best Regards, > Andy Shevchenko > >