@@ -196,44 +196,6 @@ static int gpio_rcar_irq_set_wake(struct irq_data *d, unsigned int on)
196
196
return 0 ;
197
197
}
198
198
199
- static void gpio_rcar_irq_bus_lock (struct irq_data * d )
200
- {
201
- struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
202
- struct gpio_rcar_priv * p = gpiochip_get_data (gc );
203
-
204
- pm_runtime_get_sync (& p -> pdev -> dev );
205
- }
206
-
207
- static void gpio_rcar_irq_bus_sync_unlock (struct irq_data * d )
208
- {
209
- struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
210
- struct gpio_rcar_priv * p = gpiochip_get_data (gc );
211
-
212
- pm_runtime_put (& p -> pdev -> dev );
213
- }
214
-
215
-
216
- static int gpio_rcar_irq_request_resources (struct irq_data * d )
217
- {
218
- struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
219
- struct gpio_rcar_priv * p = gpiochip_get_data (gc );
220
- int error ;
221
-
222
- error = pm_runtime_get_sync (& p -> pdev -> dev );
223
- if (error < 0 )
224
- return error ;
225
-
226
- return 0 ;
227
- }
228
-
229
- static void gpio_rcar_irq_release_resources (struct irq_data * d )
230
- {
231
- struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
232
- struct gpio_rcar_priv * p = gpiochip_get_data (gc );
233
-
234
- pm_runtime_put (& p -> pdev -> dev );
235
- }
236
-
237
199
static irqreturn_t gpio_rcar_irq_handler (int irq , void * dev_id )
238
200
{
239
201
struct gpio_rcar_priv * p = dev_id ;
@@ -280,32 +242,18 @@ static void gpio_rcar_config_general_input_output_mode(struct gpio_chip *chip,
280
242
281
243
static int gpio_rcar_request (struct gpio_chip * chip , unsigned offset )
282
244
{
283
- struct gpio_rcar_priv * p = gpiochip_get_data (chip );
284
- int error ;
285
-
286
- error = pm_runtime_get_sync (& p -> pdev -> dev );
287
- if (error < 0 )
288
- return error ;
289
-
290
- error = pinctrl_request_gpio (chip -> base + offset );
291
- if (error )
292
- pm_runtime_put (& p -> pdev -> dev );
293
-
294
- return error ;
245
+ return pinctrl_request_gpio (chip -> base + offset );
295
246
}
296
247
297
248
static void gpio_rcar_free (struct gpio_chip * chip , unsigned offset )
298
249
{
299
- struct gpio_rcar_priv * p = gpiochip_get_data (chip );
300
-
301
250
pinctrl_free_gpio (chip -> base + offset );
302
251
303
- /* Set the GPIO as an input to ensure that the next GPIO request won't
252
+ /*
253
+ * Set the GPIO as an input to ensure that the next GPIO request won't
304
254
* drive the GPIO pin as an output.
305
255
*/
306
256
gpio_rcar_config_general_input_output_mode (chip , offset , false);
307
-
308
- pm_runtime_put (& p -> pdev -> dev );
309
257
}
310
258
311
259
static int gpio_rcar_direction_input (struct gpio_chip * chip , unsigned offset )
@@ -452,6 +400,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
452
400
}
453
401
454
402
pm_runtime_enable (dev );
403
+ pm_runtime_get_sync (dev );
455
404
456
405
io = platform_get_resource (pdev , IORESOURCE_MEM , 0 );
457
406
irq = platform_get_resource (pdev , IORESOURCE_IRQ , 0 );
@@ -488,10 +437,6 @@ static int gpio_rcar_probe(struct platform_device *pdev)
488
437
irq_chip -> irq_unmask = gpio_rcar_irq_enable ;
489
438
irq_chip -> irq_set_type = gpio_rcar_irq_set_type ;
490
439
irq_chip -> irq_set_wake = gpio_rcar_irq_set_wake ;
491
- irq_chip -> irq_bus_lock = gpio_rcar_irq_bus_lock ;
492
- irq_chip -> irq_bus_sync_unlock = gpio_rcar_irq_bus_sync_unlock ;
493
- irq_chip -> irq_request_resources = gpio_rcar_irq_request_resources ;
494
- irq_chip -> irq_release_resources = gpio_rcar_irq_release_resources ;
495
440
irq_chip -> flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND ;
496
441
497
442
ret = gpiochip_add_data (gpio_chip , p );
@@ -522,6 +467,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
522
467
err1 :
523
468
gpiochip_remove (gpio_chip );
524
469
err0 :
470
+ pm_runtime_put (dev );
525
471
pm_runtime_disable (dev );
526
472
return ret ;
527
473
}
@@ -532,6 +478,7 @@ static int gpio_rcar_remove(struct platform_device *pdev)
532
478
533
479
gpiochip_remove (& p -> gpio_chip );
534
480
481
+ pm_runtime_put (& pdev -> dev );
535
482
pm_runtime_disable (& pdev -> dev );
536
483
return 0 ;
537
484
}
0 commit comments