Received: by 2002:a9a:4c47:0:b029:116:c383:538 with SMTP id u7csp1221385lko; Tue, 13 Jul 2021 19:58:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytCWXts70GLXYvOKj19j7RUc8DWHgRBRhqzVP69uInNqDp3CP0JguiwWVuGECTNU/0nYHG X-Received: by 2002:a5d:930b:: with SMTP id l11mr5863294ion.177.1626231489856; Tue, 13 Jul 2021 19:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626231489; cv=none; d=google.com; s=arc-20160816; b=qjJzkEpkwYA8UEmVu5Rn7dK0pSj2F/41Ow9vSppkNhLn/LJXUvj51aCpwP6YI+s6AR fFnykT/IO91ufpo6Wq4amBk8qOvRbkXk5mpVHwb/ZipMrH+bLWxtdePzSXoCim/HUYY7 oxT8z+YZUm0hKOo4ezHhIA7pKKPuCDRPszBClXOtZ5VTJK8ZFpCNHKnHh47Dp6hyh3sM NV8kHokXmO2TnrawcrstzCxSCWRz2AV8FhwhttB2XDZKHPWjlx+MsYS5dpPr4DR0BHIZ 5PU7W0UNdjo+DzG5j4nAKX2UmcyxtoE2AqFvlgs2Qr4a4S3XoyxAjtFZMiLZi7h8ymrn mZ2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=IPMdw/dbD3vTsEgWpwPF6DvGuj+/AZVFsyU+3doDSPg=; b=UoOqCBDj7IbFKiDyUAij9OpWFLcRcTqIGHg0wHzHIOwNCHCFKVBrXvkttsO0bUPIxL Tl4lWDyAY13cdWH/dRDC7NDMrGYO/PhDKBXuLadTtMoz+owo70dBwdYdz8mUTusOkbRJ O5TfAdWNIfL8v5QvGookxVpBhYKz+5/7GdEQ0/bWgj4MkI/OIQAIV9EeXn3QD4HII0JB xuHbPFiLsZYbXw7KMtKS2bcZXvUanUqpEuUYKIgPlf35duoJa3LRj1DvVm7tsR3rVxxE NGgM4wH32zMgLQYYoKB/x8lrHvjJAcIR0n6/TpWnPKn0xxxAAJjj1RicrjgfWt5pDCkE siCQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si924388iop.94.2021.07.13.19.57.57; Tue, 13 Jul 2021 19:58:09 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237722AbhGNC7z (ORCPT + 99 others); Tue, 13 Jul 2021 22:59:55 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:46282 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S237710AbhGNC7z (ORCPT ); Tue, 13 Jul 2021 22:59:55 -0400 X-UUID: f1224d17ae8e471e9ab8d68e86ed51f2-20210714 X-UUID: f1224d17ae8e471e9ab8d68e86ed51f2-20210714 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1661585294; Wed, 14 Jul 2021 10:57:01 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 14 Jul 2021 10:57:00 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 14 Jul 2021 10:56:58 +0800 From: Yong Wu To: Matthias Brugger , Joerg Roedel , Rob Herring , Krzysztof Kozlowski , David Airlie , Mauro Carvalho Chehab CC: Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , , , , , , , , , Nicolas Boichat , Matthias Kaehlcke , , , , , , , Daniel Vetter , Chun-Kuang Hu , Philipp Zabel , Xia Jiang , Tiffany Lin , Dafna Hirschfeld , Hsin-Yi Wang , Eizan Miyamoto , Subject: [PATCH v6 02/11] iommu/mediatek: Add probe_defer for smi-larb Date: Wed, 14 Jul 2021 10:56:17 +0800 Message-ID: <20210714025626.5528-3-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210714025626.5528-1-yong.wu@mediatek.com> References: <20210714025626.5528-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 consumer always is 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. Signed-off-by: Yong Wu --- since [1], device_is_bound is not allowed to be EXPORT. It will affect this driver built as module. thus still use dev.driver here. [1] https://lore.kernel.org/patchwork/patch/1334670/ --- 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 6f7c69688ce2..a02dde094788 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -855,7 +855,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; } diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index 778e66f5f1aa..d9365a3d8dc9 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -594,7 +594,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; } -- 2.18.0