aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-coh901.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-02-21 08:31:45 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-02-22 11:59:33 -0500
commit128a06d4bb997d90158e668173a6944d376c84cb (patch)
treecbfe9ed922f93fa4132d8d6db6e3a22aeb8637fa /drivers/pinctrl/pinctrl-coh901.c
parent4ecce45dd663f6945bed7e2e06c05b5d90f3a2a1 (diff)
pinctrl: spawn U300 pinctrl from the COH901 GPIO
This solves the riddle on how the U300 pin controller shall be able to reference the struct gpio_chip even though these are two separate drivers: spawn the pinctrl child from the GPIO driver and pass in the struct gpio_chip as platform data. In the process we rename the U300 "pinmux-u300" to "pinctrl-u300" so as not to confuse. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-coh901.c')
-rw-r--r--drivers/pinctrl/pinctrl-coh901.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c
index eba232a46a82..b90c01144fea 100644
--- a/drivers/pinctrl/pinctrl-coh901.c
+++ b/drivers/pinctrl/pinctrl-coh901.c
@@ -705,7 +705,6 @@ static inline void u300_gpio_free_ports(struct u300_gpio *gpio)
705 list_for_each_safe(p, n, &gpio->port_list) { 705 list_for_each_safe(p, n, &gpio->port_list) {
706 port = list_entry(p, struct u300_gpio_port, node); 706 port = list_entry(p, struct u300_gpio_port, node);
707 list_del(&port->node); 707 list_del(&port->node);
708 free_irq(port->irq, port);
709 kfree(port); 708 kfree(port);
710 } 709 }
711} 710}
@@ -861,10 +860,18 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
861 goto err_no_chip; 860 goto err_no_chip;
862 } 861 }
863 862
863 /* Spawn pin controller device as child of the GPIO, pass gpio chip */
864 plat->pinctrl_device->dev.platform_data = &gpio->chip;
865 err = platform_device_register(plat->pinctrl_device);
866 if (err)
867 goto err_no_pinctrl;
868
864 platform_set_drvdata(pdev, gpio); 869 platform_set_drvdata(pdev, gpio);
865 870
866 return 0; 871 return 0;
867 872
873err_no_pinctrl:
874 err = gpiochip_remove(&gpio->chip);
868err_no_chip: 875err_no_chip:
869err_no_port: 876err_no_port:
870 u300_gpio_free_ports(gpio); 877 u300_gpio_free_ports(gpio);
@@ -919,7 +926,6 @@ static struct platform_driver u300_gpio_driver = {
919 .remove = __exit_p(u300_gpio_remove), 926 .remove = __exit_p(u300_gpio_remove),
920}; 927};
921 928
922
923static int __init u300_gpio_init(void) 929static int __init u300_gpio_init(void)
924{ 930{
925 return platform_driver_probe(&u300_gpio_driver, u300_gpio_probe); 931 return platform_driver_probe(&u300_gpio_driver, u300_gpio_probe);