* [PATCH] ASoC: Fix to avoid compile error
@ 2011-04-04 4:15 Seungwhan Youn
2011-04-04 4:55 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Seungwhan Youn @ 2011-04-04 4:15 UTC (permalink / raw)
To: alsa-devel; +Cc: Seungwhan Youn, broonie, jassi.brar, lrg
This patch fixes to avoid compile error when ASoC codec doesn't use I2C
nor SPI on snd_soc_hw_bulk_write_raw().
Signed-off-by: Seungwhan Youn <sw.youn@samsung.com>
---
sound/soc/soc-cache.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 22b0990..6ba1714 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -402,7 +402,7 @@ static int snd_soc_16_16_spi_write(void *control_data, const char *data,
static int snd_soc_hw_bulk_write_raw(struct snd_soc_codec *codec, unsigned int reg,
const void *data, size_t len)
{
- int ret;
+ int ret = 0;
/* Ensure that the base register is volatile. Subsequently
* any other register that is touched by this routine should be
@@ -415,10 +415,14 @@ static int snd_soc_hw_bulk_write_raw(struct snd_soc_codec *codec, unsigned int r
switch (codec->control_type) {
case SND_SOC_I2C:
+#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
ret = i2c_master_send(codec->control_data, data, len);
+#endif
break;
case SND_SOC_SPI:
+#if defined(CONFIG_SPI_MASTER)
ret = do_spi_write(codec->control_data, data, len);
+#endif
break;
default:
BUG();
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCHv2] ASoC: Fix to avoid compile error
2011-04-04 4:55 ` Mark Brown
@ 2011-04-04 4:43 ` Seungwhan Youn
2011-04-04 23:23 ` Mark Brown
2011-04-04 5:05 ` [PATCH] " Seungwhan Youn
1 sibling, 1 reply; 5+ messages in thread
From: Seungwhan Youn @ 2011-04-04 4:43 UTC (permalink / raw)
To: alsa-devel; +Cc: Seungwhan Youn, broonie, jassi.brar, lrg
This patch fixes to avoid compile error when ASoC codec doesn't use I2C
nor SPI on snd_soc_hw_bulk_write_raw().
Signed-off-by: Seungwhan Youn <sw.youn@samsung.com>
---
sound/soc/soc-cache.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 22b0990..8418b1f 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -414,12 +414,16 @@ static int snd_soc_hw_bulk_write_raw(struct snd_soc_codec *codec, unsigned int r
return -EINVAL;
switch (codec->control_type) {
+#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
case SND_SOC_I2C:
ret = i2c_master_send(codec->control_data, data, len);
break;
+#endif
+#if defined(CONFIG_SPI_MASTER)
case SND_SOC_SPI:
ret = do_spi_write(codec->control_data, data, len);
break;
+#endif
default:
BUG();
}
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: Fix to avoid compile error
2011-04-04 4:15 [PATCH] ASoC: Fix to avoid compile error Seungwhan Youn
@ 2011-04-04 4:55 ` Mark Brown
2011-04-04 4:43 ` [PATCHv2] " Seungwhan Youn
2011-04-04 5:05 ` [PATCH] " Seungwhan Youn
0 siblings, 2 replies; 5+ messages in thread
From: Mark Brown @ 2011-04-04 4:55 UTC (permalink / raw)
To: Seungwhan Youn; +Cc: alsa-devel, jassi.brar, lrg
On Mon, Apr 04, 2011 at 01:15:04PM +0900, Seungwhan Youn wrote:
> case SND_SOC_I2C:
> +#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
> ret = i2c_master_send(codec->control_data, data, len);
> +#endif
> break;
> case SND_SOC_SPI:
> +#if defined(CONFIG_SPI_MASTER)
> ret = do_spi_write(codec->control_data, data, len);
> +#endif
> break;
If we're going to ifdef these out we should be ifdefing out the entire
case, not just the operations. Otherwise if we do manage to end up with
a broken configuration then the code will silently report success which
is broken - the fact that you have to initialise ret is a bad sign.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: Fix to avoid compile error
2011-04-04 4:55 ` Mark Brown
2011-04-04 4:43 ` [PATCHv2] " Seungwhan Youn
@ 2011-04-04 5:05 ` Seungwhan Youn
1 sibling, 0 replies; 5+ messages in thread
From: Seungwhan Youn @ 2011-04-04 5:05 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, lrg, jassi.brar, Seungwhan Youn
On Mon, Apr 4, 2011 at 1:55 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Mon, Apr 04, 2011 at 01:15:04PM +0900, Seungwhan Youn wrote:
>
>> case SND_SOC_I2C:
>> +#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
>> ret = i2c_master_send(codec->control_data, data, len);
>> +#endif
>> break;
>> case SND_SOC_SPI:
>> +#if defined(CONFIG_SPI_MASTER)
>> ret = do_spi_write(codec->control_data, data, len);
>> +#endif
>> break;
>
> If we're going to ifdef these out we should be ifdefing out the entire
> case, not just the operations. Otherwise if we do manage to end up with
> a broken configuration then the code will silently report success which
> is broken - the fact that you have to initialise ret is a bad sign.
Indeed. I'll re-submit this right away.
Thank you for your comment.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCHv2] ASoC: Fix to avoid compile error
2011-04-04 4:43 ` [PATCHv2] " Seungwhan Youn
@ 2011-04-04 23:23 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2011-04-04 23:23 UTC (permalink / raw)
To: Seungwhan Youn; +Cc: alsa-devel, jassi.brar, lrg
On Mon, Apr 04, 2011 at 01:43:42PM +0900, Seungwhan Youn wrote:
> This patch fixes to avoid compile error when ASoC codec doesn't use I2C
> nor SPI on snd_soc_hw_bulk_write_raw().
>
> Signed-off-by: Seungwhan Youn <sw.youn@samsung.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-04-04 23:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-04 4:15 [PATCH] ASoC: Fix to avoid compile error Seungwhan Youn
2011-04-04 4:55 ` Mark Brown
2011-04-04 4:43 ` [PATCHv2] " Seungwhan Youn
2011-04-04 23:23 ` Mark Brown
2011-04-04 5:05 ` [PATCH] " Seungwhan Youn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).