提交 c598a664 编写于 作者: V Ville Syrjälä

drm/i915/sdvo: Use named initializers for the SDVO command names

Use named initializers to make it easier to associate the SDVO debug
prints with the SDVO command defines. Also switch to using ARRAY_SIZE()
instead of assuming that SDVO_CMD_STATUS_SCALING_NOT_SUPP is the last
command type.
Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190619180312.31817-2-ville.syrjala@linux.intel.comReviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
上级 f384e48d
...@@ -429,13 +429,13 @@ static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd, ...@@ -429,13 +429,13 @@ static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
} }
static const char * const cmd_status_names[] = { static const char * const cmd_status_names[] = {
"Power on", [SDVO_CMD_STATUS_POWER_ON] = "Power on",
"Success", [SDVO_CMD_STATUS_SUCCESS] = "Success",
"Not supported", [SDVO_CMD_STATUS_NOTSUPP] = "Not supported",
"Invalid arg", [SDVO_CMD_STATUS_INVALID_ARG] = "Invalid arg",
"Pending", [SDVO_CMD_STATUS_PENDING] = "Pending",
"Target not specified", [SDVO_CMD_STATUS_TARGET_NOT_SPECIFIED] = "Target not specified",
"Scaling not supported" [SDVO_CMD_STATUS_SCALING_NOT_SUPP] = "Scaling not supported",
}; };
static bool __intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd, static bool __intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
...@@ -562,7 +562,7 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo, ...@@ -562,7 +562,7 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
#define BUF_PRINT(args...) \ #define BUF_PRINT(args...) \
pos += snprintf(buffer + pos, max_t(int, BUF_LEN - pos, 0), args) pos += snprintf(buffer + pos, max_t(int, BUF_LEN - pos, 0), args)
if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP) if (status < ARRAY_SIZE(cmd_status_names))
BUF_PRINT("(%s)", cmd_status_names[status]); BUF_PRINT("(%s)", cmd_status_names[status]);
else else
BUF_PRINT("(??? %d)", status); BUF_PRINT("(??? %d)", status);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册