Skip to contentSkip to conversation

crypto: Use pm_runtime_resume_and_get()

PATCH In review [email protected] 3 participants 6 messages Sep 22 – Oct 2

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover crypto: Use pm_runtime_resume_and_get()

From: bui duc phuc <[email protected]>

Hi all,

This series replaces open-coded pm_runtime_get_sync() and pm_runtime_put_noidle() error handling with pm_runtime_resume_and_get() in several crypto drivers.

No functional change intended.

Best regards,
Phuc

bui duc phuc (3):
crypto: sun8i-ss - Use pm_runtime_resume_and_get()
crypto: ccree - Use pm_runtime_resume_and_get()
crypto: sl3516 - Use pm_runtime_resume_and_get()

 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 3 +--
 drivers/crypto/ccree/cc_pm.c                      | 8 +-------
 drivers/crypto/gemini/sl3516-ce-cipher.c          | 3 +--
 drivers/crypto/gemini/sl3516-ce-rng.c             | 6 ++----
 4 files changed, 5 insertions(+), 15 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/3 crypto: sun8i-ss - Use pm_runtime_resume_and_get()

From: bui duc phuc <[email protected]>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle() error handling pattern with pm_runtime_resume_and_get(), which already does this internally.

No functional change.

Found by manual code inspection.

---
 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c +1 -2
index 36a1ebca2e70..56ba4ff6d5ff 100644
@@ -120,12 +120,11 @@ int sun8i_ss_hash_init_tfm(struct crypto_ahash *tfm)
 	memcpy(algt->fbname, crypto_ahash_driver_name(op->fallback_tfm),
 	       CRYPTO_MAX_ALG_NAME);
 
-	err = pm_runtime_get_sync(op->ss->dev);
+	err = pm_runtime_resume_and_get(op->ss->dev);
 	if (err < 0)
 		goto error_pm;
 	return 0;
 error_pm:
-	pm_runtime_put_noidle(op->ss->dev);
 	crypto_free_ahash(op->fallback_tfm);
 	return err;
 }
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/3 crypto: ccree - Use pm_runtime_resume_and_get()

In reply to [email protected]

From: bui duc phuc <[email protected]>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle() error handling pattern with pm_runtime_resume_and_get(), which already does this internally.

No functional change.

Found by manual code inspection.

---
 drivers/crypto/ccree/cc_pm.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/crypto/ccree/cc_pm.c +1 -7
index bbd118f8de0e..666866119588 100644
@@ -66,13 +66,7 @@ const struct dev_pm_ops ccree_pm = {
 
 int cc_pm_get(struct device *dev)
 {
-	int rc = pm_runtime_get_sync(dev);
-	if (rc < 0) {
-		pm_runtime_put_noidle(dev);
-		return rc;
-	}
-
-	return 0;
+	return pm_runtime_resume_and_get(dev);
 }
 
 void cc_pm_put_suspend(struct device *dev)
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/3 crypto: sl3516 - Use pm_runtime_resume_and_get()

In reply to [email protected]

From: bui duc phuc <[email protected]>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle() error handling pattern with pm_runtime_resume_and_get(), which already does this internally.

No functional change.

Found by manual code inspection.

---
 drivers/crypto/gemini/sl3516-ce-cipher.c | 3 +--
 drivers/crypto/gemini/sl3516-ce-rng.c    | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/crypto/gemini/sl3516-ce-cipher.c +1 -2
index 02ec4282333b..eba46aebf176 100644
@@ -331,13 +331,12 @@ int sl3516_ce_cipher_init(struct crypto_tfm *tfm)
 		 crypto_tfm_alg_driver_name(&sktfm->base),
 		 crypto_tfm_alg_driver_name(crypto_skcipher_tfm(op->fallback_tfm)));
 
-	err = pm_runtime_get_sync(op->ce->dev);
+	err = pm_runtime_resume_and_get(op->ce->dev);
 	if (err < 0)
 		goto error_pm;
 
 	return 0;
 error_pm:
-	pm_runtime_put_noidle(op->ce->dev);
 	crypto_free_skcipher(op->fallback_tfm);
 	return err;
 }
drivers/crypto/gemini/sl3516-ce-rng.c +2 -4
index 76931ec1cec5..19af03b03e42 100644
@@ -24,11 +24,9 @@ static int sl3516_ce_rng_read(struct hwrng *rng, void *buf, size_t max, bool wai
 	ce->hwrng_stat_bytes += max;
 #endif
 
-	err = pm_runtime_get_sync(ce->dev);
-	if (err < 0) {
-		pm_runtime_put_noidle(ce->dev);
+	err = pm_runtime_resume_and_get(ce->dev);
+	if (err < 0)
 		return err;
-	}
 
 	while (read < max) {
 		*data = readl(ce->base + IPSEC_RAND_NUM_REG);
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] crypto: sl3516 - Use pm_runtime_resume_and_get()

Quoted 11 lines · On Tue, Sep 22, 2026 at 5:20 AM <[email protected]> wrote:

From: bui duc phuc <[email protected]>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle() error handling pattern with pm_runtime_resume_and_get(), which already does this internally.

No functional change.

Found by manual code inspection.

Yours,
Linus Walleij

maintainer
#5 lore raw
In reply to [email protected]
Quoted 18 lines · On Tue, Sep 22, 2026 at 10:19:51AM +0700, [email protected] wrote:

From: bui duc phuc <[email protected]>

Hi all,

This series replaces open-coded pm_runtime_get_sync() and pm_runtime_put_noidle() error handling with pm_runtime_resume_and_get() in several crypto drivers.

No functional change intended.

Best regards,
Phuc

bui duc phuc (3):
crypto: sun8i-ss - Use pm_runtime_resume_and_get()
crypto: ccree - Use pm_runtime_resume_and_get()
crypto: sl3516 - Use pm_runtime_resume_and_get()

Quoted 8 lines
 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 3 +--
 drivers/crypto/ccree/cc_pm.c                      | 8 +-------
 drivers/crypto/gemini/sl3516-ce-cipher.c          | 3 +--
 drivers/crypto/gemini/sl3516-ce-rng.c             | 6 ++----
 4 files changed, 5 insertions(+), 15 deletions(-)
Signature · 1 line
2.43.0

All applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt