Skip to contentSkip to conversation

Some improvements for Qualcomm hwspinlock

PATCH New Baolin Wang 1 participant 3 messages Dec 4, 2019

Subsystems (2)
lore
Share & tools
lore

Baolin Wang

author reviewer
#0 lore raw

cover Some improvements for Qualcomm hwspinlock

This patch set did some optimization for Qualcomm hwlock controller, including using devm_hwspin_lock_register() API to simplify code and removing redundant pm runtime functions.

Baolin Wang (2):
hwspinlock: qcom: Remove redundant PM runtime functions
hwspinlock: qcom: Use devm_hwspin_lock_register() to register hwlock
controller

 drivers/hwspinlock/qcom_hwspinlock.c |   28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)
Signature · 1 line
1.7.9.5
author reviewer
#1 lore raw

PATCH 1/2 hwspinlock: qcom: Remove redundant PM runtime functions

Since the hwspinlock core has changed the PM runtime to be optional, and the Qualcomm hardware spinlock has no pm runtime requirement, thus remove these redundant PM runtime functions.

---
 drivers/hwspinlock/qcom_hwspinlock.c |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/hwspinlock/qcom_hwspinlock.c +2 -11
index 6da7447..5a736b0 100644
@@ -12,7 +12,6 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
-#include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 
 #include "hwspinlock_internal.h"
@@ -122,14 +121,8 @@ static int qcom_hwspinlock_probe(struct platform_device *pdev)
 							     regmap, field);
 	}
 
-	pm_runtime_enable(&pdev->dev);
-
-	ret = hwspin_lock_register(bank, &pdev->dev, &qcom_hwspinlock_ops,
-				   0, QCOM_MUTEX_NUM_LOCKS);
-	if (ret)
-		pm_runtime_disable(&pdev->dev);
-
-	return ret;
+	return hwspin_lock_register(bank, &pdev->dev, &qcom_hwspinlock_ops,
+				    0, QCOM_MUTEX_NUM_LOCKS);
 }
 
 static int qcom_hwspinlock_remove(struct platform_device *pdev)
@@ -143,8 +136,6 @@ static int qcom_hwspinlock_remove(struct platform_device *pdev)
 		return ret;
 	}
 
-	pm_runtime_disable(&pdev->dev);
-
 	return 0;
 }
 
Signature · 1 line
1.7.9.5
author reviewer
#2 lore raw

PATCH 2/2 hwspinlock: qcom: Use devm_hwspin_lock_register() to register hwlock controller

In reply to Baolin Wang

Use devm_hwspin_lock_register() to register the hwlock controller instead of unregistering the hwlock controller explicitly when removing the device.

---
 drivers/hwspinlock/qcom_hwspinlock.c |   19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/hwspinlock/qcom_hwspinlock.c +2 -17
index 5a736b0..f0da544 100644
@@ -121,27 +121,12 @@ static int qcom_hwspinlock_probe(struct platform_device *pdev)
 							     regmap, field);
 	}
 
-	return hwspin_lock_register(bank, &pdev->dev, &qcom_hwspinlock_ops,
-				    0, QCOM_MUTEX_NUM_LOCKS);
-}
-
-static int qcom_hwspinlock_remove(struct platform_device *pdev)
-{
-	struct hwspinlock_device *bank = platform_get_drvdata(pdev);
-	int ret;
-
-	ret = hwspin_lock_unregister(bank);
-	if (ret) {
-		dev_err(&pdev->dev, "%s failed: %d\n", __func__, ret);
-		return ret;
-	}
-
-	return 0;
+	return devm_hwspin_lock_register(&pdev->dev, bank, &qcom_hwspinlock_ops,
+					 0, QCOM_MUTEX_NUM_LOCKS);
 }
 
 static struct platform_driver qcom_hwspinlock_driver = {
 	.probe		= qcom_hwspinlock_probe,
-	.remove		= qcom_hwspinlock_remove,
 	.driver		= {
 		.name	= "qcom_hwspinlock",
 		.of_match_table = qcom_hwspinlock_of_match,
Signature · 1 line
1.7.9.5