Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2742664ybh; Mon, 16 Mar 2020 08:52:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtQAajsiMGq557+l0VbA9umTQIDe7tOp5CUH3m0juUHXSkXhGjtcynikx9s4rSQmGu+N3mG X-Received: by 2002:a05:6830:4008:: with SMTP id h8mr3800142ots.295.1584373933036; Mon, 16 Mar 2020 08:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584373933; cv=none; d=google.com; s=arc-20160816; b=flC/Jexi4/qip/81ZxwJeDvAqyDOfdWyFjMs/HTgFvU9Z387E1rsKTOwtD+NnjjIZ9 gU0h2bFXHILQq3c7CKXwhUS5SxG0ObVgJC/M4u2eEPU/nQMp8tAEa0S3+L6HZz+KgKvy CLFuEd2cGd/oZadKn3uvEDItJSpgwLNmhWUq/29stpD+xIK3kyOa4OtZ/vwcsc2Gs4VO WUWyWvxM4UmVqoL8OY69huL4+Bcp/Fw+ggGhc0jaYDmasMBTWwhG+EJKIcVaFgV0Exrj V4c/8OnOb7jDQ4WkRLvzE5yoJW2ZebGzqQ1wuLD5mpBJKZaIuAtw0Iy1hThbOYO+2kGz iVTg== 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=ppucAR3jBSlUx3f6FMEJLnESjyE6tqFd9bVOCG9Ch70=; b=Br943L/VY4EJimTo6aJhh2ZXneD5NouFc5rw2ms4F5QjL1O03m5pUuES/d96C57aSc sNz5PuhuHGzfrzyk5mT0Y/NAKUFF/14xXyxLrhFqQYJFdPBsLIpJ+x2K4HZLhHsBdKqx Tnz7eggVWwZAUs3ZoF7HYG/BalvcpC/MHHM4kT9gkMca43hMxy/UpX0Vian/qgnN1Odc p7IpQB1qA7xEh+zHDuJDqqHNWpVWssGkHB+/OA1nS2bmy0pqZmJQoz98rRwqY62i8lSv Az6wVQZklEP8uaNn3DFJeMx4ptJ93sAVpHGYb2Y0q75wTZ2BosDnoTHuPR6Ne2P6D3su L9mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KWi+mz5M; 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 t18si157914otq.105.2020.03.16.08.52.00; Mon, 16 Mar 2020 08:52:13 -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=KWi+mz5M; 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 S1732011AbgCPPui (ORCPT + 99 others); Mon, 16 Mar 2020 11:50:38 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33561 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731890AbgCPPuh (ORCPT ); Mon, 16 Mar 2020 11:50:37 -0400 Received: by mail-wr1-f68.google.com with SMTP id a25so21873051wrd.0 for ; Mon, 16 Mar 2020 08:50:36 -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=ppucAR3jBSlUx3f6FMEJLnESjyE6tqFd9bVOCG9Ch70=; b=KWi+mz5Ml7txmdoZr19aVQmfuq4pxYfgRps9r2wW5ZsBdqZUhieYBFFgGOjP2Y6bx4 Wyhz0sJVzU+ttJVQaciTpiR1C0VRxuyTIVO+dc22nAk47TiATbV0DDmHWZKNHrvm2d4C vUaa0hW1YGFbvsd4Uq2C+TXdm+UshPrNCJCR7kDzhdknhAK2c/faq2qcpOcTCILD4e73 SanxGSnN9MZ59DsdmAjiBTz1XxdiLtNTzfhIHxG2HnSi1v3DnTsQ2LGv/Q8k3NkWXNkz QoSGyKn9pcROOSXjXbika5mVnv89BwzwPk4bOrNqAP29KhbsRRP7ajNL8l0XJVmaY1q3 +MfQ== 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=ppucAR3jBSlUx3f6FMEJLnESjyE6tqFd9bVOCG9Ch70=; b=hHICkm4ysKVHE82x88fMf3nBwIz/aM62heUJnS4LpM6IbnhaQb5hqZa3hM+VdOnPD8 Z68snaURYWpSaczGsjFAbNfKT/OPUZdE4sgcGuYg/DDn+FcJGec7Nfg8c7ICYbJIElXK alMYaFrqMCNmzekAJvzOZwsCkrSRuuSVvrmmNYa2AlJ1tZ9CNTeJheKz0fdsogwAh82H 6iMcsPek2KhDcvJjqnjF6+iePx0SUpx4vHjtOZmsUs0/z2MiGmWRORxO7WjINHyBiVw6 1E5xerRk2/K8yTF/8vkt3SsNyX/h3woXYYvngUajHrI8B/7kyJwz0MOj+2yQ6LpdlZsu Hc3w== X-Gm-Message-State: ANhLgQ0pMHJwkxTBsNjqT3Me8CS4j8mYBrQVffd01bfp2gDlWvVr1h1j wLfH62W+Pp6i5dCqzG++tL1Yjg== X-Received: by 2002:adf:dfc1:: with SMTP id q1mr43953wrn.62.1584373836280; Mon, 16 Mar 2020 08:50:36 -0700 (PDT) Received: from myrica ([2001:171b:226b:54a0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id p16sm147962wmg.22.2020.03.16.08.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 08:50:35 -0700 (PDT) Date: Mon, 16 Mar 2020 16:50:28 +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 11/15] iommu/renesas: Use accessor functions for iommu private data Message-ID: <20200316155028.GK304669@myrica> References: <20200310091229.29830-1-joro@8bytes.org> <20200310091229.29830-12-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200310091229.29830-12-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:25AM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > Make use of dev_iommu_priv_set/get() functions. > > Signed-off-by: Joerg Roedel > --- > drivers/iommu/ipmmu-vmsa.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c > index ecb3f9464dd5..310cf09feea3 100644 > --- a/drivers/iommu/ipmmu-vmsa.c > +++ b/drivers/iommu/ipmmu-vmsa.c > @@ -89,9 +89,7 @@ static struct ipmmu_vmsa_domain *to_vmsa_domain(struct iommu_domain *dom) > > static struct ipmmu_vmsa_device *to_ipmmu(struct device *dev) > { > - struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); > - > - return fwspec ? fwspec->iommu_priv : NULL; > + return dev_iommu_priv_get(dev); The removal of the fwspec NULL check was worrying me a little. Now any user of to_ipmmu() directly dereferences dev->iommu->priv where they previously tested first whether dev->fwspec was set. But I didn't find anything that could go wrong, and the resulting code looks better. Reviewed-by: Jean-Philippe Brucker > } > > #define TLB_LOOP_TIMEOUT 100 /* 100us */ > @@ -727,14 +725,13 @@ static phys_addr_t ipmmu_iova_to_phys(struct iommu_domain *io_domain, > static int ipmmu_init_platform_device(struct device *dev, > struct of_phandle_args *args) > { > - struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); > struct platform_device *ipmmu_pdev; > > ipmmu_pdev = of_find_device_by_node(args->np); > if (!ipmmu_pdev) > return -ENODEV; > > - fwspec->iommu_priv = platform_get_drvdata(ipmmu_pdev); > + dev_iommu_priv_set(dev, platform_get_drvdata(ipmmu_pdev)); > > return 0; > } > -- > 2.17.1 >