Commit 3ff3f64b authored by Mark Brown's avatar Mark Brown Committed by Jaroslav Kysela

[ALSA] ASoC: core checkpatch cleanups

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 0be9898a
...@@ -108,9 +108,9 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec) ...@@ -108,9 +108,9 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec)
} }
#endif #endif
static inline const char* get_dai_name(int type) static inline const char *get_dai_name(int type)
{ {
switch(type) { switch (type) {
case SND_SOC_DAI_AC97_BUS: case SND_SOC_DAI_AC97_BUS:
case SND_SOC_DAI_AC97: case SND_SOC_DAI_AC97:
return "AC97"; return "AC97";
...@@ -178,9 +178,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -178,9 +178,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
/* Check that the codec and cpu DAI's are compatible */ /* Check that the codec and cpu DAI's are compatible */
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
runtime->hw.rate_min = runtime->hw.rate_min =
max(codec_dai->playback.rate_min, cpu_dai->playback.rate_min); max(codec_dai->playback.rate_min,
cpu_dai->playback.rate_min);
runtime->hw.rate_max = runtime->hw.rate_max =
min(codec_dai->playback.rate_max, cpu_dai->playback.rate_max); min(codec_dai->playback.rate_max,
cpu_dai->playback.rate_max);
runtime->hw.channels_min = runtime->hw.channels_min =
max(codec_dai->playback.channels_min, max(codec_dai->playback.channels_min,
cpu_dai->playback.channels_min); cpu_dai->playback.channels_min);
...@@ -193,9 +195,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -193,9 +195,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
codec_dai->playback.rates & cpu_dai->playback.rates; codec_dai->playback.rates & cpu_dai->playback.rates;
} else { } else {
runtime->hw.rate_min = runtime->hw.rate_min =
max(codec_dai->capture.rate_min, cpu_dai->capture.rate_min); max(codec_dai->capture.rate_min,
cpu_dai->capture.rate_min);
runtime->hw.rate_max = runtime->hw.rate_max =
min(codec_dai->capture.rate_max, cpu_dai->capture.rate_max); min(codec_dai->capture.rate_max,
cpu_dai->capture.rate_max);
runtime->hw.channels_min = runtime->hw.channels_min =
max(codec_dai->capture.channels_min, max(codec_dai->capture.channels_min,
cpu_dai->capture.channels_min); cpu_dai->capture.channels_min);
...@@ -225,7 +229,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -225,7 +229,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
goto machine_err; goto machine_err;
} }
dbg("asoc: %s <-> %s info:\n",codec_dai->name, cpu_dai->name); dbg("asoc: %s <-> %s info:\n", codec_dai->name, cpu_dai->name);
dbg("asoc: rate mask 0x%x\n", runtime->hw.rates); dbg("asoc: rate mask 0x%x\n", runtime->hw.rates);
dbg("asoc: min ch %d max ch %d\n", runtime->hw.channels_min, dbg("asoc: min ch %d max ch %d\n", runtime->hw.channels_min,
runtime->hw.channels_max); runtime->hw.channels_max);
...@@ -272,7 +276,7 @@ static void close_delayed_work(struct work_struct *work) ...@@ -272,7 +276,7 @@ static void close_delayed_work(struct work_struct *work)
int i; int i;
mutex_lock(&pcm_mutex); mutex_lock(&pcm_mutex);
for(i = 0; i < codec->num_dai; i++) { for (i = 0; i < codec->num_dai; i++) {
codec_dai = &codec->dai[i]; codec_dai = &codec->dai[i];
dbg("pop wq checking: %s status: %s waiting: %s\n", dbg("pop wq checking: %s status: %s waiting: %s\n",
...@@ -511,7 +515,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -511,7 +515,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if (cpu_dai->ops.hw_params) { if (cpu_dai->ops.hw_params) {
ret = cpu_dai->ops.hw_params(substream, params); ret = cpu_dai->ops.hw_params(substream, params);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: can't set interface %s hw params\n", printk(KERN_ERR "asoc: interface %s hw params failed\n",
cpu_dai->name); cpu_dai->name);
goto interface_err; goto interface_err;
} }
...@@ -520,7 +524,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -520,7 +524,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if (platform->pcm_ops->hw_params) { if (platform->pcm_ops->hw_params) {
ret = platform->pcm_ops->hw_params(substream, params); ret = platform->pcm_ops->hw_params(substream, params);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: can't set platform %s hw params\n", printk(KERN_ERR "asoc: platform %s hw params failed\n",
platform->name); platform->name);
goto platform_err; goto platform_err;
} }
...@@ -539,7 +543,7 @@ interface_err: ...@@ -539,7 +543,7 @@ interface_err:
codec_dai->ops.hw_free(substream); codec_dai->ops.hw_free(substream);
codec_err: codec_err:
if(machine->ops && machine->ops->hw_free) if (machine->ops && machine->ops->hw_free)
machine->ops->hw_free(substream); machine->ops->hw_free(substream);
mutex_unlock(&pcm_mutex); mutex_unlock(&pcm_mutex);
...@@ -636,7 +640,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -636,7 +640,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
int i; int i;
/* mute any active DAC's */ /* mute any active DAC's */
for(i = 0; i < machine->num_links; i++) { for (i = 0; i < machine->num_links; i++) {
struct snd_soc_codec_dai *dai = machine->dai_link[i].codec_dai; struct snd_soc_codec_dai *dai = machine->dai_link[i].codec_dai;
if (dai->dai_ops.digital_mute && dai->playback.active) if (dai->dai_ops.digital_mute && dai->playback.active)
dai->dai_ops.digital_mute(dai, 1); dai->dai_ops.digital_mute(dai, 1);
...@@ -649,7 +653,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -649,7 +653,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
if (machine->suspend_pre) if (machine->suspend_pre)
machine->suspend_pre(pdev, state); machine->suspend_pre(pdev, state);
for(i = 0; i < machine->num_links; i++) { for (i = 0; i < machine->num_links; i++) {
struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai; struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;
if (cpu_dai->suspend && cpu_dai->type != SND_SOC_DAI_AC97) if (cpu_dai->suspend && cpu_dai->type != SND_SOC_DAI_AC97)
cpu_dai->suspend(pdev, cpu_dai); cpu_dai->suspend(pdev, cpu_dai);
...@@ -661,7 +665,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -661,7 +665,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
run_delayed_work(&socdev->delayed_work); run_delayed_work(&socdev->delayed_work);
codec->suspend_bias_level = codec->bias_level; codec->suspend_bias_level = codec->bias_level;
for(i = 0; i < codec->num_dai; i++) { for (i = 0; i < codec->num_dai; i++) {
char *stream = codec->dai[i].playback.stream_name; char *stream = codec->dai[i].playback.stream_name;
if (stream != NULL) if (stream != NULL)
snd_soc_dapm_stream_event(codec, stream, snd_soc_dapm_stream_event(codec, stream,
...@@ -675,7 +679,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -675,7 +679,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
if (codec_dev->suspend) if (codec_dev->suspend)
codec_dev->suspend(pdev, state); codec_dev->suspend(pdev, state);
for(i = 0; i < machine->num_links; i++) { for (i = 0; i < machine->num_links; i++) {
struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai; struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;
if (cpu_dai->suspend && cpu_dai->type == SND_SOC_DAI_AC97) if (cpu_dai->suspend && cpu_dai->type == SND_SOC_DAI_AC97)
cpu_dai->suspend(pdev, cpu_dai); cpu_dai->suspend(pdev, cpu_dai);
...@@ -700,7 +704,7 @@ static int soc_resume(struct platform_device *pdev) ...@@ -700,7 +704,7 @@ static int soc_resume(struct platform_device *pdev)
if (machine->resume_pre) if (machine->resume_pre)
machine->resume_pre(pdev); machine->resume_pre(pdev);
for(i = 0; i < machine->num_links; i++) { for (i = 0; i < machine->num_links; i++) {
struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai; struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;
if (cpu_dai->resume && cpu_dai->type == SND_SOC_DAI_AC97) if (cpu_dai->resume && cpu_dai->type == SND_SOC_DAI_AC97)
cpu_dai->resume(pdev, cpu_dai); cpu_dai->resume(pdev, cpu_dai);
...@@ -709,8 +713,8 @@ static int soc_resume(struct platform_device *pdev) ...@@ -709,8 +713,8 @@ static int soc_resume(struct platform_device *pdev)
if (codec_dev->resume) if (codec_dev->resume)
codec_dev->resume(pdev); codec_dev->resume(pdev);
for(i = 0; i < codec->num_dai; i++) { for (i = 0; i < codec->num_dai; i++) {
char* stream = codec->dai[i].playback.stream_name; char *stream = codec->dai[i].playback.stream_name;
if (stream != NULL) if (stream != NULL)
snd_soc_dapm_stream_event(codec, stream, snd_soc_dapm_stream_event(codec, stream,
SND_SOC_DAPM_STREAM_RESUME); SND_SOC_DAPM_STREAM_RESUME);
...@@ -720,14 +724,14 @@ static int soc_resume(struct platform_device *pdev) ...@@ -720,14 +724,14 @@ static int soc_resume(struct platform_device *pdev)
SND_SOC_DAPM_STREAM_RESUME); SND_SOC_DAPM_STREAM_RESUME);
} }
/* unmute any active DAC's */ /* unmute any active DACs */
for(i = 0; i < machine->num_links; i++) { for (i = 0; i < machine->num_links; i++) {
struct snd_soc_codec_dai *dai = machine->dai_link[i].codec_dai; struct snd_soc_codec_dai *dai = machine->dai_link[i].codec_dai;
if (dai->dai_ops.digital_mute && dai->playback.active) if (dai->dai_ops.digital_mute && dai->playback.active)
dai->dai_ops.digital_mute(dai, 0); dai->dai_ops.digital_mute(dai, 0);
} }
for(i = 0; i < machine->num_links; i++) { for (i = 0; i < machine->num_links; i++) {
struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai; struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;
if (cpu_dai->resume && cpu_dai->type != SND_SOC_DAI_AC97) if (cpu_dai->resume && cpu_dai->type != SND_SOC_DAI_AC97)
cpu_dai->resume(pdev, cpu_dai); cpu_dai->resume(pdev, cpu_dai);
...@@ -757,7 +761,7 @@ static int soc_probe(struct platform_device *pdev) ...@@ -757,7 +761,7 @@ static int soc_probe(struct platform_device *pdev)
if (machine->probe) { if (machine->probe) {
ret = machine->probe(pdev); ret = machine->probe(pdev);
if(ret < 0) if (ret < 0)
return ret; return ret;
} }
...@@ -765,20 +769,20 @@ static int soc_probe(struct platform_device *pdev) ...@@ -765,20 +769,20 @@ static int soc_probe(struct platform_device *pdev)
struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai; struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;
if (cpu_dai->probe) { if (cpu_dai->probe) {
ret = cpu_dai->probe(pdev); ret = cpu_dai->probe(pdev);
if(ret < 0) if (ret < 0)
goto cpu_dai_err; goto cpu_dai_err;
} }
} }
if (codec_dev->probe) { if (codec_dev->probe) {
ret = codec_dev->probe(pdev); ret = codec_dev->probe(pdev);
if(ret < 0) if (ret < 0)
goto cpu_dai_err; goto cpu_dai_err;
} }
if (platform->probe) { if (platform->probe) {
ret = platform->probe(pdev); ret = platform->probe(pdev);
if(ret < 0) if (ret < 0)
goto platform_err; goto platform_err;
} }
...@@ -865,7 +869,7 @@ static int soc_new_pcm(struct snd_soc_device *socdev, ...@@ -865,7 +869,7 @@ static int soc_new_pcm(struct snd_soc_device *socdev,
codec_dai->codec = socdev->codec; codec_dai->codec = socdev->codec;
/* check client and interface hw capabilities */ /* check client and interface hw capabilities */
sprintf(new_name, "%s %s-%s-%d",dai_link->stream_name, codec_dai->name, sprintf(new_name, "%s %s-%s-%d", dai_link->stream_name, codec_dai->name,
get_dai_name(cpu_dai->type), num); get_dai_name(cpu_dai->type), num);
if (codec_dai->playback.channels_min) if (codec_dai->playback.channels_min)
...@@ -876,7 +880,8 @@ static int soc_new_pcm(struct snd_soc_device *socdev, ...@@ -876,7 +880,8 @@ static int soc_new_pcm(struct snd_soc_device *socdev,
ret = snd_pcm_new(codec->card, new_name, codec->pcm_devs++, playback, ret = snd_pcm_new(codec->card, new_name, codec->pcm_devs++, playback,
capture, &pcm); capture, &pcm);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: can't create pcm for codec %s\n", codec->name); printk(KERN_ERR "asoc: can't create pcm for codec %s\n",
codec->name);
kfree(rtd); kfree(rtd);
return ret; return ret;
} }
...@@ -925,8 +930,9 @@ static ssize_t codec_reg_show(struct device *dev, ...@@ -925,8 +930,9 @@ static ssize_t codec_reg_show(struct device *dev,
step = codec->reg_cache_step; step = codec->reg_cache_step;
count += sprintf(buf, "%s registers\n", codec->name); count += sprintf(buf, "%s registers\n", codec->name);
for(i = 0; i < codec->reg_cache_size; i += step) for (i = 0; i < codec->reg_cache_size; i += step)
count += sprintf(buf + count, "%2x: %4x\n", i, codec->read(codec, i)); count += sprintf(buf + count, "%2x: %4x\n", i,
codec->read(codec, i));
return count; return count;
} }
...@@ -1069,7 +1075,7 @@ int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid) ...@@ -1069,7 +1075,7 @@ int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid)
strncpy(codec->card->driver, codec->name, sizeof(codec->card->driver)); strncpy(codec->card->driver, codec->name, sizeof(codec->card->driver));
/* create the pcms */ /* create the pcms */
for(i = 0; i < machine->num_links; i++) { for (i = 0; i < machine->num_links; i++) {
ret = soc_new_pcm(socdev, &machine->dai_link[i], i); ret = soc_new_pcm(socdev, &machine->dai_link[i], i);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: can't create pcm %s\n", printk(KERN_ERR "asoc: can't create pcm %s\n",
...@@ -1099,7 +1105,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev) ...@@ -1099,7 +1105,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev)
struct snd_soc_machine *machine = socdev->machine; struct snd_soc_machine *machine = socdev->machine;
int ret = 0, i, ac97 = 0, err = 0; int ret = 0, i, ac97 = 0, err = 0;
for(i = 0; i < machine->num_links; i++) { for (i = 0; i < machine->num_links; i++) {
if (socdev->machine->dai_link[i].init) { if (socdev->machine->dai_link[i].init) {
err = socdev->machine->dai_link[i].init(codec); err = socdev->machine->dai_link[i].init(codec);
if (err < 0) { if (err < 0) {
...@@ -1119,7 +1125,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev) ...@@ -1119,7 +1125,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev)
ret = snd_card_register(codec->card); ret = snd_card_register(codec->card);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "asoc: failed to register soundcard for codec %s\n", printk(KERN_ERR "asoc: failed to register soundcard for %s\n",
codec->name); codec->name);
goto out; goto out;
} }
...@@ -1143,7 +1149,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev) ...@@ -1143,7 +1149,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev)
err = device_create_file(socdev->dev, &dev_attr_codec_reg); err = device_create_file(socdev->dev, &dev_attr_codec_reg);
if (err < 0) if (err < 0)
printk(KERN_WARNING "asoc: failed to add codec sysfs entries\n"); printk(KERN_WARNING "asoc: failed to add codec sysfs files\n");
mutex_unlock(&codec->mutex); mutex_unlock(&codec->mutex);
...@@ -1169,7 +1175,7 @@ void snd_soc_free_pcms(struct snd_soc_device *socdev) ...@@ -1169,7 +1175,7 @@ void snd_soc_free_pcms(struct snd_soc_device *socdev)
mutex_lock(&codec->mutex); mutex_lock(&codec->mutex);
#ifdef CONFIG_SND_SOC_AC97_BUS #ifdef CONFIG_SND_SOC_AC97_BUS
for(i = 0; i < codec->num_dai; i++) { for (i = 0; i < codec->num_dai; i++) {
codec_dai = &codec->dai[i]; codec_dai = &codec->dai[i];
if (codec_dai->type == SND_SOC_DAI_AC97_BUS && codec->ac97) { if (codec_dai->type == SND_SOC_DAI_AC97_BUS && codec->ac97) {
soc_ac97_dev_unregister(codec); soc_ac97_dev_unregister(codec);
...@@ -1279,7 +1285,8 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol, ...@@ -1279,7 +1285,8 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
for (bitmask = 1; bitmask < e->mask; bitmask <<= 1) for (bitmask = 1; bitmask < e->mask; bitmask <<= 1)
; ;
val = snd_soc_read(codec, e->reg); val = snd_soc_read(codec, e->reg);
ucontrol->value.enumerated.item[0] = (val >> e->shift_l) & (bitmask - 1); ucontrol->value.enumerated.item[0]
= (val >> e->shift_l) & (bitmask - 1);
if (e->shift_l != e->shift_r) if (e->shift_l != e->shift_r)
ucontrol->value.enumerated.item[1] = ucontrol->value.enumerated.item[1] =
(val >> e->shift_r) & (bitmask - 1); (val >> e->shift_r) & (bitmask - 1);
...@@ -1573,7 +1580,8 @@ int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol, ...@@ -1573,7 +1580,8 @@ int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol,
val = val << shift; val = val << shift;
val2 = val2 << shift; val2 = val2 << shift;
if ((err = snd_soc_update_bits(codec, reg, val_mask, val)) < 0) err = snd_soc_update_bits(codec, reg, val_mask, val);
if (err < 0)
return err; return err;
err = snd_soc_update_bits(codec, reg2, val_mask, val2); err = snd_soc_update_bits(codec, reg2, val_mask, val2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment