/* * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp. * * and Arnd Bergmann, IBM Corp. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * */ #undef DEBUG #include #include #include #include #include #include #include #include #include #include #include #include struct bus_type of_platform_bus_type = { .uevent = of_device_uevent, }; EXPORT_SYMBOL(of_platform_bus_type); static int __init of_bus_driver_init(void) { return of_bus_type_init(&of_platform_bus_type, "of_platform"); } postcore_initcall(of_bus_driver_init); /* * The list of OF IDs below is used for matching bus types in the * system whose devices are to be exposed as of_platform_devices. * * This is the default list valid for most platforms. This file provides * functions who can take an explicit list if necessary though * * The search is always performed recursively looking for children of * the provided device_node and recursively if such a children matches * a bus type in the list */ const struct of_device_id of_default_bus_ids[] = { { .type = "soc", }, { .compatible = "soc", }, { .type = "plb5", }, { .type = "plb4", }, { .type = "opb", }, { .type = "simple", }, {}, }; static int of_dev_node_match(struct device *dev, void *data) { return to_of_device(dev)->dev.of_node == data; } struct of_device *of_find_device_by_node(struct device_node *np) { struct device *dev; dev = bus_find_device(&of_platform_bus_type, NULL, np, of_dev_node_match); if (dev) return to_of_device(dev); return NULL; } EXPORT_SYMBOL(of_find_device_by_node);