ASoC: tegra: remove open-coded clk reference counting
authorStephen Warren <swarren@nvidia.com>
Fri, 30 Mar 2012 23:07:16 +0000 (17:07 -0600)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 1 Apr 2012 10:28:32 +0000 (11:28 +0100)
clk_enable/disable() already reference count the enable calls, so there's
no need for the callers to do the same.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/tegra/tegra_i2s.c
sound/soc/tegra/tegra_i2s.h
sound/soc/tegra/tegra_spdif.c
sound/soc/tegra/tegra_spdif.h

index d66e5095363a5ff3711907a1aa032ff656bc26e3..2d32b8ce5f2e6a2857f2c2474e10b8ea3d48c904 100644 (file)
@@ -220,8 +220,7 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream,
        if (i2sclock % (2 * srate))
                reg |= TEGRA_I2S_TIMING_NON_SYM_ENABLE;
 
-       if (!i2s->clk_refs)
-               clk_enable(i2s->clk_i2s);
+       clk_enable(i2s->clk_i2s);
 
        tegra_i2s_write(i2s, TEGRA_I2S_TIMING, reg);
 
@@ -229,8 +228,7 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream,
                TEGRA_I2S_FIFO_SCR_FIFO2_ATN_LVL_FOUR_SLOTS |
                TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_FOUR_SLOTS);
 
-       if (!i2s->clk_refs)
-               clk_disable(i2s->clk_i2s);
+       clk_disable(i2s->clk_i2s);
 
        return 0;
 }
@@ -268,9 +266,7 @@ static int tegra_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
        case SNDRV_PCM_TRIGGER_START:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
        case SNDRV_PCM_TRIGGER_RESUME:
-               if (!i2s->clk_refs)
-                       clk_enable(i2s->clk_i2s);
-               i2s->clk_refs++;
+               clk_enable(i2s->clk_i2s);
                if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
                        tegra_i2s_start_playback(i2s);
                else
@@ -283,9 +279,7 @@ static int tegra_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
                        tegra_i2s_stop_playback(i2s);
                else
                        tegra_i2s_stop_capture(i2s);
-               i2s->clk_refs--;
-               if (!i2s->clk_refs)
-                       clk_disable(i2s->clk_i2s);
+               clk_disable(i2s->clk_i2s);
                break;
        default:
                return -EINVAL;
index 15ce1e2e8bde1500d0641a8239eef0cca75e6003..c08e019c026057e7d12b10b10f03499cf254ae89 100644 (file)
 struct tegra_i2s {
        struct snd_soc_dai_driver dai;
        struct clk *clk_i2s;
-       int clk_refs;
        struct tegra_pcm_dma_params capture_dma_data;
        struct tegra_pcm_dma_params playback_dma_data;
        void __iomem *regs;
index cd836cbcb0c9990ecf7ff0fdd02f4833a959262f..3426633e91479a57e0c22551f71c54fe16779092 100644 (file)
@@ -196,18 +196,14 @@ static int tegra_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
        case SNDRV_PCM_TRIGGER_START:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
        case SNDRV_PCM_TRIGGER_RESUME:
-               if (!spdif->clk_refs)
-                       clk_enable(spdif->clk_spdif_out);
-               spdif->clk_refs++;
+               clk_enable(spdif->clk_spdif_out);
                tegra_spdif_start_playback(spdif);
                break;
        case SNDRV_PCM_TRIGGER_STOP:
        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
        case SNDRV_PCM_TRIGGER_SUSPEND:
                tegra_spdif_stop_playback(spdif);
-               spdif->clk_refs--;
-               if (!spdif->clk_refs)
-                       clk_disable(spdif->clk_spdif_out);
+               clk_disable(spdif->clk_spdif_out);
                break;
        default:
                return -EINVAL;
index 2e03db4302798bc54d5fb127eede1445b76f89f6..f5fc7124aa7b574ee7d471877fa7eacd1cca63c2 100644 (file)
 
 struct tegra_spdif {
        struct clk *clk_spdif_out;
-       int clk_refs;
        struct tegra_pcm_dma_params capture_dma_data;
        struct tegra_pcm_dma_params playback_dma_data;
        void __iomem *regs;