public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Sui Jingfeng <suijingfeng@bosc.ac.cn>
To: AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	chunkuang.hu@kernel.org
Cc: robh@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org, p.zabel@pengutronix.de, airlied@gmail.com,
	daniel@ffwll.ch, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, tzimmermann@suse.de, matthias.bgg@gmail.com,
	shawn.sung@mediatek.com, yu-chang.lee@mediatek.com,
	ck.hu@mediatek.com, jitao.shi@mediatek.com,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, wenst@chromium.org,
	kernel@collabora.com, Alexandre Mergnat <amergnat@baylibre.com>
Subject: Re: [v5,3/3] drm/mediatek: Implement OF graphs support for display paths
Date: Wed, 22 May 2024 20:13:34 +0800	[thread overview]
Message-ID: <665202d7-46be-4dc8-a6be-3579e1ec078f@bosc.ac.cn> (raw)
In-Reply-To: <20240521075717.50330-4-angelogioacchino.delregno@collabora.com>

Hi,


On 5/21/24 15:57, AngeloGioacchino Del Regno wrote:
> +static int mtk_drm_of_get_ddp_comp_type(struct device_node *node, enum mtk_ddp_comp_type *ctype)
> +{
> +	const struct of_device_id *of_id = of_match_node(mtk_ddp_comp_dt_ids, node);
> +
> +	if (!of_id)
> +		return -EINVAL;
> +
> +	*ctype = (enum mtk_ddp_comp_type)((uintptr_t)of_id->data);
> +
> +	return 0;
> +}
> +
> +static int mtk_drm_of_get_ddp_ep_cid(struct device_node *node,
> +				     int output_port, enum mtk_crtc_path crtc_path,
> +				     struct device_node **next, unsigned int *cid)
> +{
> +	struct device_node *ep_dev_node, *ep_out;
> +	enum mtk_ddp_comp_type comp_type;
> +	int ret;
> +
> +	ep_out = of_graph_get_endpoint_by_regs(node, output_port, crtc_path);
> +	if (!ep_out)
> +		return -ENOENT;
> +
> +	ep_dev_node = of_graph_get_remote_port_parent(ep_out);

below here, 'ep_out' will not be used anymore.

of_node_put(ep_out);

Maybe we should call it under a error handling tag?
But this is trivial problem.

> +	if (!ep_dev_node)
> +		return -EINVAL;
> +
> +	/*
> +	 * Pass the next node pointer regardless of failures in the later code
> +	 * so that if this function is called in a loop it will walk through all
> +	 * of the subsequent endpoints anyway.
> +	 */
> +	*next = ep_dev_node;
> +
> +	if (!of_device_is_available(ep_dev_node))
> +		return -ENODEV;
> +
> +	ret = mtk_drm_of_get_ddp_comp_type(ep_dev_node, &comp_type);
> +	if (ret) {
> +		if (mtk_ovl_adaptor_is_comp_present(ep_dev_node)) {
> +			*cid = (unsigned int)DDP_COMPONENT_DRM_OVL_ADAPTOR;
> +			return 0;
> +		}
> +		return ret;
> +	}
> +
> +	ret = mtk_ddp_comp_get_id(ep_dev_node, comp_type);
> +	if (ret < 0)
> +		return ret;
> +
> +	/* All ok! Pass the Component ID to the caller. */
> +	*cid = (unsigned int)ret;
> +
> +	return 0;
> +}
> +

-- 
Best regards
Sui Jingfeng


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2024-05-22 12:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-21  7:57 [PATCH v5 0/3] drm/mediatek: Add support for OF graphs AngeloGioacchino Del Regno
2024-05-21  7:57 ` [PATCH v5 1/3] dt-bindings: display: mediatek: Add OF graph support for board path AngeloGioacchino Del Regno
2024-05-21  7:57 ` [PATCH v5 2/3] dt-bindings: arm: mediatek: mmsys: " AngeloGioacchino Del Regno
2024-06-05  1:38   ` CK Hu (胡俊光)
2024-06-05 11:15     ` AngeloGioacchino Del Regno
2024-06-06  5:29       ` CK Hu (胡俊光)
2024-06-10  8:28         ` AngeloGioacchino Del Regno
2024-06-11  6:48           ` CK Hu (胡俊光)
2024-06-11  6:54             ` AngeloGioacchino Del Regno
2024-07-05  9:28               ` CK Hu (胡俊光)
2024-07-25  9:46                 ` AngeloGioacchino Del Regno
2024-08-06  8:29                   ` CK Hu (胡俊光)
2024-06-06  6:46       ` Chen-Yu Tsai
2024-06-06 11:17         ` AngeloGioacchino Del Regno
2024-05-21  7:57 ` [PATCH v5 3/3] drm/mediatek: Implement OF graphs support for display paths AngeloGioacchino Del Regno
2024-05-22 11:48   ` [v5,3/3] " Sui Jingfeng
2024-05-22 11:51     ` Sui Jingfeng
2024-05-22 12:13   ` Sui Jingfeng [this message]
2024-05-22 12:32   ` Sui Jingfeng
2024-05-23 10:41     ` Chen-Yu Tsai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=665202d7-46be-4dc8-a6be-3579e1ec078f@bosc.ac.cn \
    --to=suijingfeng@bosc.ac.cn \
    --cc=airlied@gmail.com \
    --cc=amergnat@baylibre.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=ck.hu@mediatek.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jitao.shi@mediatek.com \
    --cc=kernel@collabora.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mripard@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=shawn.sung@mediatek.com \
    --cc=tzimmermann@suse.de \
    --cc=wenst@chromium.org \
    --cc=yu-chang.lee@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox