exynos: use structure initialization instead of memset

Keeps the code cleaner, since the structs have to be initialized
once anyway.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
[evelikov: squash trivial conflict]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>

Conflicts:
	tests/exynos/exynos_fimg2d_test.c
main
Tobias Jakobi 2015-03-16 22:19:28 +00:00 committed by Emil Velikov
parent 89037326ca
commit 736d6a1f0f
2 changed files with 5 additions and 14 deletions

View File

@ -188,7 +188,7 @@ static void g2d_reset(struct g2d_context *ctx)
static int g2d_flush(struct g2d_context *ctx) static int g2d_flush(struct g2d_context *ctx)
{ {
int ret; int ret;
struct drm_exynos_g2d_set_cmdlist cmdlist; struct drm_exynos_g2d_set_cmdlist cmdlist = {0};
if (ctx->cmd_nr == 0 && ctx->cmd_buf_nr == 0) if (ctx->cmd_nr == 0 && ctx->cmd_buf_nr == 0)
return -1; return -1;
@ -198,8 +198,6 @@ static int g2d_flush(struct g2d_context *ctx)
return -EINVAL; return -EINVAL;
} }
memset(&cmdlist, 0, sizeof(struct drm_exynos_g2d_set_cmdlist));
cmdlist.cmd = (uint64_t)(uintptr_t)&ctx->cmd[0]; cmdlist.cmd = (uint64_t)(uintptr_t)&ctx->cmd[0];
cmdlist.cmd_buf = (uint64_t)(uintptr_t)&ctx->cmd_buf[0]; cmdlist.cmd_buf = (uint64_t)(uintptr_t)&ctx->cmd_buf[0];
cmdlist.cmd_nr = ctx->cmd_nr; cmdlist.cmd_nr = ctx->cmd_nr;

View File

@ -255,7 +255,7 @@ static void wait_for_user_input(int last)
static int g2d_solid_fill_test(struct exynos_device *dev, struct exynos_bo *dst) static int g2d_solid_fill_test(struct exynos_device *dev, struct exynos_bo *dst)
{ {
struct g2d_context *ctx; struct g2d_context *ctx;
struct g2d_image img; struct g2d_image img = {0};
unsigned int count, img_w, img_h; unsigned int count, img_w, img_h;
int ret = 0; int ret = 0;
@ -263,7 +263,6 @@ static int g2d_solid_fill_test(struct exynos_device *dev, struct exynos_bo *dst)
if (!ctx) if (!ctx)
return -EFAULT; return -EFAULT;
memset(&img, 0, sizeof(struct g2d_image));
img.bo[0] = dst->handle; img.bo[0] = dst->handle;
printf("solid fill test.\n"); printf("solid fill test.\n");
@ -306,7 +305,7 @@ static int g2d_copy_test(struct exynos_device *dev, struct exynos_bo *src,
enum e_g2d_buf_type type) enum e_g2d_buf_type type)
{ {
struct g2d_context *ctx; struct g2d_context *ctx;
struct g2d_image src_img, dst_img; struct g2d_image src_img = {0}, dst_img = {0};
unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h; unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
unsigned long userptr, size; unsigned long userptr, size;
int ret; int ret;
@ -315,8 +314,6 @@ static int g2d_copy_test(struct exynos_device *dev, struct exynos_bo *src,
if (!ctx) if (!ctx)
return -EFAULT; return -EFAULT;
memset(&src_img, 0, sizeof(struct g2d_image));
memset(&dst_img, 0, sizeof(struct g2d_image));
dst_img.bo[0] = dst->handle; dst_img.bo[0] = dst->handle;
src_x = 0; src_x = 0;
@ -389,7 +386,7 @@ static int g2d_copy_with_scale_test(struct exynos_device *dev,
enum e_g2d_buf_type type) enum e_g2d_buf_type type)
{ {
struct g2d_context *ctx; struct g2d_context *ctx;
struct g2d_image src_img, dst_img; struct g2d_image src_img = {0}, dst_img = {0};
unsigned int src_x, src_y, img_w, img_h; unsigned int src_x, src_y, img_w, img_h;
unsigned long userptr, size; unsigned long userptr, size;
int ret; int ret;
@ -398,8 +395,6 @@ static int g2d_copy_with_scale_test(struct exynos_device *dev,
if (!ctx) if (!ctx)
return -EFAULT; return -EFAULT;
memset(&src_img, 0, sizeof(struct g2d_image));
memset(&dst_img, 0, sizeof(struct g2d_image));
dst_img.bo[0] = dst->handle; dst_img.bo[0] = dst->handle;
src_x = 0; src_x = 0;
@ -475,7 +470,7 @@ static int g2d_blend_test(struct exynos_device *dev,
enum e_g2d_buf_type type) enum e_g2d_buf_type type)
{ {
struct g2d_context *ctx; struct g2d_context *ctx;
struct g2d_image src_img, dst_img; struct g2d_image src_img = {0}, dst_img = {0};
unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h; unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
unsigned long userptr, size; unsigned long userptr, size;
int ret; int ret;
@ -484,8 +479,6 @@ static int g2d_blend_test(struct exynos_device *dev,
if (!ctx) if (!ctx)
return -EFAULT; return -EFAULT;
memset(&src_img, 0, sizeof(struct g2d_image));
memset(&dst_img, 0, sizeof(struct g2d_image));
dst_img.bo[0] = dst->handle; dst_img.bo[0] = dst->handle;
src_x = 0; src_x = 0;