From patchwork Fri Feb 28 15:37:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3742131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 59EDF9F35F for ; Fri, 28 Feb 2014 15:37:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8BEAE202A7 for ; Fri, 28 Feb 2014 15:37:08 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 939EC20254 for ; Fri, 28 Feb 2014 15:37:07 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WJPUJ-0006hr-Vg; Fri, 28 Feb 2014 15:36:36 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WJPUC-0000n8-Ov; Fri, 28 Feb 2014 15:36:28 +0000 Received: from perceval.ideasonboard.com ([95.142.166.194]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WJPTy-0000ju-K2 for linux-arm-kernel@lists.infradead.org; Fri, 28 Feb 2014 15:36:15 +0000 Received: from avalon.ideasonboard.com (230.27-200-80.adsl-dyn.isp.belgacom.be [80.200.27.230]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 54BC935A47; Fri, 28 Feb 2014 16:34:49 +0100 (CET) From: Laurent Pinchart To: Will Deacon Subject: [PATCH 1/2] iommu/arm-smmu: Replace list walk with platform driver data Date: Fri, 28 Feb 2014 16:37:09 +0100 Message-Id: <1393601830-4677-2-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1393601830-4677-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> References: <1393601830-4677-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140228_103614_949511_8FC72E6C X-CRM114-Status: GOOD ( 10.07 ) X-Spam-Score: -1.9 (-) Cc: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of walking the list of registered SMMU devices at remove time to locate the device being removed, set platform driver data at probe time to point to the SMMU and retrieve the pointer at remove time. Signed-off-by: Laurent Pinchart --- drivers/iommu/arm-smmu.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 1d9ab39..c33a310 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1912,6 +1912,8 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) list_add(&smmu->list, &arm_smmu_devices); spin_unlock(&arm_smmu_devices_lock); + platform_set_drvdata(pdev, smmu); + arm_smmu_device_reset(smmu); return 0; @@ -1937,22 +1939,13 @@ static int arm_smmu_device_remove(struct platform_device *pdev) { int i; struct device *dev = &pdev->dev; - struct arm_smmu_device *curr, *smmu = NULL; + struct arm_smmu_device *smmu = platform_get_drvdata(pdev); struct rb_node *node; spin_lock(&arm_smmu_devices_lock); - list_for_each_entry(curr, &arm_smmu_devices, list) { - if (curr->dev == dev) { - smmu = curr; - list_del(&smmu->list); - break; - } - } + list_del(&smmu->list); spin_unlock(&arm_smmu_devices_lock); - if (!smmu) - return -ENODEV; - if (smmu->parent_of_node) of_node_put(smmu->parent_of_node);