LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
To: Yong Wu <yong.wu@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Joerg Roedel <joro@8bytes.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	David Airlie <airlied@linux.ie>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Evan Green <evgreen@chromium.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Tomasz Figa <tfiga@chromium.org>,
	Will Deacon <will.deacon@arm.com>,
	linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux-foundation.org, youlin.pei@mediatek.com,
	Matthias Kaehlcke <mka@chromium.org>,
	anan.sun@mediatek.com, yi.kuo@mediatek.com,
	acourbot@chromium.org, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org, Daniel Vetter <daniel@ffwll.ch>,
	Chun-Kuang Hu <chunkuang.hu@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Tiffany Lin <tiffany.lin@mediatek.com>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Eizan Miyamoto <eizan@chromium.org>,
	anthony.huang@mediatek.com,
	Frank Wunderlich <frank-w@public-files.de>
Subject: Re: [PATCH v8 03/12] iommu/mediatek: Add probe_defer for smi-larb
Date: Wed, 29 Sep 2021 18:33:05 +0200	[thread overview]
Message-ID: <33a8b313-ad1b-d307-7e8c-2fdebdc6f1a7@collabora.com> (raw)
In-Reply-To: <20210929013719.25120-4-yong.wu@mediatek.com>



On 29.09.21 03:37, Yong Wu wrote:
> Prepare for adding device_link.
> 
> The iommu consumer should use device_link to connect with the
> smi-larb(supplier). then the smi-larb should run before the iommu
> consumer. Here we delay the iommu driver until the smi driver is ready,
> then all the iommu consumers always are after the smi driver.
> 
> When there is no this patch, if some consumer drivers run before
> smi-larb, the supplier link_status is DL_DEV_NO_DRIVER(0) in the
> device_link_add, then device_links_driver_bound will use WARN_ON
> to complain that the link_status of supplier is not right.
> 
> device_is_bound may be more elegant here. but it is not allowed to
> EXPORT from https://lore.kernel.org/patchwork/patch/1334670/.
> 
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
> ---
>   drivers/iommu/mtk_iommu.c    | 2 +-
>   drivers/iommu/mtk_iommu_v1.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> index d837adfd1da5..d5848f78a677 100644
> --- a/drivers/iommu/mtk_iommu.c
> +++ b/drivers/iommu/mtk_iommu.c
> @@ -844,7 +844,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
>   			id = i;
>   
>   		plarbdev = of_find_device_by_node(larbnode);
> -		if (!plarbdev) {
> +		if (!plarbdev || !plarbdev->dev.driver) {
>   			of_node_put(larbnode);
>   			return -EPROBE_DEFER;

if plarbdev is null doesn't that mean that the device does not exist?
so we should return -ENODEV in that case?

thanks,
Dafna

>   		}
> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> index 1467ba1e4417..4d7809432239 100644
> --- a/drivers/iommu/mtk_iommu_v1.c
> +++ b/drivers/iommu/mtk_iommu_v1.c
> @@ -602,7 +602,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
>   		}
>   
>   		plarbdev = of_find_device_by_node(larbnode);
> -		if (!plarbdev) {
> +		if (!plarbdev || !plarbdev->dev.driver) {
>   			of_node_put(larbnode);
>   			return -EPROBE_DEFER;
>   		}
> 

  reply	other threads:[~2021-09-29 16:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29  1:37 [PATCH v8 00/12] Clean up "mediatek,larb" Yong Wu
2021-09-29  1:37 ` [PATCH v8 01/12] dt-binding: mediatek: Get rid of mediatek, larb for multimedia HW Yong Wu
2021-09-29  1:37 ` [PATCH v8 02/12] iommu/mediatek-v1: Free the existed fwspec if the master dev already has Yong Wu
2021-09-29  1:37 ` [PATCH v8 03/12] iommu/mediatek: Add probe_defer for smi-larb Yong Wu
2021-09-29 16:33   ` Dafna Hirschfeld [this message]
2021-09-30  7:14     ` Yong Wu
2021-09-29  1:37 ` [PATCH v8 04/12] iommu/mediatek: Add device_link between the consumer and the larb devices Yong Wu
2021-10-11 12:36   ` Dafna Hirschfeld
2021-10-16  2:23     ` Yong Wu
2021-10-18  7:13       ` Dafna Hirschfeld
2021-10-25  3:57         ` Yong Wu
2021-09-29  1:37 ` [PATCH v8 05/12] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put Yong Wu
2021-09-29  1:37 ` [PATCH v8 06/12] media: mtk-mdp: " Yong Wu
2021-09-29  1:37 ` [PATCH v8 07/12] drm/mediatek: Add pm runtime support for ovl and rdma Yong Wu
2021-09-29  1:37 ` [PATCH v8 08/12] drm/mediatek: Get rid of mtk_smi_larb_get/put Yong Wu
2021-09-29  1:37 ` [PATCH v8 09/12] media: mtk-vcodec: " Yong Wu
2021-09-29 12:13   ` Dafna Hirschfeld
2021-09-30  3:28     ` Yong Wu
2021-09-30 10:57       ` Dafna Hirschfeld
2021-10-07  2:57         ` Yong Wu
2021-09-29  1:37 ` [PATCH v8 10/12] memory: mtk-smi: " Yong Wu
2021-09-29  1:37 ` [PATCH v8 11/12] arm: dts: mediatek: Get rid of mediatek,larb for MM nodes Yong Wu
2021-09-29  1:37 ` [PATCH v8 12/12] arm64: " Yong Wu

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=33a8b313-ad1b-d307-7e8c-2fdebdc6f1a7@collabora.com \
    --to=dafna.hirschfeld@collabora.com \
    --cc=acourbot@chromium.org \
    --cc=airlied@linux.ie \
    --cc=anan.sun@mediatek.com \
    --cc=anthony.huang@mediatek.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eizan@chromium.org \
    --cc=evgreen@chromium.org \
    --cc=frank-w@public-files.de \
    --cc=hsinyi@chromium.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=mka@chromium.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=srv_heupstream@mediatek.com \
    --cc=tfiga@chromium.org \
    --cc=tiffany.lin@mediatek.com \
    --cc=will.deacon@arm.com \
    --cc=yi.kuo@mediatek.com \
    --cc=yong.wu@mediatek.com \
    --cc=youlin.pei@mediatek.com \
    --subject='Re: [PATCH v8 03/12] iommu/mediatek: Add probe_defer for smi-larb' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).