Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3181927imm; Mon, 13 Aug 2018 07:21:53 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzqbhv6aKnTnq7Rb2+eGajgxA4a+lBE9iX34m6KRZw3Kowp6Me4gukP1EsicOJfLGPKjKE1 X-Received: by 2002:a63:81c3:: with SMTP id t186-v6mr17612378pgd.413.1534170113093; Mon, 13 Aug 2018 07:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534170113; cv=none; d=google.com; s=arc-20160816; b=Zl1cU0jbvl+QpAuGQ60M2uu5kRXmXJ2pCJoojQycxdbIeOL3+qRtKPDTwFMq9iWcM7 xhSJcMWLOcEnAEVwHQoScaKBhxBmV9uJDVM4rCnxLzbu6aQ7rRkxCZbyPA94CD+o9mhI kaDIN3pN029ttJepMvER9Yq8tWPv2zaVDqeGL6NRrpStSn9EFt9p3JP53I+hHhVUTQyr +g63fzLnktuboVqw/aIN51+mdF8GRcIy50hp52cekZR0mKtm+DHQ8pRirLgCscXAjsL7 bkBlDf6SL3TB/x1Y8hsVe2P4nBKH1scNs5jIdTYzriI/xysEwawqt6mRRu5KEG0CdIyB vzBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=MY6fD8Un8OIoS+v/h2gVm98yHm/rfM+Gm3iSRQjHFi0=; b=toZAASQkNtkgy4r0WH7muZocc9E0M2htMUvMJpYA7rcuT84IJl8O0o7Zy0rjzDnQeh Z2SKBt1ED7lqknxWcSAon0jOtwkfz3Jw+Kcz0m+fkcoDCsr9FWVPXMWTR7eEyZYxHvFO 53eV0hLMVTwosPt51PgnQEQwyc1PgFDVcSKJh2oYIQJwktnYXO77zb73cfphVtMJGxUA yK/FD62BNFVkLS05K68WISVYqz8/a7XiwVsGbgDS262qXvjp4IxZQR2S2UI6TuphLFEy DJA77h2TYkAmdTQUeHf4d8kqcCKmXY3PqPBbl2wQF6zAYoXPe7UhcSqvDlFnMyHF8EYA h8Tw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 20-v6si17986708pgl.358.2018.08.13.07.21.38; Mon, 13 Aug 2018 07:21:53 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729103AbeHMQmV (ORCPT + 99 others); Mon, 13 Aug 2018 12:42:21 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:49383 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728509AbeHMQmV (ORCPT ); Mon, 13 Aug 2018 12:42:21 -0400 X-Originating-IP: 2.224.242.101 Received: from apu3b.nibble.pw (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 0F4EC1BF20C; Mon, 13 Aug 2018 13:59:50 +0000 (UTC) Date: Mon, 13 Aug 2018 15:59:49 +0200 From: jacopo mondi To: Peter Rosin Cc: linux-kernel@vger.kernel.org, Boris Brezillon , David Airlie , Rob Herring , Mark Rutland , Nicolas Ferre , Alexandre Belloni , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jyri Sarha , Daniel Vetter , Andrzej Hajda , Russell King - ARM Linux , Jacopo Mondi , Sakari Ailus Subject: Re: [PATCH v8 3/4] drm/atmel-hlcdc: iterate over all output endpoints Message-ID: <20180813135949.32vrlrevtazr5x7d@apu3b.nibble.pw> References: <20180810130359.9882-1-peda@axentia.se> <20180810130359.9882-4-peda@axentia.se> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180810130359.9882-4-peda@axentia.se> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On Fri, Aug 10, 2018 at 03:03:58PM +0200, Peter Rosin wrote: > This enables more flexible devicetrees. You can e.g. have two output > nodes where one is not enabled, without the ordering affecting things. > > Prior to this patch the active node had to have endpoint id zero. > > Signed-off-by: Peter Rosin > --- > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 32 ++++++++++++++++++------ > 1 file changed, 25 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > index 8db51fb131db..16c1b2f54b42 100644 > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > @@ -31,14 +31,16 @@ static const struct drm_encoder_funcs atmel_hlcdc_panel_encoder_funcs = { > .destroy = drm_encoder_cleanup, > }; > > -static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint) > +static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, > + struct of_endpoint *endpoint) > { > struct drm_encoder *encoder; > struct drm_panel *panel; > struct drm_bridge *bridge; > int ret; > > - ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint, > + ret = drm_of_find_panel_or_bridge(dev->dev->of_node, > + endpoint->port, endpoint->id, You are refusing endpoint->port != 0 in the caller, so that could be 0. Apart from that small nit: Reviewed-by: Jacopo Mondi Thanks j > &panel, &bridge); > if (ret) > return ret; > @@ -77,13 +79,29 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint) > > int atmel_hlcdc_create_outputs(struct drm_device *dev) > { > - int endpoint, ret = 0; > - > - for (endpoint = 0; !ret; endpoint++) > - ret = atmel_hlcdc_attach_endpoint(dev, endpoint); > + struct of_endpoint endpoint; > + struct device_node *node = NULL; > + int count = 0; > + int ret = 0; > + > + for_each_endpoint_of_node(dev->dev->of_node, node) { > + of_graph_parse_endpoint(node, &endpoint); > + > + if (endpoint.port) > + continue; > + > + ret = atmel_hlcdc_attach_endpoint(dev, &endpoint); > + if (ret == -ENODEV) > + continue; > + if (ret) { > + of_node_put(node); > + break; > + } > + count++; > + } > > /* At least one device was successfully attached.*/ > - if (ret == -ENODEV && endpoint) > + if (ret == -ENODEV && count) > return 0; > > return ret; > -- > 2.11.0 >