From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0C1FC4338F for ; Fri, 23 Jul 2021 13:05:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3DA160E95 for ; Fri, 23 Jul 2021 13:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235256AbhGWMYc (ORCPT ); Fri, 23 Jul 2021 08:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235065AbhGWMY3 (ORCPT ); Fri, 23 Jul 2021 08:24:29 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68D8AC061757 for ; Fri, 23 Jul 2021 06:05:02 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id b7so2277480wri.8 for ; Fri, 23 Jul 2021 06:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=CScnrJv6DM1l/GyT2F7M4STWfOPo8zjPQsEF1iUbnH8=; b=pR359CZFThBQXx+RGAdzrSNm+hjKs+k3/Z8qg/279n6hfh0zH6rG2p8aopBgzt/8AR yMfEx+YyL86rBJN1nVMQ7ZxGBD0V8oiQ1KHc1lRskOiY864aTXRiZa28hc3qg+uSFA6n KB6xJgvNODuqyx2r7p/h5nu3CayR/cPZf01BVpwEkOc2KNTvBC7bf9rYE5hxo6kgOkh7 sWK0+oMbfEL6kP+iAZygyKzTLC63wvMXa6x2X5YJ1fBlhpgwlj9+E8SYcl999OZcTSDF fmpAFhAoDwP+202GOpHnMcruXC72JJ86skPJk+cC/YLoyVgzeTIeTZBe3wVL4d/N+BFi 9+7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=CScnrJv6DM1l/GyT2F7M4STWfOPo8zjPQsEF1iUbnH8=; b=EHDITtAZEuyPeHOG6UT47YQLa2LRjyHXyl46Rfr95kp10ZL18zO6QB33uOtilr/7Pv MaLEee4BdQ8ZWYLJGyi5tckZ0OeXlxyJ0648i3/ifXm4o+VhfnFMOycmW2O1JPnJpWEn lNw4lvX1U/e/6EJutdf2tQJvYSy0WWhsTOlrj9dnNNretvWyoYqJ61tWTHNRl8NxxZZw vqrTMx79acAB/IJdf4s3G02DA1qmGnSrTCTbvknVqr5iYsMPnyMAO29dQnnpuWWwG/7k I+HguLNCbJvOyRiDq2rZBbB7knAbt5tvomIxFOUrSQ/DcjU897a0CdN68XCXgGpXCOfe TQfw== X-Gm-Message-State: AOAM531zL8T5TwI1jMVYJgs+25b58h7Yi8pkvGzDx4XYJBR3TFyLqmoX CFhit/QHSef4dw3+h9rTqZU= X-Google-Smtp-Source: ABdhPJw9dNXpLiJi9Pj58WjglIrkMDrfUWmhHj8agQNbnnF0vTtUjz42Tc+gEicXpbvA+6VqqLPj0w== X-Received: by 2002:adf:a1c4:: with SMTP id v4mr5154351wrv.217.1627045501040; Fri, 23 Jul 2021 06:05:01 -0700 (PDT) Received: from [192.168.1.211] ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id y11sm5286318wmi.33.2021.07.23.06.05.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Jul 2021 06:05:00 -0700 (PDT) Subject: Re: [PATCH 1/2] device property: Check fwnode->secondary in fwnode_graph_get_next_endpoint() To: Andy Shevchenko Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, rafael@kernel.org, laurent.pinchart@ideasonboard.com References: <20210722201929.3585671-1-djrscally@gmail.com> <20210722201929.3585671-2-djrscally@gmail.com> From: Daniel Scally Message-ID: Date: Fri, 23 Jul 2021 14:04:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > >> + ep = fwnode_graph_get_next_endpoint(parent->secondary, NULL);