On Wed, Jan 7, 2015 at 1:29 AM, Arnd Bergmann <arnd@xxxxxxxx> wrote: > On Tuesday 06 January 2015 14:55:53 Ganapatrao Kulkarni wrote: >> On Sat, Jan 3, 2015 at 2:40 AM, Arnd Bergmann <arnd@xxxxxxxx> wrote: >> >> +int dt_get_cpu_node_id(int cpu) >> >> +{ >> >> + struct device_node *dn = NULL; >> >> + >> >> + while ((dn = of_find_node_by_type(dn, "cpu"))) { >> >> + const u32 *cell; >> >> + u64 hwid; >> >> + >> >> + /* >> >> + * A cpu node with missing "reg" property is >> >> + * considered invalid to build a cpu_logical_map >> >> + * entry. >> >> + */ >> >> + cell = of_get_property(dn, "reg", NULL); >> >> + if (!cell) { >> >> + pr_err("%s: missing reg property\n", dn->full_name); >> >> + return default_nid; >> >> + } >> >> + hwid = of_read_number(cell, of_n_addr_cells(dn)); >> >> + >> >> + if (cpu_logical_map(cpu) == hwid) >> >> + return of_node_to_nid_single(dn); >> >> + } >> >> + return NUMA_NO_NODE; >> >> +} >> >> +EXPORT_SYMBOL(dt_get_cpu_node_id); >> > >> > Maybe just expose a function to the device node for a CPU ID here, and >> > expect callers to use of_node_to_nid? >> shall i make this wrapper function in dt_numa.c, which will use >> functions _of_node_to_nid and _of_cpu_to_node(cpu) > > Yes, I guess that would work. > >> And, this function can be a weak function in numa.c which returns 0. > > No, please don't use weak functions. You can either use IS_ENABLED() > tricks to remove function calls at compile-time, or in the header > file provide an inline function as an alternative to the extern > declaration, based on a configuration symbol. ok > > Arnd thanks ganaapat -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html