Commit 9e936277 authored by Damien Le Moal's avatar Damien Le Moal

ata: ahci: Cleanup ahci_reset_controller()

Fix multi-line comment style in ahci_reset_controller() and change the
code to return early if ahci_skip_host_reset is true, reducing
indentation by one level for the bulk of the function code.

No functional changes.
Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Reviewed-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
parent d0b24616
...@@ -975,44 +975,43 @@ int ahci_reset_controller(struct ata_host *host) ...@@ -975,44 +975,43 @@ int ahci_reset_controller(struct ata_host *host)
void __iomem *mmio = hpriv->mmio; void __iomem *mmio = hpriv->mmio;
u32 tmp; u32 tmp;
/* we must be in AHCI mode, before using anything /*
* AHCI-specific, such as HOST_RESET. * We must be in AHCI mode, before using anything AHCI-specific, such
* as HOST_RESET.
*/ */
ahci_enable_ahci(mmio); ahci_enable_ahci(mmio);
/* global controller reset */ /* Global controller reset */
if (!ahci_skip_host_reset) { if (ahci_skip_host_reset) {
dev_info(host->dev, "Skipping global host reset\n");
return 0;
}
tmp = readl(mmio + HOST_CTL); tmp = readl(mmio + HOST_CTL);
if ((tmp & HOST_RESET) == 0) { if (!(tmp & HOST_RESET)) {
writel(tmp | HOST_RESET, mmio + HOST_CTL); writel(tmp | HOST_RESET, mmio + HOST_CTL);
readl(mmio + HOST_CTL); /* flush */ readl(mmio + HOST_CTL); /* flush */
} }
/* /*
* to perform host reset, OS should set HOST_RESET * To perform host reset, OS should set HOST_RESET and poll until this
* and poll until this bit is read to be "0". * bit is read to be "0". Reset must complete within 1 second, or the
* reset must complete within 1 second, or * hardware should be considered fried.
* the hardware should be considered fried.
*/ */
tmp = ata_wait_register(NULL, mmio + HOST_CTL, HOST_RESET, tmp = ata_wait_register(NULL, mmio + HOST_CTL, HOST_RESET,
HOST_RESET, 10, 1000); HOST_RESET, 10, 1000);
if (tmp & HOST_RESET) { if (tmp & HOST_RESET) {
dev_err(host->dev, "controller reset failed (0x%x)\n", dev_err(host->dev, "Controller reset failed (0x%x)\n",
tmp); tmp);
return -EIO; return -EIO;
} }
/* turn on AHCI mode */ /* Turn on AHCI mode */
ahci_enable_ahci(mmio); ahci_enable_ahci(mmio);
/* Some registers might be cleared on reset. Restore /* Some registers might be cleared on reset. Restore initial values. */
* initial values.
*/
if (!(hpriv->flags & AHCI_HFLAG_NO_WRITE_TO_RO)) if (!(hpriv->flags & AHCI_HFLAG_NO_WRITE_TO_RO))
ahci_restore_initial_config(host); ahci_restore_initial_config(host);
} else
dev_info(host->dev, "skipping global host reset\n");
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment