66 lines
1.7 KiB
C
66 lines
1.7 KiB
C
/*
|
|
* Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
|
|
* <benh@kernel.crashing.org>
|
|
* 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 <linux/string.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/module.h>
|
|
#include <linux/mod_devicetable.h>
|
|
#include <linux/pci.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_device.h>
|
|
#include <linux/of_platform.h>
|
|
|
|
#include <linux/errno.h>
|
|
#include <linux/topology.h>
|
|
#include <asm/atomic.h>
|
|
|
|
/*
|
|
* 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(&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);
|