Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp584981imu; Tue, 11 Dec 2018 04:22:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/XHL550U+ROl7iQK1hjtjkPIGezVBXI8QZQnSOiok2csJbDCZkGH5NAiin7vKhKysCd6yu4 X-Received: by 2002:a62:4549:: with SMTP id s70mr15913621pfa.233.1544530974142; Tue, 11 Dec 2018 04:22:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544530974; cv=none; d=google.com; s=arc-20160816; b=mhes/E3nN8KS+8wDIKseChaCK6WZRwa5zUoM54ZCoFrrHje9k95zGD4kSQ5DwTbGIE keY5AJZxwYKePBS0C7BRiiHmJJcuCpc/juUopECMp4YJwLcuonpcLs2B2I3YS7x6Dp9t QuG3wkdO6elxOj7TfZ9xRaQ24otWLg8dA17M1K5Bt3Oc82eFT1QZYf9f4kgNO8oMqRvX wkBfDd72gh5Yfz0tXsBh/NqH6un9KtBsoTJJQeKwgUAUr1KLBZ0N1btVIMYhe9PXBvUk ZL6WtB77Jba/5EBt7uT5BPL84nmg2KserYCSRKUTFhTiKLu5Ys05bq8ePhvYf4HXl88S EC8w== 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=gY80pUNz/cHPGMFvvl+94BpEaYpchgnJ1ibO6TJXrxg=; b=XFwuBg2h9EhYpynGolTcbTR5w/lG0PJoAeoveAbPK1mQTddjCXYC9gvrGU9JtuM7Dc H5Ak5q3hmoc2pfvUVjaWXZI0ZhObCN+d6yQrke1G3OV5hJXI8gIOjw9FErY6iR6EZjAe kAj9lIj+Pr5zepuyNk7Zxg6R+kbLITKGi1q4o5xcUdEVMJdESnK5UJMjHZS7divsh/6l W3Ep9Oq1Ip4RTqBTExBr7lengk7HwYfs1obr5biSD89JK44Ep7WBsTVm9bko8QWMXJEp yXMNlFJRevPNYlUc5YBetNoGEAytXoafAHPKt0vFRzc3UUG51BUy1bpnXMwBrzFjyFve hSmg== 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 r2si12318970pgk.389.2018.12.11.04.22.39; Tue, 11 Dec 2018 04:22:54 -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 S1726529AbeLKMTq (ORCPT + 99 others); Tue, 11 Dec 2018 07:19:46 -0500 Received: from 8bytes.org ([81.169.241.247]:53158 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726190AbeLKMTO (ORCPT ); Tue, 11 Dec 2018 07:19:14 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id 3E60B6C6; Tue, 11 Dec 2018 13:19:13 +0100 (CET) From: Joerg Roedel To: iommu@lists.linux-foundation.org Cc: Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Will Deacon , Robin Murphy , Joerg Roedel , Matthias Brugger , Rob Clark , Thierry Reding , linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH 7/9] iommu/of: Use helper functions to access dev->iommu_fwspec Date: Tue, 11 Dec 2018 13:19:08 +0100 Message-Id: <20181211121910.5604-8-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181211121910.5604-1-joro@8bytes.org> References: <20181211121910.5604-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 Use the new helpers dev_iommu_fwspec_get()/set() to access the dev->iommu_fwspec pointer. This makes it easier to move that pointer later into another struct. Signed-off-by: Joerg Roedel --- drivers/iommu/of_iommu.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index c5dd63072529..8b071f3dcf9e 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -164,7 +164,7 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, struct device_node *master_np) { const struct iommu_ops *ops = NULL; - struct iommu_fwspec *fwspec = dev->iommu_fwspec; + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); int err = NO_IOMMU; if (!master_np) @@ -208,14 +208,18 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, } } + /* * Two success conditions can be represented by non-negative err here: * >0 : there is no IOMMU, or one was unavailable for non-fatal reasons * 0 : we found an IOMMU, and dev->fwspec is initialised appropriately * <0 : any actual error */ - if (!err) - ops = dev->iommu_fwspec->ops; + if (!err) { + /* The fwspec pointer changed, read it again */ + fwspec = dev_iommu_fwspec_get(dev); + ops = fwspec->ops; + } /* * If we have reason to believe the IOMMU driver missed the initial * add_device callback for dev, replay it to get things in order. -- 2.17.1