Skip to contentSkip to conversation

ASoC: Intel: Fix sparse warnings for firmware loader.

PATCH Applied Liam Girdwood 3 participants 10 messages Feb 19, 2014

Subsystems (3)
lore
Share & tools
lore

Liam Girdwood

author maintainer
#0 lore raw

PATCH v2 1/1 ASoC: Intel: Fix sparse warnings for firmware loader.

Changes since V1 :-
o Fixed sparse warning for block_module_remove
o Fixed additional sparse warnings when building entire driver.

Sparse gives us the following warnings on sst-firmware.c

CHECK sound/soc/intel/sst-firmware.c
sound/soc/intel/sst-firmware.c:39:34: warning: incorrect type in argument 1 (different address spaces)
sound/soc/intel/sst-firmware.c:39:34: expected void volatile [noderef] <asn:2>*dst
sound/soc/intel/sst-firmware.c:39:34: got void *
sound/soc/intel/sst-firmware.c:417:36: warning: incorrect type in argument 1 (different address spaces)
sound/soc/intel/sst-firmware.c:417:36: expected void *dest
sound/soc/intel/sst-firmware.c:417:36: got void [noderef] <asn:2>*
sound/soc/intel/sst-firmware.c:430:5: warning: symbol 'sst_block_module_remove' was not declared. Should it be static?

and

CC [M] sound/soc/intel/sst-dsp.o
sound/soc/intel/sst-dsp-priv.h:271:53: warning: incorrect type in argument 3 (different address spaces)
sound/soc/intel/sst-dsp-priv.h:271:53: expected void *src
sound/soc/intel/sst-dsp-priv.h:271:53: got void [noderef] <asn:2>*
sound/soc/intel/sst-dsp-priv.h:271:53: warning: incorrect type in argument 3 (different address spaces)
sound/soc/intel/sst-dsp-priv.h:271:53: expected void *src
sound/soc/intel/sst-dsp-priv.h:271:53: got void [noderef] <asn:2>*
sound/soc/intel/sst-dsp-priv.h:271:53: warning: incorrect type in argument 3 (different address spaces)
sound/soc/intel/sst-dsp-priv.h:271:53: expected void *src
sound/soc/intel/sst-dsp-priv.h:271:53: got void [noderef] <asn:2>*

This patch removes these warnings

---
 sound/soc/intel/sst-dsp-priv.h | 7 +++++--
 sound/soc/intel/sst-firmware.c | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
