Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2414283rbb; Wed, 28 Feb 2024 00:34:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVQc77MzXIs/dtb5+RZtiwCYSc185KUJ3yv5AjFSkE1QpNG29foa4FvsiWH/In1iX4Razzso1BN9ouSmggEfjt4c7f6W0DICFXdEOYzAQ== X-Google-Smtp-Source: AGHT+IGw+Srs2hAk9ajZU56JIaIMtQNrQl592Po9E/Q7p8gK1cimX1Pfkl4aa1uOCzi86XmKR+as X-Received: by 2002:a81:8414:0:b0:608:e353:7975 with SMTP id u20-20020a818414000000b00608e3537975mr4420831ywf.21.1709109246548; Wed, 28 Feb 2024 00:34:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709109246; cv=pass; d=google.com; s=arc-20160816; b=DCfh4TN8mc/wNEWpaG+DwocwOME4OJoiI/oUd48jY+rvFi5S9yEL0jegc1PBpX8got vGpkMhffjPaoYb7EcBhR65dR1urGKumGMEdx89SuC2+gOj1EMkQ/qjF71nQ1+5wG57ND BPxxxMP6cRyMyb7tFyVok4M4Cg2sAQLVI+/FKJZLLvl947FVberCQccGfvXJJw++Jwor shUmNpYpF8giVbZOwBRx5gRUseqfgwuGl393bUj6bNZxbvjFMdT3ff6/SoJ4UViaVa6Q Dr5LmJvAhaEI5SiU+h3P7y5MTGUgwfvRnC3kyLy7UjE9m9wT2IITdosw5kVgTMUF+p6V 1Tbg== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84679-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y7-20020ac87087000000b0042e7a4cc504si7806254qto.645.2024.02.28.00.34.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:34:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84679-linux.lists.archive=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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84679-linux.lists.archive=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 4D9AA1C216E5 for ; Wed, 28 Feb 2024 08:34:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4294933CC4; Wed, 28 Feb 2024 08:33:23 +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 Content-Transfer-Encoding: 8bit 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, -- 2.39.2