Commit 9900a422 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: remove unneeded dai->driver->ops check

On soc_add_dai(), it uses null_dai_ops if driver doesn't have
its own ops. This means, dai->driver->ops never been NULL.
dai->driver->ops check is not needed.
This patch removes it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 46471925
...@@ -3681,7 +3681,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ...@@ -3681,7 +3681,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
switch (event) { switch (event) {
case SND_SOC_DAPM_PRE_PMU: case SND_SOC_DAPM_PRE_PMU:
substream.stream = SNDRV_PCM_STREAM_CAPTURE; substream.stream = SNDRV_PCM_STREAM_CAPTURE;
if (source->driver->ops && source->driver->ops->startup) { if (source->driver->ops->startup) {
ret = source->driver->ops->startup(&substream, source); ret = source->driver->ops->startup(&substream, source);
if (ret < 0) { if (ret < 0) {
dev_err(source->dev, dev_err(source->dev,
...@@ -3695,7 +3695,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ...@@ -3695,7 +3695,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
goto out; goto out;
substream.stream = SNDRV_PCM_STREAM_PLAYBACK; substream.stream = SNDRV_PCM_STREAM_PLAYBACK;
if (sink->driver->ops && sink->driver->ops->startup) { if (sink->driver->ops->startup) {
ret = sink->driver->ops->startup(&substream, sink); ret = sink->driver->ops->startup(&substream, sink);
if (ret < 0) { if (ret < 0) {
dev_err(sink->dev, dev_err(sink->dev,
...@@ -3725,13 +3725,13 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, ...@@ -3725,13 +3725,13 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
ret = 0; ret = 0;
source->active--; source->active--;
if (source->driver->ops && source->driver->ops->shutdown) { if (source->driver->ops->shutdown) {
substream.stream = SNDRV_PCM_STREAM_CAPTURE; substream.stream = SNDRV_PCM_STREAM_CAPTURE;
source->driver->ops->shutdown(&substream, source); source->driver->ops->shutdown(&substream, source);
} }
sink->active--; sink->active--;
if (sink->driver->ops && sink->driver->ops->shutdown) { if (sink->driver->ops->shutdown) {
substream.stream = SNDRV_PCM_STREAM_PLAYBACK; substream.stream = SNDRV_PCM_STREAM_PLAYBACK;
sink->driver->ops->shutdown(&substream, sink); sink->driver->ops->shutdown(&substream, sink);
} }
......
...@@ -474,7 +474,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -474,7 +474,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
/* startup the audio subsystem */ /* startup the audio subsystem */
if (cpu_dai->driver->ops && cpu_dai->driver->ops->startup) { if (cpu_dai->driver->ops->startup) {
ret = cpu_dai->driver->ops->startup(substream, cpu_dai); ret = cpu_dai->driver->ops->startup(substream, cpu_dai);
if (ret < 0) { if (ret < 0) {
dev_err(cpu_dai->dev, "ASoC: can't open interface" dev_err(cpu_dai->dev, "ASoC: can't open interface"
...@@ -494,7 +494,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -494,7 +494,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
for (i = 0; i < rtd->num_codecs; i++) { for (i = 0; i < rtd->num_codecs; i++) {
codec_dai = rtd->codec_dais[i]; codec_dai = rtd->codec_dais[i];
if (codec_dai->driver->ops && codec_dai->driver->ops->startup) { if (codec_dai->driver->ops->startup) {
ret = codec_dai->driver->ops->startup(substream, ret = codec_dai->driver->ops->startup(substream,
codec_dai); codec_dai);
if (ret < 0) { if (ret < 0) {
...@@ -771,7 +771,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -771,7 +771,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
for (i = 0; i < rtd->num_codecs; i++) { for (i = 0; i < rtd->num_codecs; i++) {
codec_dai = rtd->codec_dais[i]; codec_dai = rtd->codec_dais[i];
if (codec_dai->driver->ops && codec_dai->driver->ops->prepare) { if (codec_dai->driver->ops->prepare) {
ret = codec_dai->driver->ops->prepare(substream, ret = codec_dai->driver->ops->prepare(substream,
codec_dai); codec_dai);
if (ret < 0) { if (ret < 0) {
...@@ -783,7 +783,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -783,7 +783,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
} }
} }
if (cpu_dai->driver->ops && cpu_dai->driver->ops->prepare) { if (cpu_dai->driver->ops->prepare) {
ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); ret = cpu_dai->driver->ops->prepare(substream, cpu_dai);
if (ret < 0) { if (ret < 0) {
dev_err(cpu_dai->dev, dev_err(cpu_dai->dev,
...@@ -829,7 +829,7 @@ int soc_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -829,7 +829,7 @@ int soc_dai_hw_params(struct snd_pcm_substream *substream,
{ {
int ret; int ret;
if (dai->driver->ops && dai->driver->ops->hw_params) { if (dai->driver->ops->hw_params) {
ret = dai->driver->ops->hw_params(substream, params, dai); ret = dai->driver->ops->hw_params(substream, params, dai);
if (ret < 0) { if (ret < 0) {
dev_err(dai->dev, "ASoC: can't set %s hw params: %d\n", dev_err(dai->dev, "ASoC: can't set %s hw params: %d\n",
...@@ -934,7 +934,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -934,7 +934,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
return ret; return ret;
platform_err: platform_err:
if (cpu_dai->driver->ops && cpu_dai->driver->ops->hw_free) if (cpu_dai->driver->ops->hw_free)
cpu_dai->driver->ops->hw_free(substream, cpu_dai); cpu_dai->driver->ops->hw_free(substream, cpu_dai);
interface_err: interface_err:
...@@ -943,7 +943,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -943,7 +943,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
codec_err: codec_err:
while (--i >= 0) { while (--i >= 0) {
struct snd_soc_dai *codec_dai = rtd->codec_dais[i]; struct snd_soc_dai *codec_dai = rtd->codec_dais[i];
if (codec_dai->driver->ops && codec_dai->driver->ops->hw_free) if (codec_dai->driver->ops->hw_free)
codec_dai->driver->ops->hw_free(substream, codec_dai); codec_dai->driver->ops->hw_free(substream, codec_dai);
codec_dai->rate = 0; codec_dai->rate = 0;
} }
...@@ -1004,11 +1004,11 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) ...@@ -1004,11 +1004,11 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
/* now free hw params for the DAIs */ /* now free hw params for the DAIs */
for (i = 0; i < rtd->num_codecs; i++) { for (i = 0; i < rtd->num_codecs; i++) {
codec_dai = rtd->codec_dais[i]; codec_dai = rtd->codec_dais[i];
if (codec_dai->driver->ops && codec_dai->driver->ops->hw_free) if (codec_dai->driver->ops->hw_free)
codec_dai->driver->ops->hw_free(substream, codec_dai); codec_dai->driver->ops->hw_free(substream, codec_dai);
} }
if (cpu_dai->driver->ops && cpu_dai->driver->ops->hw_free) if (cpu_dai->driver->ops->hw_free)
cpu_dai->driver->ops->hw_free(substream, cpu_dai); cpu_dai->driver->ops->hw_free(substream, cpu_dai);
mutex_unlock(&rtd->pcm_mutex); mutex_unlock(&rtd->pcm_mutex);
...@@ -1025,7 +1025,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -1025,7 +1025,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
for (i = 0; i < rtd->num_codecs; i++) { for (i = 0; i < rtd->num_codecs; i++) {
codec_dai = rtd->codec_dais[i]; codec_dai = rtd->codec_dais[i];
if (codec_dai->driver->ops && codec_dai->driver->ops->trigger) { if (codec_dai->driver->ops->trigger) {
ret = codec_dai->driver->ops->trigger(substream, ret = codec_dai->driver->ops->trigger(substream,
cmd, codec_dai); cmd, codec_dai);
if (ret < 0) if (ret < 0)
...@@ -1039,7 +1039,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -1039,7 +1039,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
return ret; return ret;
} }
if (cpu_dai->driver->ops && cpu_dai->driver->ops->trigger) { if (cpu_dai->driver->ops->trigger) {
ret = cpu_dai->driver->ops->trigger(substream, cmd, cpu_dai); ret = cpu_dai->driver->ops->trigger(substream, cmd, cpu_dai);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1064,8 +1064,7 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream, ...@@ -1064,8 +1064,7 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream,
for (i = 0; i < rtd->num_codecs; i++) { for (i = 0; i < rtd->num_codecs; i++) {
codec_dai = rtd->codec_dais[i]; codec_dai = rtd->codec_dais[i];
if (codec_dai->driver->ops && if (codec_dai->driver->ops->bespoke_trigger) {
codec_dai->driver->ops->bespoke_trigger) {
ret = codec_dai->driver->ops->bespoke_trigger(substream, ret = codec_dai->driver->ops->bespoke_trigger(substream,
cmd, codec_dai); cmd, codec_dai);
if (ret < 0) if (ret < 0)
...@@ -1073,7 +1072,7 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream, ...@@ -1073,7 +1072,7 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream,
} }
} }
if (cpu_dai->driver->ops && cpu_dai->driver->ops->bespoke_trigger) { if (cpu_dai->driver->ops->bespoke_trigger) {
ret = cpu_dai->driver->ops->bespoke_trigger(substream, cmd, cpu_dai); ret = cpu_dai->driver->ops->bespoke_trigger(substream, cmd, cpu_dai);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1100,12 +1099,12 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) ...@@ -1100,12 +1099,12 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
if (platform->driver->ops && platform->driver->ops->pointer) if (platform->driver->ops && platform->driver->ops->pointer)
offset = platform->driver->ops->pointer(substream); offset = platform->driver->ops->pointer(substream);
if (cpu_dai->driver->ops && cpu_dai->driver->ops->delay) if (cpu_dai->driver->ops->delay)
delay += cpu_dai->driver->ops->delay(substream, cpu_dai); delay += cpu_dai->driver->ops->delay(substream, cpu_dai);
for (i = 0; i < rtd->num_codecs; i++) { for (i = 0; i < rtd->num_codecs; i++) {
codec_dai = rtd->codec_dais[i]; codec_dai = rtd->codec_dais[i];
if (codec_dai->driver->ops && codec_dai->driver->ops->delay) if (codec_dai->driver->ops->delay)
codec_delay = max(codec_delay, codec_delay = max(codec_delay,
codec_dai->driver->ops->delay(substream, codec_dai->driver->ops->delay(substream,
codec_dai)); codec_dai));
......
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