From patchwork Fri Mar 11 23:33:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 596544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 00BD2140BB9 for ; Sat, 12 Mar 2016 10:33:52 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751888AbcCKXdu (ORCPT ); Fri, 11 Mar 2016 18:33:50 -0500 Received: from mail.kernel.org ([198.145.29.136]:43331 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751562AbcCKXdt (ORCPT ); Fri, 11 Mar 2016 18:33:49 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E184E2034B; Fri, 11 Mar 2016 23:33:47 +0000 (UTC) Received: from localhost (unknown [69.71.1.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D5BCE20259; Fri, 11 Mar 2016 23:33:46 +0000 (UTC) Date: Fri, 11 Mar 2016 17:33:45 -0600 From: Bjorn Helgaas To: Shawn Lin Cc: Murali Karicheri , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI/keystone: check return value of devm_phy_get with EPROBE_DEFER Message-ID: <20160311233345.GH4725@localhost> References: <1457325141-1354-1-git-send-email-shawn.lin@rock-chips.com> <20160311183823.GE4725@localhost> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160311183823.GE4725@localhost> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Fri, Mar 11, 2016 at 12:38:23PM -0600, Bjorn Helgaas wrote: > On Mon, Mar 07, 2016 at 12:32:21PM +0800, Shawn Lin wrote: > > If the return value of devm_phy_get is EPROBE_DEFER, we should > > defer probing the driver. > > > > Signed-off-by: Shawn Lin > > Applied to pci/host-keystone for v4.6 with the following changelog. > Thanks, Shawn! > > PCI: keystone: Defer probing if devm_phy_get() returns -EPROBE_DEFER > > A SerDes PHY is optional, so if devm_phy_get() doesn't find one at all, > that's fine. But if devm_phy_get() finds a PHY that doesn't have a driver > yet, it returns -EPROBE_DEFER. In that case, defer probing the Keystone > driver. We may be able to load it later after a PHY driver is loaded. > > [bhelgaas: changelog] > Signed-off-by: Shawn Lin > Signed-off-by: Bjorn Helgaas I meant to include the patch, too, because I tweaked it slightly to try to make it easier to read. Here's what I applied: > > > --- > > > > drivers/pci/host/pci-keystone.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c > > index 0aa81bd..42af6ac 100644 > > --- a/drivers/pci/host/pci-keystone.c > > +++ b/drivers/pci/host/pci-keystone.c > > @@ -363,6 +363,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev) > > ret = phy_init(phy); > > if (ret < 0) > > return ret; > > + } else if (PTR_ERR(phy) == -EPROBE_DEFER) { > > + return PTR_ERR(phy); > > } > > > > /* index 2 is to read PCI DEVICE_ID */ > > -- > > 2.3.7 > > > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-pci" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- > To unsubscribe from this list: send the line "unsubscribe linux-pci" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c index 0aa81bd..cd70345 100644 --- a/drivers/pci/host/pci-keystone.c +++ b/drivers/pci/host/pci-keystone.c @@ -359,6 +359,9 @@ static int __init ks_pcie_probe(struct platform_device *pdev) /* initialize SerDes Phy if present */ phy = devm_phy_get(dev, "pcie-phy"); + if (PTR_ERR_OR_ZERO(phy) == -EPROBE_DEFER) + return PTR_ERR(phy); + if (!IS_ERR_OR_NULL(phy)) { ret = phy_init(phy); if (ret < 0)