Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75811b7d authored by Paras Nagda's avatar Paras Nagda Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: remove redundant init_completion() calls



Video driver is doing init_completion() for all completion
events in msm_vidc_initialize_core() and msm_vidc_open().
So there is no need of calling init_completion() again before
waiting for completion event and hence remove them.

Change-Id: Iedd9c4c0763c29b26e91e261d9a8d0e4e24b7bb2
Signed-off-by: default avatarMaheshwar Ajja <majja@codeaurora.org>
Signed-off-by: default avatarParas Nagda <pnagda@codeaurora.org>
parent 80922117
Loading
Loading
Loading
Loading
+1 −21
Original line number Diff line number Diff line
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2447,7 +2447,6 @@ static int msm_comm_session_abort(struct msm_vidc_inst *inst)
	}
	hdev = inst->core->device;
	abort_completion = SESSION_MSG_INDEX(HAL_SESSION_ABORT_DONE);
	init_completion(&inst->completions[abort_completion]);

	rc = call_hfi_op(hdev, session_abort, (void *)inst->session);
	if (rc) {
@@ -2606,8 +2605,6 @@ static int msm_comm_init_core(struct msm_vidc_inst *inst)
			__func__);
	}

	init_completion(&core->completions
			[SYS_MSG_INDEX(HAL_SYS_INIT_DONE)]);
	rc = call_hfi_op(hdev, core_init, hdev->hfi_device_data);
	if (rc) {
		dprintk(VIDC_ERR, "Failed to init core, id = %d\n",
@@ -2711,8 +2708,6 @@ static int msm_comm_session_init(int flipped_state,
		dprintk(VIDC_ERR, "Invalid session\n");
		return -EINVAL;
	}
	init_completion(
		&inst->completions[SESSION_MSG_INDEX(HAL_SESSION_INIT_DONE)]);

	rc = call_hfi_op(hdev, session_init, hdev->hfi_device_data,
			inst, get_hal_domain(inst->session_type),
@@ -2850,8 +2845,6 @@ static int msm_vidc_start(int flipped_state, struct msm_vidc_inst *inst)
			inst, inst->state);
		goto exit;
	}
	init_completion(
		&inst->completions[SESSION_MSG_INDEX(HAL_SESSION_START_DONE)]);
	rc = call_hfi_op(hdev, session_start, (void *) inst->session);
	if (rc) {
		dprintk(VIDC_ERR,
@@ -2881,8 +2874,6 @@ static int msm_vidc_stop(int flipped_state, struct msm_vidc_inst *inst)
		goto exit;
	}
	dprintk(VIDC_DBG, "Send Stop to hal\n");
	init_completion(
		&inst->completions[SESSION_MSG_INDEX(HAL_SESSION_STOP_DONE)]);
	rc = call_hfi_op(hdev, session_stop, (void *) inst->session);
	if (rc) {
		dprintk(VIDC_ERR, "Failed to send stop\n");
@@ -2912,8 +2903,6 @@ static int msm_vidc_release_res(int flipped_state, struct msm_vidc_inst *inst)
	}
	dprintk(VIDC_DBG,
		"Send release res to hal\n");
	init_completion(&inst->completions[
			SESSION_MSG_INDEX(HAL_SESSION_RELEASE_RESOURCE_DONE)]);
	rc = call_hfi_op(hdev, session_release_res, (void *) inst->session);
	if (rc) {
		dprintk(VIDC_ERR,
@@ -2944,8 +2933,6 @@ static int msm_comm_session_close(int flipped_state,
	}
	dprintk(VIDC_DBG,
		"Send session close to hal\n");
	init_completion(
		&inst->completions[SESSION_MSG_INDEX(HAL_SESSION_END_DONE)]);
	rc = call_hfi_op(hdev, session_end, (void *) inst->session);
	if (rc) {
		dprintk(VIDC_ERR,
@@ -3983,8 +3970,6 @@ int msm_comm_try_get_prop(struct msm_vidc_inst *inst, enum hal_property ptype,
	}
	mutex_unlock(&inst->sync_lock);

	init_completion(&inst->completions[
			SESSION_MSG_INDEX(HAL_SESSION_PROPERTY_INFO)]);
	switch (ptype) {
	case HAL_PARAM_PROFILE_LEVEL_CURRENT:
	case HAL_CONFIG_VDEC_ENTROPY:
@@ -4208,8 +4193,6 @@ int msm_comm_release_scratch_buffers(struct msm_vidc_inst *inst,
		if (inst->state != MSM_VIDC_CORE_INVALID &&
				core->state != VIDC_CORE_INVALID) {
			buffer_info.response_required = true;
			init_completion(&inst->completions[SESSION_MSG_INDEX
			   (HAL_SESSION_RELEASE_BUFFER_DONE)]);
			rc = call_hfi_op(hdev, session_release_buffers,
				(void *)inst->session, &buffer_info);
			if (rc) {
@@ -4280,9 +4263,6 @@ int msm_comm_release_persist_buffers(struct msm_vidc_inst *inst)
		if (inst->state != MSM_VIDC_CORE_INVALID &&
				core->state != VIDC_CORE_INVALID) {
			buffer_info.response_required = true;
			init_completion(
			   &inst->completions[SESSION_MSG_INDEX
			   (HAL_SESSION_RELEASE_BUFFER_DONE)]);
			rc = call_hfi_op(hdev, session_release_buffers,
				(void *)inst->session, &buffer_info);
			if (rc) {
+1 −6
Original line number Diff line number Diff line
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -937,8 +937,6 @@ err_create_pkt:
	return rc;
}

static DECLARE_COMPLETION(release_resources_done);

static int __alloc_imem(struct venus_hfi_device *device, unsigned long size)
{
	struct imem *imem = NULL;
@@ -2158,8 +2156,6 @@ static int venus_hfi_core_init(void *device)
	dev = device;
	mutex_lock(&dev->lock);

	init_completion(&release_resources_done);

	rc = __load_fw(dev);
	if (rc) {
		dprintk(VIDC_ERR, "Failed to load Venus FW\n");
@@ -3461,7 +3457,6 @@ static int __response_handler(struct venus_hfi_device *device)
			break;
		case HAL_SYS_RELEASE_RESOURCE_DONE:
			dprintk(VIDC_DBG, "Received SYS_RELEASE_RESOURCE\n");
			complete(&release_resources_done);
			break;
		case HAL_SYS_INIT_DONE:
			dprintk(VIDC_DBG, "Received SYS_INIT_DONE\n");