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

ata: ahci_brcm: Perform reset after obtaining resources

Resources such as clocks, PHYs, regulators are likely to get a probe
deferral return code, which could lead to the AHCI controller being
reset a few times until it gets successfully probed. Since this is
typically the most time consuming operation, move it after the resources
have been acquired.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Florian Fainelli and committed by
Jens Axboe
1a0600d1 6fedae3c

+6 -6
+6 -6
drivers/ata/ahci_brcm.c
··· 456 456 if (IS_ERR(priv->rcdev)) 457 457 return PTR_ERR(priv->rcdev); 458 458 459 - reset_control_deassert(priv->rcdev); 460 - 461 459 hpriv = ahci_platform_get_resources(pdev, 0); 462 - if (IS_ERR(hpriv)) { 463 - ret = PTR_ERR(hpriv); 464 - goto out_reset; 465 - } 460 + if (IS_ERR(hpriv)) 461 + return PTR_ERR(hpriv); 466 462 467 463 hpriv->plat_data = priv; 468 464 hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP | AHCI_HFLAG_NO_WRITE_TO_RO; ··· 474 478 default: 475 479 break; 476 480 } 481 + 482 + ret = reset_control_deassert(priv->rcdev); 483 + if (ret) 484 + return ret; 477 485 478 486 ret = ahci_platform_enable_clks(hpriv); 479 487 if (ret)