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

Commit 9df619d9 authored by Greg Hackmann's avatar Greg Hackmann Committed by Sooraj S
Browse files

drivers: media: msm: don't use nested functions



clang doesn't support nested functions, and there's no compelling reason
that these functions need to have such a restricted scope.

Change-Id: I698f7b19de8f6dff46a717403c1f518446748b18
Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
parent 14c0b197
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -1375,9 +1375,7 @@ int msm_vidc_destroy(struct msm_vidc_inst *inst)
	return 0;
}

int msm_vidc_close(void *instance)
{
	void close_helper(struct kref *kref)
static void close_helper(struct kref *kref)
{
	struct msm_vidc_inst *inst = container_of(kref,
			struct msm_vidc_inst, kref);
@@ -1385,6 +1383,8 @@ int msm_vidc_close(void *instance)
	msm_vidc_destroy(inst);
}

int msm_vidc_close(void *instance)
{
	struct msm_vidc_inst *inst = instance;
	struct buffer_info *bi, *dummy;
	int rc = 0;
+8 −7
Original line number Diff line number Diff line
@@ -727,15 +727,16 @@ static void handle_sys_init_done(enum hal_command_response cmd, void *data)

}

void put_inst(struct msm_vidc_inst *inst)
{
	void put_inst_helper(struct kref *kref)
static void put_inst_helper(struct kref *kref)
{
		struct msm_vidc_inst *inst = container_of(kref,
				struct msm_vidc_inst, kref);
	struct msm_vidc_inst *inst = container_of(kref, struct msm_vidc_inst,
			kref);

	msm_vidc_destroy(inst);
}

void put_inst(struct msm_vidc_inst *inst)
{
	if (!inst)
		return;

+14 −15
Original line number Diff line number Diff line
@@ -59,17 +59,16 @@ static size_t get_u32_array_num_elements(struct device_node *np,
	return 0;
}

static inline enum imem_type read_imem_type(struct platform_device *pdev)
{
	bool is_compatible(char *compat)
static inline bool is_compatible(char *compat)
{
	return !!of_find_compatible_node(NULL, NULL, compat);
}

static inline enum imem_type read_imem_type(struct platform_device *pdev)
{
	return is_compatible("qcom,msm-ocmem") ? IMEM_OCMEM :
		is_compatible("qcom,msm-vmem") ? IMEM_VMEM :
						IMEM_NONE;

}

static inline void msm_vidc_free_allowed_clocks_table(
@@ -624,20 +623,20 @@ static int msm_vidc_load_cycles_per_mb_table(
	return rc;
}

static int msm_vidc_load_freq_table(struct msm_vidc_platform_resources *res)
{
	int rc = 0;
	int num_elements = 0;
	struct platform_device *pdev = res->pdev;

/* A comparator to compare loads (needed later on) */
	int cmp(const void *a, const void *b)
static int cmp_load_freq_table(const void *a, const void *b)
{
	/* want to sort in reverse so flip the comparison */
	return ((struct load_freq_table *)b)->load -
		((struct load_freq_table *)a)->load;
}

static int msm_vidc_load_freq_table(struct msm_vidc_platform_resources *res)
{
	int rc = 0;
	int num_elements = 0;
	struct platform_device *pdev = res->pdev;

	if (!of_find_property(pdev->dev.of_node, "qcom,load-freq-tbl", NULL)) {
		/* qcom,load-freq-tbl is an optional property.  It likely won't
		 * be present on cores that we can't clock scale on.
@@ -678,7 +677,7 @@ static int msm_vidc_load_freq_table(struct msm_vidc_platform_resources *res)
	 * logic to work, just sort it ourselves
	 */
	sort(res->load_freq_tbl, res->load_freq_tbl_size,
			sizeof(*res->load_freq_tbl), cmp, NULL);
			sizeof(*res->load_freq_tbl), cmp_load_freq_table, NULL);
	return rc;
}