From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 083EC64CDA; Tue, 23 Jan 2024 00:55:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705971322; cv=none; b=pXKeuJNXCstL30lCNwHtTe5XEwZzpm/82Dy+6GZ+Jxj2e8DXNYYL59HaWzF/9IFuBbdpCrtwmJl1K1JVEJhLACvznihTxSksgHJ4kZQeQzViBYNrWXq5Fo/kryGawQSwQFtkWfchsfPZrB9Xdb6cmGvBwpVpDwcIraa/mOvfeFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705971322; c=relaxed/simple; bh=PY7Bh2i5rQQmkGrPalTjXnshcsSNiFagHDF0hn1Y2R8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qL4jjJbU3eYsb6rVPKbqjL2ZBwOdTlEHEL3E8TYtGB8+2NKRoc0afxwzNxzD0xO6HY015XeWCB8R2QuDm31v9yO0om7B/LPySPT05fLNi1BAg2P1DyOrrEI1sYj25uB1PU2T4bbxHBGCdVSJKD3AKDAQlYK3MIrJeJHKdaJG4Hg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hZqaSDZd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="hZqaSDZd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54C45C43390; Tue, 23 Jan 2024 00:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705971320; bh=PY7Bh2i5rQQmkGrPalTjXnshcsSNiFagHDF0hn1Y2R8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZqaSDZdEQbWrf0dr91mLmU1GMOVr5dDpZQTEv7Y70rXpMOmUcOaWcZlwsmG0Tw9o Ga5rG3OcKjaH8ixGh3KscqmpHxLsFuXYEKmXIm8Pi/SahYnFz2dn/MdbuXFej+boSB Au8pCCmUYzh0ti+ek0MPEeVouaOcAnIipWBmVoVc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vignesh Raghavendra , Manorit Chawdhry , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 6.1 223/417] watchdog: rti_wdt: Drop runtime pm reference count when watchdog is unused Date: Mon, 22 Jan 2024 15:56:31 -0800 Message-ID: <20240122235759.640901125@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235751.480367507@linuxfoundation.org> References: <20240122235751.480367507@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vignesh Raghavendra [ Upstream commit c1a6edf3b541e44e78f10bc6024df779715723f1 ] Call runtime_pm_put*() if watchdog is not already started during probe and re enable it in watchdog start as required. On K3 SoCs, watchdogs and their corresponding CPUs are under same power-domain, so if the reference count of unused watchdogs aren't dropped, it will lead to CPU hotplug failures as Device Management firmware won't allow to turn off the power-domain due to dangling reference count. Fixes: 2d63908bdbfb ("watchdog: Add K3 RTI watchdog support") Signed-off-by: Vignesh Raghavendra Tested-by: Manorit Chawdhry Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20231213140110.938129-1-vigneshr@ti.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/rti_wdt.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c index 6e9253761fc1..ea617c0f9747 100644 --- a/drivers/watchdog/rti_wdt.c +++ b/drivers/watchdog/rti_wdt.c @@ -70,6 +70,11 @@ static int rti_wdt_start(struct watchdog_device *wdd) { u32 timer_margin; struct rti_wdt_device *wdt = watchdog_get_drvdata(wdd); + int ret; + + ret = pm_runtime_resume_and_get(wdd->parent); + if (ret) + return ret; /* set timeout period */ timer_margin = (u64)wdd->timeout * wdt->freq; @@ -295,6 +300,9 @@ static int rti_wdt_probe(struct platform_device *pdev) if (last_ping) watchdog_set_last_hw_keepalive(wdd, last_ping); + if (!watchdog_hw_running(wdd)) + pm_runtime_put_sync(&pdev->dev); + return 0; err_iomap: @@ -309,7 +317,10 @@ static int rti_wdt_remove(struct platform_device *pdev) struct rti_wdt_device *wdt = platform_get_drvdata(pdev); watchdog_unregister_device(&wdt->wdd); - pm_runtime_put(&pdev->dev); + + if (!pm_runtime_suspended(&pdev->dev)) + pm_runtime_put(&pdev->dev); + pm_runtime_disable(&pdev->dev); return 0; -- 2.43.0