Date: Sun, 8 Jan 2017 18:28:06 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311693 - head/sys/dev/sdhci Message-ID: <201701081828.v08IS6YR014844@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Sun Jan 8 18:28:06 2017 New Revision: 311693 URL: https://svnweb.freebsd.org/changeset/base/311693 Log: Now that the PRESENT_STATE register is only used for the inhibit bits loop in this function, eliminate the state variable and restructure the loop to read the register just once at the top of the loop. Suggested by: skra Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sun Jan 8 18:17:35 2017 (r311692) +++ head/sys/dev/sdhci/sdhci.c Sun Jan 8 18:28:06 2017 (r311693) @@ -821,7 +821,7 @@ static void sdhci_start_command(struct sdhci_slot *slot, struct mmc_command *cmd) { int flags, timeout; - uint32_t mask, state; + uint32_t mask; slot->curcmd = cmd; slot->cmd_done = 0; @@ -836,8 +836,6 @@ sdhci_start_command(struct sdhci_slot *s return; } - /* Read controller present state. */ - state = RD4(slot, SDHCI_PRESENT_STATE); /* Do not issue command if there is no card, clock or power. * Controller will not detect timeout without clock active. */ if (!SDHCI_GET_CARD_PRESENT(slot->bus, slot) || @@ -866,7 +864,7 @@ sdhci_start_command(struct sdhci_slot *s * (It's usually more like 20-30ms in the real world.) */ timeout = 250; - while (state & mask) { + while (mask & RD4(slot, SDHCI_PRESENT_STATE)) { if (timeout == 0) { slot_printf(slot, "Controller never released " "inhibit bit(s).\n"); @@ -877,7 +875,6 @@ sdhci_start_command(struct sdhci_slot *s } timeout--; DELAY(1000); - state = RD4(slot, SDHCI_PRESENT_STATE); } /* Prepare command flags. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701081828.v08IS6YR014844>