Skip to content

Commit f7ef1b9

Browse files
geertugregkh
authored andcommitted
memory: renesas-rpc-if: Improve Runtime PM handling
[ Upstream commit bb0b025 ] 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 <geert+renesas@glider.be> Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/6f2bd3b2b3d98c5bed541d969900b2ad04f93943.1669213027.git.geert+renesas@glider.be Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Stable-dep-of: 7d18957 ("mtd: hyperbus: rpc-if: Add missing MODULE_DEVICE_TABLE") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent aabef63 commit f7ef1b9

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

drivers/memory/renesas-rpc-if.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,13 @@ int rpcif_hw_init(struct rpcif *rpcif, bool hyperflash)
303303
{
304304
struct rpcif_priv *rpc = dev_get_drvdata(rpcif->dev);
305305
u32 dummy;
306+
int ret;
306307

307-
pm_runtime_get_sync(rpc->dev);
308+
ret = pm_runtime_resume_and_get(rpc->dev);
309+
if (ret)
310+
return ret;
308311

309312
if (rpc->type == RPCIF_RZ_G2L) {
310-
int ret;
311-
312313
ret = reset_control_reset(rpc->rstc);
313314
if (ret)
314315
return ret;
@@ -478,7 +479,9 @@ int rpcif_manual_xfer(struct rpcif *rpcif)
478479
u32 smenr, smcr, pos = 0, max = rpc->bus_size == 2 ? 8 : 4;
479480
int ret = 0;
480481

481-
pm_runtime_get_sync(rpc->dev);
482+
ret = pm_runtime_resume_and_get(rpc->dev);
483+
if (ret < 0)
484+
return ret;
482485

483486
regmap_update_bits(rpc->regmap, RPCIF_PHYCNT,
484487
RPCIF_PHYCNT_CAL, RPCIF_PHYCNT_CAL);
@@ -646,11 +649,14 @@ ssize_t rpcif_dirmap_read(struct rpcif *rpcif, u64 offs, size_t len, void *buf)
646649
struct rpcif_priv *rpc = dev_get_drvdata(rpcif->dev);
647650
loff_t from = offs & (rpc->size - 1);
648651
size_t size = rpc->size - from;
652+
int ret;
649653

650654
if (len > size)
651655
len = size;
652656

653-
pm_runtime_get_sync(rpc->dev);
657+
ret = pm_runtime_resume_and_get(rpc->dev);
658+
if (ret < 0)
659+
return ret;
654660

655661
regmap_update_bits(rpc->regmap, RPCIF_CMNCR, RPCIF_CMNCR_MD, 0);
656662
regmap_write(rpc->regmap, RPCIF_DRCR, 0);

0 commit comments

Comments
 (0)