Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2704461rwb; Mon, 15 Aug 2022 09:55:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR456glYOAJEijsLXuGtdc1Vb6zjUu0yfm4tHOobOr2JYF1gIlk8Se1HpGpw+hZ6SpHq3RgE X-Received: by 2002:a05:6402:447:b0:440:d482:495f with SMTP id p7-20020a056402044700b00440d482495fmr15720700edw.264.1660582534376; Mon, 15 Aug 2022 09:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660582534; cv=none; d=google.com; s=arc-20160816; b=LsQllNjeDHDPQgOXOieRxkDOViW2qTIVOQwknsTULAGvFXsdhWWfKZi20VnZHvQ1dq NgJcu00Vr4QcFJkXnoATK6AdG+rIksPCmY2jYmMnQJI1bKIlCRoA8er+PSo3hvMufVO2 U/KHxQto32w6JAeVqYP54KDa3wfas9GvWcyVprISouaE0RAP9TDzKwFo0waiBhMKbln7 U/+0aJtDpcEdIaLSX9XPn8NMe4cqp9vNQnYNl7xUm8UPfPerYkhPkxyjIREctSQuV5US qBUuo18VxBKKvtXyyq+i8AyOmuUe4k/JHqOWA+KRZrYIly2CTtcHsCyHWqQnoueR82au Xehg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=SpNGQdvN4GE2RulUtvTl8nGEceYnDT4c9G14FhMAadY=; b=X0ZmemuPNBR/Prq0ky08+D6sK3UpmCcSLpkRlin3CVs8SneXQjvc6Gkk9eVuCzMKew qABnkxyiAwJJhNbwR6kRJPHigqBxiNXjzCVd1RUkqUMStsbjfK0SEzDAoW55asL7ui2g 7EI7hUmcJcU9DydewWFntZxBRpY6fZJwX9d+U/6yx+UUjOuv6uKjdRy/TbmnN97MvDm8 dfXMzSG9PRHezjT24p5UgVxHxjlpJmMdk1F00mbImJig0ollUSD8ijQ5zF65bdpFVLU7 xOTPgrVaj2R8seLPcxzCN5yor2ZmlHxKG1sYczu+thakNp+JDWqJVHnAF38dG2S7HmYk hcAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z26-20020aa7c65a000000b0043cc6e2abf4si7879848edr.298.2022.08.15.09.55.09; Mon, 15 Aug 2022 09:55:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232762AbiHOQVS (ORCPT + 99 others); Mon, 15 Aug 2022 12:21:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232455AbiHOQUl (ORCPT ); Mon, 15 Aug 2022 12:20:41 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 918AD18B15 for ; Mon, 15 Aug 2022 09:20:36 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 01339113E; Mon, 15 Aug 2022 09:20:37 -0700 (PDT) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BC1963F70D; Mon, 15 Aug 2022 09:20:34 -0700 (PDT) From: Robin Murphy To: joro@8bytes.org Cc: will@kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, baolu.lu@linux.intel.com, kevin.tian@intel.com, suravee.suthikulpanit@amd.com, vasant.hegde@amd.com, mjrosato@linux.ibm.com, schnelle@linux.ibm.com, linux-kernel@vger.kernel.org Subject: [PATCH v4 08/16] iommu/arm-smmu-v3: Clean up bus_set_iommu() Date: Mon, 15 Aug 2022 17:20:09 +0100 Message-Id: <6235f07df013776656a61bb642023ecce07f46cc.1660572783.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.36.1.dirty In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Stop calling bus_set_iommu() since it's now unnecessary, and simplify the probe failure path accordingly. Acked-by: Will Deacon Signed-off-by: Robin Murphy --- v4: No change drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 53 +-------------------- 1 file changed, 2 insertions(+), 51 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index d32b02336411..e17ed5870f77 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -28,8 +28,6 @@ #include #include -#include - #include "arm-smmu-v3.h" #include "../../iommu-sva-lib.h" @@ -3673,43 +3671,6 @@ static unsigned long arm_smmu_resource_size(struct arm_smmu_device *smmu) return SZ_128K; } -static int arm_smmu_set_bus_ops(struct iommu_ops *ops) -{ - int err; - -#ifdef CONFIG_PCI - if (pci_bus_type.iommu_ops != ops) { - err = bus_set_iommu(&pci_bus_type, ops); - if (err) - return err; - } -#endif -#ifdef CONFIG_ARM_AMBA - if (amba_bustype.iommu_ops != ops) { - err = bus_set_iommu(&amba_bustype, ops); - if (err) - goto err_reset_pci_ops; - } -#endif - if (platform_bus_type.iommu_ops != ops) { - err = bus_set_iommu(&platform_bus_type, ops); - if (err) - goto err_reset_amba_ops; - } - - return 0; - -err_reset_amba_ops: -#ifdef CONFIG_ARM_AMBA - bus_set_iommu(&amba_bustype, NULL); -#endif -err_reset_pci_ops: __maybe_unused; -#ifdef CONFIG_PCI - bus_set_iommu(&pci_bus_type, NULL); -#endif - return err; -} - static void __iomem *arm_smmu_ioremap(struct device *dev, resource_size_t start, resource_size_t size) { @@ -3848,27 +3809,17 @@ static int arm_smmu_device_probe(struct platform_device *pdev) ret = iommu_device_register(&smmu->iommu, &arm_smmu_ops, dev); if (ret) { dev_err(dev, "Failed to register iommu\n"); - goto err_sysfs_remove; + iommu_device_sysfs_remove(&smmu->iommu); + return ret; } - ret = arm_smmu_set_bus_ops(&arm_smmu_ops); - if (ret) - goto err_unregister_device; - return 0; - -err_unregister_device: - iommu_device_unregister(&smmu->iommu); -err_sysfs_remove: - iommu_device_sysfs_remove(&smmu->iommu); - return ret; } static int arm_smmu_device_remove(struct platform_device *pdev) { struct arm_smmu_device *smmu = platform_get_drvdata(pdev); - arm_smmu_set_bus_ops(NULL); iommu_device_unregister(&smmu->iommu); iommu_device_sysfs_remove(&smmu->iommu); arm_smmu_device_disable(smmu); -- 2.36.1.dirty