Received: by 10.213.65.68 with SMTP id h4csp246879imn; Fri, 23 Mar 2018 03:51:34 -0700 (PDT) X-Google-Smtp-Source: AG47ELup6xzvpm+b8j+RtnT10Z8UDW1jj3dbKIo+ou5yLhc1q+5alqhJ9fjewT/Vt6hqocaGqK2j X-Received: by 2002:a17:902:b946:: with SMTP id h6-v6mr22953808pls.35.1521802294426; Fri, 23 Mar 2018 03:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521802294; cv=none; d=google.com; s=arc-20160816; b=KNCXgG4F8q3fa2ae1fwA08jy60KSnBqBOsIOKf4uhd65PS/oHgR5rMZcBebMaJ84ai a6NQ/IvFKJae/0x1My1PpN00v/cuPFJCB3bHLlT8qxuWGUZ/F1v3wnDKBQIA1DYWbA6H gUewVqU+B55No+BmQF3St2CD69ZocpTfPyzWPFm+TD1yj2podzpNZUkwXc8hwNicfyob AKUULEKc+/bfFHz7pNGLhLKW7wHpmSJHZH6JkvuN0J3ZWcPbU0EHWsmvE8Pl0vgACoSn uLqTgCGZZSajKekCQsBDaiSNyKAemxoJZoJIUJ8ouF8Y/c+H28EgLvHMmBhhV8Gj2/EQ wyeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Ji9IapHMJPVnSaRvhrUDyfggDtrlq3GCUVz5Te/QCyI=; b=BNzScZZQqHx1Qkm4AnfyGj65wptkMcv/a7n4njZVaPFhSJVG+km3L4eiDUz5Zlxtol yUCo/Vz/4YMBKsggjkwaSVqdGrGq9ommm1zc+zpgvCpUCRhBnMHZ6gEu3rDpoS6k3nb8 Ip5W2TQVIPIDDV8bRGpRy/q9DnsvVHJ0emzZ0RCcpyfqT4tz7+9YTdXoI7fG8ljf6fj4 2Cfc6VA1wAgm7BQJT/pJHumR4253wtZkfULQXwBftGnV33D6AljVcrpBVLh/gF7zBjQt TwYKnoU7+uEYTqcA1PjGdd958hrdJfQDy0luJkXjIwYI05jTTpPMMdwafDO5PC8uvpwU hzIQ== 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 bf5-v6si7884639plb.583.2018.03.23.03.51.20; Fri, 23 Mar 2018 03:51:34 -0700 (PDT) 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 S933340AbeCWKOg (ORCPT + 99 others); Fri, 23 Mar 2018 06:14:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45238 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933313AbeCWKOc (ORCPT ); Fri, 23 Mar 2018 06:14:32 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2F2CF1247; Fri, 23 Mar 2018 10:14:31 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suman Anna , Joerg Roedel , Sasha Levin Subject: [PATCH 4.4 25/97] iommu/omap: Register driver before setting IOMMU ops Date: Fri, 23 Mar 2018 10:54:12 +0100 Message-Id: <20180323094159.033214117@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Suman Anna [ Upstream commit abaa7e5b054aae567861628b74dbc7fbf8ed79e8 ] Move the registration of the OMAP IOMMU platform driver before setting the IOMMU callbacks on the platform bus. This causes the IOMMU devices to be probed first before the .add_device() callback is invoked for all registered devices, and allows the iommu_group support to be added to the OMAP IOMMU driver. While at this, also check for the return status from bus_set_iommu. Signed-off-by: Suman Anna Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/omap-iommu.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -1295,6 +1295,7 @@ static int __init omap_iommu_init(void) const unsigned long flags = SLAB_HWCACHE_ALIGN; size_t align = 1 << 10; /* L2 pagetable alignement */ struct device_node *np; + int ret; np = of_find_matching_node(NULL, omap_iommu_of_match); if (!np) @@ -1308,11 +1309,25 @@ static int __init omap_iommu_init(void) return -ENOMEM; iopte_cachep = p; - bus_set_iommu(&platform_bus_type, &omap_iommu_ops); - omap_iommu_debugfs_init(); - return platform_driver_register(&omap_iommu_driver); + ret = platform_driver_register(&omap_iommu_driver); + if (ret) { + pr_err("%s: failed to register driver\n", __func__); + goto fail_driver; + } + + ret = bus_set_iommu(&platform_bus_type, &omap_iommu_ops); + if (ret) + goto fail_bus; + + return 0; + +fail_bus: + platform_driver_unregister(&omap_iommu_driver); +fail_driver: + kmem_cache_destroy(iopte_cachep); + return ret; } subsys_initcall(omap_iommu_init); /* must be ready before omap3isp is probed */