media: staging: media: atomisp: use kvmalloc/kvzalloc
authorGeliang Tang <geliangtang@gmail.com>
Mon, 7 Aug 2017 13:44:27 +0000 (09:44 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 9 Aug 2017 14:51:41 +0000 (10:51 -0400)
Use kvmalloc()/kvzalloc() instead of atomisp_kernel_malloc()
/atomisp_kernel_zalloc().

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c
drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h

index 7bf5dcd..f48bf45 100644 (file)
@@ -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__);
index 1ccd911..31ba4e6 100644 (file)
@@ -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
index 36f934d..05897b7 100644 (file)
@@ -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]);
index 4b03f28..7542a72 100644 (file)
@@ -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,