All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolin Chen <nicoleotsuka@gmail.com>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: thierry.reding@gmail.com, joro@8bytes.org, vdumpa@nvidia.com,
	jonathanh@nvidia.com, linux-tegra@vger.kernel.org,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iommu/tegra-smmu: Expend mutex protection range
Date: Mon, 28 Sep 2020 18:15:57 -0700	[thread overview]
Message-ID: <20200929011557.GA905@Asurada-Nvidia> (raw)
In-Reply-To: <692b51fa-7a3e-dee7-b628-7cb2d2dc188d@gmail.com>

On Tue, Sep 29, 2020 at 03:17:58AM +0300, Dmitry Osipenko wrote:
> ...
> >  static bool tegra_smmu_capable(enum iommu_cap cap)
> > @@ -420,17 +413,21 @@ static int tegra_smmu_as_prepare(struct tegra_smmu *smmu,
> >  				 struct tegra_smmu_as *as)
> >  {
> >  	u32 value;
> > -	int err;
> > +	int err = 0;
> > +
> > +	mutex_lock(&smmu->lock);
> >  
> >  	if (as->use_count > 0) {
> >  		as->use_count++;
> > -		return 0;
> > +		goto err_unlock;
> 
> This looks a bit odd because it's not a error condition. Perhaps should
> be better to "goto bump_usecount"?
> 
> Or make it similar to tegra_smmu_as_unprepare()?

Hmm...I think it's simple to just make it "goto unlock" then.

WARNING: multiple messages have this Message-ID (diff)
From: Nicolin Chen <nicoleotsuka@gmail.com>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	jonathanh@nvidia.com, thierry.reding@gmail.com,
	linux-tegra@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iommu/tegra-smmu: Expend mutex protection range
Date: Mon, 28 Sep 2020 18:15:57 -0700	[thread overview]
Message-ID: <20200929011557.GA905@Asurada-Nvidia> (raw)
In-Reply-To: <692b51fa-7a3e-dee7-b628-7cb2d2dc188d@gmail.com>

On Tue, Sep 29, 2020 at 03:17:58AM +0300, Dmitry Osipenko wrote:
> ...
> >  static bool tegra_smmu_capable(enum iommu_cap cap)
> > @@ -420,17 +413,21 @@ static int tegra_smmu_as_prepare(struct tegra_smmu *smmu,
> >  				 struct tegra_smmu_as *as)
> >  {
> >  	u32 value;
> > -	int err;
> > +	int err = 0;
> > +
> > +	mutex_lock(&smmu->lock);
> >  
> >  	if (as->use_count > 0) {
> >  		as->use_count++;
> > -		return 0;
> > +		goto err_unlock;
> 
> This looks a bit odd because it's not a error condition. Perhaps should
> be better to "goto bump_usecount"?
> 
> Or make it similar to tegra_smmu_as_unprepare()?

Hmm...I think it's simple to just make it "goto unlock" then.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-09-29  1:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 23:58 [PATCH v2 0/2] iommu/tegra-smmu: Two followup changes Nicolin Chen
2020-09-28 23:58 ` Nicolin Chen
2020-09-28 23:59 ` [PATCH v2 1/2] iommu/tegra-smmu: Unwrap tegra_smmu_group_get Nicolin Chen
2020-09-28 23:59   ` Nicolin Chen
2020-09-28 23:59 ` [PATCH v2 2/2] iommu/tegra-smmu: Expend mutex protection range Nicolin Chen
2020-09-28 23:59   ` Nicolin Chen
2020-09-29  0:17   ` Dmitry Osipenko
2020-09-29  0:17     ` Dmitry Osipenko
2020-09-29  1:15     ` Nicolin Chen [this message]
2020-09-29  1:15       ` Nicolin Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200929011557.GA905@Asurada-Nvidia \
    --to=nicoleotsuka@gmail.com \
    --cc=digetx@gmail.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=vdumpa@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.