From patchwork Thu Nov 24 11:20:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 83862 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp79174qgi; Thu, 24 Nov 2016 03:20:48 -0800 (PST) X-Received: by 10.99.60.69 with SMTP id i5mr3308676pgn.158.1479986447935; Thu, 24 Nov 2016 03:20:47 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g15si10357086pli.166.2016.11.24.03.20.47; Thu, 24 Nov 2016 03:20:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964867AbcKXLUr (ORCPT + 4 others); Thu, 24 Nov 2016 06:20:47 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:54307 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964851AbcKXLUq (ORCPT ); Thu, 24 Nov 2016 06:20:46 -0500 Received: from epcpsbgm2new.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OH502FMU8TW1J20@mailout1.samsung.com> for linux-samsung-soc@vger.kernel.org; Thu, 24 Nov 2016 20:20:40 +0900 (KST) X-AuditID: cbfee61b-f796f6d000004092-06-5836cd075f86 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id D1.0E.16530.70DC6385; Thu, 24 Nov 2016 20:20:40 +0900 (KST) Received: from AMDC2765.digital.local ([106.116.147.25]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OH500D6Y8U00G70@mmp1.samsung.com>; Thu, 24 Nov 2016 20:20:39 +0900 (KST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joerg Roedel , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 3/5] iommu/exynos: Ensure that SYSMMU is added only once to its master device Date: Thu, 24 Nov 2016 12:20:18 +0100 Message-id: <1479986420-30859-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1479986420-30859-1-git-send-email-m.szyprowski@samsung.com> References: <1479986420-30859-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRmVeSWpSXmKPExsVy+t9jAV2Os2YRBntWMllsnLGe1WLBfmuL ztkb2C3OnwcSM87vY7JYe+QuuwObx5OD85g8Nq3qZPOYfGM5o0ffllWMHp83yQWwRrnZZKQm pqQWKaTmJeenZOal2yqFhrjpWigp5CXmptoqRej6hgQpKZQl5pQCeUYGaMDBOcA9WEnfLsEt Y8vP/YwFt7kq2ndtYmlg/MnRxcjJISFgIvFi+gp2CFtM4sK99WxdjFwcQgJLGSUu989mgnB+ MUo8PniCGaSKTcBQouttFxuILSLgLnH9z3MWkCJmgQ2MEutmTAArEhaIl+hZ9oQVxGYRUJU4 cfkKE4jNK+AhsXnbZKh1chInj00Gq+EU8JSYvrGfBcQWAqq5sOot4wRG3gWMDKsYJVILkguK k9JzjfJSy/WKE3OLS/PS9ZLzczcxgkP5mfQOxsO73A8xCnAwKvHwdpiYRQixJpYVV+YeYpTg YFYS4TU4BRTiTUmsrEotyo8vKs1JLT7EaAp02ERmKdHkfGCc5ZXEG5qYm5gbG1iYW1qaGCmJ 8zbOfhYuJJCeWJKanZpakFoE08fEwSnVwChYIpJ/TfiOKYeZSmnfxi2/n50NyNpVHZTxhKnr Xc7svWour84vtWWcksopNq855rVx0Dep/DWPe+/UcR2Zn+rnlndEqk1VXs6y813E+mWLWFp2 ctjLfNvzJqJkUVvMhjeZnxLVBRZf1eU7PMdVUKJJTtVU2issb/aGQ/OlTgsWLd+Y++LWBiWW 4oxEQy3mouJEAN6o+p97AgAA X-MTR: 20000000000000000@CPGS Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This patch prepares Exynos IOMMU driver for deferred probing support. Once it gets added, of_xlate() callback might be called more than once for the same SYSMMU controller and master device (for example it happens when masters device driver fails with EPROBE_DEFER). This patch adds a check, which ensures that SYSMMU controller is added to its master device (owner) only once. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index e7851cffbbee..426b1534d4d3 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1247,7 +1247,7 @@ static int exynos_iommu_of_xlate(struct device *dev, { struct exynos_iommu_owner *owner = dev->archdata.iommu; struct platform_device *sysmmu = of_find_device_by_node(spec->np); - struct sysmmu_drvdata *data; + struct sysmmu_drvdata *data, *entry; if (!sysmmu) return -ENODEV; @@ -1266,6 +1266,10 @@ static int exynos_iommu_of_xlate(struct device *dev, dev->archdata.iommu = owner; } + list_for_each_entry(entry, &owner->controllers, owner_node) + if (entry == data) + return 0; + list_add_tail(&data->owner_node, &owner->controllers); data->master = dev;