From patchwork Wed Feb 28 08:32:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 207701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3210049dyb; Wed, 28 Feb 2024 00:34:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV7eSVVMiB4zup3O0Em+QMPdQQXG4AVgh3pwVdxy4uM6Ot1C+LYs2ABOF4yvjOl05Hjk5IvezLJ6VMDrbMZb90alzh6fg== X-Google-Smtp-Source: AGHT+IHtyywx93C2qK+OrI7plTt4t/579SwqU0QFmsJqctiNrkx02aPxanpqcnYYSe8pXuvhAN7P X-Received: by 2002:a05:6214:19e5:b0:68f:9ec7:2afb with SMTP id q5-20020a05621419e500b0068f9ec72afbmr5138279qvc.0.1709109276586; Wed, 28 Feb 2024 00:34:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709109276; cv=pass; d=google.com; s=arc-20160816; b=JVkKmWfFuWVKqpO45MT5dmOcvmNIiC6SWWXqxOtyNDzuto3sTf+RM86MVIJCtfSkWG XP9nxL7UegfeMNsJP/tFAzmn+ba8kNyvhZIreJ3dN1w/R3bu9iU0ER2i2lKADy3lzIAL Ij8jneXmUs26gl9YVns6FyL1JXD8GvCtpMGOnq5sdy6FnxukP3Wassy8Ro43xwGKzFqi plAAxDz64tuwYtOcWm94VaqYDGrcKJRO7BG3qWGSbVE/798e14hVw8DMGQLEmWUBRIFq NaGjuIiuLVG79UMZdegbYD7mpngWlTG0Z6riMA1N6NEqAgarOP9aWwL3oVVN597+wngb i3CA== 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=EJkLrfz+B+TwXIL3E5Ouq4pIOb3ww8iGVXCK/i9BddI=; fh=b4RxlZ2qivTULM4Rz170YmzY2AaDA0XgV10b1FGNjlM=; b=YYsGzwH9R2OLSBtyXMk4saCFLcz3cINqIxE6Fs2WUun5mLBUGq9ss+folV4XpKpOln oM2qoNQnJw90k8rav+ANlAJDah2q8i/0S9UNdTDinvWWwx2tZls0vDhGh1I2/cHAbUA6 SRyVfDgc6Y/31mEjoIO1pkphIIgDEtCUd9YNex5UeWjpfuIxZEINVdwMLuNJHTu7nGLI JyVM1qU0lF6j7nNb/dLQPVNyNWj7tfG1S704UijgPKlFSpcXSc7TG6PsWbbbdnh2w3Gr BxJEps+9xxPS8DtC6dvceL80fjJH+n68ceSrkmiiwgipa5OR9pTpmnOiLzy9bzE00BET tPxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=kBsH59A9; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-84679-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84679-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jq12-20020ad45fcc000000b0068ff2c18375si8646488qvb.129.2024.02.28.00.34.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:34:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84679-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=kBsH59A9; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-84679-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84679-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 547C41C2131E for ; Wed, 28 Feb 2024 08:34:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A82FA36AE7; Wed, 28 Feb 2024 08:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="kBsH59A9" Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 8515A2D608 for ; Wed, 28 Feb 2024 08:33:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709109202; cv=none; b=DZLD7K4ybflyGqA+wvZ1qhSbNQPBDpXIZL9Jh0tx0kvJgaF1JMKvAaOlnaFiZ2FwBtBkDexpfm5PB3NChAfqNCPv+j4+pqOah4IqbJ40IeRDR1DgnIqriKOLQwUu6i+lquKb7DvjiMPFwyuzcLYoyOXZaj8Y00gCDydmstvI4Yg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709109202; c=relaxed/simple; bh=2iaYjthGV+4YN90lhEWZi3Roao8D27ZIeW/fg1E7/vQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ju9uzuucqBSsjTornTpyyUC43+6AuPdtSKjqRw/cjehmo+DOC+GJ5vxHsTUygnERl5lnKnURss7G9Q+LGE41nYT8rt98t9Yq7ETa3KVSZtZI1UEaggwR7lkEVFoYvYlKzbhDqFTnw1cUFO4lKf8hcxhAsRPqn27yy8E2sRs2IuI= 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=kBsH59A9; arc=none smtp.client-ip=209.85.218.42 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-ej1-f42.google.com with SMTP id a640c23a62f3a-a437a2a46b1so312314366b.2 for ; Wed, 28 Feb 2024 00:33:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1709109199; x=1709713999; 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=EJkLrfz+B+TwXIL3E5Ouq4pIOb3ww8iGVXCK/i9BddI=; b=kBsH59A9Ha6haJTBlwWotfxsIq6Wta4aGKin1c8WvrKBgMxZxPI4MMY+fCDgM7gr5T F4wKqnwSSPNRmj98C7neZE8QnsnGscQrSG+9W1RjrHnDPdPPM7K5nDyhiWAybv5ND1hq PdGNKwj1xUCWePnknpnz1xzzVVag3AjkIpBp5qsMnZrt57ZaDyfZFnokiOhO70IHMbd0 NxbLGpneRC2rQkewSpFAGPv4lZvslv5kRK0g36fikmrbx4r1BEbKiAUKPRTiysJS6tBO kiyZPMBLRkZNXSWiMPIEbLDB5yz/4L+fW3Z2bnb1N3BMekNSuyOqokpf/kxgGvQr6beC uEgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709109199; x=1709713999; 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=EJkLrfz+B+TwXIL3E5Ouq4pIOb3ww8iGVXCK/i9BddI=; b=YbHIYedGvtvW38qHxobqgttIpv5E/PoJAZlUTHGLScL6bFSlKTkiTgxeLu4tu1x8K5 lgE8LxXhMqRvUr4fiKswIXRWIbyUUqQuEZcMFlGE6Y+0NieabVGjDjIEjhaciGil3FwR zR4NFQ/PaRCLta753myUyqsQqYZycVNuUd8cIHs6h3m4EuGNgJ38ilimSTzMyHvFkQbA 4CVMpAjBrfd6rvKJ6ns0OtidtQhs5C2otGTMBETwXBqPIJhcpIhh8wQ/WiEUn1S96w04 M+Eygi/QOlCmNBmG5QYfyzYtXLV6QRvRzOUeJcHMVVVCtzTRU2jvl7hdN/yuFCsnUGKM +m+w== X-Forwarded-Encrypted: i=1; AJvYcCWNaCJ5V2sOUBm6aXvZ2D5QsvZXI1DQczmYgH2salQV8AI2xuBJ6ZBqApi5+TgJES5gGhwBIxBo02bjd1X/Fgnb02lAGu8tTzuyvAnU X-Gm-Message-State: AOJu0YxvRj1beb/LpXwUrN/qKdfMS9MvrFS/6x3Jvsh71tNbF/gjZXgz XtD79Zob9AQGW+KSeVHFwS+3x6MuSsRpEJv2Xxgf7SGL10PgBm93DavQFC+G8dnpLPphM+vS68b l X-Received: by 2002:a17:906:af8a:b0:a43:cebb:7245 with SMTP id mj10-20020a170906af8a00b00a43cebb7245mr2181635ejb.74.1709109198838; Wed, 28 Feb 2024 00:33:18 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.83]) by smtp.gmail.com with ESMTPSA id qh16-20020a170906ecb000b00a432777eb77sm1593987ejb.60.2024.02.28.00.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:33:18 -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 v8 03/10] watchdog: rzg2l_wdt: Use pm_runtime_resume_and_get() Date: Wed, 28 Feb 2024 10:32:46 +0200 Message-Id: <20240228083253.2640997-4-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228083253.2640997-1-claudiu.beznea.uj@bp.renesas.com> References: <20240228083253.2640997-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: 1792130968657157221 X-GMAIL-MSGID: 1792130968657157221 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 v8: - none Changes in v7: - none Changes in v6: - none Changes in v5: - none 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,