From patchwork Thu Aug 29 10:53:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11120983 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 7F7CF14E5 for ; Thu, 29 Aug 2019 10:53:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5EA6023404 for ; Thu, 29 Aug 2019 10:53:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DgTNRg87" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727360AbfH2KxZ (ORCPT ); Thu, 29 Aug 2019 06:53:25 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43948 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728300AbfH2KxY (ORCPT ); Thu, 29 Aug 2019 06:53:24 -0400 Received: by mail-ed1-f66.google.com with SMTP id h13so3531370edq.10 for ; Thu, 29 Aug 2019 03:53:23 -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=6CrKI9MhQzT9WqpEbXKyv6DhjyLfjSiz4qRQN1f/whw=; b=DgTNRg87AQs/Ut2ARsvMwMQBNk7BXUVzcYL46IiYCDqUP/CeYWME6luaR3oDragNfK toUZVDuX453YpYlJ8isTdax4cJbJ8bcjJJjt48fQ7i/WyQAo83gdrg8+v80XAC2qi0ZS 6srgHUKllQ0m7K214wVdDQCyw8VN9/BOl6Z52PN8+nvsyCJeZV7Z4qNScHdtQBwjHCUX m+ddGqTXKHXK7h9s/eVE+mAFYpA4fE0lxAiajY0rLhbmzmVnnaM9QB1xF7mStxI1oBO1 j0yM96oSboyFcVp3L38Of0+c0TtAEgjvfEuVlMx7jU61UoRStU2SuSpAD9xWB9W6kdg0 OBYA== 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=6CrKI9MhQzT9WqpEbXKyv6DhjyLfjSiz4qRQN1f/whw=; b=TqO5wERAoFCunQhD8u1trN622aKE/TExDPDxdHwi3E3nWn3OXtAk+qwejok8EcfNxq msXb7YC6DYAo8PshIoXdzaS+4XjPA88uCVwQyNp8051F1xFTiJWSFbEdiomJBW2BXycp 4Lyx85Wdo1qh5KKAv/vxFD8Wu4pVg8v2NYkDP0MdGiKw5yCPJypGdoHA97BEDS4GvqHM lkPc1iDnvwea2E4SHVItY11h2DL/82GJch0zGjncamFWIzHGK3fhiQqfBMZ6nXFCWODP nIsiwkQLcE7Sf7oSv47LW5l912IQF/HypCqtOZELyAySduXlynPBhzQuGmN/OfUVo4zt Pxog== X-Gm-Message-State: APjAAAVYYZh17MmH/3W+SsRgcmCTCZjmvWOBn7cE13I6uXzBeQpt0HhS 2lKiqLuF/TWtFxYx2LFcPsQ= X-Google-Smtp-Source: APXvYqyx/qJcgDZlIemQldwVnqLbbL+15wOWsgThaZHYnBCzryHVbown85YrmhjWLdJrNRbBMIx74w== X-Received: by 2002:a17:906:3518:: with SMTP id r24mr7473430eja.133.1567076002754; Thu, 29 Aug 2019 03:53:22 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id j2sm331094ejj.34.2019.08.29.03.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 03:53:21 -0700 (PDT) From: Thierry Reding To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Andrew Murray , linux-pci@vger.kernel.org, Shawn Lin , Heiko Stuebner , linux-rockchip@lists.infradead.org Subject: [PATCH v2 1/6] PCI: rockchip: Propagate errors for optional regulators Date: Thu, 29 Aug 2019 12:53:14 +0200 Message-Id: <20190829105319.14836-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190829105319.14836-1-thierry.reding@gmail.com> References: <20190829105319.14836-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 Lin Cc: Heiko Stuebner Cc: linux-rockchip@lists.infradead.org Reviewed-by: Andrew Murray Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner Acked-by: Shawn Lin Signed-off-by: Thierry Reding --- drivers/pci/controller/pcie-rockchip-host.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c index 8d20f1793a61..ef8e677ce9d1 100644 --- a/drivers/pci/controller/pcie-rockchip-host.c +++ b/drivers/pci/controller/pcie-rockchip-host.c @@ -608,29 +608,29 @@ static int rockchip_pcie_parse_host_dt(struct rockchip_pcie *rockchip) rockchip->vpcie12v = devm_regulator_get_optional(dev, "vpcie12v"); if (IS_ERR(rockchip->vpcie12v)) { - if (PTR_ERR(rockchip->vpcie12v) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(rockchip->vpcie12v) != -ENODEV) + return PTR_ERR(rockchip->vpcie12v); dev_info(dev, "no vpcie12v regulator found\n"); } rockchip->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3"); if (IS_ERR(rockchip->vpcie3v3)) { - if (PTR_ERR(rockchip->vpcie3v3) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(rockchip->vpcie3v3) != -ENODEV) + return PTR_ERR(rockchip->vpcie3v3); dev_info(dev, "no vpcie3v3 regulator found\n"); } rockchip->vpcie1v8 = devm_regulator_get_optional(dev, "vpcie1v8"); if (IS_ERR(rockchip->vpcie1v8)) { - if (PTR_ERR(rockchip->vpcie1v8) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(rockchip->vpcie1v8) != -ENODEV) + return PTR_ERR(rockchip->vpcie1v8); dev_info(dev, "no vpcie1v8 regulator found\n"); } rockchip->vpcie0v9 = devm_regulator_get_optional(dev, "vpcie0v9"); if (IS_ERR(rockchip->vpcie0v9)) { - if (PTR_ERR(rockchip->vpcie0v9) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(rockchip->vpcie0v9) != -ENODEV) + return PTR_ERR(rockchip->vpcie0v9); dev_info(dev, "no vpcie0v9 regulator found\n"); } From patchwork Thu Aug 29 10:53:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11120993 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 DA9F314DE for ; Thu, 29 Aug 2019 10:53:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B928023404 for ; Thu, 29 Aug 2019 10:53:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TPCBbnv0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728644AbfH2Kx1 (ORCPT ); Thu, 29 Aug 2019 06:53:27 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43952 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727207AbfH2Kx0 (ORCPT ); Thu, 29 Aug 2019 06:53:26 -0400 Received: by mail-ed1-f66.google.com with SMTP id h13so3531469edq.10 for ; Thu, 29 Aug 2019 03:53:25 -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=q9U83Wx+aV+BXrLCEnw6tHfbtPyYHXQQDbuakWJ5Yrs=; b=TPCBbnv0EtvQr7cah0D4UwXKcvUat2BCPYmS3BuVlIcr7/QSvvaHwzWYsJW9wEF2DC +1zsa6OPidohM27I18DWhuvVEd7rx8f+eMtVfBR4n9PR8w1nNdll7NfZ/DFoZ1lzrrsY ssxq/1FpJNoVR8XrXC/zAf+06Sv7KtRRNEOJBL05UZSRJY2NJ8dHxZ7llkPu/5Fyhm53 7a6MSt6CMwd4u1rfOA1s9vwymBIRi8TzQyXPIAAdulAWYYKRfsjClppluBpCmmPWwxfz m2Yu7VUbOVRTqf54KpPE3S/OvPP8whwUHeAg2cAISE9ZC9Tg36TARwq5MnEmZBsx1wu9 0LnQ== 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=q9U83Wx+aV+BXrLCEnw6tHfbtPyYHXQQDbuakWJ5Yrs=; b=mqiisyYjhiTh32aolf4QgvDPF3lAxveAkOtlwf/pug9uQRXQpQLhb5vWVgGRBOvacE mp63zTMpnGfTMkstNn9/+qutYxX6GpQtguyPemzBp/Lc9snj4ajj+KuNMoYTFTyUD6UN 3yIaL/fGoKDpBAIWSA8jO6nSgUz347GOV9+oQEr6bIWovS/yUSai2vBzyr0BhqKhGbAR 75x3T6Suu92JOAqX/rhWjEGL1cjd14JqIyfhjle2m0OSkYO+kxgwdXz4vES6WQKcQI8n S+DxnH3jgxmXNDbQx/x5NlONyPBBAAQ308zhCLNeTMgXVRR9yFcSNENbhzdZ2F7IF58O bcEw== X-Gm-Message-State: APjAAAVmFRTg4+j9Cp1Cc04WmBkgmAZVSEp1nQ8hAbaL+jNNygoxunuw WYTFzd4MqMFZVjxD/i1Kovw= X-Google-Smtp-Source: APXvYqzIJWSVU4BK9v3d0RS9SmMIMLv59V+By0nhPla0CQsXbRwpvRBYdwsPcg1xgT5IKX02CbzYuQ== X-Received: by 2002:a50:a5dd:: with SMTP id b29mr9142102edc.34.1567076005038; Thu, 29 Aug 2019 03:53:25 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id fj15sm329759ejb.78.2019.08.29.03.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 03:53:23 -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 v2 2/6] PCI: exynos: Propagate errors for optional PHYs Date: Thu, 29 Aug 2019 12:53:15 +0200 Message-Id: <20190829105319.14836-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190829105319.14836-1-thierry.reding@gmail.com> References: <20190829105319.14836-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() 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 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 Reviewed-by: Andrew Murray Signed-off-by: Thierry Reding --- 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 Thu Aug 29 10:53:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11120989 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 12E5716B1 for ; Thu, 29 Aug 2019 10:53:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E37C62341B for ; Thu, 29 Aug 2019 10:53:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MzdQXSay" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728800AbfH2Kxb (ORCPT ); Thu, 29 Aug 2019 06:53:31 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:42791 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727171AbfH2Kx3 (ORCPT ); Thu, 29 Aug 2019 06:53:29 -0400 Received: by mail-ed1-f66.google.com with SMTP id m44so3538553edd.9 for ; Thu, 29 Aug 2019 03:53:27 -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=g75H9RnPVD+oDePSadmENs2ts1AD7BPbSlroHbXgt0U=; b=MzdQXSayVWhJxTWNSXMnv5SJhh7z0p7v3S1mO6Jt1LsCg9fa9QM22/PSdrP8slBQHh 2HLDbT9iC5VsObzD8GCyLuMjTlcTl4OjEOnnSXkueanIHNnf320HwBf/SvJ83sSTHQVc CPV/kkl5FgNg35JJM6zBPTY3+9zkxPBtEiVDE+MWg+baUavJIvd+Rx3BJ8mk58D3FAFC fmo2jVM8Nxq828z6NtGSPYkcl34DzzB+i3q/47GKr98440PVih6HhSj92WWZCFCcrNC5 xlfrCB/TD28Jr2HP2T/Ua4eqq4/aRzUxRYVqx6iAdRp8tsxje/wCZHDh8uqT289AmSFQ ySbQ== 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=g75H9RnPVD+oDePSadmENs2ts1AD7BPbSlroHbXgt0U=; b=F1jKOpTjrZIuGLvrbYeha8O7RntTahGJiYNsBo11JS5RqmVZaNeeqU+6oO4VY20tZ3 tG1AwAI7iLjdGxW4gQqMubh/IRGR6GXXoWorIpQQ5LyR9/Sq7OncgOddmgUr6Seo4Hd2 egEOdymkvrktzuXCSNdgtopvtR6UAcC1B9u9XT/BUJ9IoSwZrh5CvRAvmxoPX8ymxa6q BG0jHbdSz+7zYFtKClwSgjqN9Il+oHueVJUOilWr8dQL0AoTMYiNkcFeMMDMl40RGffZ wMj6TPJjbC9o5fNisdoy6doo2/6oMp3Z5ZRaqNf9ngcIQj0LPUbNacEEDpfTRrleJv10 zTUg== X-Gm-Message-State: APjAAAXYK/+fhB82nrS87c1aaPtnUZh/EkNyoxsfEwg3ztAdN3D8e+2f 1qavTBgChuZ/bHADS28NBns= X-Google-Smtp-Source: APXvYqyK2Wjn3+k4B99F4fjh31BFPB7esUAdaCDhTvsr/3jXzXxCmjTq/KHMLgjy0ozsjfu5ufX1eQ== X-Received: by 2002:a50:ed08:: with SMTP id j8mr2513340eds.3.1567076006809; Thu, 29 Aug 2019 03:53:26 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id y30sm373302edi.95.2019.08.29.03.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 03:53:25 -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 v2 3/6] PCI: imx6: Propagate errors for optional regulators Date: Thu, 29 Aug 2019 12:53:16 +0200 Message-Id: <20190829105319.14836-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190829105319.14836-1-thierry.reding@gmail.com> References: <20190829105319.14836-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 Reviewed-by: Andrew Murray Signed-off-by: Thierry Reding --- 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 Thu Aug 29 10:53:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11120987 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 D9C7514DE for ; Thu, 29 Aug 2019 10:53:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B8F0F2053B for ; Thu, 29 Aug 2019 10:53:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZFNbt0bG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728462AbfH2Kxa (ORCPT ); Thu, 29 Aug 2019 06:53:30 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:40031 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728799AbfH2Kxa (ORCPT ); Thu, 29 Aug 2019 06:53:30 -0400 Received: by mail-ed1-f65.google.com with SMTP id h8so3559692edv.7 for ; Thu, 29 Aug 2019 03:53:29 -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=8gFcxUWdUh7JrthZ4h94QDUZDfQAvubHMLo7e+zp41g=; b=ZFNbt0bG4blmJJTdRvenuOxs/OnyNemmfV+FBnGOwI1azx7QTB9zzJtxSjRKZjDfEg YMKXS3NbtsySuD4ZWNJKhmLoP5h/dRDjiZ9xP4KYQc29eP3DzHq7IXtQRhwar/ILxaQl QOZecA2D/HgeTt9nThVz1oxiIJgD2p9smwpJ7RMdeAo0ZVzjMaSNvKV25F+3i4CI6AR/ gQKV41t9badED1VfuYpYWshXXcT5Up4LbzKfW/v8dA6K3YFQ7zGonv98XBQ3D4h1J24W PC7L0/Juysx2CL3yZHkegpFj73WFpEBVb42EENIey33DO58Gxvd1cqrBcWjeBFpBn4w1 1Lag== 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=8gFcxUWdUh7JrthZ4h94QDUZDfQAvubHMLo7e+zp41g=; b=NkMtbdFcvZrZwLZD161wK2E1pJXcqrdB+2Iwxlsa/YBJP5gXJYb+f9WK57E5cLurPf uQ/xo4MZzySv59QE+6dEkGn5kA+KXEGwnc/GHGSn/f2FtInnoSIPr5AwABLZdHfm441U S5X5Z2JwI4neHEd+18fBqHdsYQbgBRINz9PM9nkLfDL4j2MsQqvFkh0HV2mnRlf+7Auv 64Vdc6cuxjV4dX+2Y83BWeqdQuJfFfGj5yISoTHfexjhIUXDf2zSJsxYzjKUv5R+0IXt GTPD//3TAXgUfDwcsqcWE82QAd9EOFzvWFdQxosvrT3xJYe7QcbyvjqBGL/W/Hs+qNHp qglQ== X-Gm-Message-State: APjAAAVNkDTS9+UgYZf2lKDkvZBEGp3rdGKW3gPA4IJDeW3uN6+RhMyy B4pV3K5WIpnb0R5xcmIMLpw= X-Google-Smtp-Source: APXvYqxhLrL6/mKGjOAYXE5acZwalwbf90ih41WMGYVDr63l9ZCg1AOwIGvAZQryLm6nAKNxbUGrng== X-Received: by 2002:a50:b825:: with SMTP id j34mr9249098ede.58.1567076008523; Thu, 29 Aug 2019 03:53:28 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id h9sm374654edv.75.2019.08.29.03.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 03:53:27 -0700 (PDT) From: Thierry Reding To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Andrew Murray , linux-pci@vger.kernel.org, Thomas Petazzoni Subject: [PATCH v2 4/6] PCI: armada8x: Propagate errors for optional PHYs Date: Thu, 29 Aug 2019 12:53:17 +0200 Message-Id: <20190829105319.14836-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190829105319.14836-1-thierry.reding@gmail.com> References: <20190829105319.14836-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 reasons 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 Reviewed-by: Andrew Murray Signed-off-by: Thierry Reding --- 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 Thu Aug 29 10:53:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11120991 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 71BAB14DE for ; Thu, 29 Aug 2019 10:53:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FC2723404 for ; Thu, 29 Aug 2019 10:53:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YKOZFIrQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728079AbfH2Kxc (ORCPT ); Thu, 29 Aug 2019 06:53:32 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:39917 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728698AbfH2Kxc (ORCPT ); Thu, 29 Aug 2019 06:53:32 -0400 Received: by mail-ed1-f66.google.com with SMTP id g8so3559473edm.6 for ; Thu, 29 Aug 2019 03:53:31 -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=2SPOMFKgZSTVee5kDDmgM7l3ZhbxI3d8WmC/5XcLiLc=; b=YKOZFIrQeN3tIdyHoUuG0xTIgTA2UOioYfcT9S2ZkPdkzLl+CddK6+K+Kp6XIDepjA ts8wSGO+C7aOjZh1s98oKhwhfAU1hUV2LhzXFT3PjqEfKWaD4I3Z3bWKOgBJ7ZwxuN3t ow40vlg5VSIbIBIeEL801akAkGGOVTLGAjIHmU1LAe8wCCj60tNY3nqF18twngJ6b2+6 0MyUm0EGe8rJ6R2hGJ/n9Bx/vhnr5QUSOYKyfvF5AU8eVzZfWAt53VkZFZNt9tkW15F2 xYB/Z0FXBMZrIeQJg3DGJ1ksCngTvoCTgY10j++gvE86eM5iFz/GScZdf1Sp6FB7zF2u +s8w== 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=2SPOMFKgZSTVee5kDDmgM7l3ZhbxI3d8WmC/5XcLiLc=; b=H7lzdVbtcvDVoB6v3He+O8tlRhywMo7b6Bqo0s9qNkoEwMb6oQqnzX6qWCoi47kin4 xvlM1R9DsWyn08SFshm1+RSIUPF4++muDIITeASxSJiMCux9yedXeorQ528yYpU3YDyc Z6AvvMYCXL5A1SffPybAPnOC1+PyvnDOPcMxHhUHzRuHjIA+gRGWnfHJaUF1heRYPTvV P2FF0LeMvd5ddKT+ARkFtePZK9v3O7k+WVvvF3w3o756MgIhRHpPw/UHIC90Q52ZXyUU SXjZ8MK3h0fJ6bVpXJcfi5uB8b1fS1RFiVPclfDzWFMzgSQluXzt6vj4dyD50yIRFLql 8niw== X-Gm-Message-State: APjAAAXOuzbiwLNZM7aoAyGD3B5kmp+s9EO6e0BcktYydey/VT8s9Bxd G1d1srcFw6GTpIkQFmKSjmQ= X-Google-Smtp-Source: APXvYqwf/9wMdyWKiW+fgDSDwaKXsbKilFVOwkDy6OJtvmHc7KH2/FhCsUMDTDQgsQtGIkUZPTgs7A== X-Received: by 2002:a17:906:1e8c:: with SMTP id e12mr7529320ejj.135.1567076010292; Thu, 29 Aug 2019 03:53:30 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id f6sm378777edv.30.2019.08.29.03.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 03:53:29 -0700 (PDT) From: Thierry Reding To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Andrew Murray , linux-pci@vger.kernel.org, Shawn Guo Subject: [PATCH v2 5/6] PCI: histb: Propagate errors for optional regulators Date: Thu, 29 Aug 2019 12:53:18 +0200 Message-Id: <20190829105319.14836-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190829105319.14836-1-thierry.reding@gmail.com> References: <20190829105319.14836-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 Reviewed-by: Andrew Murray Signed-off-by: Thierry Reding --- 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 Thu Aug 29 10:53:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11120995 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 56C6016B1 for ; Thu, 29 Aug 2019 10:53:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3716A2341B for ; Thu, 29 Aug 2019 10:53:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WB2L5Grc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728061AbfH2Kxf (ORCPT ); Thu, 29 Aug 2019 06:53:35 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36342 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728509AbfH2Kxe (ORCPT ); Thu, 29 Aug 2019 06:53:34 -0400 Received: by mail-ed1-f68.google.com with SMTP id g24so3584495edu.3 for ; Thu, 29 Aug 2019 03:53:33 -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=ObPUGXaeMQTZHC5rRNant5HT8Wtg0VFfd8Aoph2s9Qs=; b=WB2L5GrcmTSUB4RE6Q1seT7kW7N8Zojp5t4Bee1J6E8h3m1rXp11rrLHE3Mn5fZsXx JLDcZJPcGXbqPi7mT1alZiusFe1MpNWrOdiRGyGQuK4E92VA9cbR4ssUrI1g+pxoeLfs DnhraV051aa43X+92bapbpOiLQ4yvCsKBp9rRZb+hvpIOqSFOylqGfhb5NEhNfN4CaKX NAha8z6LbefNBw9F7sxkJsF/1vFk3JkcEfm5pI47VA4fyLwmESIDIVV+jXJOMYqOKsuC AvtehZoLE6kuS7ElTIjzWM0VPyQIzMj33IE5uVvONNaDCoME56QmlyP9PFMaKG3YEVd+ iHEQ== 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=ObPUGXaeMQTZHC5rRNant5HT8Wtg0VFfd8Aoph2s9Qs=; b=phH1GbF3J3VA13mcdqFZNS6g4xYXR8SlFXkr93VHrYJRgKkf2qDcdSFlqlm+kTwPQf yji+zI0Y7p/PhAX5HwPQhOA2OimbGZiDpurNYKxAHo6Lec8bDhmAV+oYvhwO4SBhravk r73IQEdu2+xN63bLaOV86xO/d6j+39STTN4VsaeuUaONPMGfZjLTQoE7ClZfbA/oovNy +Z45OUGnETOHQb0afUSSLkrvFnIEAHYlYMdcMnYoZ0kd5fPJ9xIViF1nf6HC11s4YC92 1eePRuUoA2PUymR82zjHnFDjlmBO8ACX2z+0qc7IpmfYJMiG6q77dyTpswrJVzyWY9tH vd/w== X-Gm-Message-State: APjAAAUzas/6ZHaCWyrVASdh0OKvbZzeytK7t9T5mLTaXGRBeZXMNq/s EJMdFPPBtV2Gs90zwc4ZCQoI6gkt X-Google-Smtp-Source: APXvYqw3lE9siz+dSNWer9gb2ctybKgOQYARhAwiZw1vGGCEC/9JRHqTtJm5DeV5K91Pt5SDhOcTwQ== X-Received: by 2002:a05:6402:785:: with SMTP id d5mr8915763edy.210.1567076012295; Thu, 29 Aug 2019 03:53:32 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id q10sm328918ejt.54.2019.08.29.03.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 03:53:31 -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 v2 6/6] PCI: iproc: Propagate errors for optional PHYs Date: Thu, 29 Aug 2019 12:53:19 +0200 Message-Id: <20190829105319.14836-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190829105319.14836-1-thierry.reding@gmail.com> References: <20190829105319.14836-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 reasons 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 Reviewed-by: Andrew Murray Signed-off-by: Thierry Reding --- 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);