Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5074986ybv; Mon, 17 Feb 2020 11:43:10 -0800 (PST) X-Google-Smtp-Source: APXvYqxxf7uq4IANz7ko7S8JG7Rz0rCcj6O9Yh6JsFKKPwigMqjX3h6QTztGhGgkW1HyAGE3rscA X-Received: by 2002:a05:6808:611:: with SMTP id y17mr377128oih.146.1581968589971; Mon, 17 Feb 2020 11:43:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581968589; cv=none; d=google.com; s=arc-20160816; b=OH14pkl0nrkfFklqhJC6OalqXJ+dq6Ln748WNA+pj21Fe5SY25r0lZYizXekS5/oJF GjnvLWQKvy8fBkYWDnLLXD+WF0USyNRVNLuXcqFpvqG0lJUoIMuFbDy/bA5dQKdzyoMT Gm0gMePNhcOW7Ic9pZ1Upt3qq6CEdzloUKBUP1hr8pOsfK7DWSf4tMqwKhnFnc5zFKNz Qr+E5DnMECquGNTxsoCbWGcxTePba/4xOh1tlPMRvb5QYoHnIm0NSOATFTlew1yLFBnj ENzgRdQ34YNiST5ekSS5CnXaq5zvbHcNgNrJICkTVW5yAVDnHqnmoeXwiGClABkCxope hQ2Q== 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=ngSOgsXBwT9zjfy+wFFwPC2XbIH0w8ijDcTyYi5kO4w=; b=CsKG6Cx4uVMlBvkAQlu8jTi/+iYWM8PuaeGGJHbB8xLTlVVp4XekhbRuh1Z7qTFmDG jmdD54d2PNlUdVZOZiK+DchrrirAsihZ3VPBJ6rloHq1JVGXgK47FsBsBIxES2jmM19d HpBX9GXw4F7WmQ1mJOAz6Htw+jPNIdGzeY5O4eWLxhCkipALPLJWThXHLupePpAAoChN wpOPFiXNkkatA19aWeZZXQPY3D9G+I7BThtH3/Pmr/doMI0dg1VrIcVmoqXe+IPR49L/ 9knEen8S+tjRUhG425kDQ+f41O/UTPWxaELnibJPgX6jWXdjLnJM0aDOIUQvaTGq4+XW 7l3A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6si610054otk.171.2020.02.17.11.42.58; Mon, 17 Feb 2020 11:43:09 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729659AbgBQTjK (ORCPT + 99 others); Mon, 17 Feb 2020 14:39:10 -0500 Received: from 8bytes.org ([81.169.241.247]:54514 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729301AbgBQTjJ (ORCPT ); Mon, 17 Feb 2020 14:39:09 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id DFC6C542; Mon, 17 Feb 2020 20:39:06 +0100 (CET) From: Joerg Roedel To: Lu Baolu , David Woodhouse Cc: Joerg Roedel , jroedel@suse.de, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] iommu/vt-d: Move deferred device attachment into helper function Date: Mon, 17 Feb 2020 20:38:55 +0100 Message-Id: <20200217193858.26990-3-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200217193858.26990-1-joro@8bytes.org> References: <20200217193858.26990-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 Move the code that does the deferred device attachment into a separate helper function. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 80f2332a5466..42cdcce1602e 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -2529,16 +2529,20 @@ struct dmar_domain *find_domain(struct device *dev) return NULL; } -static struct dmar_domain *deferred_attach_domain(struct device *dev) +static void do_deferred_attach(struct device *dev) { - if (unlikely(attach_deferred(dev))) { - struct iommu_domain *domain; + struct iommu_domain *domain; - dev->archdata.iommu = NULL; - domain = iommu_get_domain_for_dev(dev); - if (domain) - intel_iommu_attach_device(domain, dev); - } + dev->archdata.iommu = NULL; + domain = iommu_get_domain_for_dev(dev); + if (domain) + intel_iommu_attach_device(domain, dev); +} + +static struct dmar_domain *deferred_attach_domain(struct device *dev) +{ + if (unlikely(attach_deferred(dev))) + do_deferred_attach(dev); return find_domain(dev); } -- 2.17.1