Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2744182ybh; Mon, 16 Mar 2020 08:54:07 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu6HYKrn2W9zJVO/XcBm417Pz+AW0mQUujWnI1Qt+ByScodHZJ4ACH6nqNpbMlQS5wAJhlD X-Received: by 2002:aca:4710:: with SMTP id u16mr152992oia.108.1584374047312; Mon, 16 Mar 2020 08:54:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584374047; cv=none; d=google.com; s=arc-20160816; b=uLydJaxEj9wC75bR7WMslPjCShq2ZvJe1WoDbgG25Bta43QT1+f76HLok6TX/j1oZp yeSIhkze4JWQNaL9Tmvnoov9r9aFqUV8AuzzNat+Zz0Xkeeqcx6O9cE8c9wRkdv0zrEk FNp/fap+7+Y5oqcSN+nriP8ktvpQg+a0MiVrTDce4qTfp7XXWnwPrM6RpU/94mAHNuSl 16FOdQLOlvg1RYKl/PcVV/9Ls4GIpoEke1y8U+MVy6E5HDvQPtzMGUd0udgGreNk2g/W 3rbfYccKj+OID+DBkyHpoRXhuyRIrH2lsyIIkGwDN7dviMXmcewsMfNGd74kAPg1HX7Q H13Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=CQWUEVlXfznSczAKyGpDi3T2t4zubClSxzSzuBgyOmY=; b=ehM7vFZuDxlOM+HdFuzxSIyIt1f5kyiX8TIq7At7GUnCYFkEpZzFmfM2nVpdUGfeM4 x7F1b8q8UhbL5/L2kvFX57gutos3qESNJ2Fnz06udgN6QL80sD2i5dF1k9urXfI4QjCb 8w6/EouBCuNzK3nyfDY9/8shIm9ALIoptWi/OgdYCIZN7H36Y/U5kFLxQs+NJr7u2+Un sTqxAcQkYwOaeh1+TMsAZIVOOHYEgi/YvPLSzhlwh4nn96eXnaLkNwdnVnY18LObiPDd gYWtLmHDpso3gFzU+He5jZZS6KH4pR88VvGfDgxCnan0gJu+inJUXKRy36KHCjJP+iSG coXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yl6bstE+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i62si180480oih.41.2020.03.16.08.53.55; Mon, 16 Mar 2020 08:54:07 -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; dkim=pass header.i=@linaro.org header.s=google header.b=yl6bstE+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731873AbgCPPwd (ORCPT + 99 others); Mon, 16 Mar 2020 11:52:33 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:41711 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731618AbgCPPwd (ORCPT ); Mon, 16 Mar 2020 11:52:33 -0400 Received: by mail-wr1-f68.google.com with SMTP id f11so5090892wrp.8 for ; Mon, 16 Mar 2020 08:52:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CQWUEVlXfznSczAKyGpDi3T2t4zubClSxzSzuBgyOmY=; b=yl6bstE+aSegQ4PSIZwfpkI4xv5zEpFCHJTeJOmkwQSJ+I34mLp8AxYTWZ9rJT3sc2 lfVn74R8N/A5/RlriKIwFzgnhIdRpYphZB/RGS2V7TiOu9jBnvyS/vVHkhpcG/UCkclI /Xe8pirR3stVSJMCZatixqgD5qeqsOrizxVPTp5NmPJGHiiNFTlr2SrOO2kgOC4/0W9m TaePqXQ0F0j8GjfwG6eC/pF625lANh0WVdHPpEVzOMwvBPZshj8wKu9LXxVj1/SPB9LL CEn13SHypRSkWd4ThtiGgPM4UZhcVfHP1IHQBtjQSqNt8bUgTV5XgO5/lnNRElqlP+4y Bdeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CQWUEVlXfznSczAKyGpDi3T2t4zubClSxzSzuBgyOmY=; b=b4GhOYmcm1NvUQzVVBkxb2AxoWLguHHxlsXub8zCRH5EL1K6YTFFfnIXna1v/ddS8S H5Uv+XrJrzpOYJpniYPPStJucBBVdRmEy4lj58v3LsKzsEGbAmxF4IiWuxB//pk74c2u NcklAx/cYvuQkfUYuT6Zr+/XtURT83Ecqwj2aqdUa2+JaH7cGTRzS4vLiNaQ7pPfDB5H +W9KeEdsShQmuClBawIPAV8QHeYioMM5hw5vf4shV5G/eUlrPdz+lScQcYCwjp3dF+ao PbollZk6I/h3eT/M7Q+HvQROXZ9dxRYlbV9pKK1EVfYBFYwZW9/nIgwV8iSGpKWqk93P VCDw== X-Gm-Message-State: ANhLgQ15PdStOlK/pD6B/sR051n0QUOpkESxFo7KoTdnizt18TnCsxwN Y27X4xOhGqMMH5m8sq4nuZ2f3w== X-Received: by 2002:adf:f289:: with SMTP id k9mr37838wro.220.1584373951194; Mon, 16 Mar 2020 08:52:31 -0700 (PDT) Received: from myrica ([2001:171b:226b:54a0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id t1sm509263wrq.36.2020.03.16.08.52.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 08:52:30 -0700 (PDT) Date: Mon, 16 Mar 2020 16:52:23 +0100 From: Jean-Philippe Brucker To: Joerg Roedel Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, virtualization@lists.linux-foundation.org, Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Rob Clark , Sean Paul , Will Deacon , Robin Murphy , Matthias Brugger , Thierry Reding , Andy Gross , Bjorn Andersson , Joerg Roedel Subject: Re: [PATCH 13/15] iommu/qcom: Use accessor functions for iommu private data Message-ID: <20200316155223.GM304669@myrica> References: <20200310091229.29830-1-joro@8bytes.org> <20200310091229.29830-14-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200310091229.29830-14-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 10, 2020 at 10:12:27AM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > Make use of dev_iommu_priv_set/get() functions. > > Signed-off-by: Joerg Roedel > --- > drivers/iommu/qcom_iommu.c | 61 ++++++++++++++++++++++---------------- > 1 file changed, 36 insertions(+), 25 deletions(-) > > diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c > index 4328da0b0a9f..80147f82d427 100644 > --- a/drivers/iommu/qcom_iommu.c > +++ b/drivers/iommu/qcom_iommu.c > @@ -74,16 +74,19 @@ static struct qcom_iommu_domain *to_qcom_iommu_domain(struct iommu_domain *dom) > > static const struct iommu_ops qcom_iommu_ops; > > -static struct qcom_iommu_dev * to_iommu(struct iommu_fwspec *fwspec) > +static struct qcom_iommu_dev * to_iommu(struct device *dev) > { > + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); > + > if (!fwspec || fwspec->ops != &qcom_iommu_ops) > return NULL; Following other drivers, I think this test could move to add_device() (and remove_device()?), but this is probably good enough for now. > - return fwspec->iommu_priv; > + > + return dev_iommu_priv_get(dev); > } [...] > static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args) > { > - struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); > struct qcom_iommu_dev *qcom_iommu; > struct platform_device *iommu_pdev; > unsigned asid = args->args[0]; > @@ -583,14 +594,14 @@ static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args) > WARN_ON(asid > qcom_iommu->num_ctxs)) > return -EINVAL; > > - if (!fwspec->iommu_priv) { > - fwspec->iommu_priv = qcom_iommu; > + if (dev_iommu_priv_get(dev)) { Should be: if (!dev_iommu_priv_set(dev)) Thanks, Jean > + dev_iommu_priv_set(dev, qcom_iommu); > } else { > /* make sure devices iommus dt node isn't referring to > * multiple different iommu devices. Multiple context > * banks are ok, but multiple devices are not: > */ > - if (WARN_ON(qcom_iommu != fwspec->iommu_priv)) > + if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev))) > return -EINVAL; > } > > -- > 2.17.1 >