Linux-mmc Archive on lore.kernel.org
 help / color / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Ulf Hansson <ulf.hansson@linaro.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	bcm-kernel-feedback-list@broadcom.com,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Jun Nie <jun.nie@linaro.org>, Shawn Guo <shawnguo@kernel.org>,
	Paul Cercueil <paul@crapouillou.net>,
	Kevin Hilman <khilman@baylibre.com>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Al Cooper <alcooperx@gmail.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Lars Povlsen <lars.povlsen@microchip.com>,
	Steen Hegelund <Steen.Hegelund@microchip.com>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org, linux-tegra@vger.kernel.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Subject: [RFT 06/11] mmc: sdhci-brcmstb: Simplify with optional clock and dev_err_probe()
Date: Wed,  2 Sep 2020 21:36:53 +0200
Message-ID: <20200902193658.20539-7-krzk@kernel.org> (raw)
In-Reply-To: <20200902193658.20539-1-krzk@kernel.org>

Only -ENOENT from devm_clk_get() means that clock is not present in
device tree.  Other errors have their own meaning and should not be
ignored.

Simplify getting the clock which is in fact optional and also use
dev_err_probe() for handling deferred.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Not tested on HW.
---
 drivers/mmc/host/sdhci-brcmstb.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
index ad01f6451a95..876668827580 100644
--- a/drivers/mmc/host/sdhci-brcmstb.c
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -235,13 +235,11 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
 
 	dev_dbg(&pdev->dev, "Probe found match for %s\n",  match->compatible);
 
-	clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(clk)) {
-		if (PTR_ERR(clk) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-		dev_err(&pdev->dev, "Clock not found in Device Tree\n");
-		clk = NULL;
-	}
+	clk = devm_clk_get_optional(&pdev->dev, NULL);
+	if (IS_ERR(clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(clk),
+				     "Failed to get clock from Device Tree\n");
+
 	res = clk_prepare_enable(clk);
 	if (res)
 		return res;
-- 
2.17.1


  parent reply index

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 19:36 [PATCH 00/11] mmc: Minor cleanups and compile test Krzysztof Kozlowski
2020-09-02 19:36 ` [PATCH 01/11] mmc: bcm2835: Simplify with dev_err_probe() Krzysztof Kozlowski
2020-09-02 19:56   ` Florian Fainelli
2020-09-02 19:36 ` [PATCH 02/11] mmc: davinci: " Krzysztof Kozlowski
2020-09-02 19:36 ` [PATCH 03/11] mmc: dw_mmc-zx: " Krzysztof Kozlowski
2020-09-02 19:36 ` [PATCH 04/11] mmc: jz4740: " Krzysztof Kozlowski
2020-09-03 10:49   ` Paul Cercueil
2020-09-03 11:47     ` Ulf Hansson
2020-09-02 19:36 ` [PATCH 05/11] mmc: meson: " Krzysztof Kozlowski
2020-09-02 19:36 ` Krzysztof Kozlowski [this message]
2020-09-02 19:58   ` [RFT 06/11] mmc: sdhci-brcmstb: Simplify with optional clock and dev_err_probe() Florian Fainelli
2020-09-03  8:09     ` Ulf Hansson
2020-09-02 19:36 ` [PATCH 07/11] mmc: sdhci-of-arasan: Simplify with dev_err_probe() Krzysztof Kozlowski
2020-09-02 19:36 ` [PATCH 08/11] mmc: sdhci-tegra: " Krzysztof Kozlowski
2020-09-02 19:36 ` [PATCH 09/11] mmc: dw_mmc: " Krzysztof Kozlowski
2020-09-02 19:36 ` [PATCH 10/11] mmc: sdhci-of-sparx5: Use proper printk format for dma_addr_t Krzysztof Kozlowski
2020-09-04  8:08   ` Lars Povlsen
2020-09-02 19:36 ` [PATCH 11/11] mmc: host: Enable compile testing of multiple drivers Krzysztof Kozlowski
2020-09-02 21:32   ` Michał Mirosław
2020-09-03  5:39     ` Krzysztof Kozlowski
2020-09-03  8:09 ` [PATCH 00/11] mmc: Minor cleanups and compile test Ulf Hansson
2020-09-03  8:28   ` Krzysztof Kozlowski
2020-09-10 22:55   ` Rob Herring
2020-09-11  6:00     ` Krzysztof Kozlowski

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=20200902193658.20539-7-krzk@kernel.org \
    --to=krzk@kernel.org \
    --cc=Steen.Hegelund@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=adrian.hunter@intel.com \
    --cc=alcooperx@gmail.com \
    --cc=arnd@arndb.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=jbrunet@baylibre.com \
    --cc=jh80.chung@samsung.com \
    --cc=jonathanh@nvidia.com \
    --cc=jun.nie@linaro.org \
    --cc=khilman@baylibre.com \
    --cc=lars.povlsen@microchip.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=michal.simek@xilinx.com \
    --cc=narmstrong@baylibre.com \
    --cc=nsaenzjulienne@suse.de \
    --cc=paul@crapouillou.net \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=shawnguo@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=ulf.hansson@linaro.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

Linux-mmc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mmc/0 linux-mmc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mmc linux-mmc/ https://lore.kernel.org/linux-mmc \
		linux-mmc@vger.kernel.org
	public-inbox-index linux-mmc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mmc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git