powerpc/kprobes: Remove kretprobe_trampoline_holder.
[linux/fpc-iii.git] / drivers / usb / core / of.c
blob2289700c31d6e2fb3fd55e58280a32a48a676703
1 /*
2 * of.c The helpers for hcd device tree support
4 * Copyright (C) 2016 Freescale Semiconductor, Inc.
5 * Author: Peter Chen <peter.chen@freescale.com>
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 of
9 * the License as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <linux/of.h>
22 /**
23 * usb_of_get_child_node - Find the device node match port number
24 * @parent: the parent device node
25 * @portnum: the port number which device is connecting
27 * Find the node from device tree according to its port number.
29 * Return: On success, a pointer to the device node, %NULL on failure.
31 struct device_node *usb_of_get_child_node(struct device_node *parent,
32 int portnum)
34 struct device_node *node;
35 u32 port;
37 for_each_child_of_node(parent, node) {
38 if (!of_property_read_u32(node, "reg", &port)) {
39 if (port == portnum)
40 return node;
44 return NULL;
46 EXPORT_SYMBOL_GPL(usb_of_get_child_node);