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

Commit cac8ed4b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Use mutex_trylock for core lock in trigger ssr"

parents 439300b6 20ceed07
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@
		V4L2_EVENT_MSM_VIDC_RELEASE_BUFFER_REFERENCE
#define L_MODE V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY

#define TRIGGER_SSR_LOCK_RETRIES 5

const char *const mpeg_video_vidc_extradata[] = {
	"Extradata none",
	"Extradata MB Quantization",
@@ -5305,6 +5307,7 @@ int msm_vidc_trigger_ssr(struct msm_vidc_core *core,
{
	int rc = 0;
	struct hfi_device *hdev;
	int try_lock_counter = TRIGGER_SSR_LOCK_RETRIES;

	if (!core || !core->device) {
		dprintk(VIDC_WARN, "Invalid parameters: %pK\n", core);
@@ -5312,7 +5315,13 @@ int msm_vidc_trigger_ssr(struct msm_vidc_core *core,
	}
	hdev = core->device;

	mutex_lock(&core->lock);
	while (try_lock_counter) {
		if (mutex_trylock(&core->lock))
			break;
		try_lock_counter--;
		if (!try_lock_counter)
			return -EBUSY;
	}
	if (core->state == VIDC_CORE_INIT_DONE) {
		/*
		 * In current implementation user-initiated SSR triggers
+4 −4
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
@@ -131,7 +131,7 @@ static int trigger_ssr_open(struct inode *inode, struct file *file)
static ssize_t trigger_ssr_write(struct file *filp, const char __user *buf,
		size_t count, loff_t *ppos) {
	unsigned long ssr_trigger_val = 0;
	int rc = 0;
	int rc = 0, ret = 0;
	struct msm_vidc_core *core = filp->private_data;
	size_t size = MAX_SSR_STRING_LEN;
	char kbuf[MAX_SSR_STRING_LEN + 1] = {0};
@@ -156,8 +156,8 @@ static ssize_t trigger_ssr_write(struct file *filp, const char __user *buf,
		dprintk(VIDC_WARN, "returning error err %d\n", rc);
		rc = -EINVAL;
	} else {
		msm_vidc_trigger_ssr(core, ssr_trigger_val);
		rc = count;
		ret = msm_vidc_trigger_ssr(core, ssr_trigger_val);
		rc = (ret == -EBUSY ? ret : count);
	}
exit:
	return rc;