Most hmm_alloc() callers want BO_PRIVATE type memory.
Add a hmm_create_from_userdata() helper for other cases so that
the hmm_alloc() calls for all the callers who don't want this
can be simplied.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/staging/media/atomisp/include/hmm/hmm.h | 1 +
drivers/staging/media/atomisp/pci/hmm/hmm.c | 5 +++++
drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
@@ -39,6 +39,7 @@ 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_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);
int hmm_store(ia_css_ptr virt, const void *data, unsigned int bytes);
@@ -221,6 +221,11 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
return 0;
}
+ia_css_ptr hmm_create_from_userdata(size_t bytes, const void __user *userptr)
+{
+ return hmm_alloc(bytes, HMM_BO_USER, 0, userptr, 0);
+}
+
void hmm_free(ia_css_ptr virt)
{
struct hmm_buffer_object *bo;
@@ -171,7 +171,7 @@ int ia_css_frame_map(struct ia_css_frame **frame,
goto error;
}
- me->data = hmm_alloc(me->data_bytes, HMM_BO_USER, 0, data, 0);
+ me->data = hmm_create_from_userdata(me->data_bytes, data);
if (me->data == mmgr_NULL)
err = -EINVAL;