@@ -74,17 +74,12 @@ static const struct hwspinlock_ops omap_hwspinlock_ops = {
7474
7575static int omap_hwspinlock_probe (struct platform_device * pdev )
7676{
77- struct device_node * node = pdev -> dev .of_node ;
7877 struct hwspinlock_device * bank ;
79- struct hwspinlock * hwlock ;
8078 void __iomem * io_base ;
8179 int num_locks , i , ret ;
8280 /* Only a single hwspinlock block device is supported */
8381 int base_id = 0 ;
8482
85- if (!node )
86- return - ENODEV ;
87-
8883 io_base = devm_platform_ioremap_resource (pdev , 0 );
8984 if (IS_ERR (io_base ))
9085 return PTR_ERR (io_base );
@@ -93,10 +88,10 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
9388 * make sure the module is enabled and clocked before reading
9489 * the module SYSSTATUS register
9590 */
96- pm_runtime_enable (& pdev -> dev );
91+ devm_pm_runtime_enable (& pdev -> dev );
9792 ret = pm_runtime_resume_and_get (& pdev -> dev );
9893 if (ret < 0 )
99- goto runtime_err ;
94+ return ret ;
10095
10196 /* Determine number of locks */
10297 i = readl (io_base + SYSSTATUS_OFFSET );
@@ -108,55 +103,24 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
108103 */
109104 ret = pm_runtime_put (& pdev -> dev );
110105 if (ret < 0 )
111- goto runtime_err ;
106+ return ret ;
112107
113108 /* one of the four lsb's must be set, and nothing else */
114- if (hweight_long (i & 0xf ) != 1 || i > 8 ) {
115- ret = - EINVAL ;
116- goto runtime_err ;
117- }
109+ if (hweight_long (i & 0xf ) != 1 || i > 8 )
110+ return - EINVAL ;
118111
119112 num_locks = i * 32 ; /* actual number of locks in this device */
120113
121114 bank = devm_kzalloc (& pdev -> dev , struct_size (bank , lock , num_locks ),
122115 GFP_KERNEL );
123- if (!bank ) {
124- ret = - ENOMEM ;
125- goto runtime_err ;
126- }
127-
128- platform_set_drvdata (pdev , bank );
116+ if (!bank )
117+ return - ENOMEM ;
129118
130- for (i = 0 , hwlock = & bank -> lock [ 0 ] ; i < num_locks ; i ++ , hwlock ++ )
131- hwlock -> priv = io_base + LOCK_BASE_OFFSET + sizeof (u32 ) * i ;
119+ for (i = 0 ; i < num_locks ; i ++ )
120+ bank -> lock [ i ]. priv = io_base + LOCK_BASE_OFFSET + sizeof (u32 ) * i ;
132121
133- ret = hwspin_lock_register ( bank , & pdev -> dev , & omap_hwspinlock_ops ,
122+ return devm_hwspin_lock_register ( & pdev -> dev , bank , & omap_hwspinlock_ops ,
134123 base_id , num_locks );
135- if (ret )
136- goto runtime_err ;
137-
138- dev_dbg (& pdev -> dev , "Registered %d locks with HwSpinlock core\n" ,
139- num_locks );
140-
141- return 0 ;
142-
143- runtime_err :
144- pm_runtime_disable (& pdev -> dev );
145- return ret ;
146- }
147-
148- static void omap_hwspinlock_remove (struct platform_device * pdev )
149- {
150- struct hwspinlock_device * bank = platform_get_drvdata (pdev );
151- int ret ;
152-
153- ret = hwspin_lock_unregister (bank );
154- if (ret ) {
155- dev_err (& pdev -> dev , "%s failed: %d\n" , __func__ , ret );
156- return ;
157- }
158-
159- pm_runtime_disable (& pdev -> dev );
160124}
161125
162126static const struct of_device_id omap_hwspinlock_of_match [] = {
@@ -169,7 +133,6 @@ MODULE_DEVICE_TABLE(of, omap_hwspinlock_of_match);
169133
170134static struct platform_driver omap_hwspinlock_driver = {
171135 .probe = omap_hwspinlock_probe ,
172- .remove_new = omap_hwspinlock_remove ,
173136 .driver = {
174137 .name = "omap_hwspinlock" ,
175138 .of_match_table = omap_hwspinlock_of_match ,
0 commit comments