From patchwork Wed Nov 23 14:41:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 25025 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2834111wrr; Wed, 23 Nov 2022 06:48:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf7MVmU3++ASmzcsP7Qnow2xb7ZSCG4r81TOCRIgWSRoM6DAztw8gbhhxk1Py+0cDWZQFplC X-Received: by 2002:a17:90b:8c6:b0:218:9ef4:de9d with SMTP id ds6-20020a17090b08c600b002189ef4de9dmr19215332pjb.178.1669214913409; Wed, 23 Nov 2022 06:48:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669214913; cv=none; d=google.com; s=arc-20160816; b=oJHMj/r3ywbsOAnhfVZpTuDVXLywv5rKvoGOPa3Ts+VSgbrF8ys2wgz9nTfn2uH5Uz b0eYQzi0vRBwMSGxwYPEvk/iH8ADqExj30zBlU4dAOP2fAajrXy8yvhHyynsfZBof2x+ 5F8yTqzM+UCjyupb/JNU83UbdSXD9ERmIMbqE3qUUTlQOjbfFj7VGDp/tL7SWzFaiLcN CPyuzG522E4Kz9QNo+A3lDRR98DoIo5Is7yttVhv5+COu4gInqlUts2diOHbzf7S4/MX vKEYBje3VluKpQuR58L22OAsXy9qP+Ug5MNK/BTxcxrQBXwirwM7xneg5S5WK4RFuDLy IZLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LWHYnKJi3ip4Lirx3Ad9aOo6vGfyAX52zjAI9cBkeVw=; b=t27Iaq4qvkJgNmnC9slpxU2VJN7STcEut+Og4u1CTS4El323Up+msGldYNVWt0Ac8s uJPJbWRGihVJ6b9lMUifLLbBEXIsiksYMHHOvJkCUpz0tjZNubIact6xGCHU+htKqfDh 98D3NXq8NIwcxlroToeo10v3QoY2Wm0IPa+Xbq/EeXoSa9IHy1JWMacbk/FhGbyw2U5G gXFrIj+CcOrrsr5nPg9zmsYQ6iKS8DCCZCrbiwbRru81Ilay/ukcsnJYkl0zgi14k02L zU+am3Gvr7+2p8ryR5ceAQfAacJgR0jdlm3bYxn1YIWBrX+gekut25N+Q3/71URm+4xr bExg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q16-20020a63cc50000000b00476d7732344si16785233pgi.741.2022.11.23.06.48.19; Wed, 23 Nov 2022 06:48:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238610AbiKWOlp (ORCPT + 99 others); Wed, 23 Nov 2022 09:41:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237022AbiKWOlh (ORCPT ); Wed, 23 Nov 2022 09:41:37 -0500 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5419456EF1 for ; Wed, 23 Nov 2022 06:41:33 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed10:881b:815b:474d:c3fd]) by michel.telenet-ops.be with bizsmtp id nqhS2800R49U0Rd06qhSXG; Wed, 23 Nov 2022 15:41:30 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oxqwH-001Rqj-SD; Wed, 23 Nov 2022 15:41:25 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1oxqwH-0012Hb-4O; Wed, 23 Nov 2022 15:41:25 +0100 From: Geert Uytterhoeven To: Krzysztof Kozlowski , Vignesh Raghavendra , Miquel Raynal , Richard Weinberger , Mark Brown Cc: Philipp Zabel , Sergey Shtylyov , Wolfram Sang , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 4/6] memory: renesas-rpc-if: Improve Runtime PM handling Date: Wed, 23 Nov 2022 15:41:20 +0100 Message-Id: <6f2bd3b2b3d98c5bed541d969900b2ad04f93943.1669213027.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750298696968635419?= X-GMAIL-MSGID: =?utf-8?q?1750298696968635419?= Convert from the deprecated pm_runtime_get_sync() to the new pm_runtime_resume_and_get(), and add error checking. Signed-off-by: Geert Uytterhoeven --- v2: - No changes. --- drivers/memory/renesas-rpc-if.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c index 83171242f9514c22..9346dcc29a36662e 100644 --- a/drivers/memory/renesas-rpc-if.c +++ b/drivers/memory/renesas-rpc-if.c @@ -304,12 +304,13 @@ int rpcif_hw_init(struct rpcif *rpcif, bool hyperflash) { struct rpcif_priv *rpc = dev_get_drvdata(rpcif->dev); u32 dummy; + int ret; - pm_runtime_get_sync(rpc->dev); + ret = pm_runtime_resume_and_get(rpc->dev); + if (ret) + return ret; if (rpc->type == RPCIF_RZ_G2L) { - int ret; - ret = reset_control_reset(rpc->rstc); if (ret) return ret; @@ -482,7 +483,9 @@ int rpcif_manual_xfer(struct rpcif *rpcif) u32 smenr, smcr, pos = 0, max = rpc->bus_size == 2 ? 8 : 4; int ret = 0; - pm_runtime_get_sync(rpc->dev); + ret = pm_runtime_resume_and_get(rpc->dev); + if (ret < 0) + return ret; regmap_update_bits(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_CAL, RPCIF_PHYCNT_CAL); @@ -650,11 +653,14 @@ ssize_t rpcif_dirmap_read(struct rpcif *rpcif, u64 offs, size_t len, void *buf) struct rpcif_priv *rpc = dev_get_drvdata(rpcif->dev); loff_t from = offs & (rpc->size - 1); size_t size = rpc->size - from; + int ret; if (len > size) len = size; - pm_runtime_get_sync(rpc->dev); + ret = pm_runtime_resume_and_get(rpc->dev); + if (ret < 0) + return ret; regmap_update_bits(rpc->regmap, RPCIF_CMNCR, RPCIF_CMNCR_MD, 0); regmap_write(rpc->regmap, RPCIF_DRCR, 0);