staging: vchiq_core: Simplify VCHIQ init
authorStefan Wahren <stefan.wahren@i2se.com>
Thu, 25 May 2017 22:26:19 +0000 (00:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 May 2017 15:02:30 +0000 (17:02 +0200)
Since the ARM side of VCHIQ support only 1 state, we could simplify
the init code. This makes it possible to avoid BUG_ON and a theoretical
overflow of id.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c

index 6b24651e9eea244d5ee135782bfef23d5efe65b5..c47de9692c8c72db6bcbdb7e49b4b3d98b8854fe 100644 (file)
@@ -2349,7 +2349,6 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero,
        VCHIQ_SHARED_STATE_T *remote;
        VCHIQ_STATUS_T status;
        char threadname[16];
-       static int id;
        int i;
 
        vchiq_log_warning(vchiq_core_log_level,
@@ -2437,7 +2436,6 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero,
 
        memset(state, 0, sizeof(VCHIQ_STATE_T));
 
-       state->id = id++;
        state->is_master = is_master;
 
        /*
@@ -2556,8 +2554,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero,
        set_user_nice(state->sync_thread, -20);
        wake_up_process(state->sync_thread);
 
-       BUG_ON(state->id >= VCHIQ_MAX_STATES);
-       vchiq_states[state->id] = state;
+       vchiq_states[0] = state;
 
        /* Indicate readiness to the other side */
        local->initialised = 1;