Commit b74196e7 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab
Browse files

media: atomisp: remove force argument from __destroy_[stream[s]|pipe[s]]()

The force argument to the __destroy_pipe[s]() and __destroy_stream[s]()
functions is always true. Remove the argument and remove the code necessary
to handle the false case.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-40-hdegoede@redhat.com


Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 1341bc9e
Loading
Loading
Loading
Loading
+11 −23
Original line number Diff line number Diff line
@@ -418,24 +418,14 @@ static void __dump_stream_config(struct atomisp_sub_device *asd,
}

static int __destroy_stream(struct atomisp_sub_device *asd,
			    struct atomisp_stream_env *stream_env, bool force)
			    struct atomisp_stream_env *stream_env)
{
	struct atomisp_device *isp = asd->isp;
	int i;
	unsigned long timeout;

	if (!stream_env->stream)
		return 0;

	if (!force) {
		for (i = 0; i < IA_CSS_PIPE_ID_NUM; i++)
			if (stream_env->update_pipe[i])
				break;

		if (i == IA_CSS_PIPE_ID_NUM)
			return 0;
	}

	if (stream_env->stream_state == CSS_STREAM_STARTED
	    && ia_css_stream_stop(stream_env->stream) != 0) {
		dev_err(isp->dev, "stop stream failed.\n");
@@ -469,12 +459,12 @@ static int __destroy_stream(struct atomisp_sub_device *asd,
	return 0;
}

static int __destroy_streams(struct atomisp_sub_device *asd, bool force)
static int __destroy_streams(struct atomisp_sub_device *asd)
{
	int ret, i;

	for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) {
		ret = __destroy_stream(asd, &asd->stream_env[i], force);
		ret = __destroy_stream(asd, &asd->stream_env[i]);
		if (ret)
			return ret;
	}
@@ -529,21 +519,19 @@ static int __create_streams(struct atomisp_sub_device *asd)
	return 0;
rollback:
	for (i--; i >= 0; i--)
		__destroy_stream(asd, &asd->stream_env[i], true);
		__destroy_stream(asd, &asd->stream_env[i]);
	return ret;
}

static int __destroy_stream_pipes(struct atomisp_sub_device *asd,
				  struct atomisp_stream_env *stream_env,
				  bool force)
				  struct atomisp_stream_env *stream_env)
{
	struct atomisp_device *isp = asd->isp;
	int ret = 0;
	int i;

	for (i = 0; i < IA_CSS_PIPE_ID_NUM; i++) {
		if (!stream_env->pipes[i] ||
		    !(force || stream_env->update_pipe[i]))
		if (!stream_env->pipes[i])
			continue;
		if (ia_css_pipe_destroy(stream_env->pipes[i])
		    != 0) {
@@ -557,7 +545,7 @@ static int __destroy_stream_pipes(struct atomisp_sub_device *asd,
	return ret;
}

static int __destroy_pipes(struct atomisp_sub_device *asd, bool force)
static int __destroy_pipes(struct atomisp_sub_device *asd)
{
	struct atomisp_device *isp = asd->isp;
	int i;
@@ -571,7 +559,7 @@ static int __destroy_pipes(struct atomisp_sub_device *asd, bool force)
			continue;
		}

		ret = __destroy_stream_pipes(asd, &asd->stream_env[i], force);
		ret = __destroy_stream_pipes(asd, &asd->stream_env[i]);
		if (ret)
			return ret;
	}
@@ -581,10 +569,10 @@ static int __destroy_pipes(struct atomisp_sub_device *asd, bool force)

void atomisp_destroy_pipes_stream_force(struct atomisp_sub_device *asd)
{
	if (__destroy_streams(asd, true))
	if (__destroy_streams(asd))
		dev_warn(asd->isp->dev, "destroy stream failed.\n");

	if (__destroy_pipes(asd, true))
	if (__destroy_pipes(asd))
		dev_warn(asd->isp->dev, "destroy pipe failed.\n");
}

@@ -801,7 +789,7 @@ int atomisp_create_pipes_stream(struct atomisp_sub_device *asd)
	ret = __create_streams(asd);
	if (ret) {
		dev_warn(asd->isp->dev, "create stream failed %d.\n", ret);
		__destroy_pipes(asd, true);
		__destroy_pipes(asd);
		return ret;
	}