Skip to content

Commit 444a43b

Browse files
moonlinuxbjorn-helgaas
authored andcommitted
PCI: j721e: Use 'pcie->reset_gpio' directly and drop the local variable
Assign the result of devm_gpiod_get_optional() directly to pcie->reset_gpio, thereby removing the local variable. Signed-off-by: Anand Moon <linux.amoon@gmail.com> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com> Link: https://patch.msgid.link/20251028154229.6774-3-linux.amoon@gmail.com
1 parent 6fad11c commit 444a43b

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

drivers/pci/controller/cadence/pci-j721e.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ static int j721e_pcie_probe(struct platform_device *pdev)
477477
struct j721e_pcie *pcie;
478478
struct cdns_pcie_rc *rc = NULL;
479479
struct cdns_pcie_ep *ep = NULL;
480-
struct gpio_desc *gpiod;
481480
void __iomem *base;
482481
u32 num_lanes;
483482
u32 mode;
@@ -589,12 +588,12 @@ static int j721e_pcie_probe(struct platform_device *pdev)
589588

590589
switch (mode) {
591590
case PCI_MODE_RC:
592-
gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
593-
if (IS_ERR(gpiod)) {
594-
ret = dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get reset GPIO\n");
591+
pcie->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
592+
if (IS_ERR(pcie->reset_gpio)) {
593+
ret = dev_err_probe(dev, PTR_ERR(pcie->reset_gpio),
594+
"Failed to get reset GPIO\n");
595595
goto err_get_sync;
596596
}
597-
pcie->reset_gpio = gpiod;
598597

599598
ret = cdns_pcie_init_phy(dev, cdns_pcie);
600599
if (ret) {
@@ -616,9 +615,9 @@ static int j721e_pcie_probe(struct platform_device *pdev)
616615
* This shall ensure that the power and the reference clock
617616
* are stable.
618617
*/
619-
if (gpiod) {
618+
if (pcie->reset_gpio) {
620619
msleep(PCIE_T_PVPERL_MS);
621-
gpiod_set_value_cansleep(gpiod, 1);
620+
gpiod_set_value_cansleep(pcie->reset_gpio, 1);
622621
}
623622

624623
ret = cdns_pcie_host_setup(rc);

0 commit comments

Comments
 (0)