Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp11533269imu; Tue, 1 Jan 2019 01:15:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN6rVzls8SZW84xlGMo4sAse7GsSsytx5XcZn2B2SPOZVcpkEhR24DU1qM1bq2QJAccwi/51 X-Received: by 2002:a63:ed15:: with SMTP id d21mr9983633pgi.305.1546334150535; Tue, 01 Jan 2019 01:15:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546334150; cv=none; d=google.com; s=arc-20160816; b=F0GTsLMARhnp9STVpY6dBor9rwpxnmUIit4jtVk2vQg4R7Z3/bjPW9p23SYH9RINXL zkoOO/UOewAQvxq+Y5xAyye6ThRrfaDWdrXZNhOqeWZ7rd7z9woinGhaAEeJ9X/g/+61 MKQzSpUnb8aRBWcxpUqODDAQKFnljQXFPhua7Ql8mGt7bWyI5cu3xiSIMjvx0SVxMs7N /j9tteeD7eWdrXky6EIO8Idzkn9X3+psy05h2D65Ohi5JfN45oOQNVf5Fd4KegSe6I8C n3hn7nzAdNQ0jUUGau/d9AXQPvcu+/SkzcUuH5i9WQWGrof61jmX6TpK2/yRIIZ9uDjt DQxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=7flToov4xJOQ4OPdOcbw5F6nGHfd8mSOw0sKcsKKZt8=; b=Va+t/gkhVz2mNhntiN07+iYVwmCnujNG6rWKg5viRQLgU5rYXyYdDCF1T8NMIi5PMO fpTEygQWBPZINwwTqYlSFkToN5+SolkaInR1BkTbtsC9J4MzKK3m8tqp1Gd63fepPI8r /zXijZdkNk7lrLUQ+VIGdQEVSjpFqV0wQrh4Gr42gugZbzLO25f+y+SmUcjj5nD7SMGr N1Cd1uELCha+bLnUdk0skPp0Rdd5IuHBOsZtin1XcSVbg39hTKVhHCr5hEyksgCRsZui ZOXAm9ZiCSWfnwLGjFIo8CafmmUOIKLe89yAPkJM0dMQ7tQyMarYwmo+Zm0tc+Vr+lBj Z/fw== 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 n30si13518960pgb.406.2019.01.01.01.15.12; Tue, 01 Jan 2019 01:15:50 -0800 (PST) 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 S1728445AbfAAEwH (ORCPT + 99 others); Mon, 31 Dec 2018 23:52:07 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:47995 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728425AbfAAEwH (ORCPT ); Mon, 31 Dec 2018 23:52:07 -0500 X-UUID: f37bd95a5c0342f0a47459b720a2ea70-20190101 X-UUID: f37bd95a5c0342f0a47459b720a2ea70-20190101 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1143020851; Tue, 01 Jan 2019 12:51:58 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 1 Jan 2019 12:51:57 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 1 Jan 2019 12:51:56 +0800 From: Yong Wu To: Joerg Roedel , Greg Kroah-Hartman , Matthias Brugger , Rob Herring CC: Robin Murphy , Tomasz Figa , Will Deacon , , , , , , , , , , , Nicolas Boichat Subject: [PATCH 03/13] iommu/mediatek: Add probe_defer for smi-larb Date: Tue, 1 Jan 2019 12:51:06 +0800 Message-ID: <1546318276-18993-4-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1546318276-18993-1-git-send-email-yong.wu@mediatek.com> References: <1546318276-18993-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. This is a preparing patch for adding device_link. Signed-off-by: Yong Wu --- 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 36526c9..202e41b 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -645,7 +645,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) return -EPROBE_DEFER; data->smi_imu.larb_imu[id].dev = &plarbdev->dev; diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index f8b8275..9386aee 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -601,7 +601,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) plarbdev = of_platform_device_create( larb_spec.np, NULL, platform_bus_type.dev_root); - if (!plarbdev) { + if (!plarbdev || !plarbdev->dev.driver) { of_node_put(larb_spec.np); return -EPROBE_DEFER; } -- 1.9.1