All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check
@ 2022-11-19  3:04 Sebastian Falbesoner
  2022-11-21  2:56 ` Bough Chen
  2022-11-21  8:53 ` [PATCH] " Adrian Hunter
  0 siblings, 2 replies; 5+ messages in thread
From: Sebastian Falbesoner @ 2022-11-19  3:04 UTC (permalink / raw)
  To: Adrian Hunter, Haibo Chen, Ulf Hansson; +Cc: linux-mmc, Sebastian Falbesoner

With the current logic the "failed to exit halt state" error would be
shown even if any other bit than CQHCI_HALT was set in the CQHCI_CTL
register, since the right hand side is always true. Fix this by using
the correct operator (bit-wise instead of logical AND) to only check for
the halt bit flag, which was obviously intended here.

Signed-off-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 31ea0a2fce35..ffeb5759830f 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1512,7 +1512,7 @@ static void esdhc_cqe_enable(struct mmc_host *mmc)
 	 * system resume back.
 	 */
 	cqhci_writel(cq_host, 0, CQHCI_CTL);
-	if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT)
+	if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
 		dev_err(mmc_dev(host->mmc),
 			"failed to exit halt state when enable CQE\n");
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH] mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check
  2022-11-19  3:04 [PATCH] mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check Sebastian Falbesoner
@ 2022-11-21  2:56 ` Bough Chen
  2022-11-21 10:57   ` [PATCH v2] " Sebastian Falbesoner
  2022-11-21  8:53 ` [PATCH] " Adrian Hunter
  1 sibling, 1 reply; 5+ messages in thread
From: Bough Chen @ 2022-11-21  2:56 UTC (permalink / raw)
  To: Sebastian Falbesoner, Adrian Hunter, Ulf Hansson; +Cc: linux-mmc

> -----Original Message-----
> From: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
> Sent: 2022年11月19日 11:04
> To: Adrian Hunter <adrian.hunter@intel.com>; Bough Chen
> <haibo.chen@nxp.com>; Ulf Hansson <ulf.hansson@linaro.org>
> Cc: linux-mmc@vger.kernel.org; Sebastian Falbesoner
> <sebastian.falbesoner@gmail.com>
> Subject: [PATCH] mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check
> 
> With the current logic the "failed to exit halt state" error would be shown even
> if any other bit than CQHCI_HALT was set in the CQHCI_CTL register, since the
> right hand side is always true. Fix this by using the correct operator (bit-wise
> instead of logical AND) to only check for the halt bit flag, which was obviously
> intended here.
> 
> Signed-off-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>

Thanks for the catch. Please add the fix tag in the commit log, and then I can give my ack.

Best Regards
Haibo chen
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
> b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 31ea0a2fce35..ffeb5759830f 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1512,7 +1512,7 @@ static void esdhc_cqe_enable(struct mmc_host
> *mmc)
>  	 * system resume back.
>  	 */
>  	cqhci_writel(cq_host, 0, CQHCI_CTL);
> -	if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT)
> +	if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
>  		dev_err(mmc_dev(host->mmc),
>  			"failed to exit halt state when enable CQE\n");
> 
> --
> 2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check
  2022-11-19  3:04 [PATCH] mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check Sebastian Falbesoner
  2022-11-21  2:56 ` Bough Chen
