Commit df0347f3 authored by Geliang Tang's avatar Geliang Tang Committed by Mauro Carvalho Chehab

media: staging: media: atomisp: use kvmalloc/kvzalloc

Use kvmalloc()/kvzalloc() instead of atomisp_kernel_malloc()
/atomisp_kernel_zalloc().
Signed-off-by: default avatarGeliang Tang <geliangtang@gmail.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 20aa6463
......@@ -82,35 +82,6 @@ union host {
} ptr;
};
/*
* atomisp_kernel_malloc: chooses whether kmalloc() or vmalloc() is preferable.
*
* It is also a wrap functions to pass into css framework.
*/
void *atomisp_kernel_malloc(size_t bytes)
{
/* vmalloc() is preferable if allocating more than 1 page */
if (bytes > PAGE_SIZE)
return vmalloc(bytes);
return kmalloc(bytes, GFP_KERNEL);
}
/*
* atomisp_kernel_zalloc: chooses whether set 0 to the allocated memory.
*
* It is also a wrap functions to pass into css framework.
*/
void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem)
{
void *ptr = atomisp_kernel_malloc(bytes);
if (ptr && zero_mem)
memset(ptr, 0, bytes);
return ptr;
}
/*
* get sensor:dis71430/ov2720 related info from v4l2_subdev->priv data field.
* subdev->priv is set in mrst.c
......@@ -4316,7 +4287,7 @@ int atomisp_set_parameters(struct video_device *vdev,
* are ready, the parameters will be set to CSS.
* per-frame setting only works for the main output frame.
*/
param = atomisp_kernel_zalloc(sizeof(*param), true);
param = kvzalloc(sizeof(*param), GFP_KERNEL);
if (!param) {
dev_err(asd->isp->dev, "%s: failed to alloc params buffer\n",
__func__);
......
......@@ -78,8 +78,6 @@ static inline void __iomem *atomisp_get_io_virt_addr(unsigned int address)
return ret;
}
*/
void *atomisp_kernel_malloc(size_t bytes);
void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem);
/*
* Interrupt functions
......
......@@ -1671,9 +1671,9 @@ int atomisp_alloc_metadata_output_buf(struct atomisp_sub_device *asd)
/* We allocate the cpu-side buffer used for communication with user
* space */
for (i = 0; i < ATOMISP_METADATA_TYPE_NUM; i++) {
asd->params.metadata_user[i] = atomisp_kernel_malloc(
asd->params.metadata_user[i] = kvmalloc(
asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].
stream_info.metadata_info.size);
stream_info.metadata_info.size, GFP_KERNEL);
if (!asd->params.metadata_user[i]) {
while (--i >= 0) {
kvfree(asd->params.metadata_user[i]);
......
......@@ -301,8 +301,6 @@ struct atomisp_device {
extern struct device *atomisp_dev;
extern void *atomisp_kernel_malloc(size_t bytes);
#define atomisp_is_wdt_running(a) timer_pending(&(a)->wdt)
#ifdef ISP2401
extern void atomisp_wdt_refresh_pipe(struct atomisp_video_pipe *pipe,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment