return IA_CSS_ERR_INVALID_ARGUMENTS;
}
- me = sh_css_malloc(sizeof(*me));
+ me = kmalloc(sizeof(*me), GFP_KERNEL);
if (!me)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
err = init_pipe_defaults(mode, me, copy_pipe);
if (err != IA_CSS_SUCCESS) {
- sh_css_free(me);
+ kfree(me);
return err;
}
err = pipe_generate_pipe_num(me, &(me->pipe_num));
if (err != IA_CSS_SUCCESS) {
- sh_css_free(me);
+ kfree(me);
return err;
}
if (pipe->config.acc_extension) {
ia_css_pipe_unload_extension(pipe, pipe->config.acc_extension);
}
- sh_css_free(pipe);
+ kfree(pipe);
IA_CSS_LEAVE("err = %d", err);
return err;
}
if (err != IA_CSS_SUCCESS)
return err;
mycs->num_yuv_scaler = cas_scaler_descr.num_stage;
- mycs->yuv_scaler_binary = sh_css_calloc(cas_scaler_descr.num_stage,
- sizeof(struct ia_css_binary));
+ mycs->yuv_scaler_binary = kzalloc(cas_scaler_descr.num_stage *
+ sizeof(struct ia_css_binary), GFP_KERNEL);
if (mycs->yuv_scaler_binary == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
return err;
}
- mycs->is_output_stage = sh_css_calloc(cas_scaler_descr.num_stage,
- sizeof(bool));
+ mycs->is_output_stage = kzalloc(cas_scaler_descr.num_stage
+ * sizeof(bool), GFP_KERNEL);
if (mycs->is_output_stage == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
return err;
err = ia_css_binary_find(&yuv_scaler_descr,
&mycs->yuv_scaler_binary[i]);
if (err != IA_CSS_SUCCESS) {
- sh_css_free(mycs->is_output_stage);
+ kfree(mycs->is_output_stage);
mycs->is_output_stage = NULL;
return err;
}
for (i = 0; i < pipe->pipe_settings.video.num_yuv_scaler; i++)
ia_css_binary_unload(&pipe->pipe_settings.video.yuv_scaler_binary[i]);
- sh_css_free(pipe->pipe_settings.video.is_output_stage);
+ kfree(pipe->pipe_settings.video.is_output_stage);
pipe->pipe_settings.video.is_output_stage = NULL;
- sh_css_free(pipe->pipe_settings.video.yuv_scaler_binary);
+ kfree(pipe->pipe_settings.video.yuv_scaler_binary);
pipe->pipe_settings.video.yuv_scaler_binary = NULL;
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS);
return err;
}
mycs->num_yuv_scaler = cas_scaler_descr.num_stage;
- mycs->yuv_scaler_binary = sh_css_calloc(cas_scaler_descr.num_stage,
- sizeof(struct ia_css_binary));
+ mycs->yuv_scaler_binary = kzalloc(cas_scaler_descr.num_stage *
+ sizeof(struct ia_css_binary), GFP_KERNEL);
if (mycs->yuv_scaler_binary == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
IA_CSS_LEAVE_ERR_PRIVATE(err);
return err;
}
- mycs->is_output_stage = sh_css_calloc(cas_scaler_descr.num_stage,
- sizeof(bool));
+ mycs->is_output_stage = kzalloc(cas_scaler_descr.num_stage *
+ sizeof(bool), GFP_KERNEL);
if (mycs->is_output_stage == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
IA_CSS_LEAVE_ERR_PRIVATE(err);
for (i = 0; i < pipe->pipe_settings.capture.num_yuv_scaler; i++)
ia_css_binary_unload(&pipe->pipe_settings.capture.yuv_scaler_binary[i]);
- sh_css_free(pipe->pipe_settings.capture.is_output_stage);
+ kfree(pipe->pipe_settings.capture.is_output_stage);
pipe->pipe_settings.capture.is_output_stage = NULL;
- sh_css_free(pipe->pipe_settings.capture.yuv_scaler_binary);
+ kfree(pipe->pipe_settings.capture.yuv_scaler_binary);
pipe->pipe_settings.capture.yuv_scaler_binary = NULL;
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS);
i *= max_scale_factor_per_stage;
}
- descr->in_info = sh_css_malloc(descr->num_stage * sizeof(struct ia_css_frame_info));
+ descr->in_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL);
if (descr->in_info == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
- descr->internal_out_info = sh_css_malloc(descr->num_stage * sizeof(struct ia_css_frame_info));
+ descr->internal_out_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL);
if (descr->internal_out_info == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
- descr->out_info = sh_css_malloc(descr->num_stage * sizeof(struct ia_css_frame_info));
+ descr->out_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL);
if (descr->out_info == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
- descr->vf_info = sh_css_malloc(descr->num_stage * sizeof(struct ia_css_frame_info));
+ descr->vf_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL);
if (descr->vf_info == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
- descr->is_output_stage = sh_css_malloc(descr->num_stage * sizeof(bool));
+ descr->is_output_stage = kmalloc(descr->num_stage * sizeof(bool), GFP_KERNEL);
if (descr->is_output_stage == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
return err;
}
+/* FIXME: merge most of this and single output version */
static enum ia_css_err ia_css_pipe_create_cas_scaler_desc(struct ia_css_pipe *pipe,
struct ia_css_cas_binary_descr *descr)
{
descr->num_stage = num_stages;
- descr->in_info = sh_css_malloc(descr->num_stage * sizeof(struct ia_css_frame_info));
+ descr->in_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL);
if (descr->in_info == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
- descr->internal_out_info = sh_css_malloc(descr->num_stage * sizeof(struct ia_css_frame_info));
+ descr->internal_out_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL);
if (descr->internal_out_info == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
- descr->out_info = sh_css_malloc(descr->num_stage * sizeof(struct ia_css_frame_info));
+ descr->out_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL);
if (descr->out_info == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
- descr->vf_info = sh_css_malloc(descr->num_stage * sizeof(struct ia_css_frame_info));
+ descr->vf_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL);
if (descr->vf_info == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
- descr->is_output_stage = sh_css_malloc(descr->num_stage * sizeof(bool));
+ descr->is_output_stage = kmalloc(descr->num_stage * sizeof(bool), GFP_KERNEL);
if (descr->is_output_stage == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
static void ia_css_pipe_destroy_cas_scaler_desc(struct ia_css_cas_binary_descr *descr)
{
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "ia_css_pipe_destroy_cas_scaler_desc() enter:\n");
- sh_css_free(descr->in_info);
+ kfree(descr->in_info);
descr->in_info = NULL;
- sh_css_free(descr->internal_out_info);
+ kfree(descr->internal_out_info);
descr->internal_out_info = NULL;
- sh_css_free(descr->out_info);
+ kfree(descr->out_info);
descr->out_info = NULL;
- sh_css_free(descr->vf_info);
+ kfree(descr->vf_info);
descr->vf_info = NULL;
- sh_css_free(descr->is_output_stage);
+ kfree(descr->is_output_stage);
descr->is_output_stage = NULL;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "ia_css_pipe_destroy_cas_scaler_desc() leave\n");
}
goto ERR;
mycs->num_output = cas_scaler_descr.num_output_stage;
mycs->num_yuv_scaler = cas_scaler_descr.num_stage;
- mycs->yuv_scaler_binary = sh_css_calloc(cas_scaler_descr.num_stage,
- sizeof(struct ia_css_binary));
+ mycs->yuv_scaler_binary = kzalloc(cas_scaler_descr.num_stage *
+ sizeof(struct ia_css_binary), GFP_KERNEL);
if (mycs->yuv_scaler_binary == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
- mycs->is_output_stage = sh_css_calloc(cas_scaler_descr.num_stage,
- sizeof(bool));
+ mycs->is_output_stage = kzalloc(cas_scaler_descr.num_stage *
+ sizeof(bool), GFP_KERNEL);
if (mycs->is_output_stage == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
}
mycs->num_vf_pp = 1;
}
- mycs->vf_pp_binary = sh_css_calloc(mycs->num_vf_pp, sizeof(struct ia_css_binary));
+ mycs->vf_pp_binary = kzalloc(mycs->num_vf_pp * sizeof(struct ia_css_binary),
+ GFP_KERNEL);
if (mycs->vf_pp_binary == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR;
for (i = 0; i < pipe->pipe_settings.yuvpp.num_vf_pp; i++) {
ia_css_binary_unload(&pipe->pipe_settings.yuvpp.vf_pp_binary[i]);
}
- sh_css_free(pipe->pipe_settings.yuvpp.is_output_stage);
+ kfree(pipe->pipe_settings.yuvpp.is_output_stage);
pipe->pipe_settings.yuvpp.is_output_stage = NULL;
- sh_css_free(pipe->pipe_settings.yuvpp.yuv_scaler_binary);
+ kfree(pipe->pipe_settings.yuvpp.yuv_scaler_binary);
pipe->pipe_settings.yuvpp.yuv_scaler_binary = NULL;
- sh_css_free(pipe->pipe_settings.yuvpp.vf_pp_binary);
+ kfree(pipe->pipe_settings.yuvpp.vf_pp_binary);
pipe->pipe_settings.yuvpp.vf_pp_binary = NULL;
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS);
}
/* allocate the stream instance */
- curr_stream = sh_css_malloc(sizeof(struct ia_css_stream));
+ curr_stream = kmalloc(sizeof(struct ia_css_stream), GFP_KERNEL);
if (curr_stream == NULL) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
IA_CSS_LEAVE_ERR(err);
/* allocate pipes */
curr_stream->num_pipes = num_pipes;
- curr_stream->pipes = sh_css_malloc(num_pipes * sizeof(struct ia_css_pipe *));
+ curr_stream->pipes = kzalloc(num_pipes * sizeof(struct ia_css_pipe *), GFP_KERNEL);
if (curr_stream->pipes == NULL) {
curr_stream->num_pipes = 0;
- sh_css_free(curr_stream);
+ kfree(curr_stream);
curr_stream = NULL;
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
IA_CSS_LEAVE_ERR(err);
}
}
/* free associated memory of stream struct */
- sh_css_free(stream->pipes);
+ kfree(stream->pipes);
stream->pipes = NULL;
stream->num_pipes = 0;
#ifndef ISP2401
err1 = (err != IA_CSS_SUCCESS) ? err : err2;
#endif
- sh_css_free(stream);
+ kfree(stream);
#ifndef ISP2401
IA_CSS_LEAVE_ERR(err);
#else
* more details.
*/
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+
#include <math_support.h>
#include "platform_support.h"
#include "sh_css_firmware.h"
*sh_css_fw = *fw;
#if defined(HRT_UNSCHED)
- sh_css_fw->blob.code = sh_css_malloc(1);
+ sh_css_fw->blob.code = vmalloc(1);
#else
- sh_css_fw->blob.code = sh_css_malloc(fw->blob.size);
+ sh_css_fw->blob.code = vmalloc(fw->blob.size);
#endif
if (sh_css_fw->blob.code == NULL)
char *namebuffer;
int namelength = (int)strlen(name);
- namebuffer = (char *) sh_css_malloc(namelength+1);
+ namebuffer = (char *) kmalloc(namelength + 1, GFP_KERNEL);
if (namebuffer == NULL)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
- memcpy(namebuffer, name, namelength+1);
+ memcpy(namebuffer, name, namelength + 1);
bd->name = fw_minibuffer[index].name = namebuffer;
} else {
size_t configstruct_size = sizeof(struct ia_css_config_memory_offsets);
size_t statestruct_size = sizeof(struct ia_css_state_memory_offsets);
- char *parambuf = (char *) sh_css_malloc(paramstruct_size + configstruct_size + statestruct_size);
+ char *parambuf = (char *)kmalloc(paramstruct_size + configstruct_size + statestruct_size,
+ GFP_KERNEL);
if (parambuf == NULL)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
sh_css_num_binaries = file_header->binary_nr;
/* Only allocate memory for ISP blob info */
if (sh_css_num_binaries > (NUM_OF_SPS + NUM_OF_BLS)) {
- sh_css_blob_info = sh_css_malloc(
+ sh_css_blob_info = kmalloc(
(sh_css_num_binaries - (NUM_OF_SPS + NUM_OF_BLS)) *
- sizeof(*sh_css_blob_info));
+ sizeof(*sh_css_blob_info), GFP_KERNEL);
if (sh_css_blob_info == NULL)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
} else {
sh_css_blob_info = NULL;
}
- fw_minibuffer = sh_css_malloc(sh_css_num_binaries * sizeof(struct fw_param));
+ fw_minibuffer = kzalloc(sh_css_num_binaries * sizeof(struct fw_param), GFP_KERNEL);
if (fw_minibuffer == NULL)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
- memset(fw_minibuffer, 0, sh_css_num_binaries * sizeof(struct fw_param));
for (i = 0; i < sh_css_num_binaries; i++) {
struct ia_css_fw_info *bi = &binaries[i];
unsigned int i = 0;
for (i = 0; i < sh_css_num_binaries; i++) {
if (fw_minibuffer[i].name)
- sh_css_free((void *)fw_minibuffer[i].name);
+ kfree((void *)fw_minibuffer[i].name);
if (fw_minibuffer[i].buffer)
- sh_css_free((void *)fw_minibuffer[i].buffer);
+ vfree((void *)fw_minibuffer[i].buffer);
}
- sh_css_free(fw_minibuffer);
+ kfree(fw_minibuffer);
fw_minibuffer = NULL;
}
memset(&sh_css_sp_fw, 0, sizeof(sh_css_sp_fw));
if (sh_css_blob_info) {
- sh_css_free(sh_css_blob_info);
+ kfree(sh_css_blob_info);
sh_css_blob_info = NULL;
}
sh_css_num_binaries = 0;