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

media: atomisp: Simplify hmm_alloc() calls

Make hmm_alloc() only take size as a parameter and remove other parameters.
since all callers always pass the same flags.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-30-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 ceff4bdb
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -36,9 +36,7 @@
int hmm_init(void);
void hmm_cleanup(void);

ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
		     int from_highmem, const void __user *userptr,
		     const uint16_t attrs);
ia_css_ptr hmm_alloc(size_t bytes);
ia_css_ptr hmm_create_from_userdata(size_t bytes, const void __user *userptr);
void hmm_free(ia_css_ptr ptr);
int hmm_load(ia_css_ptr virt, void *data, unsigned int bytes);
+11 −8
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ int hmm_init(void)
	 * at the beginning, to avoid hmm_alloc return 0 in the
	 * further allocation.
	 */
	dummy_ptr = hmm_alloc(1, HMM_BO_PRIVATE, 0, NULL, 0);
	dummy_ptr = hmm_alloc(1);

	if (!ret) {
		ret = sysfs_create_group(&atomisp_dev->kobj,
@@ -168,9 +168,7 @@ void hmm_cleanup(void)
	hmm_initialized = false;
}

ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
		     int from_highmem, const void __user *userptr,
		     const uint16_t attrs)
static ia_css_ptr __hmm_alloc(size_t bytes, enum hmm_bo_type type, const void __user *userptr)
{
	unsigned int pgnr;
	struct hmm_buffer_object *bo;
@@ -194,7 +192,7 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
	}

	/* Allocate pages for memory */
	ret = hmm_bo_alloc_pages(bo, type, from_highmem, userptr);
	ret = hmm_bo_alloc_pages(bo, type, false, userptr);
	if (ret) {
		dev_err(atomisp_dev, "hmm_bo_alloc_pages failed.\n");
		goto alloc_page_err;
@@ -208,8 +206,8 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
	}

	dev_dbg(atomisp_dev,
		"%s: pages: 0x%08x (%zu bytes), type: %d from highmem %d, user ptr %p\n",
		__func__, bo->start, bytes, type, from_highmem, userptr);
		"%s: pages: 0x%08x (%zu bytes), type: %d, user ptr %p\n",
		__func__, bo->start, bytes, type, userptr);

	return bo->start;

@@ -221,9 +219,14 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
	return 0;
}

ia_css_ptr hmm_alloc(size_t bytes)
{
	return __hmm_alloc(bytes, HMM_BO_PRIVATE, NULL);
}

ia_css_ptr hmm_create_from_userdata(size_t bytes, const void __user *userptr)
{
	return hmm_alloc(bytes, HMM_BO_USER, 0, userptr, 0);
	return __hmm_alloc(bytes, HMM_BO_USER, userptr);
}

void hmm_free(ia_css_ptr virt)
+1 −1
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ ia_css_isp_dvs_statistics_allocate(
			    HIVE_ISP_DDR_WORD_BYTES);

	me->size = hor_size + ver_size;
	me->data_ptr = hmm_alloc(me->size, HMM_BO_PRIVATE, 0, NULL, 0);
	me->data_ptr = hmm_alloc(me->size);
	if (me->data_ptr == mmgr_NULL)
		goto err;
	me->hor_size = hor_size;
+1 −1
Original line number Diff line number Diff line
@@ -294,7 +294,7 @@ ia_css_isp_dvs2_statistics_allocate(
	       * grid->aligned_height * IA_CSS_DVS2_NUM_COEF_TYPES;

	me->size = 2 * size;
	me->data_ptr = hmm_alloc(me->size, HMM_BO_PRIVATE, 0, NULL, 0);
	me->data_ptr = hmm_alloc(me->size);
	if (me->data_ptr == mmgr_NULL)
		goto err;
	me->hor_proj = me->data_ptr;
+1 −2
Original line number Diff line number Diff line
@@ -728,8 +728,7 @@ static int frame_allocate_buffer_data(struct ia_css_frame *frame)
#ifdef ISP2401
	IA_CSS_ENTER_LEAVE_PRIVATE("frame->data_bytes=%d\n", frame->data_bytes);
#endif
	frame->data = hmm_alloc(frame->data_bytes,
				HMM_BO_PRIVATE, 0, NULL, 0);
	frame->data = hmm_alloc(frame->data_bytes);
	if (frame->data == mmgr_NULL)
		return -ENOMEM;
	return 0;
Loading