From: wqyoung <quanyang.wang@windriver.com>
To: Dinghao Liu <dinghao.liu@zju.edu.cn>
Cc: kjlu@umn.edu, Mark Brown <broonie@kernel.org>,
Michal Simek <michal.simek@xilinx.com>,
linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [v2] spi: spi-zynqmp-gqspi: Fix runtime PM imbalance in zynqmp_qspi_probe
Date: Thu, 15 Apr 2021 09:21:58 +0800 [thread overview]
Message-ID: <20210415012158.GA2465158@pek-qwang2-d1> (raw)
In-Reply-To: <20210412073154.25011-1-dinghao.liu@zju.edu.cn>
Hi Dinghao,
On Mon, Apr 12, 2021 at 03:31:54PM +0800, Dinghao Liu wrote:
> There is a PM usage counter decrement after zynqmp_qspi_init_hw()
> without any refcount increment, which leads to refcount leak.Add
> a refcount increment to balance the refcount. Also set
> auto_runtime_pm to resume suspended spi controller.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
> changelog:
>
> v2: - Add a refcount increment to fix refcout leak instead of the
> refcount decrement on error.
> Set ctlr->auto_runtime_pm = true.
> ---
> drivers/spi/spi-zynqmp-gqspi.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c
> index c8fa6ee18ae7..8b21c7b0e7eb 100644
> --- a/drivers/spi/spi-zynqmp-gqspi.c
> +++ b/drivers/spi/spi-zynqmp-gqspi.c
> @@ -1160,6 +1160,7 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
> pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
> pm_runtime_set_active(&pdev->dev);
> pm_runtime_enable(&pdev->dev);
> + pm_runtime_get_sync(&pdev->dev);
Please check the return value here, if ret is "< 0", goto error label,
and a pm_runtime_put_sync is needed in error label
> /* QSPI controller initializations */
> zynqmp_qspi_init_hw(xqspi);
>
> @@ -1187,6 +1188,7 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
> ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_RX_DUAL | SPI_RX_QUAD |
> SPI_TX_DUAL | SPI_TX_QUAD;
> ctlr->dev.of_node = np;
> + ctlr->auto_runtime_pm = true;
>
> ret = devm_spi_register_controller(&pdev->dev, ctlr);
> if (ret) {
These 2 function
pm_runtime_mark_last_busy(&pdev->dev);
pm_runtime_put_autosuspend(&pdev->dev);
are the last operations in probe function since if they runs,
spi_controller will enter suspend state and disable clks after 3s
passing. So please move them just before "return 0".
And would you please cc me when you send V3? I am preparing to send a patch series
to fix clk and suspend/resume issues which bases on the pm_runtime issue.
Thanks,
Quanyang
> --
> 2.17.1
>
next prev parent reply other threads:[~2021-04-15 1:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-12 7:31 [PATCH] [v2] spi: spi-zynqmp-gqspi: Fix runtime PM imbalance in zynqmp_qspi_probe Dinghao Liu
2021-04-15 1:21 ` wqyoung [this message]
2021-04-15 5:27 ` dinghao.liu
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=20210415012158.GA2465158@pek-qwang2-d1 \
--to=quanyang.wang@windriver.com \
--cc=broonie@kernel.org \
--cc=dinghao.liu@zju.edu.cn \
--cc=kjlu@umn.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=michal.simek@xilinx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).