All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Baolin Wang <baolin.wang@linaro.org>
Cc: ohad@wizery.com, broonie@kernel.org, linux-spi@vger.kernel.org,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/8] hwspinlock: sprd: Use devm_hwspin_lock_register()
Date: Tue, 26 Jun 2018 13:51:38 -0700	[thread overview]
Message-ID: <20180626205138.GF3206@builder> (raw)
In-Reply-To: <e5f5f315a882fe5cdd161c8cb1790c9f3de0920a.1529654288.git.baolin.wang@linaro.org>

On Fri 22 Jun 01:09 PDT 2018, Baolin Wang wrote:

> Use devm_hwspin_lock_register() to register the hwlock controller to
> avoid unregistering the device explicitly.
> 
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> ---
>  drivers/hwspinlock/sprd_hwspinlock.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c
> index dc42bf5..ba5daf6 100644
> --- a/drivers/hwspinlock/sprd_hwspinlock.c
> +++ b/drivers/hwspinlock/sprd_hwspinlock.c
> @@ -120,8 +120,9 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, sprd_hwlock);
>  	pm_runtime_enable(&pdev->dev);
>  
> -	ret = hwspin_lock_register(&sprd_hwlock->bank, &pdev->dev,
> -				   &sprd_hwspinlock_ops, 0, SPRD_HWLOCKS_NUM);
> +	ret = devm_hwspin_lock_register(&pdev->dev, &sprd_hwlock->bank,
> +					&sprd_hwspinlock_ops, 0,
> +					SPRD_HWLOCKS_NUM);
>  	if (ret) {
>  		pm_runtime_disable(&pdev->dev);
>  		clk_disable_unprepare(sprd_hwlock->clk);
> @@ -135,7 +136,6 @@ static int sprd_hwspinlock_remove(struct platform_device *pdev)
>  {
>  	struct sprd_hwspinlock_dev *sprd_hwlock = platform_get_drvdata(pdev);
>  
> -	hwspin_lock_unregister(&sprd_hwlock->bank);

Until the hwspinlock is unregistered it's possible for clients to issue
operations on it, so disabling power and clocks before that seems bad.

Regards,
Bjorn

>  	pm_runtime_disable(&pdev->dev);
>  	clk_disable_unprepare(sprd_hwlock->clk);
>  	return 0;
> -- 
> 1.7.9.5
> 

  reply	other threads:[~2018-06-26 20:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22  8:08 [PATCH 1/8] hwspinlock: Add one new API to support getting a specific hwlock by the name Baolin Wang
2018-06-22  8:08 ` [PATCH 2/8] hwspinlock: Add devm_xxx() APIs to request/free hwlock Baolin Wang
2018-06-22  8:09 ` [PATCH 3/8] hwspinlock: Add devm_xxx() APIs to register/unregister one hwlock controller Baolin Wang
2018-06-22  8:09 ` [PATCH 4/8] hwspinlock: Remove redundant config Baolin Wang
2018-06-22  8:09 ` [PATCH 5/8] hwspinlock: Fix one comment mistake Baolin Wang
2018-06-22  8:09 ` [PATCH 6/8] hwspinlock: sprd: Use devm_hwspin_lock_register() Baolin Wang
2018-06-26 20:51   ` Bjorn Andersson [this message]
2018-06-27  2:17     ` Baolin Wang
2018-06-22  8:09 ` [PATCH 7/8] spi: sprd: Replace of_hwspin_lock_get_id() with of_hwspin_lock_get_id_byname() Baolin Wang
2018-06-25 12:47   ` Mark Brown
2018-06-22  8:09 ` [PATCH 8/8] spi: sprd: Change to use devm_hwspin_lock_request_specific() Baolin Wang
2018-06-25 12:47   ` Mark Brown
2018-06-26 20:54 ` [PATCH 1/8] hwspinlock: Add one new API to support getting a specific hwlock by the name Bjorn Andersson
2018-06-26 20:54   ` Bjorn Andersson
2018-06-27  2:18   ` Baolin Wang

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=20180626205138.GF3206@builder \
    --to=bjorn.andersson@linaro.org \
    --cc=baolin.wang@linaro.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=ohad@wizery.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.