thermal: armada: fix formula documentation comment
[linux-2.6-block.git] / include / linux / node.h
CommitLineData
1da177e4
LT
1/*
2 * include/linux/node.h - generic node definition
3 *
4 * This is mainly for topological representation. We define the
5 * basic 'struct node' here, which can be embedded in per-arch
6 * definitions of processors.
7 *
8 * Basic handling of the devices is done in drivers/base/node.c
9 * and system devices are handled in drivers/base/sys.c.
10 *
11 * Nodes are exported via driverfs in the class/node/devices/
12 * directory.
1da177e4
LT
13 */
14#ifndef _LINUX_NODE_H_
15#define _LINUX_NODE_H_
16
10fbcf4c 17#include <linux/device.h>
1da177e4 18#include <linux/cpumask.h>
39da08cb 19#include <linux/workqueue.h>
1da177e4
LT
20
21struct node {
10fbcf4c 22 struct device dev;
39da08cb
LS
23
24#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
25 struct work_struct node_work;
26#endif
1da177e4
LT
27};
28
c04fc586 29struct memory_block;
8732794b 30extern struct node *node_devices[];
9a305230 31typedef void (*node_registration_func_t)(struct node *);
0fc44159 32
9037a993
MH
33#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA)
34extern int link_mem_sections(int nid, unsigned long start_pfn, unsigned long nr_pages);
35#else
36static inline int link_mem_sections(int nid, unsigned long start_pfn, unsigned long nr_pages)
37{
38 return 0;
39}
40#endif
41
4b45099b 42extern void unregister_node(struct node *node);
36920e06 43#ifdef CONFIG_NUMA
9037a993
MH
44/* Core of the node registration - only memory hotplug should use this */
45extern int __register_one_node(int nid);
46
47/* Registers an online node */
48static inline int register_one_node(int nid)
49{
50 int error = 0;
51
52 if (node_online(nid)) {
53 struct pglist_data *pgdat = NODE_DATA(nid);
54
55 error = __register_one_node(nid);
56 if (error)
57 return error;
58 /* link memory sections under this node */
59 error = link_mem_sections(nid, pgdat->node_start_pfn, pgdat->node_spanned_pages);
60 }
61
62 return error;
63}
64
0fc44159 65extern void unregister_one_node(int nid);
76b67ed9
KH
66extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
67extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
c04fc586
GH
68extern int register_mem_sect_under_node(struct memory_block *mem_blk,
69 int nid);
d3360164
NF
70extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
71 unsigned long phys_index);
9a305230
LS
72
73#ifdef CONFIG_HUGETLBFS
74extern void register_hugetlbfs_with_node(node_registration_func_t doregister,
75 node_registration_func_t unregister);
76#endif
76b67ed9 77#else
9037a993
MH
78static inline int __register_one_node(int nid)
79{
80 return 0;
81}
36920e06
KH
82static inline int register_one_node(int nid)
83{
84 return 0;
85}
86static inline int unregister_one_node(int nid)
87{
88 return 0;
89}
76b67ed9
KH
90static inline int register_cpu_under_node(unsigned int cpu, unsigned int nid)
91{
92 return 0;
93}
94static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
95{
96 return 0;
97}
c04fc586
GH
98static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
99 int nid)
100{
101 return 0;
102}
d3360164
NF
103static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
104 unsigned long phys_index)
c04fc586
GH
105{
106 return 0;
107}
9a305230
LS
108
109static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
110 node_registration_func_t unreg)
111{
112}
76b67ed9 113#endif
1da177e4 114
10fbcf4c 115#define to_node(device) container_of(device, struct node, dev)
1da177e4
LT
116
117#endif /* _LINUX_NODE_H_ */