Skip to contentSkip to conversation

hwrng: cctrng - Discard pm_runtime_put_autosuspend() return value

PATCH RESEND In review Herbert Xu 2 participants 2 messages Oct 15

Subsystems (3)
lore
Share & tools
lore

Herbert Xu

author maintainer
#0 lore raw

PATCH RESEND 1/1 hwrng: cctrng - Discard pm_runtime_put_autosuspend() return value

From: Brian Norris <[email protected]>

Printing an error message on pm_runtime_put_autosuspend() returning a non-zero value is not particularly useful.

Returning an error code from pm_runtime_put_autosuspend() merely means that it has not queued up a timer or work item to check whether or not the device can be suspended and there are many perfectly valid situations in which that can happen, like after writing "on" to the device's runtime PM "control" attribute in sysfs for one example.

Accordingly, update cc_trng_pm_put_suspend() to simply discard the return value of pm_runtime_put_autosuspend().

This will facilitate a planned change of the pm_runtime_put_autosuspend() return type to void in the future, similar to commit 3afd8df02433 ("PM: runtime: Change pm_runtime_put() return type to void").

 drivers/char/hw_random/cctrng.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/char/hw_random/cctrng.c +1 -5
index a6925211c3b5..7e1e1a7844b0 100644
@@ -96,11 +96,7 @@ static int cc_trng_pm_get(struct device *dev)
 
 static void cc_trng_pm_put_suspend(struct device *dev)
 {
-	int rc = 0;
-
-	rc = pm_runtime_put_autosuspend(dev);
-	if (rc)
-		dev_err(dev, "pm_runtime_put_autosuspend returned %x\n", rc);
+	pm_runtime_put_autosuspend(dev);
 }
 
 static int cc_trng_pm_init(struct cctrng_drvdata *drvdata)
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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 31 lines · Herbert Xu

From: Brian Norris <[email protected]>

Printing an error message on pm_runtime_put_autosuspend() returning a non-zero value is not particularly useful.

Returning an error code from pm_runtime_put_autosuspend() merely means that it has not queued up a timer or work item to check whether or not the device can be suspended and there are many perfectly valid situations in which that can happen, like after writing "on" to the device's runtime PM "control" attribute in sysfs for one example.

Accordingly, update cc_trng_pm_put_suspend() to simply discard the return value of pm_runtime_put_autosuspend().

This will facilitate a planned change of the pm_runtime_put_autosuspend() return type to void in the future, similar to commit 3afd8df02433 ("PM: runtime: Change pm_runtime_put() return type to void").

  drivers/char/hw_random/cctrng.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/char/hw_random/cctrng.c +0 -0
index a6925211c3b5..7e1e1a7844b0 100644
@@ -96,11 +96,7 @@ static int cc_trng_pm_get(struct device *dev)
 
  static void cc_trng_pm_put_suspend(struct device *dev)

drivers/char/hw_random/cctrng.c static int cc_trng_pm_get(struct device *dev) · line 102

Quoted 10 lines
drivers/char/hw_random/cctrng.c +1 -5
  {
-	int rc = 0;
-
-	rc = pm_runtime_put_autosuspend(dev);
-	if (rc)
-		dev_err(dev, "pm_runtime_put_autosuspend returned %x\n", rc);
+	pm_runtime_put_autosuspend(dev);
  }
 
  static int cc_trng_pm_init(struct cctrng_drvdata *drvdata)