Remove __ from topology macros
Subsystems (7)
PATCH 1/1 Remove __ from topology macros
When I originally wrote the patches implementing the in-kernel topology macros, they were meant to be called as a second layer of functions, sans underbars. This additional layer was deemed unnecessary and summarily dropped. As such, carrying around (and typing!) all these extra underbars is quite pointless. Here's a patch to nip this in the (sorta) bud. The macros only appear in 16 files so far, most of them being the definitions themselves.
[mcd@arrakis push]$ diffstat remove_underbars-2.5.59.patch
drivers/base/cpu.c | 2 +- drivers/base/memblk.c | 2 +- drivers/base/node.c | 2 +- include/asm-alpha/topology.h | 10 +++++----- include/asm-generic/topology.h | 24 ++++++++++++------------ include/asm-i386/cpu.h | 2 +- include/asm-i386/memblk.h | 2 +- include/asm-i386/node.h | 2 +- include/asm-i386/topology.h | 14 +++++++------- include/asm-ia64/topology.h | 18 +++++++++--------- include/asm-mips64/topology.h | 2 +- include/asm-ppc64/topology.h | 13 ++++--------- include/linux/mmzone.h | 2 +- kernel/sched.c | 10 +++++----- mm/page_alloc.c | 2 +- mm/vmscan.c | 2 +- 16 files changed, 52 insertions(+), 57 deletions(-)
Any objections?
Cheers!
-Matt
drivers/base/cpu.c +1 -1
@@ -35,7 +35,7 @@*/ int __init register_cpu (struct cpu *cpu,int num,struct node *root) { - cpu->node_id =__cpu_to_node (num); + cpu->node_id =cpu_to_node (num); cpu->sysdev.name ="cpu" ; cpu->sysdev.id = num;if (root)
drivers/base/memblk.c +1 -1
@@ -36,7 +36,7 @@*/ int __init register_memblk (struct memblk *memblk,int num,struct node *root) { - memblk->node_id =__memblk_to_node (num); + memblk->node_id =memblk_to_node (num); memblk->sysdev.name ="memblk" ; memblk->sysdev.id = num;if (root)
drivers/base/node.c +1 -1
@@ -72,7 +72,7 @@ {int error; - node->cpumap =__node_to_cpu_mask (num); + node->cpumap =node_to_cpumask (num); node->sysroot.id = num;if (parent) node->sysroot.dev.parent = &parent->sysroot.sysdev;
include/asm-alpha/topology.h +5 -5
@@ -6,7 +6,7 @@#include <asm/machvec.h> #ifdef CONFIG_NUMA -static inline int __cpu_to_node (int cpu) +static inline int cpu_to_node (int cpu) {int node;
@@ -23,13 +23,13 @@return node; } -static inline int __node_to_cpu_mask (int node) +static inline int node_to_cpumask (int node) {unsigned long node_cpu_mask =0 ;int cpu;for (cpu =0 ; cpu <NR_CPUS ; cpu++) { -if (cpu_online (cpu) && (__cpu_to_node (cpu) == node)) +if (cpu_online (cpu) && (cpu_to_node (cpu) == node)) node_cpu_mask |=1UL << cpu; }
@@ -40,8 +40,8 @@ return node_cpu_mask; } -# define __node_to_memblk (node) (node) -# define __memblk_to_node (memblk) (memblk) +# define node_to_memblk (node) (node) +# define memblk_to_node (memblk) (memblk)#else /* CONFIG_NUMA */ # include <asm-generic/topology.h>
include/asm-generic/topology.h +12 -12
@@ -29,23 +29,23 @@/* Other architectures wishing to use this simple topology API should fill in the below functions as appropriate in their own <asm/topology.h> file. */ -#ifndef __cpu_to_node -#define __cpu_to_node (cpu) (0) +#ifndef cpu_to_node +#define cpu_to_node (cpu) (0)#endif -#ifndef __memblk_to_node -#define __memblk_to_node (memblk) (0) +#ifndef memblk_to_node +#define memblk_to_node (memblk) (0)#endif -#ifndef __parent_node -#define __parent_node (node) (0) +#ifndef parent_node +#define parent_node (node) (0)#endif -#ifndef __node_to_first_cpu -#define __node_to_first_cpu (node) (0) +#ifndef node_to_cpumask +#define node_to_cpumask (node) (cpu_online_map)#endif -#ifndef __node_to_cpu_mask -#define __node_to_cpu_mask (node) (cpu_online_map) +#ifndef node_to_first_cpu +#define node_to_first_cpu (node) (0)#endif -#ifndef __node_to_memblk -#define __node_to_memblk (node) (0) +#ifndef node_to_memblk +#define node_to_memblk (node) (0)#endif /* Cross-node load balancing interval. */
include/asm-i386/cpu.h +1 -1
@@ -17,7 +17,7 @@struct node *parent =NULL ;#ifdef CONFIG_NUMA - parent = &node_devices[__cpu_to_node (num)].node; + parent = &node_devices[cpu_to_node (num)].node;#endif /* CONFIG_NUMA */ return register_cpu (&cpu_devices[num].cpu, num, parent);
include/asm-i386/memblk.h +1 -1
@@ -14,7 +14,7 @@extern struct i386_memblk memblk_devices[MAX_NR_MEMBLKS ];static inline int arch_register_memblk (int num){ -int p_node =__memblk_to_node (num); +int p_node =memblk_to_node (num);return register_memblk (&memblk_devices[num].memblk, num, &node_devices[p_node].node);
include/asm-i386/node.h +1 -1
@@ -13,7 +13,7 @@extern struct i386_node node_devices[MAX_NUMNODES ];static inline int arch_register_node (int num){ -int p_node =__parent_node (num); +int p_node =parent_node (num);struct node *parent =NULL ;if (p_node != num)
include/asm-i386/topology.h +7 -7
@@ -34,32 +34,32 @@extern volatile int cpu_2_node[];/* Returns the number of the node containing CPU 'cpu' */ -static inline int __cpu_to_node (int cpu) +static inline int cpu_to_node (int cpu) {return cpu_2_node[cpu]; }/* Returns the number of the node containing MemBlk 'memblk' */ -#define __memblk_to_node (memblk) (memblk) +#define memblk_to_node (memblk) (memblk)/* Returns the number of the node containing Node 'node'. This architecture is flat, so it is a pretty simple function! */ -#define __parent_node (node) (node) +#define parent_node (node) (node)/* Returns a bitmask of CPUs on Node 'node'. */ -static inline unsigned long __node_to_cpu_mask (int node) +static inline unsigned long node_to_cpumask (int node) {return node_2_cpu_mask[node]; }/* Returns the number of the first CPU on Node 'node'. */ -static inline int __node_to_first_cpu (int node) +static inline int node_to_first_cpu (int node) { -return __ffs (__node_to_cpu_mask (node)); +return __ffs (node_to_cpumask (node)); }/* Returns the number of the first MemBlk on Node 'node' */ -#define __node_to_memblk (node) (node) +#define node_to_memblk (node) (node)/* Cross-node load balancing interval. */ #define NODE_BALANCE_RATE 100
include/asm-ia64/topology.h +9 -9
@@ -21,25 +21,25 @@/* * Returns the number of the node containing CPU 'cpu' */ -#define __cpu_to_node (cpu) (int)(cpu_to_node_map[cpu]) +#define cpu_to_node (cpu) (int)(cpu_to_node_map[cpu])/* * Returns a bitmask of CPUs on Node 'node'. */ -#define __node_to_cpu_mask (node) (node_to_cpu_mask[node]) +#define node_to_cpumask (node) (node_to_cpumask[node])#else -#define __cpu_to_node (cpu) (0) -#define __node_to_cpu_mask (node) (phys_cpu_present_map) +#define cpu_to_node (cpu) (0) +#define node_to_cpumask (node) (phys_cpu_present_map)#endif /* * Returns the number of the node containing MemBlk 'memblk' */ #ifdef CONFIG_ACPI_NUMA -#define __memblk_to_node (memblk) (node_memblk[memblk].nid) +#define memblk_to_node (memblk) (node_memblk[memblk].nid)#else -#define __memblk_to_node (memblk) (memblk) +#define memblk_to_node (memblk) (memblk)#endif /*
@@ -47,18 +47,18 @@* Not implemented here. Multi-level hierarchies detected with * the help of node_distance(). */ -#define __parent_node (nid) (nid) +#define parent_node (nid) (nid)/* * Returns the number of the first CPU on Node 'node'. */ -#define __node_to_first_cpu (node) (__ffs(__node_to_cpu_mask(node))) +#define node_to_first_cpu (node) (__ffs(node_to_cpumask(node)))/* * Returns the number of the first MemBlk on Node 'node' * Should be fixed when IA64 discontigmem goes in. */ -#define __node_to_memblk (node) (node) +#define node_to_memblk (node) (node)/* Cross-node load balancing interval. */ #define NODE_BALANCE_RATE 10
include/asm-mips64/topology.h +1 -1
@@ -3,6 +3,6 @@#include <asm/mmzone.h> -#define __cpu_to_node (cpu) (cputocnode(cpu)) +#define cpu_to_node (cpu) (cputocnode(cpu))#endif /* _ASM_MIPS64_TOPOLOGY_H */
include/asm-ppc64/topology.h +4 -9
@@ -5,7 +5,7 @@#ifdef CONFIG_NUMA -static inline int __cpu_to_node (int cpu) +static inline int cpu_to_node (int cpu) {int node;
@@ -19,7 +19,7 @@return node; } -static inline int __node_to_first_cpu (int node) +static inline int node_to_first_cpu (int node) {int cpu;
@@ -31,7 +31,7 @@return -1 ; } -static inline unsigned long __node_to_cpu_mask (int node) +static inline unsigned long node_to_cpumask (int node) {int cpu;unsigned long mask =0UL ;
@@ -51,12 +51,7 @@#else /* !CONFIG_NUMA */ -#define __cpu_to_node (cpu) (0) -#define __memblk_to_node (memblk) (0) -#define __parent_node (nid) (0) -#define __node_to_first_cpu (node) (0) -#define __node_to_cpu_mask (node) (cpu_online_map) -#define __node_to_memblk (node) (0) +#include <asm-generic/topology.h> #endif /* CONFIG_NUMA */
include/linux/mmzone.h +1 -1
@@ -257,7 +257,7 @@#include <asm/topology.h> /* Returns the number of the current Node. */ -#define numa_node_id () (__cpu_to_node(smp_processor_id())) +#define numa_node_id () (cpu_to_node(smp_processor_id()))#ifndef CONFIG_DISCONTIGMEM extern struct pglist_data contig_page_data;
kernel/sched.c +5 -5
@@ -213,7 +213,7 @@int i;for (i =0 ; i <NR_CPUS ; i++) - cpu_rq(i)->node_nr_running = &node_nr_running[__cpu_to_node(i)]; + cpu_rq(i)->node_nr_running = &node_nr_running[cpu_to_node(i)]; }#else /* !CONFIG_NUMA */
@@ -715,7 +715,7 @@ } minload =10000000 ; - cpumask =__node_to_cpu_mask (node); + cpumask =node_to_cpumask (node);for (i =0 ; i <NR_CPUS ; ++i) {if (!(cpumask & (1UL << i)))continue ;
@@ -767,7 +767,7 @@static inline unsigned long cpus_to_balance (int this_cpu,runqueue_t *this_rq) { -int this_node =__cpu_to_node (this_cpu); +int this_node =cpu_to_node (this_cpu);/* * Avoid rebalancing between nodes too often. * We rebalance globally once every NODE_BALANCE_RATE load balances.
@@ -776,9 +776,9 @@int node =find_busiest_node (this_node); this_rq->nr_balanced =0 ;if (node >=0 ) - return (__node_to_cpu_mask(node) | (1UL << this_cpu)); + return (node_to_cpumask(node) | (1UL << this_cpu)); } -return __node_to_cpu_mask (this_node); +return node_to_cpumask (this_node); }#else /* !CONFIG_NUMA */
mm/page_alloc.c +1 -1
@@ -1269,7 +1269,7 @@ pgdat->node_mem_map = node_mem_map;free_area_init_core (pgdat, zones_size, zholes_size); -memblk_set_online (__node_to_memblk (nid)); +memblk_set_online (node_to_memblk (nid));calculate_zone_bitmap (pgdat, zones_size); }
mm/vmscan.c +1 -1
@@ -929,7 +929,7 @@DEFINE_WAIT (wait);daemonize (); -set_cpus_allowed (tsk,__node_to_cpu_mask (pgdat->node_id)); +set_cpus_allowed (tsk,node_to_cpumask (pgdat->node_id));sprintf (tsk->comm,"kswapd%d" , pgdat->node_id);sigfillset (&tsk->blocked);
Quoted 7 lines · Matthew Dobson
When I originally wrote the patches implementing the in-kernel topology macros, they were meant to be called as a second layer of functions, sans underbars. This additional layer was deemed unnecessary and summarily dropped. As such, carrying around (and typing!) all these extra underbars is quite pointless. Here's a patch to nip this in the (sorta) bud. The macros only appear in 16 files so far, most of them being the definitions themselves.
This eases my eyes quite a bit. Thanks.
-- wli
Quoted 1 line
When I originally wrote the patches implementing the in-kernel topology macros, they were meant to be called as a second layer of functions, sans underbars. This additional layer was deemed unnecessary and summarily dropped. As such, carrying around (and typing!) all these extra underbars is quite pointless. Here's a patch to nip this in the (sorta) bud. The macros only appear in 16 files so far, most of them being the definitions themselves.
Whee! much cleaner ;-) Very cool.
M.