Merge tag 'usb-serial-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/johan...
[linux/fpc-iii.git] / drivers / staging / board / board.c
blobd5a6abc845191c939e7116699511b92bf5e6976f
1 #include <linux/init.h>
2 #include <linux/device.h>
3 #include <linux/kernel.h>
4 #include <linux/of.h>
5 #include <linux/of_address.h>
6 #include "board.h"
8 static bool find_by_address(u64 base_address)
10 struct device_node *dn = of_find_all_nodes(NULL);
11 struct resource res;
13 while (dn) {
14 if (!of_address_to_resource(dn, 0, &res)) {
15 if (res.start == base_address) {
16 of_node_put(dn);
17 return true;
20 dn = of_find_all_nodes(dn);
23 return false;
26 bool __init board_staging_dt_node_available(const struct resource *resource,
27 unsigned int num_resources)
29 unsigned int i;
31 for (i = 0; i < num_resources; i++) {
32 const struct resource *r = resource + i;
34 if (resource_type(r) == IORESOURCE_MEM)
35 if (find_by_address(r->start))
36 return true; /* DT node available */
39 return false; /* Nothing found */