video: driver: use macros to prepare enums & string arrays

video driver is maintaining multiple tables based on enum
name pair. So this mapping might go wrong if new entry is
inserted in different position.

So added logic to prepare enums & static const char* arrays
using macros. So compiler will take care of creation and
maintaining order.

Change-Id: Id3669cf3ce150b3ababb84dce18326220f41d88d
Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
此提交包含在:
Govindaraj Rajagopal
2022-11-14 16:46:48 +05:30
父節點 2d17637ec0
當前提交 2eda86592a
共有 4 個檔案被更改,包括 271 行新增490 行删除

查看文件

@@ -13,6 +13,16 @@
struct msm_vidc_inst;
#define FOREACH_STATE(STATE) { \
STATE(NONE) \
STATE(OPEN) \
STATE(INPUT_STREAMING) \
STATE(OUTPUT_STREAMING) \
STATE(STREAMING) \
STATE(CLOSE) \
STATE(ERROR) \
}
#define call_session_op(c, op, ...) \
(((c) && (c)->session_ops && (c)->session_ops->op) ? \
((c)->session_ops->op(__VA_ARGS__)) : 0)
@@ -70,14 +80,7 @@ struct msm_vidc_buffers_info {
struct msm_vidc_buffers partial_data;
};
enum msm_vidc_state {
MSM_VIDC_OPEN = 1,
MSM_VIDC_INPUT_STREAMING = 2,
MSM_VIDC_OUTPUT_STREAMING = 3,
MSM_VIDC_STREAMING = 4,
MSM_VIDC_CLOSE = 5,
MSM_VIDC_ERROR = 6,
};
enum msm_vidc_state FOREACH_STATE(GENERATE_MSM_VIDC_ENUM);
#define MSM_VIDC_SUB_STATE_NONE 0
#define MSM_VIDC_MAX_SUB_STATES 6