Skip to content

Commit

Permalink
powerpc: Turn get/set_hard_smp_proccessor_id into inlines
Browse files Browse the repository at this point in the history
They don't need to be macros, and having them as inline functions
avoids warnings about unused variables on some configurations when the
argument isn't evaluated.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Benjamin Herrenschmidt authored and Paul Mackerras committed Aug 20, 2008
1 parent f3d3d30 commit 41eba0a
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions arch/powerpc/include/asm/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,16 @@ extern int smp_hw_index[];

#define raw_smp_processor_id() (current_thread_info()->cpu)
#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
#define get_hard_smp_processor_id(cpu) (smp_hw_index[(cpu)])
#define set_hard_smp_processor_id(cpu, phys)\
(smp_hw_index[(cpu)] = (phys))

static inline int get_hard_smp_processor_id(int cpu)
{
return smp_hw_index[cpu];
}

static inline void set_hard_smp_processor_id(int cpu, int phys)
{
smp_hw_index[cpu] = phys;
}
#endif

DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
Expand Down Expand Up @@ -92,20 +99,32 @@ extern void __cpu_die(unsigned int cpu);
#endif /* CONFIG_SMP */

#ifdef CONFIG_PPC64
#define get_hard_smp_processor_id(CPU) (paca[(CPU)].hw_cpu_id)
#define set_hard_smp_processor_id(CPU, VAL) \
do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0)
static inline int get_hard_smp_processor_id(int cpu)
{
return paca[cpu].hw_cpu_id;
}

static inline void set_hard_smp_processor_id(int cpu, int phys)
{
paca[cpu].hw_cpu_id = phys;
}

extern void smp_release_cpus(void);

#else
/* 32-bit */
#ifndef CONFIG_SMP
extern int boot_cpuid_phys;
#define get_hard_smp_processor_id(cpu) boot_cpuid_phys
#define set_hard_smp_processor_id(cpu, phys)
#endif
#endif
static inline int get_hard_smp_processor_id(int cpu)
{
return boot_cpuid_phys;
}

static inline void set_hard_smp_processor_id(int cpu, int phys)
{
}
#endif /* !CONFIG_SMP */
#endif /* !CONFIG_PPC64 */

extern int smt_enabled_at_boot;

Expand Down

0 comments on commit 41eba0a

Please sign in to comment.