sound/soc/intel/sst-dsp-priv.h +5 -2
index 6135564..fe8e81a 100644
@@ -41,8 +41,10 @@ struct sst_ops {
 	u64 (*read64)(void __iomem *addr, u32 offset);
 
 	/* DSP I/DRAM IO */
-	void (*ram_read)(struct sst_dsp *sst, void *dest, void *src, size_t bytes);
-	void (*ram_write)(struct sst_dsp *sst, void *dest, void *src, size_t bytes);
+	void (*ram_read)(struct sst_dsp *sst, void  *dest, void __iomem *src,
+		size_t bytes);
+	void (*ram_write)(struct sst_dsp *sst, void __iomem *dest, void *src,
+		size_t bytes);
 
 	void (*dump)(struct sst_dsp *);
 
@@ -296,6 +298,7 @@ struct sst_module *sst_module_get_from_id(struct sst_dsp *dsp, u32 id);
 struct sst_module *sst_mem_block_alloc_scratch(struct sst_dsp *dsp);
 void sst_mem_block_free_scratch(struct sst_dsp *dsp,
 	struct sst_module *scratch);
+int sst_block_module_remove(struct sst_module *module);
 
 /* Register the DSPs memory blocks - would be nice to read from ACPI */
 struct sst_mem_block *sst_mem_block_register(struct sst_dsp *dsp, u32 offset,
sound/soc/intel/sst-firmware.c +1 -1
index 31cd154..dee7eb5 100644
@@ -30,7 +30,7 @@
 #include "sst-dsp.h"
 #include "sst-dsp-priv.h"
 
-static void sst_memcpy32(void *dest, void *src, u32 bytes)
+static void sst_memcpy32(volatile void __iomem *dest, void *src, u32 bytes)
 {
 	u32 i;
 
Signature · 1 line
1.8.3.2
author maintainer
#1 lore raw

PATCH 1/1 ASoC: Intel: Make sure we only build SST drivers on X86

Disable build on non X86 architectures. This fixes the following build errors on PPC :-

sound/soc/intel/sst-dsp.c: In function 'sst_dsp_outbox_write':
sound/soc/intel/sst-dsp.c:218:2: error: implicit declaration of function 'memcpy_toio' [-Werror=implicit-function-declaration]
memcpy_toio(sst->mailbox.out_base, message, bytes);
^
sound/soc/intel/sst-dsp.c: In function 'sst_dsp_outbox_read':
sound/soc/intel/sst-dsp.c:231:2: error: implicit declaration of function 'memcpy_fromio' [-Werror=implicit-function-declaration]
memcpy_fromio(message, sst->mailbox.out_base, bytes);
^

---
 sound/soc/intel/Kconfig | 1 +
 1 file changed, 1 insertion(+)
sound/soc/intel/Kconfig +1 -0
index c962432..e61bd89 100644
@@ -15,6 +15,7 @@ config SND_SST_MFLD_PLATFORM
 config SND_SOC_INTEL_SST
 	tristate "ASoC support for Intel(R) Smart Sound Technology"
 	select SND_SOC_INTEL_SST_ACPI if ACPI
+	depends on X86
 	help
           This adds support for Intel(R) Smart Sound Technology (SST).
           Say Y if you have such a device
Signature · 1 line
1.8.3.2
maintainer
#2 lore raw

Re: [PATCH] ASoC: Intel: Make sure we only build SST drivers on X86

Quoted 7 lines · Liam Girdwood

Disable build on non X86 architectures. This fixes the following build errors on PPC :-

sound/soc/intel/sst-dsp.c: In function 'sst_dsp_outbox_write':
sound/soc/intel/sst-dsp.c:218:2: error: implicit declaration of function 'memcpy_toio' [-Werror=implicit-function-declaration]
memcpy_toio(sst->mailbox.out_base, message, bytes);
^

But lots of architectures do actually have these operations, I suspect looking at some of the existing users depending on PCI is enough if excessively strict (this will improve build coverage which tends to be useful even if the driver can't be run).

#3 lore raw

Re: [PATCH] ASoC: Intel: Make sure we only build SST drivers on X86

At Thu, 20 Feb 2014 00:00:40 +0900,

Quoted 10 lines · Mark Brown
Quoted 7 lines · Liam Girdwood

Disable build on non X86 architectures. This fixes the following build errors on PPC :-

sound/soc/intel/sst-dsp.c: In function 'sst_dsp_outbox_write':
sound/soc/intel/sst-dsp.c:218:2: error: implicit declaration of function 'memcpy_toio' [-Werror=implicit-function-declaration]
memcpy_toio(sst->mailbox.out_base, message, bytes);
^

Quoted 4 lines

But lots of architectures do actually have these operations, I suspect looking at some of the existing users depending on PCI is enough if excessively strict (this will improve build coverage which tends to be useful even if the driver can't be run).

Yes. I guess including linux/io.h should fix the build issue.

Though, limiting the build to X86 isn't bad particularly for this driver.

Takashi

maintainer
#4 lore raw

Re: [PATCH] ASoC: Intel: Make sure we only build SST drivers on X86

Quoted 8 lines · Takashi Iwai
Quoted 4 lines · Mark Brown

But lots of architectures do actually have these operations, I suspect looking at some of the existing users depending on PCI is enough if excessively strict (this will improve build coverage which tends to be useful even if the driver can't be run).

Yes. I guess including linux/io.h should fix the build issue.

It should for PowerPC (and ought to be done anyway since an implicit include is going to break eventually on x86 too) but it won't for architectures that don't have the function at all.

Quoted 2 lines

Though, limiting the build to X86 isn't bad particularly for this driver.

Most people working on ASoC don't build x86 that often, more build coverage of these minority platforms is going to help avoid issues for -next! :)

#5 lore raw

Re: [PATCH] ASoC: Intel: Make sure we only build SST drivers on X86

At Thu, 20 Feb 2014 00:57:58 +0900,

Quoted 9 lines · Mark Brown
Quoted 6 lines · Takashi Iwai
Quoted 4 lines · Mark Brown

But lots of architectures do actually have these operations, I suspect looking at some of the existing users depending on PCI is enough if excessively strict (this will improve build coverage which tends to be useful even if the driver can't be run).

Quoted 5 lines
Quoted 1 line

Yes. I guess including linux/io.h should fix the build issue.

It should for PowerPC (and ought to be done anyway since an implicit include is going to break eventually on x86 too) but it won't for architectures that don't have the function at all.

memcpy_toio() is supposed to be defined in all architecture. If the arch doesn't support it properly, it still should take from asm-generic/io.h. So, it's a good test coverage for such archs ;)

Takashi

maintainer
#6 lore raw

Re: [PATCH] ASoC: Intel: Make sure we only build SST drivers on X86

Quoted 3 lines · Takashi Iwai

memcpy_toio() is supposed to be defined in all architecture. If the arch doesn't support it properly, it still should take from asm-generic/io.h. So, it's a good test coverage for such archs ;)

Ah, so it is - in that case it's just the include that needs to be added (and ideally the depends X86 || COMPILE_TEST).

author maintainer
#7 lore raw

Re: [PATCH] ASoC: Intel: Make sure we only build SST drivers on X86

In reply to Mark Brown
Quoted 9 lines · Mark Brown
Quoted 7 lines · Liam Girdwood

Disable build on non X86 architectures. This fixes the following build errors on PPC :-

sound/soc/intel/sst-dsp.c: In function 'sst_dsp_outbox_write':
sound/soc/intel/sst-dsp.c:218:2: error: implicit declaration of function 'memcpy_toio' [-Werror=implicit-function-declaration]
memcpy_toio(sst->mailbox.out_base, message, bytes);
^

Quoted 4 lines

But lots of architectures do actually have these operations, I suspect looking at some of the existing users depending on PCI is enough if excessively strict (this will improve build coverage which tends to be useful even if the driver can't be run).

I know that the other architectures will implement their own ops, but no other architecture other than X86 will have Intel SST.

I can either send a new patch that additionally includes linux/io.h or send a V2 ?

Liam

maintainer
#8 lore raw

Re: [PATCH] ASoC: Intel: Make sure we only build SST drivers on X86

Quoted 9 lines · Liam Girdwood
Quoted 4 lines · Mark Brown

But lots of architectures do actually have these operations, I suspect looking at some of the existing users depending on PCI is enough if excessively strict (this will improve build coverage which tends to be useful even if the driver can't be run).

I know that the other architectures will implement their own ops, but no other architecture other than X86 will have Intel SST.

Yes, it should be something like

	depends on (X86 || COMPILE_TEST) && WHATEVER

if there's a WHATEVER needed to guarantee the operation is there (I think PCI does the job). That way only people actively looking to build test will see the option on !X86 but people doing wider scale work can get build coverage more easily.

Quoted 2 lines

I can either send a new patch that additionally includes linux/io.h or send a V2 ?

The include of linux/io.h is needed no matter what - if it's being implicitly included on x86 then someone could change the headers and break it later on. If you can send a new patch right now that'd be great.

maintainer Applied
#9 lore raw
In reply to Liam Girdwood

On Wed, Feb 19, 2014 at 02:06:23PM +0000, Liam Girdwood wrote:

Applied, thanks.

Quoted 3 lines

Changes since V1 :-
o Fixed sparse warning for block_module_remove
o Fixed additional sparse warnings when building entire driver.

Don't put stuff like this in the changelog, if you want to include it put it after the ---. Nobody is going to care when they look at the git log since v1 won't be there.