hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/hwspinlock/sirf_hwspinlock.c
....@@ -9,7 +9,6 @@
99 #include <linux/module.h>
1010 #include <linux/device.h>
1111 #include <linux/io.h>
12
-#include <linux/pm_runtime.h>
1312 #include <linux/slab.h>
1413 #include <linux/spinlock.h>
1514 #include <linux/hwspinlock.h>
....@@ -56,7 +55,7 @@
5655 {
5756 struct sirf_hwspinlock *hwspin;
5857 struct hwspinlock *hwlock;
59
- int idx, ret;
58
+ int idx;
6059
6160 if (!pdev->dev.of_node)
6261 return -ENODEV;
....@@ -69,9 +68,9 @@
6968 return -ENOMEM;
7069
7170 /* retrieve io base */
72
- hwspin->io_base = of_iomap(pdev->dev.of_node, 0);
73
- if (!hwspin->io_base)
74
- return -ENOMEM;
71
+ hwspin->io_base = devm_platform_ioremap_resource(pdev, 0);
72
+ if (IS_ERR(hwspin->io_base))
73
+ return PTR_ERR(hwspin->io_base);
7574
7675 for (idx = 0; idx < HW_SPINLOCK_NUMBER; idx++) {
7776 hwlock = &hwspin->bank.lock[idx];
....@@ -80,39 +79,9 @@
8079
8180 platform_set_drvdata(pdev, hwspin);
8281
83
- pm_runtime_enable(&pdev->dev);
84
-
85
- ret = hwspin_lock_register(&hwspin->bank, &pdev->dev,
86
- &sirf_hwspinlock_ops, 0,
87
- HW_SPINLOCK_NUMBER);
88
- if (ret)
89
- goto reg_failed;
90
-
91
- return 0;
92
-
93
-reg_failed:
94
- pm_runtime_disable(&pdev->dev);
95
- iounmap(hwspin->io_base);
96
-
97
- return ret;
98
-}
99
-
100
-static int sirf_hwspinlock_remove(struct platform_device *pdev)
101
-{
102
- struct sirf_hwspinlock *hwspin = platform_get_drvdata(pdev);
103
- int ret;
104
-
105
- ret = hwspin_lock_unregister(&hwspin->bank);
106
- if (ret) {
107
- dev_err(&pdev->dev, "%s failed: %d\n", __func__, ret);
108
- return ret;
109
- }
110
-
111
- pm_runtime_disable(&pdev->dev);
112
-
113
- iounmap(hwspin->io_base);
114
-
115
- return 0;
82
+ return devm_hwspin_lock_register(&pdev->dev, &hwspin->bank,
83
+ &sirf_hwspinlock_ops, 0,
84
+ HW_SPINLOCK_NUMBER);
11685 }
11786
11887 static const struct of_device_id sirf_hwpinlock_ids[] = {
....@@ -123,7 +92,6 @@
12392
12493 static struct platform_driver sirf_hwspinlock_driver = {
12594 .probe = sirf_hwspinlock_probe,
126
- .remove = sirf_hwspinlock_remove,
12795 .driver = {
12896 .name = "atlas7_hwspinlock",
12997 .of_match_table = of_match_ptr(sirf_hwpinlock_ids),