From f4cad05d70e8dff2cf1fc6306431ea066b509ac7 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 14 Apr 2025 09:01:32 +0200 Subject: [PATCH 14/45] dmioem: Improve code portability (variable declarations) For better code portability, declare variables at the beginning of their block scope. Signed-off-by: Jean Delvare --- dmioem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dmioem.c b/dmioem.c index 1df77ec..453e0ad 100644 --- a/dmioem.c +++ b/dmioem.c @@ -148,12 +148,13 @@ static void dmi_dell_hotkeys(const struct dmi_header *h) { int count = (h->length - 0x04) / 0x04; u8 *hotkey = h->data + 0x04; + int i; if (!count) return; pr_list_start("Hotkey Mappings", NULL); - for (int i = 0; i < count; i++) + for (i = 0; i < count; i++) { pr_list_item("Scancode 0x%04hx -> Keycode 0x%04hx", WORD(hotkey + 0x00), WORD(hotkey + 0x02)); @@ -175,6 +176,7 @@ static void dmi_dell_indexed_io_access(const struct dmi_header *h) u8 *data = h->data; u8 *token; u8 type; + int i; pr_attr("Index Port", "0x%04hx", WORD(data + 0x04)); pr_attr("Data Port", "0x%04hx", WORD(data + 0x06)); @@ -195,7 +197,7 @@ static void dmi_dell_indexed_io_access(const struct dmi_header *h) return; pr_list_start("Tokens", NULL); - for (int i = 0; i < tokens - 1; i++) + for (i = 0; i < tokens - 1; i++) { token = data + 0x0C + 0x05 * i; pr_list_item("0x%04hx (location 0x%02hhx, AND mask 0x%02hhx, OR mask 0x%02hhx)", @@ -209,6 +211,7 @@ static void dmi_dell_token_interface(const struct dmi_header *h) int tokens = (h->length - 0x0B) / 0x06; u8 *data = h->data; u8 *token; + int i; pr_attr("Command I/O Address", "0x%04x", WORD(data + 0x04)); pr_attr("Command I/O Code", "0x%02x", data[0x06]); @@ -221,7 +224,7 @@ static void dmi_dell_token_interface(const struct dmi_header *h) return; pr_list_start("Tokens", NULL); - for (int i = 0; i < tokens - 1; i++) + for (i = 0; i < tokens - 1; i++) { token = data + 0x0B + 0x06 * i; pr_list_item("0x%04hx (location 0x%04hx, value 0x%04hx)", -- 2.47.0