mbox series

[v2,0/6] PCI: Propagate errors for optional resources

Message ID 20190829105319.14836-1-thierry.reding@gmail.com (mailing list archive)
Headers show
Series PCI: Propagate errors for optional resources | expand

Message

Thierry Reding Aug. 29, 2019, 10:53 a.m. UTC
From: Thierry Reding <treding@nvidia.com>

A common pattern exists among several PCI host controller drivers. Some
of the resources that they support are optional, and the way that the
drivers handle these resources is by propagating -EPROBE_DEFER and keep
going without the resource otherwise. However, there can be several
reasons for failing to obtain a resource (e.g. out of memory). Currently
all of these reasons will cause the drivers to consider the optional
resource to not be there. However, if the resource was in fact required
in the specific case and requesting it failed because of some other
reason, the drivers would still happily continue and cause potentially
hard to find problems.

Instead of rolling all error codes into one, reverse the check and only
handle -ENODEV as meaning "resource was not specified". Fatal errors in
that case will cause the driver to fail to probe rather than continuing
as if nothing had happened.

Changes in v2:
- add Rockchip PCI patch which was previously separate
- addressed Bjorn's comments regarding commit message
- collected Reviewed-by, Tested-by and Acked-by tags

Thierry

Thierry Reding (6):
  PCI: rockchip: Propagate errors for optional regulators
  PCI: exynos: Propagate errors for optional PHYs
  PCI: imx6: Propagate errors for optional regulators
  PCI: armada8x: Propagate errors for optional PHYs
  PCI: histb: Propagate errors for optional regulators
  PCI: iproc: Propagate errors for optional PHYs

 drivers/pci/controller/dwc/pci-exynos.c      |  2 +-
 drivers/pci/controller/dwc/pci-imx6.c        |  4 ++--
 drivers/pci/controller/dwc/pcie-armada8k.c   |  7 +++----
 drivers/pci/controller/dwc/pcie-histb.c      |  4 ++--
 drivers/pci/controller/pcie-iproc-platform.c |  9 +++------
 drivers/pci/controller/pcie-rockchip-host.c  | 16 ++++++++--------
 6 files changed, 19 insertions(+), 23 deletions(-)

Comments

Lorenzo Pieralisi Sept. 4, 2019, 2:48 p.m. UTC | #1
On Thu, Aug 29, 2019 at 12:53:13PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> A common pattern exists among several PCI host controller drivers. Some
> of the resources that they support are optional, and the way that the
> drivers handle these resources is by propagating -EPROBE_DEFER and keep
> going without the resource otherwise. However, there can be several
> reasons for failing to obtain a resource (e.g. out of memory). Currently
> all of these reasons will cause the drivers to consider the optional
> resource to not be there. However, if the resource was in fact required
> in the specific case and requesting it failed because of some other
> reason, the drivers would still happily continue and cause potentially
> hard to find problems.
> 
> Instead of rolling all error codes into one, reverse the check and only
> handle -ENODEV as meaning "resource was not specified". Fatal errors in
> that case will cause the driver to fail to probe rather than continuing
> as if nothing had happened.
> 
> Changes in v2:
> - add Rockchip PCI patch which was previously separate
> - addressed Bjorn's comments regarding commit message
> - collected Reviewed-by, Tested-by and Acked-by tags
> 
> Thierry
> 
> Thierry Reding (6):
>   PCI: rockchip: Propagate errors for optional regulators
>   PCI: exynos: Propagate errors for optional PHYs
>   PCI: imx6: Propagate errors for optional regulators
>   PCI: armada8x: Propagate errors for optional PHYs
>   PCI: histb: Propagate errors for optional regulators
>   PCI: iproc: Propagate errors for optional PHYs
> 
>  drivers/pci/controller/dwc/pci-exynos.c      |  2 +-
>  drivers/pci/controller/dwc/pci-imx6.c        |  4 ++--
>  drivers/pci/controller/dwc/pcie-armada8k.c   |  7 +++----
>  drivers/pci/controller/dwc/pcie-histb.c      |  4 ++--
>  drivers/pci/controller/pcie-iproc-platform.c |  9 +++------
>  drivers/pci/controller/pcie-rockchip-host.c  | 16 ++++++++--------
>  6 files changed, 19 insertions(+), 23 deletions(-)

Applied to pci/misc for v5.4, thanks !

Lorenzo