From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
Sangbeom Kim <sbkim73@samsung.com>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [RFT v2 3/3] ASoC: samsung: Add proper error paths to s3c24xx I2S driver
Date: Fri, 28 Jul 2017 10:17:02 +0530 [thread overview]
Message-ID: <6ee4fbe7-1b0d-d76d-f52e-3ccbe04309c8@gmail.com> (raw)
In-Reply-To: <20170727171338.13300-4-krzk@kernel.org>
On Thursday 27 July 2017 10:43 PM, Krzysztof Kozlowski wrote:
> s3c2412_i2s_probe() might fail so driver has to revert work done by
> s3c_i2sv2_probe() (clock enabling). Missing doing this would lead to
> clock enable in-balance.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>
> ---
>
> Please, kindly test on S3C24xx hardware.
>
> Changes since v1:
> 1. Drop clk assignment to disable proper clock on remove()
> ---
> sound/soc/samsung/s3c-i2s-v2.c | 9 +++++++++
> sound/soc/samsung/s3c-i2s-v2.h | 7 +++++++
> sound/soc/samsung/s3c2412-i2s.c | 13 +++++++++----
> 3 files changed, 25 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/samsung/s3c-i2s-v2.c b/sound/soc/samsung/s3c-i2s-v2.c
> index 3894bda06ebb..58c3e9bfc6b7 100644
> --- a/sound/soc/samsung/s3c-i2s-v2.c
> +++ b/sound/soc/samsung/s3c-i2s-v2.c
> @@ -651,6 +651,15 @@ int s3c_i2sv2_probe(struct snd_soc_dai *dai,
> }
> EXPORT_SYMBOL_GPL(s3c_i2sv2_probe);
>
> +void s3c_i2sv2_cleanup(struct snd_soc_dai *dai,
> + struct s3c_i2sv2_info *i2s)
> +{
> + clk_disable_unprepare(i2s->iis_pclk);
> + clk_put(i2s->iis_pclk);
> + i2s->iis_pclk = NULL;
> +}
> +EXPORT_SYMBOL_GPL(s3c_i2sv2_cleanup);
> +
> #ifdef CONFIG_PM
> static int s3c2412_i2s_suspend(struct snd_soc_dai *dai)
> {
> diff --git a/sound/soc/samsung/s3c-i2s-v2.h b/sound/soc/samsung/s3c-i2s-v2.h
> index 182d80564e37..3fca20f7a853 100644
> --- a/sound/soc/samsung/s3c-i2s-v2.h
> +++ b/sound/soc/samsung/s3c-i2s-v2.h
> @@ -92,6 +92,13 @@ extern int s3c_i2sv2_probe(struct snd_soc_dai *dai,
> unsigned long base);
>
> /**
> + * s3c_i2sv2_cleanup - cleanup resources allocated in s3c_i2sv2_probe
> + * @dai: The ASoC DAI structure supplied to the original probe.
> + * @i2s: Our local i2s structure to fill in.
> + */
> +extern void s3c_i2sv2_cleanup(struct snd_soc_dai *dai,
> + struct s3c_i2sv2_info *i2s);
> +/**
> * s3c_i2sv2_register_component - register component and dai with soc core
> * @dev: DAI device
> * @id: DAI ID
> diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
> index bcd1cbdeac93..cc0840fff5aa 100644
> --- a/sound/soc/samsung/s3c2412-i2s.c
> +++ b/sound/soc/samsung/s3c2412-i2s.c
> @@ -65,7 +65,8 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
> s3c2412_i2s.iis_cclk = devm_clk_get(dai->dev, "i2sclk");
> if (IS_ERR(s3c2412_i2s.iis_cclk)) {
> pr_err("failed to get i2sclk clock\n");
> - return PTR_ERR(s3c2412_i2s.iis_cclk);
> + ret = PTR_ERR(s3c2412_i2s.iis_cclk);
> + goto err;
> }
>
> /* Set MPLL as the source for IIS CLK */
> @@ -73,20 +74,24 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
> clk_set_parent(s3c2412_i2s.iis_cclk, clk_get(NULL, "mpll"));
> ret = clk_prepare_enable(s3c2412_i2s.iis_cclk);
> if (ret)
> - return ret;
> -
> - s3c2412_i2s.iis_cclk = s3c2412_i2s.iis_pclk;
> + goto err;
>
> /* Configure the I2S pins (GPE0...GPE4) in correct mode */
> s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
> S3C_GPIO_PULL_NONE);
>
> return 0;
> +
> +err:
> + s3c_i2sv2_cleanup(dai, &s3c2412_i2s);
> +
> + return ret;
> }
>
> static int s3c2412_i2s_remove(struct snd_soc_dai *dai)
> {
> clk_disable_unprepare(s3c2412_i2s.iis_cclk);
> + s3c_i2sv2_cleanup(dai, &s3c2412_i2s);
>
> return 0;
> }
next prev parent reply other threads:[~2017-07-28 4:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-27 17:13 [RFT v2 0/3] ASoC: samsung: s3c24xx: Fixes for error paths Krzysztof Kozlowski
2017-07-27 17:13 ` [RFT v2 1/3] ASoC: samsung: Fix possible double iounmap on s3c24xx driver probe failure Krzysztof Kozlowski
2017-07-28 4:39 ` Arvind Yadav
2017-07-27 17:13 ` [RFT v2 2/3] ASoC: samsung: Add missing prepare for iis clock of s3c24xx Krzysztof Kozlowski
2017-07-28 4:41 ` Arvind Yadav
2017-07-28 5:44 ` Krzysztof Kozlowski
2017-07-28 6:05 ` Arvind Yadav
2017-07-28 10:18 ` Applied "ASoC: samsung: Add missing prepare for iis clock of s3c24xx" to the asoc tree Mark Brown
2017-07-27 17:13 ` [RFT v2 3/3] ASoC: samsung: Add proper error paths to s3c24xx I2S driver Krzysztof Kozlowski
2017-07-28 4:47 ` Arvind Yadav [this message]
2017-07-28 10:17 ` Applied "ASoC: samsung: Add proper error paths to s3c24xx I2S driver" to the asoc tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6ee4fbe7-1b0d-d76d-f52e-3ccbe04309c8@gmail.com \
--to=arvind.yadav.cs@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=krzk@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=s.nawrocki@samsung.com \
--cc=sbkim73@samsung.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).