From patchwork Wed Jun 21 08:57:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9801231 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE63260329 for ; Wed, 21 Jun 2017 08:57:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE11A28516 for ; Wed, 21 Jun 2017 08:57:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1C9C2853D; Wed, 21 Jun 2017 08:57:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FEF528516 for ; Wed, 21 Jun 2017 08:57:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752311AbdFUI5j (ORCPT ); Wed, 21 Jun 2017 04:57:39 -0400 Received: from mail-lf0-f52.google.com ([209.85.215.52]:35172 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751736AbdFUI5i (ORCPT ); Wed, 21 Jun 2017 04:57:38 -0400 Received: by mail-lf0-f52.google.com with SMTP id p189so89917618lfe.2 for ; Wed, 21 Jun 2017 01:57:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=MZVBOGJ5aBdIZqO8g08FFHeexrqts1EeegTdW/TmtKo=; b=OrtCIpy9DDBxzfVnichfcuMXSNmEI4TS1Onlk0bf54VlyY3+1VEZPxNwLVHs8wfxF3 /tNIVRAb95zZ9uwuRpwaLaB+sIrPD8AYAGUWduMP0zRDM6nB2uSsY+9zUatBEM1kvJe4 MG+s17sEaXDybFnfcZEePG/0B5hgCw0Qq7yKY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MZVBOGJ5aBdIZqO8g08FFHeexrqts1EeegTdW/TmtKo=; b=rH6yzIKZAyf6XQdx3tJpjpap/MXVXDNEegoupsANzoL3UA3zLgg2xI2Qm3D2bbDAC7 WZe0QAgeUe0wyQoUQ5DfBTj//U7AvjLyf49UhGomngiYEgsY56tma4jlcbNabaFFRLwg 4fKd6CIVa5rgopLcuoUUBWNbPyh3jdLG7m+eXfqTH3AdD2s2wAqyPKbQy4q4uol1+1Ez xezZk3PZgTFiOHRXwtE+Zh34o9EuPSSSXv5RoZIhLOsLxW8DorHgG5J6VL2qXTw2g47F M42tzkSrxLq6RZ+HifmZCgJ3E1xqCQWSEJ9WXrE1W8BLKc1tTzAP7Chgxa0v4J+1qzgc ucSA== X-Gm-Message-State: AKS2vOwNd9mvXA5+aLVf7yaN52iKoXQOFVPexfD12bWE33be4Im1lamI aybyChQBkcUI97oK X-Received: by 10.46.0.219 with SMTP id e88mr9574058lji.116.1498035456240; Wed, 21 Jun 2017 01:57:36 -0700 (PDT) Received: from fabina.bredbandsbolaget.se (c-2d0be055.014-348-6c756e10.cust.bredbandsbolaget.se. [85.224.11.45]) by smtp.gmail.com with ESMTPSA id l1sm3500328ljb.48.2017.06.21.01.57.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jun 2017 01:57:34 -0700 (PDT) From: Linus Walleij To: Bjorn Helgaas , linux-pci@vger.kernel.org Cc: Hans Ulli Kroll , Florian Fainelli , Linus Walleij Subject: [PATCH v2] pci: ftpci100: Make clocks compulsory Date: Wed, 21 Jun 2017 10:57:30 +0200 Message-Id: <20170621085730.28804-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);