Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4119780pxu; Mon, 30 Nov 2020 18:31:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzVVPsn6XpLsck307kZ5XI3CECoRZ6ai/HIg8ujNM8gS1htl86MwnpjF2fZC9YzBER08so X-Received: by 2002:a05:6402:2208:: with SMTP id cq8mr861204edb.182.1606789878434; Mon, 30 Nov 2020 18:31:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606789878; cv=none; d=google.com; s=arc-20160816; b=XcwUVvpaT1Jt2amcrqOdBvTIG2H0D5Z5ilTxUcyuiXD3bBBJAZbvXcWVe0DlarZKdK OfM/c42dlh90WUPMZDM44BZiCFEYxL02GOzqa3uGuqBodQhO6jfHHYa8Rapj3llyv8If 2wmJ86WL32V+V4VkfA3o+vDO1yqPp3Eo8e0tIGsqsypjqEM7RLuYUglCCxPTneiJS2rH 3nFFs33d9vxKg8Vqj3X0uMGEUyijqkZfhQAK+clK53sZwIaFuiJ3vHtMiAje9k40kKCU TQZt8BtfzPPDfcpO37pfXY8FHFDDa5ZRZYYmIrEmb2I1roV4j2g/ie8Cm7bCOrqwwRqN gLiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QqbKklLehV02sqEO6xWws9h8KqbyIuoqbgjIH2JLpIc=; b=MISDasRz9i0NjoDpRHane1lrzsGj/Mv8R4CcT3iW0H+G96GZN0h7zg2MZ98K7sr+Qm IohXB/l5CJOtmOEnQrg8Yr4tUoxoWfZqYscbZg5VQ6Z0mvERmffnMTz+VyPFNZkTavj/ qnoF/sBfGURX1/gdDuhhF5/Oj+2w+OaZKvsA2D6JqdT1cC6NbFDYFiObDqmn4N9pB/XK FiT2oJZ+ahIJVIOHRMZvPrI7ii7gj6hIvUM3kHlp9mnCzPNlHuPEY5+iy3JWDfu6ZwQo 6iFoY0o8vk0YRDa2ozI9SdLy5mXMql3K2MQ/9pJmouiw+ACxyls3GqpI4DG9QJO+LtB2 N68w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=N5cWitsA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg4si242769edb.104.2020.11.30.18.30.55; Mon, 30 Nov 2020 18:31:18 -0800 (PST) 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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=N5cWitsA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387461AbgK3R3u (ORCPT + 99 others); Mon, 30 Nov 2020 12:29:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728730AbgK3R3s (ORCPT ); Mon, 30 Nov 2020 12:29:48 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD31CC0613CF; Mon, 30 Nov 2020 09:29:07 -0800 (PST) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DE829B26; Mon, 30 Nov 2020 18:29:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1606757346; bh=BJ/nlLtM3oiSm7GiMgtM1dVBitZnJoMLuTFsPgKPyeQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N5cWitsASa9EAyC9y9wFzTw+68hNpJioMTV/6za1A/OFvRa/NMMzpSLdwbjqXfJ+O KgcW/zT5kf+axtydQvAyMPA34LXtrUroZpemdq/wE/ksHY5jzemxx8950xQyQYms5y Sg8OO+865pPYf/6jWpA8fE53YxiGtF6f/L893nHY= Date: Mon, 30 Nov 2020 19:28:57 +0200 From: Laurent Pinchart To: Andy Shevchenko Cc: Daniel Scally , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org, linux-media@vger.kernel.org, devel@acpica.org, rjw@rjwysocki.net, lenb@kernel.org, gregkh@linuxfoundation.org, mika.westerberg@linux.intel.com, linus.walleij@linaro.org, bgolaszewski@baylibre.com, wsa@kernel.org, yong.zhi@intel.com, sakari.ailus@linux.intel.com, bingbu.cao@intel.com, tian.shu.qiu@intel.com, mchehab@kernel.org, robert.moore@intel.com, erik.kaneda@intel.com, pmladek@suse.com, rostedt@goodmis.org, sergey.senozhatsky@gmail.com, linux@rasmusvillemoes.dk, kieran.bingham+renesas@ideasonboard.com, jacopo+renesas@jmondi.org, laurent.pinchart+renesas@ideasonboard.com, jorhand@linux.microsoft.com, kitakar@gmail.com, heikki.krogerus@linux.intel.com Subject: Re: [PATCH 02/18] property: Add support for calling fwnode_graph_get_endpoint_by_id() for fwnode->secondary Message-ID: <20201130172857.GS14465@pendragon.ideasonboard.com> References: <20201130133129.1024662-1-djrscally@gmail.com> <20201130133129.1024662-3-djrscally@gmail.com> <20201130172900.GM4077@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201130172900.GM4077@smile.fi.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 30, 2020 at 07:29:00PM +0200, Andy Shevchenko wrote: > On Mon, Nov 30, 2020 at 01:31:13PM +0000, Daniel Scally wrote: > > This function is used to find fwnode endpoints against a device. In > > some instances those endpoints are software nodes which are children of > > fwnode->secondary. Add support to fwnode_graph_get_endpoint_by_id() to > > find those endpoints by recursively calling itself passing the ptr to > > fwnode->secondary in the event no endpoint is found for the primary. > > One nit below, after addressing: > Reviewed-by: Andy Shevchenko > > ... > > > + if (!best_ep && fwnode && !IS_ERR_OR_NULL(fwnode->secondary)) > > + return fwnode_graph_get_endpoint_by_id(fwnode->secondary, port, > > + endpoint, flags); > > > return best_ep; > > Can we, please, do > > if (best_ep) > return best_ep; > > if (fwnode && !IS_ERR_OR_NULL(fwnode->secondary)) > return fwnode_graph_get_endpoint_by_id(fwnode->secondary, port, > endpoint, flags); > > return NULL; > > ? > > This 'if (fwnode && !IS_ERR_OR_NULL(fwnode->secondary))' becomes kinda > idiomatic to the cases when we need to proceed primary followed by the > secondary in cases where it's not already done. We could also move the !fwnode check to the beginning of the function. > > } > > EXPORT_SYMBOL_GPL(fwnode_graph_get_endpoint_by_id); -- Regards, Laurent Pinchart