From: "Seunghwan Baek" <sh8267.baek@samsung.com>
To: "'Adrian Hunter'" <adrian.hunter@intel.com>,
<linux-kernel@vger.kernel.org>, <linux-mmc@vger.kernel.org>,
<ulf.hansson@linaro.org>, <ritesh.list@gmail.com>,
<quic_asutoshd@quicinc.com>
Cc: <grant.jung@samsung.com>, <jt77.jang@samsung.com>,
<junwoo80.lee@samsung.com>, <dh0421.hwang@samsung.com>,
<jangsub.yi@samsung.com>, <sh043.lee@samsung.com>,
<cw9316.lee@samsung.com>, <wkon.kim@samsung.com>,
<stable@vger.kernel.org>
Subject: RE: [PATCH 2/2] mmc : fix for check cqe halt.
Date: Tue, 27 Aug 2024 10:42:55 +0900 [thread overview]
Message-ID: <000001daf822$70840e10$518c2a30$@samsung.com> (raw)
In-Reply-To: <7164bfde-3c43-495f-8e1f-83b998ff17e2@intel.com>
> The subject starts with "[Patch 2/2]" but is there another patch?
> Did you mean "[Patch v2] ..."?
>
> > To check if mmc cqe is in halt state, need to check set/clear of
> > CQHCI_HALT bit. At this time, we need to check with &, not &&.
> > Therefore, code to> check whether cqe is in halt state is modified to
> cqhci_halted, which has already been implemented.
>
> Doesn't compile:
>
> drivers/mmc/host/cqhci-core.c: In function ‘__cqhci_enable’:
> drivers/mmc/host/cqhci-core.c:285:13: error: implicit declaration of
> function ‘cqhci_halted’; did you mean ‘cqhci_writel’? [-Werror=implicit-
> function-declaration]
> 285 | if (cqhci_halted(cq_host))
> | ^~~~~~~~~~~~
> | cqhci_writel
> drivers/mmc/host/cqhci-core.c: At top level:
> drivers/mmc/host/cqhci-core.c:956:13: error: conflicting types for
> ‘cqhci_halted’; have ‘bool(struct cqhci_host *)’ {aka ‘_Bool(struct
> cqhci_host *)’}
> 956 | static bool cqhci_halted(struct cqhci_host *cq_host)
> | ^~~~~~~~~~~~
> drivers/mmc/host/cqhci-core.c:285:13: note: previous implicit declaration
> of ‘cqhci_halted’ with type ‘int()’
> 285 | if (cqhci_halted(cq_host))
> | ^~~~~~~~~~~~
> cc1: all warnings being treated as errors
>
> Not only should it compile, but you must test it!
>
> Probably better to make 2 patches:
> 1. Just the fix, cc stable i.e.
>
> diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
> index c14d7251d0bb..a02da26a1efd 100644
> --- a/drivers/mmc/host/cqhci-core.c
> +++ b/drivers/mmc/host/cqhci-core.c
> @@ -617,7 +617,7 @@ static int cqhci_request(struct mmc_host *mmc, struct
> mmc_request *mrq)
> cqhci_writel(cq_host, 0, CQHCI_CTL);
> mmc->cqe_on = true;
> pr_debug("%s: cqhci: CQE on\n", mmc_hostname(mmc));
> - if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT) {
> + if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT) {
> pr_err("%s: cqhci: CQE failed to exit halt state\n",
> mmc_hostname(mmc));
> }
>
> 2. Tidy up, no cc stable
>
> diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
> index a02da26a1efd..178277d90c31 100644
> --- a/drivers/mmc/host/cqhci-core.c
> +++ b/drivers/mmc/host/cqhci-core.c
> @@ -33,6 +33,11 @@ struct cqhci_slot {
> #define CQHCI_HOST_OTHER BIT(4)
> };
>
> +static bool cqhci_halted(struct cqhci_host *cq_host) {
> + return cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT; }
> +
> static inline u8 *get_desc(struct cqhci_host *cq_host, u8 tag) {
> return cq_host->desc_base + (tag * cq_host->slot_sz); @@ -282,7
> +287,7 @@ static void __cqhci_enable(struct cqhci_host *cq_host)
>
> cqhci_writel(cq_host, cqcfg, CQHCI_CFG);
>
> - if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
> + if (cqhci_halted(cq_host))
> cqhci_writel(cq_host, 0, CQHCI_CTL);
>
> mmc->cqe_on = true;
> @@ -617,7 +622,7 @@ static int cqhci_request(struct mmc_host *mmc, struct
> mmc_request *mrq)
> cqhci_writel(cq_host, 0, CQHCI_CTL);
> mmc->cqe_on = true;
> pr_debug("%s: cqhci: CQE on\n", mmc_hostname(mmc));
> - if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT) {
> + if (cqhci_halted(cq_host)) {
> pr_err("%s: cqhci: CQE failed to exit halt state\n",
> mmc_hostname(mmc));
> }
> @@ -953,11 +958,6 @@ static bool cqhci_clear_all_tasks(struct mmc_host
> *mmc, unsigned int timeout)
> return ret;
> }
>
> -static bool cqhci_halted(struct cqhci_host *cq_host) -{
> - return cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT;
> -}
> -
> static bool cqhci_halt(struct mmc_host *mmc, unsigned int timeout) {
> struct cqhci_host *cq_host = mmc->cqe_private;
>
>
>
> >
> > Fixes: 0653300224a6 ("mmc: cqhci: rename cqhci.c to cqhci-core.c")
>
> Fixes tag should be the commit that introduced the code, not one that
> moved it. In this case, it has been there since the beginning:
>
> Fixes: a4080225f51d ("mmc: cqhci: support for command queue enabled host")
>
> Looks like the offending code kinda worked which explains why it wasn't
> noticed sooner.
>
Sorry for my mistake.
I will make the patch again as you advised.
Thank you for your help.
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Seunghwan Baek <sh8267.baek@samsung.com>
> > ---
> > drivers/mmc/host/cqhci-core.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mmc/host/cqhci-core.c
> > b/drivers/mmc/host/cqhci-core.c index c14d7251d0bb..3d5bcb92c78e
> > 100644
> > --- a/drivers/mmc/host/cqhci-core.c
> > +++ b/drivers/mmc/host/cqhci-core.c
> > @@ -282,7 +282,7 @@ static void __cqhci_enable(struct cqhci_host
> > *cq_host)
> >
> > cqhci_writel(cq_host, cqcfg, CQHCI_CFG);
> >
> > - if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
> > + if (cqhci_halted(cq_host))
> > cqhci_writel(cq_host, 0, CQHCI_CTL);
> >
> > mmc->cqe_on = true;
> > @@ -617,7 +617,7 @@ static int cqhci_request(struct mmc_host *mmc,
> struct mmc_request *mrq)
> > cqhci_writel(cq_host, 0, CQHCI_CTL);
> > mmc->cqe_on = true;
> > pr_debug("%s: cqhci: CQE on\n", mmc_hostname(mmc));
> > - if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT) {
> > + if (cqhci_halted(cq_host)) {
> > pr_err("%s: cqhci: CQE failed to exit halt state\n",
> > mmc_hostname(mmc));
> > }
next prev parent reply other threads:[~2024-08-27 1:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240826091726epcas1p19797d2dd890feef6f9c4b83e9156341a@epcas1p1.samsung.com>
2024-08-26 9:17 ` [PATCH 2/2] mmc : fix for check cqe halt Seunghwan Baek
2024-08-26 10:16 ` Adrian Hunter
2024-08-27 1:42 ` Seunghwan Baek [this message]
[not found] <CGME20240828060713epcas1p4ff8b4f345747eeb7e581385a62d07879@epcas1p4.samsung.com>
2024-08-28 6:07 ` Seunghwan Baek
2024-08-28 6:32 ` Ritesh Harjani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000001daf822$70840e10$518c2a30$@samsung.com' \
--to=sh8267.baek@samsung.com \
--cc=adrian.hunter@intel.com \
--cc=cw9316.lee@samsung.com \
--cc=dh0421.hwang@samsung.com \
--cc=grant.jung@samsung.com \
--cc=jangsub.yi@samsung.com \
--cc=jt77.jang@samsung.com \
--cc=junwoo80.lee@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=quic_asutoshd@quicinc.com \
--cc=ritesh.list@gmail.com \
--cc=sh043.lee@samsung.com \
--cc=stable@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=wkon.kim@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox