From patchwork Mon Jun 3 15:50:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 165632 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645501ili; Mon, 3 Jun 2019 08:52:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8ORTHnHCj90pO0gZiyoX3CE6c4oYlh65Ed2ipemdq03rNRwmtZLSYLquT7bv0+kzmzaut X-Received: by 2002:a17:902:868f:: with SMTP id g15mr30592712plo.67.1559577162441; Mon, 03 Jun 2019 08:52:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577162; cv=none; d=google.com; s=arc-20160816; b=xshLG6vQ3w2KJlbb8JY3lGkVmxwfAxEinDM19QG9qqQUzerkPHAbdtvL2t3wDpv9dg unBhkRB+jaLBaGjyXaLGGrWZJPn4p1zz2EVUiKvjaXMZCRRXh/onAow1UKba0DHOJCBi roXUSRniD5xKqmZfYZtgyWdUJNwtECEMKuOQpHFSSNX8KZzCM9rUfaAvEShNncGgzsG/ XWUM0m0Z1LuiPLqGhyoL1aU1Kjzjj52xNDmiQwyQVrEqineG8k8r5wcxgPEo9kft/WyY +kvG6SUgzuowLO/CuqlFOpbbtlPow6w4/gpXIhBDxO/hgIbpM4G5g7VH1I48e2HSq6PC iRaA== 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=XRWKlJED9Lo0lEkJD8RqoGMbvqXKL7qmOJuZ400Zx4w=; b=Tjvt+hhthdr+u9tgb8QcUVKcneKI/U4zJuXm0kkVmJD0+301M3n1YaOPbvJmyj7nI7 zVU098GXPmPwxebLebaDPS09uygvHyY2XHA82+QXXtD5fKGGH+61nR0e5qV4UI8U0Lpv Rmqziq8bX9S3U7wB29ZObsFyvCaMougnOdC+d1Vyrnfz3W8x7Ujq65WST63S5bkzoomT 04iTgZf65s/T0tU7JqA0U+tJ7s7ZagxnRdWP7NEYIGn3o2GgUJ+gY3uz+lLrDU1oJ4pV Y1vD6ylNpsdaRuJ0yV2x9Il3sxTyfXXoonZCqpizZN1SovikIG1u9iJqGsMGdJCqjnMy cGlQ== 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 gn3si8189430plb.321.2019.06.03.08.52.42; Mon, 03 Jun 2019 08:52:42 -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 S1729588AbfFCPwU (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:20 -0400 Received: from foss.arm.com ([217.140.101.70]:54068 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729553AbfFCPwQ (ORCPT ); Mon, 3 Jun 2019 11:52:16 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 17DDD15AB; Mon, 3 Jun 2019 08:52:16 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B58773F246; Mon, 3 Jun 2019 08:52:14 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Will Deacon , Robin Murphy , Joerg Roedel Subject: [RFC PATCH 50/57] drivers: iommu: arm-smmu: Use driver_find_device_by_fwnode() helper Date: Mon, 3 Jun 2019 16:50:16 +0100 Message-Id: <1559577023-558-51-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559577023-558-1-git-send-email-suzuki.poulose@arm.com> References: <1559577023-558-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reuse the driver_find_device_by_fwnode() helper to lookup devices. Cc: Will Deacon Cc: Robin Murphy Cc: Joerg Roedel Signed-off-by: Suzuki K Poulose --- drivers/iommu/arm-smmu-v3.c | 9 ++------- drivers/iommu/arm-smmu.c | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index d787856..1f9851f 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -2023,16 +2023,11 @@ arm_smmu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova) static struct platform_driver arm_smmu_driver; -static int arm_smmu_match_node(struct device *dev, const void *data) -{ - return dev->fwnode == data; -} - static struct arm_smmu_device *arm_smmu_get_by_fwnode(struct fwnode_handle *fwnode) { - struct device *dev = driver_find_device(&arm_smmu_driver.driver, NULL, - fwnode, arm_smmu_match_node); + struct device *dev = driver_find_device_by_fwnode(&arm_smmu_driver.driver, + NULL, fwnode); put_device(dev); return dev ? dev_get_drvdata(dev) : NULL; } diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 4ce429b..c962e82 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1431,16 +1431,11 @@ static bool arm_smmu_capable(enum iommu_cap cap) } } -static int arm_smmu_match_node(struct device *dev, const void *data) -{ - return dev->fwnode == data; -} - static struct arm_smmu_device *arm_smmu_get_by_fwnode(struct fwnode_handle *fwnode) { - struct device *dev = driver_find_device(&arm_smmu_driver.driver, NULL, - fwnode, arm_smmu_match_node); + struct device *dev = driver_find_device_by_fwnode(&arm_smmu_driver.driver, + NULL, fwnode); put_device(dev); return dev ? dev_get_drvdata(dev) : NULL; }