staging: vc04_services: Get rid of the rest of suspend/resume state handling
authorNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Fri, 31 Jan 2020 10:38:33 +0000 (11:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Feb 2020 00:23:01 +0000 (16:23 -0800)
The only remaining state doesn't provide any information anymore nor the
completion that depends on it, which is set to complete_all() before any
user may wait on it.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200131103836.14312-18-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h

index cee643a..e753ccf 100644 (file)
 int vchiq_arm_log_level = VCHIQ_LOG_DEFAULT;
 int vchiq_susp_log_level = VCHIQ_LOG_ERROR;
 
-#define VC_RESUME_NUM_OFFSET 1 /* number of values before idle which are -ve */
-static const char *const resume_state_names[] = {
-       "VC_RESUME_RESUMED"
-};
 /* The number of times we allow force suspend to timeout before actually
 ** _forcing_ suspend.  This is to cater for SW which fails to release vchiq
 ** correctly - we don't want to prevent ARM suspend indefinitely in this case.
@@ -2342,11 +2338,6 @@ vchiq_arm_init_state(struct vchiq_state *state,
                atomic_set(&arm_state->ka_use_ack_count, 0);
                atomic_set(&arm_state->ka_release_count, 0);
 
-               init_completion(&arm_state->vc_resume_complete);
-               /* Initialise to 'done' state.  We only want to block on resume
-                * completion while videocore is suspended. */
-               set_resume_state(arm_state, VC_RESUME_RESUMED);
-
                arm_state->state = state;
                arm_state->first_connect = 0;
 
@@ -2355,24 +2346,6 @@ vchiq_arm_init_state(struct vchiq_state *state,
 }
 
 void
-set_resume_state(struct vchiq_arm_state *arm_state,
-                enum vc_resume_status new_state)
-{
-       /* set the state in all cases */
-       arm_state->vc_resume_state = new_state;
-
-       /* state specific additional actions */
-       switch (new_state) {
-       case VC_RESUME_RESUMED:
-               complete_all(&arm_state->vc_resume_complete);
-               break;
-       default:
-               BUG();
-               break;
-       }
-}
-
-void
 vchiq_platform_check_suspend(struct vchiq_state *state)
 {
        struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
@@ -2427,22 +2400,6 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
 
        write_unlock_bh(&arm_state->susp_res_lock);
 
-       /* Completion is in a done state when we're not suspended, so this won't
-        * block for the non-suspended case. */
-       if (!try_wait_for_completion(&arm_state->vc_resume_complete)) {
-               vchiq_log_info(vchiq_susp_log_level, "%s %s wait for resume",
-                       __func__, entity);
-               if (wait_for_completion_killable(
-                               &arm_state->vc_resume_complete)) {
-                       vchiq_log_error(vchiq_susp_log_level, "%s %s wait for "
-                               "resume interrupted", __func__, entity);
-                       ret = VCHIQ_ERROR;
-                       goto out;
-               }
-               vchiq_log_info(vchiq_susp_log_level, "%s %s resumed", __func__,
-                       entity);
-       }
-
        if (ret == VCHIQ_SUCCESS) {
                enum vchiq_status status = VCHIQ_SUCCESS;
                long ack_cnt = atomic_xchg(&arm_state->ka_use_ack_count, 0);
@@ -2634,7 +2591,6 @@ vchiq_dump_service_use_state(struct vchiq_state *state)
        int only_nonzero = 0;
        static const char *nz = "<-- preventing suspend";
 
-       enum vc_resume_status  vc_resume_state;
        int peer_count;
        int vc_use_count;
        int active_services;
@@ -2648,7 +2604,6 @@ vchiq_dump_service_use_state(struct vchiq_state *state)
                return;
 
        read_lock_bh(&arm_state->susp_res_lock);
-       vc_resume_state  = arm_state->vc_resume_state;
        peer_count = arm_state->peer_use_count;
        vc_use_count = arm_state->videocore_use_count;
        active_services = state->unused_service;
@@ -2677,13 +2632,6 @@ vchiq_dump_service_use_state(struct vchiq_state *state)
 
        read_unlock_bh(&arm_state->susp_res_lock);
 
-       vchiq_log_warning(vchiq_susp_log_level,
-               "-- Videcore suspend state: %s --",
-               suspend_state_names[vc_suspend_state + VC_SUSPEND_NUM_OFFSET]);
-       vchiq_log_warning(vchiq_susp_log_level,
-               "-- Videcore resume state: %s --",
-               resume_state_names[vc_resume_state + VC_RESUME_NUM_OFFSET]);
-
        if (only_nonzero)
                vchiq_log_warning(vchiq_susp_log_level, "Too many active "
                        "services (%d).  Only dumping up to first %d services "
index b1fad28..54c8796 100644 (file)
 #include "vchiq_core.h"
 #include "vchiq_debugfs.h"
 
-enum vc_resume_status {
-       VC_RESUME_RESUMED      /* Videocore resumed successfully (active) */
-};
-
 enum USE_TYPE_E {
        USE_TYPE_SERVICE,
        USE_TYPE_SERVICE_NO_RESUME,
@@ -32,10 +28,7 @@ struct vchiq_arm_state {
        atomic_t ka_use_ack_count;
        atomic_t ka_release_count;
 
-       struct completion vc_resume_complete;
-
        rwlock_t susp_res_lock;
-       enum vc_resume_status vc_resume_state;
 
        struct vchiq_state *state;
 
@@ -122,8 +115,4 @@ vchiq_instance_get_trace(struct vchiq_instance *instance);
 extern void
 vchiq_instance_set_trace(struct vchiq_instance *instance, int trace);
 
-extern void
-set_resume_state(struct vchiq_arm_state *arm_state,
-                enum vc_resume_status new_state);
-
 #endif /* VCHIQ_ARM_H */