From patchwork Tue Feb 6 07:51:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 197237 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1383042dyb; Mon, 5 Feb 2024 23:53:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IEEChn78xpYkkGwwEUU0pwTi/RFio73lDsIUbiU/LbzxxeWZOZRxZTuhSs3mVZ9ft/wSr+z X-Received: by 2002:a17:902:64c8:b0:1d8:d73b:794f with SMTP id y8-20020a17090264c800b001d8d73b794fmr750572pli.56.1707205999038; Mon, 05 Feb 2024 23:53:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707205999; cv=pass; d=google.com; s=arc-20160816; b=ck0+oDMXEot+ojSvw5JqTxIyu9jxIGbpmwH2KeVvSAOCQsnkg8ZYg5TVym+hWsKXB8 x/xe4cRp/QtTlcRWf7RQIoxivMzv7E9kngvXnBVaTlQDb2sDWIpvlm1BL/gqohbjJNVu iAt9wHL5pBh1yUkK2MYKqotBuOR7MeoYvGQEGE3JB3A2z+Fbty4EbeWjhlTYKuv7zTD4 0sm6obgpQUouQcwuUwOE1Ez3PBtV4F5Ab+CrRwTQFse2nLVMz9dkeRkXrEEQqnD/fM4y OdVRtDDqPtWxFtSeEIhuSY3po8egMDBneoPBw3B+3V7cmaUtymSldtGk6+Pv2QUkGzOS WUCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Re6g7QbwuG7CNxQRWc79B5kKgna8Uj7zWIgOl3cniuA=; fh=F4Z27nolkXSqst4/a3CqgqufIvIsAl58UXB8zOFFTjc=; b=vdW/UwvcX4fcPnhLMcO1D91wmj/tYkhYv0gVQW7jGWUW6WZlGsyN0acFOg/R5SRIZL tVD7m0+mYs7VbYF0+qa7rN0/f9RBoNwBaP6QaFjskHRqBQnDQybgqlls1x3BjNMX8Htm 0yjSb3s63xfAvdgkgTFp5RpOEILTR0B2zBC6xPG+aPBGyfRM2b4aFtc8OA80oL2uhPEu aDrZctQXpLzcwjWcv8w7jYZPv17qRYcM25jnlPsHklklPGOt+9xKmAQpJaiNnuz/dgTB lWL681YN/McY2IS6dYn7SfhCc5oeIHP4E5K/3pzrhiWZCNFWJ45rfCJXjl/1fBBUL0yt avPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b="cw0/9nYB"; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-54441-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54441-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWdk3sd3vweZYOb48uKj6pjpvAGPMtGMNwd7HM6YEwv43iCushUMlZ8rf0LfKCnr6LXvUD9WgsDi232xJzPYqdziEqsdw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b10-20020a170902d88a00b001d9e1ab2acbsi159036plz.356.2024.02.05.23.53.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 23:53:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54441-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b="cw0/9nYB"; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-54441-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54441-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A9847284B29 for ; Tue, 6 Feb 2024 07:53:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B08BE12BF01; Tue, 6 Feb 2024 07:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="cw0/9nYB" Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 053B612B147 for ; Tue, 6 Feb 2024 07:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707205935; cv=none; b=Fmfhi5xCtaLVdAiLEKJwO4W14H2WgngWAhs6WP8n3+wDpUZpkA98M9W3KKiibza4VbeSBKm30v/057txudyPP1c/NRQrOqne8w42CdvSCPbadnOvGmGkavmsOimQ0z4ZNKXRGK+BPbbNqONLGhkRM/FAySmCpouXVs5k9tsMHww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707205935; c=relaxed/simple; bh=iY4Nq0gmeNoMpaiXAPg8UyiEeagDbHOfI4LQk9pKbUk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=i5aEYWlwvebMi6JD5kjEfLCK8er9J2gPqV/kcUStvV82pkAkE7X6SPuRm+y7BtIodAnUp2VPu0a/MR6FECgiXal9fg1GeG681D5A5K4Bi/daLNY5KKno0LFURaDgmdqPrOL1gwrQQyBCEa6vWlEfsOLHp7s7TuT6Od/PJYGKtRw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=cw0/9nYB; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-40fc22f372cso41241715e9.1 for ; Mon, 05 Feb 2024 23:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1707205931; x=1707810731; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Re6g7QbwuG7CNxQRWc79B5kKgna8Uj7zWIgOl3cniuA=; b=cw0/9nYB6Rfto3zX2hu8hJXLdICVs2i/t5e6PmwC7rJJX4kyZMOenC/u3NTw3TXmzd 2Fo9coEi9cQtnsdW7dY13PVyjJ8ldEdkAK+JKVZECBJ4nm4TA8AykNe9nuFnu2JPKzDh KCJgMTAPfM1Bps+fWP5li08CY3EJhlxNYMLMf34254PWo2DqY4NmKkAHGyfNVONLIY/b hblMY6LMwN+smpMuHNySVMpxEUz/PWAZ2j6WU0SsdeqXz+W/bWTVIlMQz9cNRtA1NHOQ fL9MXWZumfzMyz8nx3qyEYPlArgQ/aVt0wUHfXnYOLn3xH6if5uFyM/iTb5G5dK46/+K ExMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707205931; x=1707810731; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Re6g7QbwuG7CNxQRWc79B5kKgna8Uj7zWIgOl3cniuA=; b=dliq5gNYIuSU8IUW+nV3PswznVrW87lv2GdSQLWwEh6Ax6SWkD3nDtXzAF5RVqPV7P n6QunsbKo/DUH2QAa134GtK+fDUN54dCgsC9VfhjYBwdiM0GiIUG0N5wgNj7p1HWgYfr RjmtLOrhLAVQ2N9Bmy98TDYGikH+5i481OQASt0BhW29h6v6wtWanHmuRKJ7EXHQys/x 1OGNVVuF4KO9pFS9KvGBor2EMlen8XwXZsdXGLsNuY4A9GeADVKkttZmGWjHZULdYfpW SF1TPSncJkunvpNbzXXbhhtkzfwjvOvFI/CtOkQwhbq+Lpx/3K8T0CQbxfeKQ1PmrWUD Jl9w== X-Gm-Message-State: AOJu0YwU2f+f3dsV8HseSIj8799hcw0hn2t3rCJFqcOHyAnTg5afvZ79 S6uE2PbAVk2TkPsCNHMfGW6mUGoNDWcewBkVDf6hZth97v4GrRQpkpz4fF4g/b0= X-Received: by 2002:a05:600c:3c97:b0:40f:cb0d:a44e with SMTP id bg23-20020a05600c3c9700b0040fcb0da44emr1034104wmb.9.1707205931238; Mon, 05 Feb 2024 23:52:11 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWoSIcqKjoanSWxwphMlxu7ln46eqk3ZHWmxw5kPc0ytMMrDj+G1cvjlpMW2WUZIONlpZR/K/et1+AFj2qjFc/eQgpImL6b+QnuA5cEKWB3RctoRIxxIOx3UrwqWVuwS26Q727uwOtVH4iYXd7VLVpcBuOp+z+nN00Veb74MnqJr7BybLLxb3vloETJMbb6R/lkqxQnMD6fqFsyCDNGMi0TmIHCAeW7G66sXigDahSIEaDE5zLLA1/LxpQs6s5sQL2+5Vjx+Kb1yLmUCSOgLBBwUldO7EgcCA8/qBXoQtuqlIqTnqpr9VT+yPNkKRhoXZrfMKpSa85WMZ0gx8crtbT4ZazCl91bh+MN3ofHl4xpc4ZCA3ndyHBEsHy9bKHpWgV36hoKI6kRukQmDmZSBCadvVFaI0rG4ZPJq1J6ckY++80T1RSlPC9XT5FDL0mLMOh4O5IKyr6MnvvdWHtvLM/O0d/gkLslCzdMizm8osF9ApW3CYmJ1GpBzGMtIUoZm/zGjpPLLicpYQ== Received: from claudiu-X670E-Pro-RS.. ([82.78.167.154]) by smtp.gmail.com with ESMTPSA id j32-20020a05600c1c2000b0040fbad272f6sm1106843wms.46.2024.02.05.23.52.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 23:52:10 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: wim@linux-watchdog.org, linux@roeck-us.net, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, p.zabel@pengutronix.de, geert+renesas@glider.be, magnus.damm@gmail.com, biju.das.jz@bp.renesas.com Cc: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v4 3/9] watchdog: rzg2l_wdt: Use pm_runtime_resume_and_get() Date: Tue, 6 Feb 2024 09:51:43 +0200 Message-Id: <20240206075149.864996-4-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240206075149.864996-1-claudiu.beznea.uj@bp.renesas.com> References: <20240206075149.864996-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790135237509820264 X-GMAIL-MSGID: 1790135237509820264 From: Claudiu Beznea 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 --- Changes in v4: - none Changes in v3: - none Changes in v2: - propagate the return code of rzg2l_wdt_start() to it's callers 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 1741f98ca67c..d87d4f50180c 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,