From: Linus Walleij <linus.walleij@linaro.org>
To: Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org
Cc: Hans Ulli Kroll <ulli.kroll@googlemail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH v2] pci: ftpci100: Make clocks compulsory
Date: Wed, 21 Jun 2017 10:57:30 +0200 [thread overview]
Message-ID: <20170621085730.28804-1-linus.walleij@linaro.org> (raw)
This fixes a regression on the FTPCI100 PCI driver.
When the clock controller was augmented to probe clocks
from the platform device except to the most basic clocks
pertaining to timers, clocks may return an error pointer
containing -EPROBE_DEFER.
This hit the PCI driver which would try to continue
without the clocks, but the actual clocks appeared later,
so we did not pick them up properly, and in the end of
the boot, these clocks get gated off if no users register,
so the PCI host became numbed off and silently nonworking.
The clocks for this PCI bus are defined properly for all
platforms implementing it, so we should make them compulsory
before new users arrive so we have our resources under
control.
This makes the driver bail out of probe with any error
code from the clock, including -EPROBE_DEFER so that we
again have a clean boot.
Fixes: cea186ac1e45 ("pci: ftpci100: Add clock handling")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Inadvertedly managed to switch PTR_ERR() for ERR_PTR()
in the code, and the compile screamed.
---
drivers/pci/host/pci-ftpci100.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/host/pci-ftpci100.c b/drivers/pci/host/pci-ftpci100.c
index d3bf153a2ab2..db31ab21884e 100644
--- a/drivers/pci/host/pci-ftpci100.c
+++ b/drivers/pci/host/pci-ftpci100.c
@@ -463,24 +463,20 @@ static int faraday_pci_probe(struct platform_device *pdev)
/* Retrieve and enable optional clocks */
clk = devm_clk_get(dev, "PCLK");
- if (IS_ERR(clk)) {
- dev_err(dev, "no PCLK available\n");
- } else {
- ret = clk_prepare_enable(clk);
- if (ret) {
- dev_err(dev, "could not prepare PCLK\n");
- return ret;
- }
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+ ret = clk_prepare_enable(clk);
+ if (ret) {
+ dev_err(dev, "could not prepare PCLK\n");
+ return ret;
}
p->bus_clk = devm_clk_get(dev, "PCICLK");
- if (IS_ERR(p->bus_clk)) {
- dev_err(dev, "no PCICLK available\n");
- } else {
- ret = clk_prepare_enable(p->bus_clk);
- if (ret) {
- dev_err(dev, "could not prepare PCICLK\n");
- return ret;
- }
+ if (IS_ERR(p->bus_clk))
+ return PTR_ERR(clk);
+ ret = clk_prepare_enable(p->bus_clk);
+ if (ret) {
+ dev_err(dev, "could not prepare PCICLK\n");
+ return ret;
}
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
--
2.9.4
next reply other threads:[~2017-06-21 8:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-21 8:57 Linus Walleij [this message]
2017-06-27 21:43 ` [PATCH v2] pci: ftpci100: Make clocks compulsory Bjorn Helgaas
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=20170621085730.28804-1-linus.walleij@linaro.org \
--to=linus.walleij@linaro.org \
--cc=bhelgaas@google.com \
--cc=f.fainelli@gmail.com \
--cc=linux-pci@vger.kernel.org \
--cc=ulli.kroll@googlemail.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).