hv: Fix identifier reuse

Now we have name reuse definitions in hypervisor as following:
"enum cpu_state cpu_state" in per_cpu.h,
"struct shell_cmd *shell_cmd" in shell_priv.h.
MISRAC requires that tag names shall not be reused anywhere
with in a program.So these definitions violate MISRAC rules
"identifier resue".This patch is used to fix it.

1. modify the definitions to "enum pcpu_boot_state boot_state"
and "struct shell_cmd *cmds".
2. modifty the relevant usage.

v1->v2
    update commit message to be more explicit.

v2->v3
    update the enum definition.

Tracked-On: #861
Signed-off-by: Junjun Shan <junjun.shan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
junjunshan1
2018-10-11 17:13:47 +08:00
committed by wenlingz
parent dbd9ab07e1
commit 7dd35cb72e
5 changed files with 18 additions and 18 deletions

View File

@@ -311,12 +311,12 @@ static void init_percpu_data_area(void)
"fail to get phy cpu id");
}
static void cpu_set_current_state(uint16_t pcpu_id, enum cpu_state state)
static void cpu_set_current_state(uint16_t pcpu_id, enum pcpu_boot_state state)
{
spinlock_obtain(&up_count_spinlock);
/* Check if state is initializing */
if (state == CPU_STATE_INITIALIZING) {
if (state == PCPU_STATE_INITIALIZING) {
/* Increment CPU up count */
up_count++;
@@ -325,12 +325,12 @@ static void cpu_set_current_state(uint16_t pcpu_id, enum cpu_state state)
}
/* If cpu is dead, decrement CPU up count */
if (state == CPU_STATE_DEAD) {
if (state == PCPU_STATE_DEAD) {
up_count--;
}
/* Set state for the specified CPU */
per_cpu(cpu_state, pcpu_id) = state;
per_cpu(boot_state, pcpu_id) = state;
spinlock_release(&up_count_spinlock);
}
@@ -429,7 +429,7 @@ static void bsp_boot_post(void)
cpu_xsave_init();
/* Set state for this CPU to initializing */
cpu_set_current_state(BOOT_CPU_ID, CPU_STATE_INITIALIZING);
cpu_set_current_state(BOOT_CPU_ID, PCPU_STATE_INITIALIZING);
/* Perform any necessary BSP initialization */
init_bsp();
@@ -527,7 +527,7 @@ void cpu_secondary_init(void)
* and Set state for this CPU to initializing
*/
cpu_set_current_state(get_cpu_id_from_lapic_id(get_cur_lapic_id()),
CPU_STATE_INITIALIZING);
PCPU_STATE_INITIALIZING);
bitmap_set_nolock(get_cpu_id(), &pcpu_active_bitmap);
@@ -706,7 +706,7 @@ void cpu_dead(uint16_t pcpu_id)
cache_flush_invalidate_all();
/* Set state to show CPU is dead */
cpu_set_current_state(pcpu_id, CPU_STATE_DEAD);
cpu_set_current_state(pcpu_id, PCPU_STATE_DEAD);
/* Halt the CPU */
do {