Hi,

On Thu, Jan 05 2012, Girish K S wrote:
> @@ -1703,10 +1707,13 @@ static int sdhci_execute_tuning(struct mmc_host *mmc)
>        * Host Controller needs tuning only in case of SDR104 mode
>        * and for SDR50 mode when Use Tuning for SDR50 is set in
>        * Capabilities register.
> +      * If the Host Controller supports the HS200 mode then tuning
> +      * function has to be executed.
>        */
>       if (((ctrl & SDHCI_CTRL_UHS_MASK) == SDHCI_CTRL_UHS_SDR104) ||
>           (((ctrl & SDHCI_CTRL_UHS_MASK) == SDHCI_CTRL_UHS_SDR50) &&
> -         (host->flags & SDHCI_SDR50_NEEDS_TUNING)))
> +         (host->flags & SDHCI_SDR50_NEEDS_TUNING)) ||
> +         (host->flags & SDHCI_HS200_NEEDS_TUNING))
>               ctrl |= SDHCI_CTRL_EXEC_TUNING;
>       else {
>               spin_unlock(&host->lock);

Actually, this generates a warning:

/home/cjb/git/mmc/drivers/mmc/host/sdhci.c: In function ‘sdhci_execute_tuning’:
/home/cjb/git/mmc/drivers/mmc/host/sdhci.c:1716:7: warning: suggest parentheses 
around ‘&&’ within ‘||’ [-Wparentheses]

.. as well as being hard to follow.  Shall we split it up as below instead?

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 64febf2..5627354 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1694,6 +1694,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 
opcode)
        int tuning_loop_counter = MAX_TUNING_LOOP;
        unsigned long timeout;
        int err = 0;
+       bool requires_tuning_nonuhs;
 
        host = mmc_priv(mmc);
 
@@ -1704,16 +1705,19 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, 
u32 opcode)
        ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
 
        /*
-        * Host Controller needs tuning only in case of SDR104 mode
-        * and for SDR50 mode when Use Tuning for SDR50 is set in
+        * The Host Controller needs tuning only in case of SDR104 mode
+        * and for SDR50 mode when Use Tuning for SDR50 is set in the
         * Capabilities register.
-        * If the Host Controller supports the HS200 mode then tuning
-        * function has to be executed.
+        * If the Host Controller supports the HS200 mode then the
+        * tuning function has to be executed.
         */
-       if ((ctrl & SDHCI_CTRL_UHS_MASK == SDHCI_CTRL_UHS_SDR104) ||
-           ((ctrl & SDHCI_CTRL_UHS_MASK == SDHCI_CTRL_UHS_SDR50) &&
-            host->flags & SDHCI_SDR50_NEEDS_TUNING ||
+       if (((ctrl & SDHCI_CTRL_UHS_MASK) == SDHCI_CTRL_UHS_SDR50) &&
+           (host->flags & SDHCI_SDR50_NEEDS_TUNING ||
             host->flags & SDHCI_HS200_NEEDS_TUNING))
+               requires_tuning_nonuhs = true;
+
+       if (((ctrl & SDHCI_CTRL_UHS_MASK) == SDHCI_CTRL_UHS_SDR104) ||
+           requires_tuning_nonuhs)
                ctrl |= SDHCI_CTRL_EXEC_TUNING;
        else {
                spin_unlock(&host->lock);

-- 
Chris Ball   <c...@laptop.org>   <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to