Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp586168ybz; Wed, 15 Apr 2020 14:35:18 -0700 (PDT) X-Google-Smtp-Source: APiQypIL+db2eXrJ/VDMplFC+kZ1nVk8jeHIuXn4HXLd2aZeFAaT7ShDVnedsly6SgcmjxoXRl4q X-Received: by 2002:a17:907:210d:: with SMTP id qn13mr7074998ejb.376.1586986518708; Wed, 15 Apr 2020 14:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586986518; cv=none; d=google.com; s=arc-20160816; b=sB4lR5kNQhtd3Q8zoT5IlFEZsGS9Canf/kLvKFN9k+9GKL/jrGFOmFildj7ZMsh0Mq l8enOq6yPcvuTcurJgv40VgAXZ7y2jVE0wQFv5XwOR9voAjpoIw84TMF7SUJe/vCQR2+ DR38WmJIvFgwJfkeSE2E93iu78+X/ZOyTjofEQRhNc0WqkAtKcLWv7lkbH0Cim3b0Kq8 EwaCxxHrusG0422QGvJZlykjXACn8NnMZJkc0y1OU/5CtsH4zMN1GnMC61a36Hlm7RsR zJZ/3OogVLCNmbbYdFhRpmHTfK6rNzOWoUyCu+346ZYxGeCW6VsnO7FssN0ckavqdUNz +ODg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=ezIcyRMiPGZm7PvEZbHm5gxVf6Pdmy4EhVwWSrt2Oa4=; b=qBtdTtAlcOSG3OG8nIGv3+fIedwsVYDc0wTL3pPQnQXt6EZOSN62Vkr6dm9uTro9xE fuDRsuj93DPqtuC+8aUN6QMRZ1HNcewOeKZJrgctrhk8dvMdF+ljz+oapbAL7JMZ2LYN godSbCnw0s8kbAClanInFZKPGJnGXqQui+VqyMD7TSWbI5dak6T6JvraFZEATD4O7FsK i5Y+gg1GTC+95iRk/xZiHT7A9WWAh1t+foGZGW33IL5a1DQlKmCRFcAILmBADKdgKZq2 k1+E/vfaUW/ATOz+N4+AjS/QWatVFB+KfMDwjxNp2S9sJlruxNX0NyFBPY0JkkVeLOww ms2A== 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=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd13si11196490edb.199.2020.04.15.14.34.55; Wed, 15 Apr 2020 14:35:18 -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=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730432AbgDNNSt (ORCPT + 99 others); Tue, 14 Apr 2020 09:18:49 -0400 Received: from 8bytes.org ([81.169.241.247]:35298 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502914AbgDNNQL (ORCPT ); Tue, 14 Apr 2020 09:16:11 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 701C280A; Tue, 14 Apr 2020 15:15:57 +0200 (CEST) From: Joerg Roedel To: Joerg Roedel , Will Deacon , Robin Murphy , Marek Szyprowski , Kukjin Kim , Krzysztof Kozlowski , David Woodhouse , Lu Baolu , Andy Gross , Bjorn Andersson , Matthias Brugger , Rob Clark , Heiko Stuebner , Gerald Schaefer , Thierry Reding , Jonathan Hunter , Jean-Philippe Brucker Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-s390@vger.kernel.org, linux-tegra@vger.kernel.org, virtualization@lists.linux-foundation.org, Joerg Roedel Subject: [PATCH v2 31/33] iommu/exynos: Convert to probe/release_device() call-backs Date: Tue, 14 Apr 2020 15:15:40 +0200 Message-Id: <20200414131542.25608-32-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200414131542.25608-1-joro@8bytes.org> References: <20200414131542.25608-1-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel Convert the Exynos IOMMU driver to use the probe_device() and release_device() call-backs of iommu_ops, so that the iommu core code does the group and sysfs setup. Signed-off-by: Joerg Roedel --- drivers/iommu/exynos-iommu.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 09cdd163560a..60c8a56e4a3f 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1235,19 +1235,13 @@ static phys_addr_t exynos_iommu_iova_to_phys(struct iommu_domain *iommu_domain, return phys; } -static int exynos_iommu_add_device(struct device *dev) +static struct iommu_device *exynos_iommu_probe_device(struct device *dev) { struct exynos_iommu_owner *owner = dev->archdata.iommu; struct sysmmu_drvdata *data; - struct iommu_group *group; if (!has_sysmmu(dev)) - return -ENODEV; - - group = iommu_group_get_for_dev(dev); - - if (IS_ERR(group)) - return PTR_ERR(group); + return ERR_PTR(-ENODEV); list_for_each_entry(data, &owner->controllers, owner_node) { /* @@ -1259,17 +1253,15 @@ static int exynos_iommu_add_device(struct device *dev) DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME); } - iommu_group_put(group); /* There is always at least one entry, see exynos_iommu_of_xlate() */ data = list_first_entry(&owner->controllers, struct sysmmu_drvdata, owner_node); - iommu_device_link(&data->iommu, dev); - return 0; + return &data->iommu; } -static void exynos_iommu_remove_device(struct device *dev) +static void exynos_iommu_release_device(struct device *dev) { struct exynos_iommu_owner *owner = dev->archdata.iommu; struct sysmmu_drvdata *data; @@ -1287,15 +1279,9 @@ static void exynos_iommu_remove_device(struct device *dev) iommu_group_put(group); } } - iommu_group_remove_device(dev); list_for_each_entry(data, &owner->controllers, owner_node) device_link_del(data->link); - - /* There is always at least one entry, see exynos_iommu_of_xlate() */ - data = list_first_entry(&owner->controllers, - struct sysmmu_drvdata, owner_node); - iommu_device_unlink(&data->iommu, dev); } static int exynos_iommu_of_xlate(struct device *dev, @@ -1341,8 +1327,8 @@ static const struct iommu_ops exynos_iommu_ops = { .unmap = exynos_iommu_unmap, .iova_to_phys = exynos_iommu_iova_to_phys, .device_group = generic_device_group, - .add_device = exynos_iommu_add_device, - .remove_device = exynos_iommu_remove_device, + .probe_device = exynos_iommu_probe_device, + .release_device = exynos_iommu_release_device, .pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE, .of_xlate = exynos_iommu_of_xlate, }; -- 2.17.1