aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2012-08-01 03:27:38 -0400
committerPaul Mundt <lethal@linux-sh.org>2012-08-01 03:27:38 -0400
commit1e32dfe323d156d5d7b25b9feffe015d19713db2 (patch)
treef68b06588fa03582565ae810dc4445fc5d73edfa /drivers
parent92f53a85db3730ae088aaeb7900f85909fd1eda6 (diff)
sh: pfc: Fix up init ordering mess.
Commit ca5481c68e9fbcea62bb3c78ae6cccf99ca8fb73 ("sh: pfc: Rudimentary pinctrl-backed GPIO support.") introduced a regression for platforms that were doing early GPIO API calls (from arch_initcall() or earlier), leading to a situation where our two-stage registration logic would trip itself up and we'd -ENODEV out of the pinctrl registration path, resulting in endless -EPROBE_DEFER errors. Further lack of checking any sort of errors from gpio_request() resulted in boot time warnings, tripping on the FLAG_REQUESTED test-and-set in gpio_ensure_requested(). As it turns out there's no particular need to bother with the two-stage registration, as the platform bus is already available at the point that we have to start caring. As such, it's easiest to simply fold these together in to a single init path, the ordering of which is ensured through the platform's mux registration, as usual. Reported-by: Rafael J. Wysocki <rjw@sisk.pl> Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/sh/pfc/pinctrl.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/sh/pfc/pinctrl.c b/drivers/sh/pfc/pinctrl.c
index 814b29255aef..2804eaae804e 100644
--- a/drivers/sh/pfc/pinctrl.c
+++ b/drivers/sh/pfc/pinctrl.c
@@ -325,20 +325,6 @@ static struct pinctrl_desc sh_pfc_pinctrl_desc = {
325 .confops = &sh_pfc_pinconf_ops, 325 .confops = &sh_pfc_pinconf_ops,
326}; 326};
327 327
328int sh_pfc_register_pinctrl(struct sh_pfc *pfc)
329{
330 sh_pfc_pmx = kzalloc(sizeof(struct sh_pfc_pinctrl), GFP_KERNEL);
331 if (unlikely(!sh_pfc_pmx))
332 return -ENOMEM;
333
334 spin_lock_init(&sh_pfc_pmx->lock);
335
336 sh_pfc_pmx->pfc = pfc;
337
338 return 0;
339}
340EXPORT_SYMBOL_GPL(sh_pfc_register_pinctrl);
341
342static inline void __devinit sh_pfc_map_one_gpio(struct sh_pfc *pfc, 328static inline void __devinit sh_pfc_map_one_gpio(struct sh_pfc *pfc,
343 struct sh_pfc_pinctrl *pmx, 329 struct sh_pfc_pinctrl *pmx,
344 struct pinmux_gpio *gpio, 330 struct pinmux_gpio *gpio,
@@ -505,7 +491,7 @@ static struct platform_device sh_pfc_pinctrl_device = {
505 .id = -1, 491 .id = -1,
506}; 492};
507 493
508static int __init sh_pfc_pinctrl_init(void) 494static int sh_pfc_pinctrl_init(void)
509{ 495{
510 int rc; 496 int rc;
511 497
@@ -519,10 +505,22 @@ static int __init sh_pfc_pinctrl_init(void)
519 return rc; 505 return rc;
520} 506}
521 507
508int sh_pfc_register_pinctrl(struct sh_pfc *pfc)
509{
510 sh_pfc_pmx = kzalloc(sizeof(struct sh_pfc_pinctrl), GFP_KERNEL);
511 if (unlikely(!sh_pfc_pmx))
512 return -ENOMEM;
513
514 spin_lock_init(&sh_pfc_pmx->lock);
515
516 sh_pfc_pmx->pfc = pfc;
517
518 return sh_pfc_pinctrl_init();
519}
520EXPORT_SYMBOL_GPL(sh_pfc_register_pinctrl);
521
522static void __exit sh_pfc_pinctrl_exit(void) 522static void __exit sh_pfc_pinctrl_exit(void)
523{ 523{
524 platform_driver_unregister(&sh_pfc_pinctrl_driver); 524 platform_driver_unregister(&sh_pfc_pinctrl_driver);
525} 525}
526
527subsys_initcall(sh_pfc_pinctrl_init);
528module_exit(sh_pfc_pinctrl_exit); 526module_exit(sh_pfc_pinctrl_exit);