From d43854dfd9140f7a9f5f0efea2e208bf4198c0b8 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Tue, 17 Jul 2018 15:54:55 +0200 Subject: [PATCH] tree: Change sunxi_cedrus_log for request_log As part of the ongoing switch to a generic name, let's start with log function. Signed-off-by: Maxime Ripard --- src/media.c | 18 +++++++++--------- src/sunxi_cedrus.c | 4 ++-- src/utils.c | 2 +- src/utils.h | 2 +- src/v4l2.c | 32 ++++++++++++++------------------ 5 files changed, 27 insertions(+), 31 deletions(-) diff --git a/src/media.c b/src/media.c index 0d02d60..16ac634 100644 --- a/src/media.c +++ b/src/media.c @@ -40,8 +40,8 @@ int media_request_alloc(int media_fd) rc = ioctl(media_fd, MEDIA_IOC_REQUEST_ALLOC, &request_alloc); if (rc < 0) { - sunxi_cedrus_log("Unable to allocate media request: %s\n", - strerror(errno)); + request_log("Unable to allocate media request: %s\n", + strerror(errno)); return -1; } @@ -54,8 +54,8 @@ int media_request_reinit(int request_fd) rc = ioctl(request_fd, MEDIA_REQUEST_IOC_REINIT, NULL); if (rc < 0) { - sunxi_cedrus_log("Unable to reinit media request: %s\n", - strerror(errno)); + request_log("Unable to reinit media request: %s\n", + strerror(errno)); return -1; } @@ -68,8 +68,8 @@ int media_request_queue(int request_fd) rc = ioctl(request_fd, MEDIA_REQUEST_IOC_QUEUE, NULL); if (rc < 0) { - sunxi_cedrus_log("Unable to queue media request: %s\n", - strerror(errno)); + request_log("Unable to queue media request: %s\n", + strerror(errno)); return -1; } @@ -87,11 +87,11 @@ int media_request_wait_completion(int request_fd) rc = select(request_fd + 1, NULL, NULL, &except_fds, &tv); if (rc == 0) { - sunxi_cedrus_log("Timeout when waiting for media request\n"); + request_log("Timeout when waiting for media request\n"); return -1; } else if (rc < 0) { - sunxi_cedrus_log("Unable to select media request: %s\n", - strerror(errno)); + request_log("Unable to select media request: %s\n", + strerror(errno)); return -1; } diff --git a/src/sunxi_cedrus.c b/src/sunxi_cedrus.c index af91a8a..549967e 100644 --- a/src/sunxi_cedrus.c +++ b/src/sunxi_cedrus.c @@ -149,8 +149,8 @@ VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context) rc = ioctl(video_fd, VIDIOC_QUERYCAP, &capability); if (rc < 0 || !(capability.capabilities & V4L2_CAP_VIDEO_M2M_MPLANE)) { - sunxi_cedrus_log("Video device %s does not support m2m mplanes\n", - video_path); + request_log("Video device %s does not support m2m mplanes\n", + video_path); status = VA_STATUS_ERROR_OPERATION_FAILED; goto error; } diff --git a/src/utils.c b/src/utils.c index 33c2556..cdefe4a 100644 --- a/src/utils.c +++ b/src/utils.c @@ -30,7 +30,7 @@ #include "sunxi_cedrus.h" #include "utils.h" -void sunxi_cedrus_log(const char *format, ...) +void request_log(const char *format, ...) { va_list arguments; diff --git a/src/utils.h b/src/utils.h index c44284f..e39141d 100644 --- a/src/utils.h +++ b/src/utils.h @@ -26,6 +26,6 @@ #ifndef _UTILS_H_ #define _UTILS_H_ -void sunxi_cedrus_log(const char *format, ...); +void request_log(const char *format, ...); #endif diff --git a/src/v4l2.c b/src/v4l2.c index f33e84d..a3b41be 100644 --- a/src/v4l2.c +++ b/src/v4l2.c @@ -71,8 +71,8 @@ int v4l2_set_format(int video_fd, unsigned int type, unsigned int pixelformat, rc = ioctl(video_fd, VIDIOC_S_FMT, &format); if (rc < 0) { - sunxi_cedrus_log("Unable to set format for type %d: %s\n", type, - strerror(errno)); + request_log("Unable to set format for type %d: %s\n", type, + strerror(errno)); return -1; } @@ -93,8 +93,8 @@ int v4l2_get_format(int video_fd, unsigned int type, unsigned int *width, rc = ioctl(video_fd, VIDIOC_G_FMT, &format); if (rc < 0) { - sunxi_cedrus_log("Unable to get format for type %d: %s\n", type, - strerror(errno)); + request_log("Unable to get format for type %d: %s\n", type, + strerror(errno)); return -1; } @@ -138,15 +138,15 @@ int v4l2_create_buffers(int video_fd, unsigned int type, rc = ioctl(video_fd, VIDIOC_G_FMT, &buffers.format); if (rc < 0) { - sunxi_cedrus_log("Unable to get format for type %d: %s\n", type, - strerror(errno)); + request_log("Unable to get format for type %d: %s\n", type, + strerror(errno)); return -1; } rc = ioctl(video_fd, VIDIOC_CREATE_BUFS, &buffers); if (rc < 0) { - sunxi_cedrus_log("Unable to create buffer for type %d: %s\n", - type, strerror(errno)); + request_log("Unable to create buffer for type %d: %s\n", type, + strerror(errno)); return -1; } @@ -173,8 +173,7 @@ int v4l2_request_buffer(int video_fd, unsigned int type, unsigned int index, rc = ioctl(video_fd, VIDIOC_QUERYBUF, &buffer); if (rc < 0) { - sunxi_cedrus_log("Unable to query buffer: %s\n", - strerror(errno)); + request_log("Unable to query buffer: %s\n", strerror(errno)); return -1; } @@ -217,8 +216,7 @@ int v4l2_queue_buffer(int video_fd, int request_fd, unsigned int type, rc = ioctl(video_fd, VIDIOC_QBUF, &buffer); if (rc < 0) { - sunxi_cedrus_log("Unable to queue buffer: %s\n", - strerror(errno)); + request_log("Unable to queue buffer: %s\n", strerror(errno)); return -1; } @@ -248,8 +246,7 @@ int v4l2_dequeue_buffer(int video_fd, int request_fd, unsigned int type, rc = ioctl(video_fd, VIDIOC_DQBUF, &buffer); if (rc < 0) { - sunxi_cedrus_log("Unable to dequeue buffer: %s\n", - strerror(errno)); + request_log("Unable to dequeue buffer: %s\n", strerror(errno)); return -1; } @@ -280,8 +277,7 @@ int v4l2_set_control(int video_fd, int request_fd, unsigned int id, void *data, rc = ioctl(video_fd, VIDIOC_S_EXT_CTRLS, &controls); if (rc < 0) { - sunxi_cedrus_log("Unable to set control: %s\n", - strerror(errno)); + request_log("Unable to set control: %s\n", strerror(errno)); return -1; } @@ -296,8 +292,8 @@ int v4l2_set_stream(int video_fd, unsigned int type, bool enable) rc = ioctl(video_fd, enable ? VIDIOC_STREAMON : VIDIOC_STREAMOFF, &buf_type); if (rc < 0) { - sunxi_cedrus_log("Unable to %sable stream: %s\n", - enable ? "en" : "dis", strerror(errno)); + request_log("Unable to %sable stream: %s\n", + enable ? "en" : "dis", strerror(errno)); return -1; }