All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Takuo Koguchi <takuo.koguchi@gmail.com>
Cc: lkml@vger.kernel.org, khoroshilov@ispras.ru,
	takuo.koguchi.sw@gmail.com,
	Takuo Koguchi <takuo.koguchi.sw@hitachi.com>,
	Mark Brown <broonie@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: sun4i: disable clocks in the remove function
Date: Wed, 6 Dec 2017 16:20:05 +0100	[thread overview]
Message-ID: <20171206152005.yfbyylu6tbe5gnnv@flea.lan> (raw)
In-Reply-To: <1512573752-13091-1-git-send-email-takuo.koguchi.sw@hitachi.com>

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

Hi,

On Thu, Dec 07, 2017 at 12:22:13AM +0900, Takuo Koguchi wrote:
> mclk and hclk need to be disabled explicitly since pm_runtime_disable does
> not disable the clocks.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Takuo Koguchi <takuo.koguchi.sw@hitachi.com>
> ---
>  drivers/spi/spi-sun4i.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c
> index c5cd635..9011c09 100644
> --- a/drivers/spi/spi-sun4i.c
> +++ b/drivers/spi/spi-sun4i.c
> @@ -525,6 +525,11 @@ static int sun4i_spi_probe(struct platform_device *pdev)
>  
>  static int sun4i_spi_remove(struct platform_device *pdev)
>  {
> +	struct spi_master *master = dev_get_drvdata(&pdev->dev);
> +	struct sun4i_spi *sspi = spi_master_get_devdata(master);
> +
> +	clk_disable_unprepare(sspi->mclk);
> +	clk_disable_unprepare(sspi->hclk);

And that will in turn create an unbalanced disable call if suspend was
called before the remove, which is very likely.

Why are you not calling pm_runtime_force_suspend? How did you test
that patch?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Takuo Koguchi <takuo.koguchi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: lkml-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	khoroshilov-ufN2psIa012HXe+LvDLADg@public.gmane.org,
	takuo.koguchi.sw-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	Takuo Koguchi
	<takuo.koguchi.sw-FCd8Q96Dh0JBDgjK7y7TUQ@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] spi: sun4i: disable clocks in the remove function
Date: Wed, 6 Dec 2017 16:20:05 +0100	[thread overview]
Message-ID: <20171206152005.yfbyylu6tbe5gnnv@flea.lan> (raw)
In-Reply-To: <1512573752-13091-1-git-send-email-takuo.koguchi.sw-FCd8Q96Dh0JBDgjK7y7TUQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]

Hi,

On Thu, Dec 07, 2017 at 12:22:13AM +0900, Takuo Koguchi wrote:
> mclk and hclk need to be disabled explicitly since pm_runtime_disable does
> not disable the clocks.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Takuo Koguchi <takuo.koguchi.sw-FCd8Q96Dh0JBDgjK7y7TUQ@public.gmane.org>
> ---
>  drivers/spi/spi-sun4i.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c
> index c5cd635..9011c09 100644
> --- a/drivers/spi/spi-sun4i.c
> +++ b/drivers/spi/spi-sun4i.c
> @@ -525,6 +525,11 @@ static int sun4i_spi_probe(struct platform_device *pdev)
>  
>  static int sun4i_spi_remove(struct platform_device *pdev)
>  {
> +	struct spi_master *master = dev_get_drvdata(&pdev->dev);
> +	struct sun4i_spi *sspi = spi_master_get_devdata(master);
> +
> +	clk_disable_unprepare(sspi->mclk);
> +	clk_disable_unprepare(sspi->hclk);

And that will in turn create an unbalanced disable call if suspend was
called before the remove, which is very likely.

Why are you not calling pm_runtime_force_suspend? How did you test
that patch?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] spi: sun4i: disable clocks in the remove function
Date: Wed, 6 Dec 2017 16:20:05 +0100	[thread overview]
Message-ID: <20171206152005.yfbyylu6tbe5gnnv@flea.lan> (raw)
In-Reply-To: <1512573752-13091-1-git-send-email-takuo.koguchi.sw@hitachi.com>

Hi,

On Thu, Dec 07, 2017 at 12:22:13AM +0900, Takuo Koguchi wrote:
> mclk and hclk need to be disabled explicitly since pm_runtime_disable does
> not disable the clocks.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Takuo Koguchi <takuo.koguchi.sw@hitachi.com>
> ---
>  drivers/spi/spi-sun4i.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c
> index c5cd635..9011c09 100644
> --- a/drivers/spi/spi-sun4i.c
> +++ b/drivers/spi/spi-sun4i.c
> @@ -525,6 +525,11 @@ static int sun4i_spi_probe(struct platform_device *pdev)
>  
>  static int sun4i_spi_remove(struct platform_device *pdev)
>  {
> +	struct spi_master *master = dev_get_drvdata(&pdev->dev);
> +	struct sun4i_spi *sspi = spi_master_get_devdata(master);
> +
> +	clk_disable_unprepare(sspi->mclk);
> +	clk_disable_unprepare(sspi->hclk);

And that will in turn create an unbalanced disable call if suspend was
called before the remove, which is very likely.

Why are you not calling pm_runtime_force_suspend? How did you test
that patch?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171206/abb6347c/attachment.sig>

  reply	other threads:[~2017-12-06 15:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 15:22 [PATCH] spi: sun4i: disable clocks in the remove function Takuo Koguchi
2017-12-06 15:22 ` Takuo Koguchi
2017-12-06 15:20 ` Maxime Ripard [this message]
2017-12-06 15:20   ` Maxime Ripard
2017-12-06 15:20   ` Maxime Ripard
2017-12-06 18:00   ` Takuo Koguchi
2017-12-06 18:00     ` Takuo Koguchi
2017-12-06 18:00     ` Takuo Koguchi
2017-12-07  7:20   ` [PATCH V3] " Takuo Koguchi
2017-12-07  7:20     ` Takuo Koguchi
2017-12-07  7:20     ` Takuo Koguchi
2017-12-07  9:18     ` Maxime Ripard
2017-12-07  9:18       ` Maxime Ripard
2017-12-07  9:18       ` Maxime Ripard
2017-12-07 11:58     ` Mark Brown
2017-12-07 11:58       ` Mark Brown
2017-12-07 11:58       ` Mark Brown
2017-12-07 12:35     ` Applied "spi: sun4i: disable clocks in the remove function" to the spi tree Mark Brown
2017-12-07 12:35       ` Mark Brown
2017-12-07 12:35       ` Mark Brown

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=20171206152005.yfbyylu6tbe5gnnv@flea.lan \
    --to=maxime.ripard@free-electrons.com \
    --cc=broonie@kernel.org \
    --cc=khoroshilov@ispras.ru \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=lkml@vger.kernel.org \
    --cc=takuo.koguchi.sw@gmail.com \
    --cc=takuo.koguchi.sw@hitachi.com \
    --cc=takuo.koguchi@gmail.com \
    --cc=wens@csie.org \
    /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.