ASoC: Fix trival sparse warnings
Subsystems (5)
cover ASoC: Fix trival sparse warnings
Hi,
This series fixes a couple of trivial issues that are reported when running the sparse codechecker on the ASoC tree.
- Lars
Lars-Peter Clausen (5):
ASoC: tlv320aic31xx: Remove duplicate const
ASoC: cs42xx8: Make of match table static
ASoC: omap-pcm: Include omap-pcm.h
ASoC: rcar: Fix dma direction type
ASoC: sh/fsi: Make one-bit bitfields unsigned
sound/soc/codecs/cs42xx8.c | 2 +- sound/soc/codecs/tlv320aic31xx.c | 21 ++++++++++----------- sound/soc/omap/omap-pcm.c | 1 + sound/soc/sh/fsi.c | 12 ++++++------ sound/soc/sh/rcar/core.c | 2 +- sound/soc/sh/rcar/rsnd.h | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-)
Signature · 1 line
1.8.0
PATCH 1/5 ASoC: tlv320aic31xx: Remove duplicate const
SOC_ENUM_SINGLE_DECL() already adds the const qualifier, so there is no need to manually specify it.
Fixes the following warnings from sparse:
sound/soc/codecs/tlv320aic31xx.c:253:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:255:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:257:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:260:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:262:1: warning: duplicate const
--- sound/soc/codecs/tlv320aic31xx.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
sound/soc/codecs/tlv320aic31xx.c +10 -11
@@ -249,17 +249,16 @@ static const char * const mic_select_text[] = {"Off" ,"FFR 10 Ohm" ,"FFR 20 Ohm" ,"FFR 40 Ohm" }; -static const -SOC_ENUM_SINGLE_DECL(mic1lp_p_enum, AIC31XX_MICPGAPI, 6, mic_select_text); -static const -SOC_ENUM_SINGLE_DECL(mic1rp_p_enum, AIC31XX_MICPGAPI, 4, mic_select_text); -static const -SOC_ENUM_SINGLE_DECL(mic1lm_p_enum, AIC31XX_MICPGAPI, 2, mic_select_text); - -static const -SOC_ENUM_SINGLE_DECL(cm_m_enum, AIC31XX_MICPGAMI, 6, mic_select_text); -static const -SOC_ENUM_SINGLE_DECL(mic1lm_m_enum, AIC31XX_MICPGAMI, 4, mic_select_text); +static SOC_ENUM_SINGLE_DECL(mic1lp_p_enum, AIC31XX_MICPGAPI, 6, + mic_select_text); +static SOC_ENUM_SINGLE_DECL(mic1rp_p_enum, AIC31XX_MICPGAPI, 4, + mic_select_text); +static SOC_ENUM_SINGLE_DECL(mic1lm_p_enum, AIC31XX_MICPGAPI, 2, + mic_select_text); + +static SOC_ENUM_SINGLE_DECL(cm_m_enum, AIC31XX_MICPGAMI, 6, mic_select_text); +static SOC_ENUM_SINGLE_DECL(mic1lm_m_enum, AIC31XX_MICPGAMI, 4, + mic_select_text); static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6350, 50, 0); static const DECLARE_TLV_DB_SCALE(adc_fgain_tlv, 0, 10, 0);
Signature · 1 line
1.8.0
Re: [PATCH 1/5] ASoC: tlv320aic31xx: Remove duplicate const
Quoted 2 lines · Lars-Peter Clausen
SOC_ENUM_SINGLE_DECL()already adds the const qualifier, so there is no need to manually specify it.
Applied, thanks.
PATCH 2/5 ASoC: cs42xx8: Make of match table static
In reply to Lars-Peter ClausenThe cs42xx8_of_match table is not used outside of the driver, hence it can and should be made static.
Fixes the following warning from sparse:
sound/soc/codecs/cs42xx8.c:425:27: warning: symbol 'cs42xx8_of_match' was not declared. Should it be static?
--- sound/soc/codecs/cs42xx8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs42xx8.c +1 -1
@@ -422,7 +422,7 @@ const struct cs42xx8_driver_data cs42888_data = { };EXPORT_SYMBOL_GPL (cs42888_data); -const struct of_device_id cs42xx8_of_match[] = { +static const struct of_device_id cs42xx8_of_match[] = { { .compatible ="cirrus,cs42448" , .data = &cs42448_data, }, { .compatible ="cirrus,cs42888" , .data = &cs42888_data, }, {/* sentinel */ }
Signature · 1 line
1.8.0
Re: [PATCH 2/5] ASoC: cs42xx8: Make of match table static
Quoted 8 lines · Lars-Peter Clausen
The
cs42xx8_of_matchtable is not used outside of the driver, hence it can and should be made static.Fixes the following warning from sparse:
sound/soc/codecs/cs42xx8.c:425:27: warning: symbol 'cs42xx8_of_match' was not declared. Should it be static?Signed-off-by Lars-Peter Clausen <[email protected]>
Thanks,
Re: [PATCH 2/5] ASoC: cs42xx8: Make of match table static
In reply to Lars-Peter ClausenQuoted 2 lines · Lars-Peter Clausen
The
cs42xx8_of_matchtable is not used outside of the driver, hence it can and should be made static.
Applied, thanks.
PATCH 3/5 ASoC: omap-pcm: Include omap-pcm.h
In reply to Lars-Peter Clausenomap_pcm_platform_register() is declared in omap-pcm.h and defined in omap-pcm.c. To make sure that the function signature matches for both omap-pcm.c should include omap-pcm.h
Fixes the following warning from sparse:
sound/soc/omap/omap-pcm.c:235:5: warning: symbol 'omap_pcm_platform_register' was not declared. Should it be static?
--- sound/soc/omap/omap-pcm.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/omap/omap-pcm.c +1 -0
@@ -31,6 +31,7 @@#include <sound/pcm_params.h> #include <sound/dmaengine_pcm.h> #include <sound/soc.h> +#include <sound/omap-pcm.h> #ifdef CONFIG_ARCH_OMAP1 #define pcm_omap1510 () cpu_is_omap1510()
Signature · 1 line
1.8.0
Re: [PATCH 3/5] ASoC: omap-pcm: Include omap-pcm.h
Quoted 3 lines · Lars-Peter Clausen
omap_pcm_platform_register()is declared inomap-pcm.hand defined inomap-pcm.c. To make sure that the function signature matches for bothomap-pcm.cshould includeomap-pcm.h
Applied, thanks.
Re: [PATCH 3/5] ASoC: omap-pcm: Include omap-pcm.h
Quoted 6 lines · Mark Brown
Quoted 3 lines · Lars-Peter Clausen
omap_pcm_platform_register()is declared inomap-pcm.hand defined inomap-pcm.c. To make sure that the function signature matches for bothomap-pcm.cshould includeomap-pcm.hApplied, thanks.
This patch somehow did not make it, the patch is not in asoc/next, nor is there a asoc/topic/omap or similar. Shall I resend?
Thanks,
- Lars
Mark Brown
maintainerRe: [PATCH 3/5] ASoC: omap-pcm: Include omap-pcm.h
Quoted 6 lines · Lars-Peter Clausen
Quoted 1 line · Mark Brown
Applied, thanks.
This patch somehow did not make it, the patch is not in asoc/next, nor is there a asoc/topic/omap or similar. Shall I resend?
It seems to be there?
Re: [PATCH 3/5] ASoC: omap-pcm: Include omap-pcm.h
Quoted 10 lines · Mark Brown
Quoted 6 lines · Lars-Peter Clausen
Quoted 1 line · Mark Brown
Applied, thanks.
This patch somehow did not make it, the patch is not in asoc/next, nor is there a asoc/topic/omap or similar. Shall I resend?
It seems to be there?
Now it is.
Thanks,
- Lars
PATCH 4/5 ASoC: rcar: Fix dma direction type
In reply to Lars-Peter Clausendmaengine_prep_slave_single() expects a enum dma_transfer_direction and not a enum dma_data_direction. Since the integer representations of both DMA_TO_DEVICE and DMA_MEM_TO_DEV aswell as DMA_FROM_DEVICE and DMA_DEV_TO_MEM have the same value the code worked fine even though it was using the wrong type.
Fixes the following warning from sparse:
sound/soc/sh/rcar/core.c:227:49: warning: mixing different enum types
sound/soc/sh/rcar/core.c:227:49: int enum dma_data_direction versus
sound/soc/sh/rcar/core.c:227:49: int enum dma_transfer_direction
--- sound/soc/sh/rcar/core.c | 2 +- sound/soc/sh/rcar/rsnd.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/sh/rcar/core.c +1 -1
@@ -363,7 +363,7 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,if (ret <0 ) goto rsnd_dma_init_err; - dma->dir = is_play ?DMA_TO_DEVICE :DMA_FROM_DEVICE ; + dma->dir = is_play ?DMA_MEM_TO_DEV :DMA_DEV_TO_MEM ;INIT_WORK (&dma->work, rsnd_dma_do_work);return 0 ;
sound/soc/sh/rcar/rsnd.h +1 -1
@@ -158,7 +158,7 @@ struct rsnd_dma {struct sh_dmae_slave slave;struct work_struct work;struct dma_chan *chan; -enum dma_data_direction dir; +enum dma_transfer_direction dir;int submit_loop;int offset;/* it cares A/B plane */
Signature · 1 line
1.8.0
Re: [PATCH 4/5] ASoC: rcar: Fix dma direction type
Hi Lars
Quoted 5 lines
dmaengine_prep_slave_single()expects a enumdma_transfer_directionand not a enumdma_data_direction. Since the integer representations of bothDMA_TO_DEVICEandDMA_MEM_TO_DEVaswell asDMA_FROM_DEVICEandDMA_DEV_TO_MEMhave the same value the code worked fine even though it was using the wrong type.
Quoted 7 lines
Fixes the following warning from sparse:
sound/soc/sh/rcar/core.c:227:49: warning: mixing different enum types
sound/soc/sh/rcar/core.c:227:49: int enumdma_data_directionversus
sound/soc/sh/rcar/core.c:227:49: int enumdma_transfer_directionSigned-off-by Lars-Peter Clausen <[email protected]>---
Actually, ${LINUX}/sound/soc/sh/fsi.c :: fsi_dma_transfer() is using enum dma_data_direction to dmaengine_prep_dma_cyclic() Does it have same issue ?
Quoted 33 lines
sound/soc/sh/rcar/core.c | 2 +- sound/soc/sh/rcar/rsnd.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)sound/soc/sh/rcar/core.c +1
-1@@ -363,7 +363,7 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,if (ret <0 ) goto rsnd_dma_init_err; - dma->dir = is_play ?DMA_TO_DEVICE :DMA_FROM_DEVICE ; + dma->dir = is_play ?DMA_MEM_TO_DEV :DMA_DEV_TO_MEM ;INIT_WORK (&dma->work, rsnd_dma_do_work);return 0 ;sound/soc/sh/rcar/rsnd.h +1
-1@@ -158,7 +158,7 @@ struct rsnd_dma {struct sh_dmae_slave slave;struct work_struct work;struct dma_chan *chan; -enum dma_data_direction dir; +enum dma_transfer_direction dir;int submit_loop;int offset;/* it cares A/B plane */ Signature · 1 line
1.8.0
Re: [PATCH 4/5] ASoC: rcar: Fix dma direction type
Quoted 13 lines · Kuninori Morimoto
Hi Lars
Quoted 10 lines
dmaengine_prep_slave_single()expects a enumdma_transfer_directionand not a enumdma_data_direction. Since the integer representations of bothDMA_TO_DEVICEandDMA_MEM_TO_DEVaswell asDMA_FROM_DEVICEandDMA_DEV_TO_MEMhave the same value the code worked fine even though it was using the wrong type.Fixes the following warning from sparse:
sound/soc/sh/rcar/core.c:227:49: warning: mixing different enum types
sound/soc/sh/rcar/core.c:227:49: int enumdma_data_directionversus
sound/soc/sh/rcar/core.c:227:49: int enumdma_transfer_direction
Quoted 8 lines
Quoted 2 lines
Signed-off-by Lars-Peter Clausen <[email protected]>---
Actually,
${LINUX}/sound/soc/sh/fsi.c::fsi_dma_transfer()is using enumdma_data_directiontodmaengine_prep_dma_cyclic()Does it have same issue ?
Yes, but the fix for that should go in after your "ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer" patch, because otherwise the fix just introduces a new warning because before that patch dir is also passed to dma_sync_single_xxx() which wants a enum dma_data_direction.
- Lars
Re: [PATCH 4/5] ASoC: rcar: Fix dma direction type
Hi Lars
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
dmaengine_prep_slave_single()expects a enumdma_transfer_directionand not a enumdma_data_direction. Since the integer representations of bothDMA_TO_DEVICEandDMA_MEM_TO_DEVaswell asDMA_FROM_DEVICEandDMA_DEV_TO_MEMhave the same value the code worked fine even though it was using the wrong type.Quoted 7 lines
Fixes the following warning from sparse:
sound/soc/sh/rcar/core.c:227:49: warning: mixing different enum types
sound/soc/sh/rcar/core.c:227:49: int enumdma_data_directionversus
sound/soc/sh/rcar/core.c:227:49: int enumdma_transfer_directionSigned-off-by Lars-Peter Clausen <[email protected]>---
Quoted 8 lines
Quoted 3 lines
Actually,
${LINUX}/sound/soc/sh/fsi.c::fsi_dma_transfer()is using enumdma_data_directiontodmaengine_prep_dma_cyclic()Does it have same issue ?Yes, but the fix for that should go in after your "ASoC: fsi: use
SNDRV_DMA_TYPE_DEVfor sound buffer" patch, because otherwise the fix just introduces a new warning because before that patch dir is also passed todma_sync_single_xxx()which wants a enumdma_data_direction.
Ahh, yes, indeed
Thank you for your explain
Re: [PATCH 4/5] ASoC: rcar: Fix dma direction type
In reply to Lars-Peter ClausenQuoted 4 lines · Lars-Peter Clausen
dmaengine_prep_slave_single()expects a enumdma_transfer_directionand not a enumdma_data_direction. Since the integer representations of bothDMA_TO_DEVICEandDMA_MEM_TO_DEVaswell asDMA_FROM_DEVICEandDMA_DEV_TO_MEMhave the same value the code worked fine even though it was using the wrong type.
Applied, thanks.
PATCH 5/5 ASoC: sh/fsi: Make one-bit bitfields unsigned
In reply to Lars-Peter ClausenOne-bit signed bitfields have two possible values: 0 and -1. This sometimes leads to unexpected results (e.g. foo.bar = 1; foo.bar == 1 => false) which is why it is recommended to make one-bit bitfields unsigned.
This fixes the following sparse warnings:
sound/soc/sh/fsi.c:267:25: error: dubious one-bit signed bitfield sound/soc/sh/fsi.c:268:22: error: dubious one-bit signed bitfield sound/soc/sh/fsi.c:269:20: error: dubious one-bit signed bitfield sound/soc/sh/fsi.c:270:28: error: dubious one-bit signed bitfield sound/soc/sh/fsi.c:271:26: error: dubious one-bit signed bitfield sound/soc/sh/fsi.c:272:25: error: dubious one-bit signed bitfield
--- sound/soc/sh/fsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/sh/fsi.c +6 -6
@@ -264,12 +264,12 @@ struct fsi_priv {u32 fmt; int chan_num:16; - int clk_master:1; - int clk_cpg:1; - int spdif:1; - int enable_stream:1; - int bit_clk_inv:1; - int lr_clk_inv:1; + unsigned int clk_master:1; + unsigned int clk_cpg:1; + unsigned int spdif:1; + unsigned int enable_stream:1; + unsigned int bit_clk_inv:1; + unsigned int lr_clk_inv:1; };struct fsi_stream_handler {
Signature · 1 line
1.8.0
Re: [PATCH 5/5] ASoC: sh/fsi: Make one-bit bitfields unsigned
Hi
Quoted 12 lines
One-bit signed bitfields have two possible values: 0 and -1. This sometimes leads to unexpected results (e.g. foo.bar = 1; foo.bar == 1 => false) which is why it is recommended to make one-bit bitfields unsigned.
This fixes the following sparse warnings:
sound/soc/sh/fsi.c:267:25: error: dubious one-bit signed bitfieldsound/soc/sh/fsi.c:268:22: error: dubious one-bit signed bitfieldsound/soc/sh/fsi.c:269:20: error: dubious one-bit signed bitfieldsound/soc/sh/fsi.c:270:28: error: dubious one-bit signed bitfieldsound/soc/sh/fsi.c:271:26: error: dubious one-bit signed bitfieldsound/soc/sh/fsi.c:272:25: error: dubious one-bit signed bitfield
Quoted 2 lines
Signed-off-by Lars-Peter Clausen <[email protected]>---
Quoted 29 lines
sound/soc/sh/fsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)sound/soc/sh/fsi.c +6
-6@@ -264,12 +264,12 @@ struct fsi_priv {u32 fmt; int chan_num:16; - int clk_master:1; - int clk_cpg:1; - int spdif:1; - int enable_stream:1; - int bit_clk_inv:1; - int lr_clk_inv:1; + unsigned int clk_master:1; + unsigned int clk_cpg:1; + unsigned int spdif:1; + unsigned int enable_stream:1; + unsigned int bit_clk_inv:1; + unsigned int lr_clk_inv:1; };struct fsi_stream_handler {Signature · 1 line
1.8.0
Re: [PATCH 5/5] ASoC: sh/fsi: Make one-bit bitfields unsigned
In reply to Lars-Peter ClausenQuoted 3 lines · Lars-Peter Clausen
One-bit signed bitfields have two possible values: 0 and -1. This sometimes leads to unexpected results (e.g. foo.bar = 1; foo.bar == 1 => false) which is why it is recommended to make one-bit bitfields unsigned.
Applied, thanks.