Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: rockchip: Make 'ep-gpios' DT property optional

The Rockchip PCIe controller DT binding clearly states that 'ep-gpios' is
an optional property. And indeed there are boards that don't require it.

Make the driver follow the binding by using devm_gpiod_get_optional()
instead of devm_gpiod_get().

[bhelgaas: tidy whitespace]
Link: https://lore.kernel.org/r/20210121162321.4538-2-wens@kernel.org
Fixes: e77f847df54c ("PCI: rockchip: Add Rockchip PCIe controller support")
Fixes: 956cd99b35a8 ("PCI: rockchip: Separate common code from RC driver")
Fixes: 964bac9455be ("PCI: rockchip: Split out rockchip_pcie_parse_dt() to parse DT")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Chen-Yu Tsai and committed by
Bjorn Helgaas
58adbfb3 7c53f6b6

+6 -6
+6 -6
drivers/pci/controller/pcie-rockchip.c
··· 82 82 } 83 83 84 84 rockchip->mgmt_sticky_rst = devm_reset_control_get_exclusive(dev, 85 - "mgmt-sticky"); 85 + "mgmt-sticky"); 86 86 if (IS_ERR(rockchip->mgmt_sticky_rst)) { 87 87 if (PTR_ERR(rockchip->mgmt_sticky_rst) != -EPROBE_DEFER) 88 88 dev_err(dev, "missing mgmt-sticky reset property in node\n"); ··· 118 118 } 119 119 120 120 if (rockchip->is_rc) { 121 - rockchip->ep_gpio = devm_gpiod_get(dev, "ep", GPIOD_OUT_HIGH); 122 - if (IS_ERR(rockchip->ep_gpio)) { 123 - dev_err(dev, "missing ep-gpios property in node\n"); 124 - return PTR_ERR(rockchip->ep_gpio); 125 - } 121 + rockchip->ep_gpio = devm_gpiod_get_optional(dev, "ep", 122 + GPIOD_OUT_HIGH); 123 + if (IS_ERR(rockchip->ep_gpio)) 124 + return dev_err_probe(dev, PTR_ERR(rockchip->ep_gpio), 125 + "failed to get ep GPIO\n"); 126 126 } 127 127 128 128 rockchip->aclk_pcie = devm_clk_get(dev, "aclk");