Skip to content

Commit

Permalink
of: implement of_node_to_nid as a weak function
Browse files Browse the repository at this point in the history
Implement of_node_to_nid as weak function to remove the dependency on
asm/prom.h. This is in preparation to make prom.h optional.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Grant Likely <grant.likely@linaro.org>
  • Loading branch information
Rob Herring committed Oct 10, 2013
1 parent 25ff794 commit 0c3f061
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
7 changes: 0 additions & 7 deletions arch/powerpc/include/asm/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ extern void kdump_move_device_tree(void);
/* cache lookup */
struct device_node *of_find_next_cache_node(struct device_node *np);

#ifdef CONFIG_NUMA
extern int of_node_to_nid(struct device_node *device);
#else
static inline int of_node_to_nid(struct device_node *device) { return 0; }
#endif
#define of_node_to_nid of_node_to_nid

extern void of_instantiate_rtc(void);

extern int of_get_ibm_chip_id(struct device_node *np);
Expand Down
4 changes: 0 additions & 4 deletions arch/sparc/include/asm/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ extern int of_getintprop_default(struct device_node *np,
const char *name,
int def);
extern int of_find_in_proplist(const char *list, const char *match, int len);
#ifdef CONFIG_NUMA
extern int of_node_to_nid(struct device_node *dp);
#define of_node_to_nid of_node_to_nid
#endif

extern void prom_build_devicetree(void);
extern void of_populate_present_mask(void);
Expand Down
7 changes: 7 additions & 0 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ int of_n_size_cells(struct device_node *np)
}
EXPORT_SYMBOL(of_n_size_cells);

#ifdef CONFIG_NUMA
int __weak of_node_to_nid(struct device_node *np)
{
return numa_node_id();
}
#endif

#if defined(CONFIG_OF_DYNAMIC)
/**
* of_node_get - Increment refcount of a node
Expand Down
11 changes: 4 additions & 7 deletions include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,10 @@ static inline const char *of_prop_next_string(struct property *prop,
#define of_match_node(_matches, _node) NULL
#endif /* CONFIG_OF */

#ifndef of_node_to_nid
static inline int of_node_to_nid(struct device_node *np)
{
return numa_node_id();
}

#define of_node_to_nid of_node_to_nid
#if defined(CONFIG_OF) && defined(CONFIG_NUMA)
extern int of_node_to_nid(struct device_node *np);
#else
static inline int of_node_to_nid(struct device_node *device) { return 0; }
#endif

/**
Expand Down

0 comments on commit 0c3f061

Please sign in to comment.