staging: ccree: simplify pm manager using local var
authorGilad Ben-Yossef <gilad@benyossef.com>
Thu, 9 Nov 2017 09:16:14 +0000 (09:16 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Nov 2017 08:20:38 +0000 (09:20 +0100)
Make the code more readable by using a local variable.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ccree/ssi_pm.c

index e1bc4c5..d60143c 100644 (file)
@@ -90,20 +90,24 @@ int cc_pm_resume(struct device *dev)
 int cc_pm_get(struct device *dev)
 {
        int rc = 0;
+       struct ssi_drvdata *drvdata =
+               (struct ssi_drvdata *)dev_get_drvdata(dev);
 
-       if (cc_req_queue_suspended((struct ssi_drvdata *)dev_get_drvdata(dev))) {
+       if (cc_req_queue_suspended(drvdata))
                rc = pm_runtime_get_sync(dev);
-       } else {
+       else
                pm_runtime_get_noresume(dev);
-       }
+
        return rc;
 }
 
 int cc_pm_put_suspend(struct device *dev)
 {
        int rc = 0;
+       struct ssi_drvdata *drvdata =
+               (struct ssi_drvdata *)dev_get_drvdata(dev);
 
-       if (!cc_req_queue_suspended((struct ssi_drvdata *)dev_get_drvdata(dev))) {
+       if (!cc_req_queue_suspended(drvdata)) {
                pm_runtime_mark_last_busy(dev);
                rc = pm_runtime_put_autosuspend(dev);
        } else {