@ 2022-11-21  8:53 ` Adrian Hunter
  1 sibling, 0 replies; 5+ messages in thread
From: Adrian Hunter @ 2022-11-21  8:53 UTC (permalink / raw)
  To: Sebastian Falbesoner, Haibo Chen, Ulf Hansson; +Cc: linux-mmc

On 19/11/22 05:04, Sebastian Falbesoner wrote:
> With the current logic the "failed to exit halt state" error would be
> shown even if any other bit than CQHCI_HALT was set in the CQHCI_CTL
> register, since the right hand side is always true. Fix this by using
> the correct operator (bit-wise instead of logical AND) to only check for
> the halt bit flag, which was obviously intended here.
> 
> Signed-off-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>

Fixes: 85236d2be844 ("mmc: sdhci-esdhc-imx: clear the HALT bit when enable CQE")
Acked-by: Adrian Hunter <adrian.hunter@intel.com>


> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 31ea0a2fce35..ffeb5759830f 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1512,7 +1512,7 @@ static void esdhc_cqe_enable(struct mmc_host *mmc)
>  	 * system resume back.
>  	 */
>  	cqhci_writel(cq_host, 0, CQHCI_CTL);
> -	if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT)
> +	if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
>  		dev_err(mmc_dev(host->mmc),
>  			"failed to exit halt state when enable CQE\n");
>  


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check
  2022-11-21  2:56 ` Bough Chen
@ 2022-11-21 10:57   ` Sebastian Falbesoner
  2022-11-21 20:29     ` Ulf Hansson
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Falbesoner @ 2022-11-21 10:57 UTC (permalink / raw)
  To: Adrian Hunter, Haibo Chen, Ulf Hansson; +Cc: linux-mmc, Sebastian Falbesoner

With the current logic the "failed to exit halt state" error would be
shown even if any other bit than CQHCI_HALT was set in the CQHCI_CTL
register, since the right hand side is always true. Fix this by using
the correct operator (bit-wise instead of logical AND) to only check for
the halt bit flag, which was obviously intended here.

Fixes: 85236d2be844 ("mmc: sdhci-esdhc-imx: clear the HALT bit when enable CQE")
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
---
Changes in v2:
- added fix tag and ack from Adrian Hunter

 drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 31ea0a2fce35..ffeb5759830f 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1512,7 +1512,7 @@ static void esdhc_cqe_enable(struct mmc_host *mmc)
 	 * system resume back.
 	 */
 	cqhci_writel(cq_host, 0, CQHCI_CTL);
-	if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT)
+	if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
 		dev_err(mmc_dev(host->mmc),
 			"failed to exit halt state when enable CQE\n");
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check
  2022-11-21 10:57   ` [PATCH v2] " Sebastian Falbesoner
@ 2022-11-21 20:29     ` Ulf Hansson
  0 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2022-11-21 20:29 UTC (permalink / raw)
  To: Sebastian Falbesoner; +Cc: Adrian Hunter, Haibo Chen, linux-mmc

On Mon, 21 Nov 2022 at 11:57, Sebastian Falbesoner
<sebastian.falbesoner@gmail.com> wrote:
>
> With the current logic the "failed to exit halt state" error would be
> shown even if any other bit than CQHCI_HALT was set in the CQHCI_CTL
> register, since the right hand side is always true. Fix this by using
> the correct operator (bit-wise instead of logical AND) to only check for
> the halt bit flag, which was obviously intended here.
>
> Fixes: 85236d2be844 ("mmc: sdhci-esdhc-imx: clear the HALT bit when enable CQE")
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> Signed-off-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>

Applied for fixes, by adding Haibo's ack and a stable tag, thanks!

Kind regards
Uffe


> ---
> Changes in v2:
> - added fix tag and ack from Adrian Hunter
>
>  drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 31ea0a2fce35..ffeb5759830f 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1512,7 +1512,7 @@ static void esdhc_cqe_enable(struct mmc_host *mmc)
>          * system resume back.
>          */
>         cqhci_writel(cq_host, 0, CQHCI_CTL);
> -       if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT)
> +       if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
>                 dev_err(mmc_dev(host->mmc),
>                         "failed to exit halt state when enable CQE\n");
>
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-21 20:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-19  3:04 [PATCH] mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check Sebastian Falbesoner
2022-11-21  2:56 ` Bough Chen
2022-11-21 10:57   ` [PATCH v2] " Sebastian Falbesoner
2022-11-21 20:29     ` Ulf Hansson
2022-11-21  8:53 ` [PATCH] " Adrian Hunter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.