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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB0B4C48297 for ; Tue, 6 Feb 2024 13:31:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=drGFzuyhy1qVy3fRCpX65QZZb7yRL/pZuyWuWM7pcJA=; b=uimpNvStaF1B1k Kz39aEza736+yQLb0pNFzDwI/TGqYyNSF3apJcqkkUbr3s3OkQKwaPZsMrtw/fs7k6Q8DhIdeh8Xp vzFHvWVy1XsP0dbcNlnxBfdZ5GPzeO+aLYF2aedt/Z/sCCLQlKsfuHqLw2sgZTaJv63NSW1H7t8XR CkOC4l8M/MKlYs8CxgkuTrN1FBQWx0Fu+h+omM/qMOwXf9AGKpPkmXsV8fNPTR8nty5/ir6HWx+Nc rWtRfiHEN4YlfmVVIS2LXaFJvKK6mQCkmh9rvSMLDvoTIFsfc40BDtsWjC57QKejNVv5uQoWqXEQW gyc7OqUDiJ6nNUtOwbLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXLXs-00000007j7K-2bKh; Tue, 06 Feb 2024 13:31:28 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXLXq-00000007j6r-0KQc; Tue, 06 Feb 2024 13:31:27 +0000 Received: from pendragon.ideasonboard.com (85-76-34-85-nat.elisa-mobile.fi [85.76.34.85]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CAB3874A; Tue, 6 Feb 2024 14:29:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1707226198; bh=KMA/bJybbnWogXygT+8vj+CljyBc90aEvqxIQixKXiE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jJt87ajWVdK89Rfyb+jiky4gvmowtfZOCJZtCWAdBzrxqQjYl8RkDAWw1GjNPt3rj Jenek9xQ8efrqfbQWdR/MAB0bf8AjF6cNDJomTaxkqGCx5MqRkTc5onD0kUQ+f/BDi E1GhB9QNoRnXcHEKttDqnEeZ9R8xAGJsVuVXKMVI= Date: Tue, 6 Feb 2024 15:31:22 +0200 From: Laurent Pinchart To: Kuninori Morimoto Subject: Re: [PATCH 1/4] gpu: drm: replace of_graph_get_next_endpoint() Message-ID: <20240206133122.GA2827@pendragon.ideasonboard.com> References: <87ttmmnvzh.wl-kuninori.morimoto.gx@renesas.com> <87sf26nvy2.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87sf26nvy2.wl-kuninori.morimoto.gx@renesas.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240206_053126_280493_86EF47D9 X-CRM114-Status: GOOD ( 23.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Alim Akhtar , Sam Ravnborg , Alexandre Torgue , dri-devel@lists.freedesktop.org, "Lad, Prabhakar" , Andrzej Hajda , Sylwester Nawrocki , Sakari Ailus , David Airlie , linux-stm32@st-md-mailman.stormreply.com, linux-omap@vger.kernel.org, Florian Fainelli , Dave Stevenson , Hugues Fruchet , Helge Deller , Alexey Brodkin , Russell King , Broadcom internal kernel review list , =?utf-8?Q?=22Uwe_Kleine-K=C3=B6nig=22?= , Jessica Zhang , linux-media@vger.kernel.org, Jacopo Mondi , Maxime Coquelin , Tim Harvey , Maarten Lankhorst , Eugen Hristev , linux-samsung-soc@vger.kernel.org, Maxime Ripard , linux-fbdev@vger.kernel.org, Biju Das , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, Neil Armstrong , Thomas Zimmermann , Claudiu Beznea , Krzysztof Kozlowski , Daniel Vetter , Hans Verkuil , linux-rpi-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Morimoto-san, Thank you for the patch. On Tue, Feb 06, 2024 at 02:55:01AM +0000, Kuninori Morimoto wrote: > From DT point of view, in general, drivers should be asking for a > specific port number because their function is fixed in the binding. > > of_graph_get_next_endpoint() doesn't match to this concept. > > Simply replace > > - of_graph_get_next_endpoint(xxx, NULL); > + of_graph_get_endpoint_by_regs(xxx, 0, -1); > > Link: https://lore.kernel.org/r/20240202174941.GA310089-robh@kernel.org > Signed-off-by: Kuninori Morimoto > --- > drivers/gpu/drm/drm_of.c | 2 +- > drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 2 +- > drivers/gpu/drm/tiny/arcpgu.c | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c > index 177b600895d3..c2eae9296012 100644 > --- a/drivers/gpu/drm/drm_of.c > +++ b/drivers/gpu/drm/drm_of.c > @@ -516,7 +516,7 @@ struct mipi_dsi_host *drm_of_get_dsi_bus(struct device *dev) > /* > * Get first endpoint child from device. > */ > - endpoint = of_graph_get_next_endpoint(dev->of_node, NULL); > + endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1); This assumes that the DSI device's port@0 will also be the input. That's fine for current users of this function, but we should at least document it. diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 177b600895d3..012c4d04cf51 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -504,6 +504,8 @@ EXPORT_SYMBOL_GPL(drm_of_get_data_lanes_count_ep); * Gets parent DSI bus for a DSI device controlled through a bus other * than MIPI-DCS (SPI, I2C, etc.) using the Device Tree. * + * This function assumes that the device's port@0 is the DSI input. + * * Returns pointer to mipi_dsi_host if successful, -EINVAL if the * request is unsupported, -EPROBE_DEFER if the DSI host is found but * not available, or -ENODEV otherwise. With this, Reviewed-by: Laurent Pinchart > if (!endpoint) > return ERR_PTR(-ENODEV); > > diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c > index 4618c892cdd6..e10e469aa7a6 100644 > --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c > +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c > @@ -400,7 +400,7 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c) > rpi_touchscreen_i2c_write(ts, REG_POWERON, 0); > > /* Look up the DSI host. It needs to probe before we do. */ > - endpoint = of_graph_get_next_endpoint(dev->of_node, NULL); > + endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1); > if (!endpoint) > return -ENODEV; > > diff --git a/drivers/gpu/drm/tiny/arcpgu.c b/drivers/gpu/drm/tiny/arcpgu.c > index e5b10e41554a..04d0053b9315 100644 > --- a/drivers/gpu/drm/tiny/arcpgu.c > +++ b/drivers/gpu/drm/tiny/arcpgu.c > @@ -288,7 +288,7 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) > * There is only one output port inside each device. It is linked with > * encoder endpoint. > */ > - endpoint_node = of_graph_get_next_endpoint(pdev->dev.of_node, NULL); > + endpoint_node = of_graph_get_endpoint_by_regs(pdev->dev.of_node, 0, -1); > if (endpoint_node) { > encoder_node = of_graph_get_remote_port_parent(endpoint_node); > of_node_put(endpoint_node); -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel