[PATCH 4/10] x86: microcode_amd: fix compile warning

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andreas Herrmann
Date: Tuesday, December 16, 2008 - 11:13 am

CC      arch/x86/kernel/microcode_amd.o
arch/x86/kernel/microcode_amd.c: In function ‘request_microcode_fw’:
arch/x86/kernel/microcode_amd.c:393: warning: passing argument 2 of ‘generic_load_microcode’ discards qualifiers from pointer target type

(Respect "const" qualifier of firmware->data.)

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 arch/x86/kernel/microcode_amd.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index a8a0ec6..89b386c 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -225,8 +225,8 @@ static void apply_microcode_amd(int cpu)
 	uci->cpu_sig.rev = rev;
 }
 
-static void *get_next_ucode(u8 *buf, unsigned int size,
-			int (*get_ucode_data)(void *, const void *, size_t),
+static void *get_next_ucode(const u8 *buf, unsigned int size,
+			int (*get_ucode_data)(void *, const u8 *, size_t),
 			unsigned int *mc_size)
 {
 	unsigned int total_size;
@@ -268,8 +268,8 @@ static void *get_next_ucode(u8 *buf, unsigned int size,
 }
 
 
-static int install_equiv_cpu_table(u8 *buf,
-		int (*get_ucode_data)(void *, const void *, size_t))
+static int install_equiv_cpu_table(const u8 *buf,
+		int (*get_ucode_data)(void *, const u8 *, size_t))
 {
 #define UCODE_CONTAINER_HEADER_SIZE	12
 	u8 *container_hdr[UCODE_CONTAINER_HEADER_SIZE];
@@ -311,11 +311,13 @@ static void free_equiv_cpu_table(void)
 	}
 }
 
-static int generic_load_microcode(int cpu, void *data, size_t size,
-		int (*get_ucode_data)(void *, const void *, size_t))
+static int generic_load_microcode(int cpu, const u8 *data, size_t size,
+		int (*get_ucode_data)(void *, const u8 *, size_t))
 {
 	struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
-	u8 *ucode_ptr = data, *new_mc = NULL, *mc;
+	const u8 *ucode_ptr = data;
+	void *new_mc = NULL;
+	void *mc;
 	int new_rev = uci->cpu_sig.rev;
 	unsigned int leftover;
 	unsigned long offset;
@@ -368,7 +370,7 @@ static int generic_load_microcode(int cpu, void *data, size_t size,
 	return (int)leftover;
 }
 
-static int get_ucode_fw(void *to, const void *from, size_t n)
+static int get_ucode_fw(void *to, const u8 *from, size_t n)
 {
 	memcpy(to, from, n);
 	return 0;
@@ -390,7 +392,7 @@ static int request_microcode_fw(int cpu, struct device *device)
 		return ret;
 	}
 
-	ret = generic_load_microcode(cpu, (void*)firmware->data, firmware->size,
+	ret = generic_load_microcode(cpu, firmware->data, firmware->size,
 			&get_ucode_fw);
 
 	release_firmware(firmware);
-- 
1.6.0.4



--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/10] x86: microcode_amd: fixes and cleanup, Andreas Herrmann, (Tue Dec 16, 11:06 am)
[PATCH 1/10] x86: microcode_amd: fix wrong handling of equ ..., Andreas Herrmann, (Tue Dec 16, 11:07 am)
[PATCH 2/10] x86: microcode_amd: fix typos and trailing wh ..., Andreas Herrmann, (Tue Dec 16, 11:08 am)
[PATCH 3/10] x86: microcode_amd: fix checkpatch warnings/e ..., Andreas Herrmann, (Tue Dec 16, 11:11 am)
[PATCH 4/10] x86: microcode_amd: fix compile warning, Andreas Herrmann, (Tue Dec 16, 11:13 am)
[PATCH 5/10] x86: microcode_amd: don't pass superfluous fu ..., Andreas Herrmann, (Tue Dec 16, 11:14 am)
[PATCH 6/10] x86: microcode_amd: replace inline asm by com ..., Andreas Herrmann, (Tue Dec 16, 11:16 am)
[PATCH 7/10] x86: microcode_amd: consolidate macro definitions, Andreas Herrmann, (Tue Dec 16, 11:17 am)
[PATCH 8/10] x86: microcode_amd: remove (wrong) chipset de ..., Andreas Herrmann, (Tue Dec 16, 11:20 am)
[PATCH 9/10] x86: microcode_amd: use 'packed' attribute fo ..., Andreas Herrmann, (Tue Dec 16, 11:21 am)
[PATCH 10/10] x86: microcode_amd: modify log messages, Andreas Herrmann, (Tue Dec 16, 11:22 am)
Re: [PATCH 0/10] x86: microcode_amd: fixes and cleanup, Dmitry Adamushko, (Tue Dec 16, 4:22 pm)
Re: [PATCH 0/10] x86: microcode_amd: fixes and cleanup, Dmitry Adamushko, (Tue Dec 16, 4:24 pm)