regulator: ltc3589: Staticize ltc3589_reg_defaults
[firefly-linux-kernel-4.4.55.git] / drivers / usb / musb / musb_am335x.c
1 #include <linux/platform_device.h>
2 #include <linux/pm_runtime.h>
3 #include <linux/module.h>
4 #include <linux/of_platform.h>
5
6 static int am335x_child_probe(struct platform_device *pdev)
7 {
8         int ret;
9
10         pm_runtime_enable(&pdev->dev);
11
12         ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
13         if (ret)
14                 goto err;
15
16         return 0;
17 err:
18         pm_runtime_disable(&pdev->dev);
19         return ret;
20 }
21
22 static int of_remove_populated_child(struct device *dev, void *d)
23 {
24         struct platform_device *pdev = to_platform_device(dev);
25
26         of_device_unregister(pdev);
27         return 0;
28 }
29
30 static int am335x_child_remove(struct platform_device *pdev)
31 {
32         device_for_each_child(&pdev->dev, NULL, of_remove_populated_child);
33         pm_runtime_disable(&pdev->dev);
34         return 0;
35 }
36
37 static const struct of_device_id am335x_child_of_match[] = {
38         { .compatible = "ti,am33xx-usb" },
39         {  },
40 };
41 MODULE_DEVICE_TABLE(of, am335x_child_of_match);
42
43 static struct platform_driver am335x_child_driver = {
44         .probe          = am335x_child_probe,
45         .remove         = am335x_child_remove,
46         .driver         = {
47                 .name   = "am335x-usb-childs",
48                 .of_match_table = am335x_child_of_match,
49         },
50 };
51
52 module_platform_driver(am335x_child_driver);
53 MODULE_DESCRIPTION("AM33xx child devices");
54 MODULE_LICENSE("GPL v2");