From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C93BBC433ED for ; Thu, 15 Apr 2021 05:30:10 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 785576115C for ; Thu, 15 Apr 2021 05:30:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 785576115C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zju.edu.cn Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=o1UR0rqCSTF8esunPoe+kqUbjVV5hwMuIaABOzaPfQs=; b=hs3vuYbhlHyOfVPOrmcPWOkOO 6yWbKCXijGV5ECEPfwPdVl07Bi7phg3VKPNSOmH0sTiXd66Iw8PluAxlJuGkkMZgM3zbFjw1vDch9 epxxR3L67zew/od4g/uOAz4UOC4WeYquNsk5fKQgcNoSf/+K07SVcC+FtpON6+sI5ABNjC28fvh47 WA9aJFQ4K0hUWsqIIbt6Jb4ufOI4ZZaLcR3Rx+LNav+BeUAFEGjSKZP8cbssLY+ZwQatwwGOfwl9j YCDQNoqKZhi5cTG9aPcaU6jqtjlGn1PUy5/umQcsVT1TKuW1Xez1C6ZTcztABVoAOtV/Uo0zErw+8 Y2sB/j/hA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWuXY-00EuCi-4S; Thu, 15 Apr 2021 05:27:44 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWuXS-00EuBM-6E for linux-arm-kernel@desiato.infradead.org; Thu, 15 Apr 2021 05:27:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=zl3K1Wl85GAb6bsqNH3jN3HZnG3ulA+relossH4xu5o=; b=Dj2jWcLl9BPt59DZu1IV9/xriQ PxIf9V8U4aHlVSbMLnLBr+nxMVWNSxkB9cqlqdtOrF4c743ikDW0fRo268S0Sm1T52lp5lZoZKslY cc3EGCqk/C6iTkwuxXV8YzYYpeiFT+YdPmfTEqRdT5zmQbuNbrApm5xczAcs8SVUg/g8oGx2vDRZh 0bfH82w9WHlmkgbZFHzPAx5DJOfJdzAA8JoOzq8QqkIp2nqVSjyE/RusU9JmRbd3e86VljKA2+L7C ncrzVkLDV6m6p2yj6Silcr1NwDSdC+htw/WVL3FfFyxM2bwnCk4biEcUhlwHbqwhpSdYyWoSCNvHg Ijf6xbwg==; Received: from mail.zju.edu.cn ([61.164.42.155] helo=zju.edu.cn) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWuXM-008HSM-AA for linux-arm-kernel@lists.infradead.org; Thu, 15 Apr 2021 05:27:34 +0000 Received: by ajax-webmail-mail-app3 (Coremail) ; Thu, 15 Apr 2021 13:27:22 +0800 (GMT+08:00) X-Originating-IP: [222.205.72.8] Date: Thu, 15 Apr 2021 13:27:22 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: dinghao.liu@zju.edu.cn To: wqyoung Cc: kjlu@umn.edu, "Mark Brown" , "Michal Simek" , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: Re: [PATCH] [v2] spi: spi-zynqmp-gqspi: Fix runtime PM imbalance in zynqmp_qspi_probe X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT5.0.13 build 20210104(ab8c30b6) Copyright (c) 2002-2021 www.mailtech.cn zju.edu.cn In-Reply-To: <20210415012158.GA2465158@pek-qwang2-d1> References: <20210412073154.25011-1-dinghao.liu@zju.edu.cn> <20210415012158.GA2465158@pek-qwang2-d1> MIME-Version: 1.0 Message-ID: <7b720ae6.58927.178d3ff88f3.Coremail.dinghao.liu@zju.edu.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: cC_KCgC3nz66zndgCbQmAQ--.40483W X-CM-SenderInfo: qrrzjiaqtzq6lmxovvfxof0/1tbiAgwNBlZdtTXCvwAIs7 X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210414_222732_647761_08FC4C23 X-CRM114-Status: GOOD ( 20.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > 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 > > --- > > 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 for your advice and I will send a new patch soon. Regards, Dinghao _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel