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 45EA6187FF6; Tue, 30 Jul 2024 17:30:02 +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=1722360602; cv=none; b=NNXKGE2U0HV6hdZxrlBXmhcIPYICx0P8O0zBHJ8XrRmPMMikS1DwuPfa0HEapkOMucMuY5sDARro9A1xlQPYbiLoJYbfW3voX8Q3wkJ6XguHMkU3+FTdcacuho/c1cmbpeT9XMEqB7y0+H433brm1hVVldQ7Kx3z/z7ypVCW5IE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722360602; c=relaxed/simple; bh=f5gJjUNPy0uwBQnkZd71nqYEncREi3l0yvLhzEW/UJ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mlDQWlq4rb47KDAUFQGiyL/Jar3xFx8JmJNT/yS9ekjUAnwMuJK0IXvbd30UxW1MF8Fl5JTGoGCPcTbf7zHPEOK6mX7CMrI+BMw9WP0M9tYIrz7cefyd+/hgoJGg6NoopL4Z7Mn+3bVBdOCibPqRXswpLI8xDTz9dy4kpbkPNs8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bsf7mTX/; 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="bsf7mTX/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBD64C32782; Tue, 30 Jul 2024 17:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722360602; bh=f5gJjUNPy0uwBQnkZd71nqYEncREi3l0yvLhzEW/UJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bsf7mTX/i83xyjz5PUUWlJZjk6hA1YZQ8lyOoUPrioHuSzgsQrNB7mAqor11xyDnA Wqfnv3LQ899w9dMxaPQNJziXg4H+rC7NlEuU3wtqH8QBll6brMAztyjvJzgqOVIV0a KbEkeVHrKqHr5XTm+Y9UkU3wDCW6wwbhVpE1Do54= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Claudiu Beznea , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 6.10 749/809] watchdog: rzg2l_wdt: Use pm_runtime_resume_and_get() Date: Tue, 30 Jul 2024 17:50:25 +0200 Message-ID: <20240730151754.542674767@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730151724.637682316@linuxfoundation.org> References: <20240730151724.637682316@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.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Claudiu Beznea [ Upstream commit f0ba0fcdd19943809b1a7f760f77f6673c6aa7f7 ] pm_runtime_get_sync() may return with error. In case it returns with error dev->power.usage_count needs to be decremented. pm_runtime_resume_and_get() takes care of this. Thus use it. Along with it the rzg2l_wdt_set_timeout() function was updated to propagate the result of rzg2l_wdt_start() to its caller. Fixes: 2cbc5cd0b55f ("watchdog: Add Watchdog Timer driver for RZ/G2L") Signed-off-by: Claudiu Beznea Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20240531065723.1085423-4-claudiu.beznea.uj@bp.renesas.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/rzg2l_wdt.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c index 1741f98ca67c5..d87d4f50180c5 100644 --- a/drivers/watchdog/rzg2l_wdt.c +++ b/drivers/watchdog/rzg2l_wdt.c @@ -123,8 +123,11 @@ static void rzg2l_wdt_init_timeout(struct watchdog_device *wdev) static int rzg2l_wdt_start(struct watchdog_device *wdev) { struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); + int ret; - pm_runtime_get_sync(wdev->parent); + ret = pm_runtime_resume_and_get(wdev->parent); + if (ret) + return ret; /* Initialize time out */ rzg2l_wdt_init_timeout(wdev); @@ -150,6 +153,8 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev) static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int timeout) { + int ret = 0; + wdev->timeout = timeout; /* @@ -159,10 +164,10 @@ static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int time */ if (watchdog_active(wdev)) { rzg2l_wdt_stop(wdev); - rzg2l_wdt_start(wdev); + ret = rzg2l_wdt_start(wdev); } - return 0; + return ret; } static int rzg2l_wdt_restart(struct watchdog_device *wdev, -- 2.43.0