@@ -242,32 +242,18 @@ static void gpio_rcar_config_general_input_output_mode(struct gpio_chip *chip,
242
242
243
243
static int gpio_rcar_request (struct gpio_chip * chip , unsigned offset )
244
244
{
245
- struct gpio_rcar_priv * p = gpiochip_get_data (chip );
246
- int error ;
247
-
248
- error = pm_runtime_get_sync (& p -> pdev -> dev );
249
- if (error < 0 )
250
- return error ;
251
-
252
- error = pinctrl_request_gpio (chip -> base + offset );
253
- if (error )
254
- pm_runtime_put (& p -> pdev -> dev );
255
-
256
- return error ;
245
+ return pinctrl_request_gpio (chip -> base + offset );
257
246
}
258
247
259
248
static void gpio_rcar_free (struct gpio_chip * chip , unsigned offset )
260
249
{
261
- struct gpio_rcar_priv * p = gpiochip_get_data (chip );
262
-
263
250
pinctrl_free_gpio (chip -> base + offset );
264
251
265
- /* 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
266
254
* drive the GPIO pin as an output.
267
255
*/
268
256
gpio_rcar_config_general_input_output_mode (chip , offset , false);
269
-
270
- pm_runtime_put (& p -> pdev -> dev );
271
257
}
272
258
273
259
static int gpio_rcar_direction_input (struct gpio_chip * chip , unsigned offset )
@@ -414,6 +400,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
414
400
}
415
401
416
402
pm_runtime_enable (dev );
403
+ pm_runtime_get_sync (dev );
417
404
418
405
io = platform_get_resource (pdev , IORESOURCE_MEM , 0 );
419
406
irq = platform_get_resource (pdev , IORESOURCE_IRQ , 0 );
@@ -480,6 +467,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
480
467
err1 :
481
468
gpiochip_remove (gpio_chip );
482
469
err0 :
470
+ pm_runtime_put (dev );
483
471
pm_runtime_disable (dev );
484
472
return ret ;
485
473
}
@@ -490,6 +478,7 @@ static int gpio_rcar_remove(struct platform_device *pdev)
490
478
491
479
gpiochip_remove (& p -> gpio_chip );
492
480
481
+ pm_runtime_put (& pdev -> dev );
493
482
pm_runtime_disable (& pdev -> dev );
494
483
return 0 ;
495
484
}
0 commit comments