From patchwork Wed Aug 28 16:36:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11119391 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DFFEF112C for ; Wed, 28 Aug 2019 16:36:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD77422CF8 for ; Wed, 28 Aug 2019 16:36:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kBdBg7p1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726395AbfH1Qgl (ORCPT ); Wed, 28 Aug 2019 12:36:41 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:40922 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726472AbfH1Qgl (ORCPT ); Wed, 28 Aug 2019 12:36:41 -0400 Received: by mail-ed1-f68.google.com with SMTP id h8so719706edv.7 for ; Wed, 28 Aug 2019 09:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RsKnTqZhiTnUNPCrQwtT99WQodGr2SwrsXfj7oMbBZo=; b=kBdBg7p1h/Iic/OopZYem59dY9R8T1EQCnI3GIiIiMs+iCE6wi4freEngg7BO14F95 QWlGJvu6lz8doDCNxDDD6XvM8A3yuEuLMY0i5Csabmyxv5YFDb6UskoCS/GphZrpKVDr a3Weio0pzD9YBMePTyiUIdOU5H9SGM/SWAkvVmuthkATL9hVYlKx0EGLgmPzzsHEVKl6 6b9lwahRebXEvTup/g6ssgBmaljLggxALrjWwClEmXOUvrS6CcNVWxZG+jRlUT/phnmr qa5t40ctNs1QQvTfuDRdWciY03KTYmSoLU/SaBw0MCPqEuIYkLvUxayclSeXTVxkWxmc /drQ== 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:mime-version :content-transfer-encoding; bh=RsKnTqZhiTnUNPCrQwtT99WQodGr2SwrsXfj7oMbBZo=; b=XKF83jU48+hXq6fi2kRi3cKYvw/n3tZl/uyPflikPSaf8dqVPQxZDWK2I89altOjK7 dBC7VtNjf1V7lb1hAJPDy5fyvpPB7QErUOut19cvcEgEbfBUii/gKO+sXua13RvejM2Q 0jD3vaNdaH1o74dFu/E9TuV4jhtUjYIYh8ttpoixIoC70qt+6rPEReR5FyljEWupjEps bU2uPZmBClAC30gMYumEDYSpVnX1F9+b+LsfL3o/z/c/CwmJPd5Cy6uJ8GRQC09iU8OI sMCaTAjTNSeCN5DFb+jIv3ov156yLJxwK6HEZaApnrAQx48j8TVQC1Zf01X/U3opALz4 fWmA== X-Gm-Message-State: APjAAAU1oxUTPvVaXeiqJb1N4o0JHo7n2cJm/Y9PMyBTq9jMntxjuUTM b2gdcf6CZowu5oYrp6WO0Bs= X-Google-Smtp-Source: APXvYqxlLlMuoJcGHsVLpw6kO5euhv8jxFKJv08Am5RitAHTN6IJ32sBDym4YIp+kMafUNlOCzzaSQ== X-Received: by 2002:a17:906:3187:: with SMTP id 7mr232363ejy.238.1567010199277; Wed, 28 Aug 2019 09:36:39 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id w14sm545880edf.7.2019.08.28.09.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 09:36:37 -0700 (PDT) From: Thierry Reding To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Andrew Murray , linux-pci@vger.kernel.org, Jingoo Han , Kukjin Kim , Krzysztof Kozlowski Subject: [PATCH 1/5] PCI: exynos: Properly handle optional PHYs Date: Wed, 28 Aug 2019 18:36:32 +0200 Message-Id: <20190828163636.12967-1-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Thierry Reding devm_of_phy_get() can fail for a number of resides besides probe deferral. It can for example return -ENOMEM if it runs out of memory as it tries to allocate devres structures. Propagating only -EPROBE_DEFER is problematic because it results in these legitimately fatal errors being treated as "PHY not specified in DT". What we really want is to ignore the optional PHYs only if they have not been specified in DT. devm_of_phy_get() returns -ENODEV in this case, so that's the special case that we need to handle. So we propagate all errors, except -ENODEV, so that real failures will still cause the driver to fail probe. Cc: Jingoo Han Cc: Kukjin Kim Cc: Krzysztof Kozlowski Signed-off-by: Thierry Reding Reviewed-by: Andrew Murray --- drivers/pci/controller/dwc/pci-exynos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c index cee5f2f590e2..14a6ba4067fb 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -465,7 +465,7 @@ static int __init exynos_pcie_probe(struct platform_device *pdev) ep->phy = devm_of_phy_get(dev, np, NULL); if (IS_ERR(ep->phy)) { - if (PTR_ERR(ep->phy) == -EPROBE_DEFER) + if (PTR_ERR(ep->phy) != -ENODEV) return PTR_ERR(ep->phy); ep->phy = NULL; From patchwork Wed Aug 28 16:36:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11119399 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F69D112C for ; Wed, 28 Aug 2019 16:36:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E76022CF8 for ; Wed, 28 Aug 2019 16:36:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qo8W2T7I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726504AbfH1Qgn (ORCPT ); Wed, 28 Aug 2019 12:36:43 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:43398 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726472AbfH1Qgn (ORCPT ); Wed, 28 Aug 2019 12:36:43 -0400 Received: by mail-ed1-f65.google.com with SMTP id h13so692683edq.10 for ; Wed, 28 Aug 2019 09:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3JNWpHXZU/aa0aBL4bmI4Ioqw08cqJCb7QH5Ooq5hac=; b=qo8W2T7IeuJlGyxV79T2P+Ga3XkXd6ke7e1RMFpzmqs5UZn01y/3dEW7aos24HRDfL j8v6PLRohyLdiOufNThqCa7b3pMa61k4BZBW9BVa2qD4XUqxSkDrxAUtmPGyNEWs7nnB ypRLgRNPBTgu2CBB2MmtNfv6mrL60cDmNaTxbN2y5x23tzvJ2kfoIzrj9N+zj3+u/QXk 7zbFU3hqB9L0MNAGEX0TEMd+vehefoRms2bfwySlCVeCMZoltlMvR4ZvvJqpomsO2fkI QJrqaBkhAgifIIso3SRIAs5NB1UwyVT6VNKT7nhiMWyGqFEUvYuN2UGmrAw1gpH4S0Qb 8ysQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=3JNWpHXZU/aa0aBL4bmI4Ioqw08cqJCb7QH5Ooq5hac=; b=LSi0JrcQGNom56XBBONJzD/auPyXXfe83O7mGpWF2YZYC6sAgCYjlmmoR15VUi/OFI J7xk8sO7FBJ5QEqWN5sQnoasKl3SWSOare9rUnKyX/mKG7SK+8GT7nzUUzYMVYlHPMPZ zfnBGDfD6DsZPE7ZLNDrqUnIrI8aJO/X+1N0+J57fild3CxWM7Y5Epsq917XSBz0IWmo a9EZhhJo5h0OJZEEZVsmZEN0yBY5rj8t8xFqccv8AfERgF8TxjaEpnmBuIZ+9s0oGlez JY7PX44xusTZev75ip0eDbhN0rhV6HZzMv/XWwLVq9rH6u8EHMDNjzHh3i40X8qV949F HnVw== X-Gm-Message-State: APjAAAXyBewHO7jOhy7YkoDPyAU8CFj9SKR1DEGwsuv/VPIPVHi174q6 1zqXb38eMbqbs5qBbphGnU0= X-Google-Smtp-Source: APXvYqzu1Brl59dFQAGAWDUJm53TeL7ZP+Xh/kidXo+mABEOlS3Fk3Azq20RtWGS9bpOTKoQPqknnQ== X-Received: by 2002:a50:9127:: with SMTP id e36mr4940140eda.219.1567010201644; Wed, 28 Aug 2019 09:36:41 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id w14sm558550eda.69.2019.08.28.09.36.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 09:36:40 -0700 (PDT) From: Thierry Reding To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Andrew Murray , linux-pci@vger.kernel.org, Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Fabio Estevam , kernel@pengutronix.de, linux-imx@nxp.com Subject: [PATCH 2/5] PCI: imx6: Properly handle optional regulators Date: Wed, 28 Aug 2019 18:36:33 +0200 Message-Id: <20190828163636.12967-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190828163636.12967-1-thierry.reding@gmail.com> References: <20190828163636.12967-1-thierry.reding@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Thierry Reding regulator_get_optional() can fail for a number of reasons besides probe deferral. It can for example return -ENOMEM if it runs out of memory as it tries to allocate data structures. Propagating only -EPROBE_DEFER is problematic because it results in these legitimately fatal errors being treated as "regulator not specified in DT". What we really want is to ignore the optional regulators only if they have not been specified in DT. regulator_get_optional() returns -ENODEV in this case, so that's the special case that we need to handle. So we propagate all errors, except -ENODEV, so that real failures will still cause the driver to fail probe. Cc: Richard Zhu Cc: Lucas Stach Cc: Shawn Guo Cc: Sascha Hauer Cc: Fabio Estevam Cc: kernel@pengutronix.de Cc: linux-imx@nxp.com Signed-off-by: Thierry Reding Reviewed-by: Andrew Murray --- drivers/pci/controller/dwc/pci-imx6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 8b8efa3063f5..acfbd34032a8 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1174,8 +1174,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) imx6_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie"); if (IS_ERR(imx6_pcie->vpcie)) { - if (PTR_ERR(imx6_pcie->vpcie) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(imx6_pcie->vpcie) != -ENODEV) + return PTR_ERR(imx6_pcie->vpcie); imx6_pcie->vpcie = NULL; } From patchwork Wed Aug 28 16:36:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11119403 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D8621399 for ; Wed, 28 Aug 2019 16:36:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D3B822CED for ; Wed, 28 Aug 2019 16:36:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iWol2RYS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726506AbfH1Qgr (ORCPT ); Wed, 28 Aug 2019 12:36:47 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:41153 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726472AbfH1Qgq (ORCPT ); Wed, 28 Aug 2019 12:36:46 -0400 Received: by mail-ed1-f68.google.com with SMTP id w5so705704edl.8 for ; Wed, 28 Aug 2019 09:36:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3QAm45dwRpgNZHPTIYO73+t7h3+jOQOBkntawCm9BvA=; b=iWol2RYS8jelw/ICPnbRo6g4y1QvZ9vX5gnal01GMaax0C78rCWmNvVTL8JovKVrXh WBqy71YyUGdv5KtCoEbSuISoUgVKyey8RMZJ8ZijJ4AdzNczE50g2XKsR8oy7ZJ0m9F+ 0L/puxcLNFVR9s1v2WeJPPKPIaL/nN0fptSJnL6UJ7NVBE4czdYZrj8lszW4HufyST8W +qbCEuJ0gi1PMps0OUbhhLXwnsHdw68U3Qq7c88iMlPLjS0OYJYhyLQie81scPx88e8l t5qEVihqGh1hSg106+BzjEN3MjAP/pxJGVS3TSYP9ooATjRDmgpHLMEczfsCwanp1Uh/ 8HIg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=3QAm45dwRpgNZHPTIYO73+t7h3+jOQOBkntawCm9BvA=; b=g0JXIeeH3McOV5E/stJUBIV9I2CfSN4Nt2FMgL8ypRixjJC7jKSRe30452C9/MCRR8 pgnlAXBra2YJDCfYUG09BeQt8UBwLm9ebU+jPLY3/I266NMF7qQPZT+yjJFIJfLBlVB2 rUnaSFJoPT44pOLun0AL41hBVwa2d+AZ/yHlsxL6FPXdGNF/VTBl2G8kQOB1Z+eThn+G 327c91SXmM0itIcbjXFo/cAir+5uEJXMJ72o8kIkAgznJ4Mu8hto2hlHIUwLUBK3+ecX KCGamHWTDUDFuQ9AK4r9HMD8jR1LZafGja/QeMEAh/4gZlJg6249h/pRbckb4FGvWIDg +5vg== X-Gm-Message-State: APjAAAWa19B3wkirA30OwnDihWPwRm1SVa80SfvEn6/2P2oxkPHnKjBC oFW/zTkWVWmRjt4n2rDiEGiRBcvB X-Google-Smtp-Source: APXvYqwkyUVT0wctKrL5oM5DbaEwHtvxTCTiOdry6IqfPIChLG6u1LAAF4L+9nIrBJ6UYwFsgM4J5A== X-Received: by 2002:a50:89b4:: with SMTP id g49mr5026146edg.39.1567010204583; Wed, 28 Aug 2019 09:36:44 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id l6sm548646edr.56.2019.08.28.09.36.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 09:36:42 -0700 (PDT) From: Thierry Reding To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Andrew Murray , linux-pci@vger.kernel.org, Thomas Petazzoni Subject: [PATCH 3/5] PCI: armada8x: Properly handle optional PHYs Date: Wed, 28 Aug 2019 18:36:34 +0200 Message-Id: <20190828163636.12967-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190828163636.12967-1-thierry.reding@gmail.com> References: <20190828163636.12967-1-thierry.reding@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Thierry Reding devm_of_phy_get_by_index() can fail for a number of resides besides probe deferral. It can for example return -ENOMEM if it runs out of memory as it tries to allocate devres structures. Propagating only -EPROBE_DEFER is problematic because it results in these legitimately fatal errors being treated as "PHY not specified in DT". What we really want is to ignore the optional PHYs only if they have not been specified in DT. devm_of_phy_get_by_index() returns -ENODEV in this case, so that's the special case that we need to handle. So we propagate all errors, except -ENODEV, so that real failures will still cause the driver to fail probe. Cc: Thomas Petazzoni Signed-off-by: Thierry Reding Reviewed-by: Andrew Murray --- drivers/pci/controller/dwc/pcie-armada8k.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-armada8k.c b/drivers/pci/controller/dwc/pcie-armada8k.c index 3d55dc78d999..49596547e8c2 100644 --- a/drivers/pci/controller/dwc/pcie-armada8k.c +++ b/drivers/pci/controller/dwc/pcie-armada8k.c @@ -118,11 +118,10 @@ static int armada8k_pcie_setup_phys(struct armada8k_pcie *pcie) for (i = 0; i < ARMADA8K_PCIE_MAX_LANES; i++) { pcie->phy[i] = devm_of_phy_get_by_index(dev, node, i); - if (IS_ERR(pcie->phy[i]) && - (PTR_ERR(pcie->phy[i]) == -EPROBE_DEFER)) - return PTR_ERR(pcie->phy[i]); - if (IS_ERR(pcie->phy[i])) { + if (PTR_ERR(pcie->phy[i]) != -ENODEV) + return PTR_ERR(pcie->phy[i]); + pcie->phy[i] = NULL; continue; } From patchwork Wed Aug 28 16:36:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11119405 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5A0E112C for ; Wed, 28 Aug 2019 16:36:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4A6022CED for ; Wed, 28 Aug 2019 16:36:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LrM+ynsY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726513AbfH1Qgt (ORCPT ); Wed, 28 Aug 2019 12:36:49 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:35474 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726472AbfH1Qgt (ORCPT ); Wed, 28 Aug 2019 12:36:49 -0400 Received: by mail-ed1-f66.google.com with SMTP id t50so755788edd.2 for ; Wed, 28 Aug 2019 09:36:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=80ZrKgSivSW8WuAEFrIJj/qoImkkT28I8bgQGgM3b5k=; b=LrM+ynsYR7GYORsfwTv8c7QKitpkwJN75gF+hRzbK+Vgo/MXzNKqSvS8vLWW1xMtG8 ET7L0yqhjluQecCxHpxpVaqGVJawp76CRaT84IXVxTKiRPVKdQ3S6Ogzqg7jMU1xZhOM SIPioVekpDg3RQmj553WXzEsmzrFKEKoL9nEIkeQHBPPltinhlKiG18EqheA1YQCX203 uVIhpo0/ADDCr97CQtLqENWzGjI4fGEGriI8+9RnxMFIRCGma7S7ZX4nnP3PhtwvLdoz L3sIeK/2sJGU5rO6LAQuiJnldi7ZIpoRkLlgdUUH7VNTMWGE5kWFwGDDXVZtjfBy2LEe FRUw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=80ZrKgSivSW8WuAEFrIJj/qoImkkT28I8bgQGgM3b5k=; b=dQDVRyR1rw57YBksd459kTXV90WPPj0v2SF3TS+4OaAzfP0qqFbDokoBlaQWENjXbr y6JUFTjCKJFoH8dpNKfS9EuPHyxxGFZl2Hty8vgjqk7zMmUJDvWgXO2pn33OnTo3oi9r Qj6zmNfURY1ODMldg3Jvku7urpCCAOVnPRnjZ28RGsGRfEwe763+dcTNv9oC+lmuWwGN +s18uIg2DU3STNQ/klfrXqVlcmW+xuhIJ2Hrid27TA/s5VxrwApZoc+tUrjdlEw2hO+B WAIutYDdqCarbJbfIn4pSYMSfqe1xSgDC+DJCgoAY5a2w4OkiOkQh2rTASYLsPZCf44U C/Bg== X-Gm-Message-State: APjAAAUMjTFujpG+5xd+egeBNqfZ/JTTWEXdwg3/hifkzD585vVkBx+Q J8CTEIPo9h9SrvYXRH0d+qs= X-Google-Smtp-Source: APXvYqzjoRSE84BDLem3z/1CwoRMcw5726zQzh7WEENOVFsbq/kJwYtrSyuBh2TYolObPQ8xmkdlNQ== X-Received: by 2002:a05:6402:789:: with SMTP id d9mr4884877edy.25.1567010207110; Wed, 28 Aug 2019 09:36:47 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id b3sm447457ejl.55.2019.08.28.09.36.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 09:36:45 -0700 (PDT) From: Thierry Reding To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Andrew Murray , linux-pci@vger.kernel.org, Shawn Guo Subject: [PATCH 4/5] PCI: histb: Properly handle optional regulators Date: Wed, 28 Aug 2019 18:36:35 +0200 Message-Id: <20190828163636.12967-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190828163636.12967-1-thierry.reding@gmail.com> References: <20190828163636.12967-1-thierry.reding@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Thierry Reding regulator_get_optional() can fail for a number of reasons besides probe deferral. It can for example return -ENOMEM if it runs out of memory as it tries to allocate data structures. Propagating only -EPROBE_DEFER is problematic because it results in these legitimately fatal errors being treated as "regulator not specified in DT". What we really want is to ignore the optional regulators only if they have not been specified in DT. regulator_get_optional() returns -ENODEV in this case, so that's the special case that we need to handle. So we propagate all errors, except -ENODEV, so that real failures will still cause the driver to fail probe. Cc: Shawn Guo Signed-off-by: Thierry Reding Reviewed-by: Andrew Murray --- drivers/pci/controller/dwc/pcie-histb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-histb.c b/drivers/pci/controller/dwc/pcie-histb.c index 954bc2b74bbc..811b5c6d62ea 100644 --- a/drivers/pci/controller/dwc/pcie-histb.c +++ b/drivers/pci/controller/dwc/pcie-histb.c @@ -340,8 +340,8 @@ static int histb_pcie_probe(struct platform_device *pdev) hipcie->vpcie = devm_regulator_get_optional(dev, "vpcie"); if (IS_ERR(hipcie->vpcie)) { - if (PTR_ERR(hipcie->vpcie) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(hipcie->vpcie) != -ENODEV) + return PTR_ERR(hipcie->vpcie); hipcie->vpcie = NULL; } From patchwork Wed Aug 28 16:36:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11119407 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7C6C1399 for ; Wed, 28 Aug 2019 16:36:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B685120679 for ; Wed, 28 Aug 2019 16:36:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T2HUOvzj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726515AbfH1Qgv (ORCPT ); Wed, 28 Aug 2019 12:36:51 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:45973 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726472AbfH1Qgv (ORCPT ); Wed, 28 Aug 2019 12:36:51 -0400 Received: by mail-ed1-f66.google.com with SMTP id x19so675456eda.12 for ; Wed, 28 Aug 2019 09:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kmCn7C0sRpOCWgYfI3KtN2oHKFZs45dKwXRqZzCSl9s=; b=T2HUOvzjxuJj6Tq8jF+DxOjzEePhRRtX9NGwpDgDfxMBsFFXTRxOEmx5orPLpIhUyB 76qB2i/n00AEFTE66IeO+ppig4B7/tVTP5HPejafpegR3mveGVvmvjlIUNnKHgTV0LVy 4AoqwArr8AGg1nWmjhjzvdAKYMhDB3fhOw+38LsPEHw+rlH0OYnfP0iHgMC8JnBjfAAx jERJl7eBVTaRyxmbriZXjNinV4SlY5qMSOqEf2FGKIPsj+Rszlm7Os+1w3md/Op23fjY LpQNmTEfeAYccrbVdRhzmc3+vLoYGXeXp8T3rQCsUNN5HOA5F4/xNGTRZcHByAv5ofPw 9wzw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=kmCn7C0sRpOCWgYfI3KtN2oHKFZs45dKwXRqZzCSl9s=; b=mPpkUGheVecGhikbzpJts7bpODZLVPZjnwIjbn4NfWYf3JoOVyrP4yMvfYB6+68ROv CkYCFZHQdoy9CmAZ5y50RKpP8PiXRgyvej2FL2tAUzzWl6QcGlTJe98NXG6j66z5aDes yT09bCNw2qUUoUGu6XsL/xr30ZAxIcnD5hbbX7e6NQiNunzgT5grYKY5jRWfVLH5VuqK VnPG91CgHMcpHuPuXrPgIhxiSuMjSaJUrR/GmSLnhXp6UtBCHlX2LWfyl2exWpVaPtc6 ThHUu7snJecJNA4sRWz57qPpc3orDUXsxwlDMlrb1d3ND48ULktw602lsqydCo7/SYyT 4aEQ== X-Gm-Message-State: APjAAAX4yVFfWL56BaItwcd8PwQ8RRdCzk03BzKzKPUfKPtTV4zX2vhZ Cwf1j+xjCAJuuVtOW1mvhC0= X-Google-Smtp-Source: APXvYqzIf/XzwZtwNInsuJj1oavENaEWpR+UcoyCyExiTc1SnDuw/QyRfNS5Azoz94f0BkC55Ba91w== X-Received: by 2002:a50:f419:: with SMTP id r25mr5014817edm.57.1567010209371; Wed, 28 Aug 2019 09:36:49 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id nn19sm449978ejb.12.2019.08.28.09.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 09:36:48 -0700 (PDT) From: Thierry Reding To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Andrew Murray , linux-pci@vger.kernel.org, Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com Subject: [PATCH 5/5] PCI: iproc: Properly handle optional PHYs Date: Wed, 28 Aug 2019 18:36:36 +0200 Message-Id: <20190828163636.12967-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190828163636.12967-1-thierry.reding@gmail.com> References: <20190828163636.12967-1-thierry.reding@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Thierry Reding devm_phy_get() can fail for a number of resides besides probe deferral. It can for example return -ENOMEM if it runs out of memory as it tries to allocate devres structures. Propagating only -EPROBE_DEFER is problematic because it results in these legitimately fatal errors being treated as "PHY not specified in DT". What we really want is to ignore the optional PHYs only if they have not been specified in DT. devm_phy_optional_get() is a function that exactly does what's required here, so use that instead. Cc: Ray Jui Cc: Scott Branden Cc: bcm-kernel-feedback-list@broadcom.com Signed-off-by: Thierry Reding Reviewed-by: Andrew Murray --- drivers/pci/controller/pcie-iproc-platform.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/pcie-iproc-platform.c b/drivers/pci/controller/pcie-iproc-platform.c index 5a3550b6bb29..9ee6200a66f4 100644 --- a/drivers/pci/controller/pcie-iproc-platform.c +++ b/drivers/pci/controller/pcie-iproc-platform.c @@ -93,12 +93,9 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev) pcie->need_ib_cfg = of_property_read_bool(np, "dma-ranges"); /* PHY use is optional */ - pcie->phy = devm_phy_get(dev, "pcie-phy"); - if (IS_ERR(pcie->phy)) { - if (PTR_ERR(pcie->phy) == -EPROBE_DEFER) - return -EPROBE_DEFER; - pcie->phy = NULL; - } + pcie->phy = devm_phy_optional_get(dev, "pcie-phy"); + if (IS_ERR(pcie->phy)) + return PTR_ERR(pcie->phy); ret = devm_of_pci_get_host_bridge_resources(dev, 0, 0xff, &resources, &iobase);