All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Pargmann <mpa@pengutronix.de>
To: Mark Brown <broonie@kernel.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
	alsa-devel@alsa-project.org, Timur Tabi <timur@tabi.org>,
	kernel@pengutronix.de, Nicolin Chen <Guangyu.Chen@freescale.com>,
	Markus Pargmann <mpa@pengutronix.de>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/15] ASoC: fsl-ssi: baud clock error handling
Date: Wed, 26 Feb 2014 17:02:10 +0100	[thread overview]
Message-ID: <1393430538-32333-8-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1393430538-32333-1-git-send-email-mpa@pengutronix.de>

This patch adds error handling for baud clock. It checks for PROBE_DEFER
error codes and handles clk_prepare_enable() errors.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 sound/soc/fsl/fsl_ssi.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 43d4342..64d188f 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -995,11 +995,19 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
 	 * and, instead, abandon MASTER mode that needs baud clock.
 	 */
 	ssi_private->baudclk = devm_clk_get(&pdev->dev, "baud");
-	if (IS_ERR(ssi_private->baudclk))
+	if (IS_ERR(ssi_private->baudclk)) {
+		ret = PTR_ERR(ssi_private->baudclk);
+		if (ret == -EPROBE_DEFER)
+			goto error_baud_clk;
 		dev_dbg(&pdev->dev, "could not get baud clock: %ld\n",
-			 PTR_ERR(ssi_private->baudclk));
-	else
-		clk_prepare_enable(ssi_private->baudclk);
+				PTR_ERR(ssi_private->baudclk));
+	} else {
+		ret = clk_prepare_enable(ssi_private->baudclk);
+		if (ret) {
+			dev_err(&pdev->dev, "Failed to enable baud clock\n");
+			goto error_baud_clk;
+		}
+	}
 
 	/*
 	 * We have burstsize be "fifo_depth - 2" to match the SSI
@@ -1021,6 +1029,11 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
 	}
 
 	return 0;
+
+error_baud_clk:
+	clk_disable_unprepare(ssi_private->clk);
+
+	return ret;
 }
 
 static void fsl_ssi_imx_clean(struct platform_device *pdev,
-- 
1.8.5.3

WARNING: multiple messages have this Message-ID
From: mpa@pengutronix.de (Markus Pargmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/15] ASoC: fsl-ssi: baud clock error handling
Date: Wed, 26 Feb 2014 17:02:10 +0100	[thread overview]
Message-ID: <1393430538-32333-8-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1393430538-32333-1-git-send-email-mpa@pengutronix.de>

This patch adds error handling for baud clock. It checks for PROBE_DEFER
error codes and handles clk_prepare_enable() errors.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 sound/soc/fsl/fsl_ssi.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 43d4342..64d188f 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -995,11 +995,19 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
 	 * and, instead, abandon MASTER mode that needs baud clock.
 	 */
 	ssi_private->baudclk = devm_clk_get(&pdev->dev, "baud");
-	if (IS_ERR(ssi_private->baudclk))
+	if (IS_ERR(ssi_private->baudclk)) {
+		ret = PTR_ERR(ssi_private->baudclk);
+		if (ret == -EPROBE_DEFER)
+			goto error_baud_clk;
 		dev_dbg(&pdev->dev, "could not get baud clock: %ld\n",
-			 PTR_ERR(ssi_private->baudclk));
-	else
-		clk_prepare_enable(ssi_private->baudclk);
+				PTR_ERR(ssi_private->baudclk));
+	} else {
+		ret = clk_prepare_enable(ssi_private->baudclk);
+		if (ret) {
+			dev_err(&pdev->dev, "Failed to enable baud clock\n");
+			goto error_baud_clk;
+		}
+	}
 
 	/*
 	 * We have burstsize be "fifo_depth - 2" to match the SSI
@@ -1021,6 +1029,11 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
 	}
 
 	return 0;
+
+error_baud_clk:
+	clk_disable_unprepare(ssi_private->clk);
+
+	return ret;
 }
 
 static void fsl_ssi_imx_clean(struct platform_device *pdev,
-- 
1.8.5.3

  parent reply	other threads:[~2014-02-26 16:02 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26 16:02 [PATCH 00/15] ASoC: fsl-ssi: Driver cleanup Markus Pargmann
2014-02-26 16:02 ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 01/15] ASoC: fsl-ssi: Use regmap Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-27  2:08   ` Li.Xiubo
2014-02-27  2:08     ` Li.Xiubo at freescale.com
2014-02-27 15:23     ` Markus Pargmann
2014-02-27 15:23       ` Markus Pargmann
2014-02-27 16:06       ` Timur Tabi
2014-02-27 16:06         ` Timur Tabi
2014-03-05  6:21     ` Mark Brown
2014-03-05  6:21       ` Mark Brown
2014-03-05  7:04       ` Li.Xiubo
2014-03-05  7:04         ` Li.Xiubo at freescale.com
2014-03-05  7:07       ` Li.Xiubo
2014-03-05  7:07         ` Li.Xiubo at freescale.com
2014-02-26 16:02 ` [PATCH 02/15] ASoC: fsl-ssi: Remove fsl_ssi_setup Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 03/15] ASoC: fsl-ssi: Move debugging to seperate file Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 04/15] ASoC: fsl-ssi: Use dev_name for DAI driver struct Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 05/15] ASoC: fsl-ssi: Move imx-specific probe to seperate function Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 06/15] ASoC: fsl-ssi: Remove useless DMA code Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` Markus Pargmann [this message]
2014-02-26 16:02   ` [PATCH 07/15] ASoC: fsl-ssi: baud clock error handling Markus Pargmann
2014-02-26 16:02 ` [PATCH 08/15] ASoC: fsl-ssi: Cleanup probe function Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 09/15] ASoC: fsl-ssi: Remove unnecessary variables from ssi_private Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 10/15] ASoC: fsl-ssi: reorder and document fsl_ssi_private Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 11/15] ASoC: fsl-ssi: Fix register values when disabling Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 12/15] ASoC: fsl-ssi: Only enable baudclk when used Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 13/15] ASoC: fsl-ssi: Set default dai-fmts Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 14/15] ASoC: fsl-ssi: Transmit enable synchronization Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann
2014-02-26 16:02 ` [PATCH 15/15] ASoC: fsl-ssi: Update binding documentation Markus Pargmann
2014-02-26 16:02   ` Markus Pargmann

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=1393430538-32333-8-git-send-email-mpa@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=Guangyu.Chen@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=fabio.estevam@freescale.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=timur@tabi.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.