From: Simon Horman <horms@verge.net.au>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Magnus Damm <magnus.damm@gmail.com>,
Linux MMC List <linux-mmc@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH/RFC 2/5] mmc: tmio: add complete to DMA ops
Date: Fri, 16 Jun 2017 09:13:55 +0200 [thread overview]
Message-ID: <20170616071354.GE16534@verge.net.au> (raw)
In-Reply-To: <CAMuHMdVpE+2QK2WbfyDCCUq1fzHqnuyAKsGgzj+ZonOwc96w3A@mail.gmail.com>
On Fri, Jun 16, 2017 at 09:09:31AM +0200, Geert Uytterhoeven wrote:
> Hi Simon,
>
> On Fri, Jun 16, 2017 at 9:04 AM, Simon Horman <horms@verge.net.au> wrote:
> > On Fri, Jun 16, 2017 at 08:25:12AM +0200, Geert Uytterhoeven wrote:
> >> On Fri, Jun 16, 2017 at 8:06 AM, Simon Horman <horms@verge.net.au> wrote:
> >> > On Fri, Jun 09, 2017 at 09:35:20AM +0200, Geert Uytterhoeven wrote:
> >> >> On Thu, Jun 8, 2017 at 3:09 PM, Simon Horman <horms+renesas@verge.net.au> wrote:
> >> >> > Add complete to DMA ops to allow DMAC implementation dependent
> >> >> > handling of DMA completion.
> >> >> >
> >> >> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> >> >> > ---
> >> >> > drivers/mmc/host/tmio_mmc.h | 1 +
> >> >> > drivers/mmc/host/tmio_mmc_core.c | 10 ++++++++--
> >> >> > 2 files changed, 9 insertions(+), 2 deletions(-)
> >> >> >
> >> >> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> >> >> > index 9c94b6eb9b49..82725f9de359 100644
> >> >> > --- a/drivers/mmc/host/tmio_mmc.h
> >> >> > +++ b/drivers/mmc/host/tmio_mmc.h
> >> >> > @@ -121,6 +121,7 @@ struct tmio_mmc_dma_ops {
> >> >> > struct tmio_mmc_data *pdata);
> >> >> > void (*release)(struct tmio_mmc_host *host);
> >> >> > void (*abort)(struct tmio_mmc_host *host);
> >> >> > + void (*complete)(struct tmio_mmc_host *host);
> >> >> > };
> >> >> >
> >> >> > struct tmio_mmc_host {
> >> >> > diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> >> >> > index 0e76e099dc7f..26fe9bb64849 100644
> >> >> > --- a/drivers/mmc/host/tmio_mmc_core.c
> >> >> > +++ b/drivers/mmc/host/tmio_mmc_core.c
> >> >> > @@ -86,6 +86,12 @@ static inline void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
> >> >> > host->dma_ops->abort(host);
> >> >> > }
> >> >> >
> >> >> > +static inline void tmio_mmc_complete_dma(struct tmio_mmc_host *host)
> >> >> > +{
> >> >> > + if (host->dma_ops)
> >> >> > + host->dma_ops->complete(host);
> >> >>
> >> >> I believe this will cause a crash and thus break bisection, as no driver
> >> >> fills in the complete pointer yet.
> >> >
> >> > Indeed. And it seems to cause a panic on non-Gen3 users of the driver.
> >> >
> >> > I think the fix should be:
> >> >
> >> > diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> >> > index 26fe9bb64849..9ec2e933b6f0 100644
> >> > --- a/drivers/mmc/host/tmio_mmc_core.c
> >> > +++ b/drivers/mmc/host/tmio_mmc_core.c
> >> > @@ -88,7 +88,7 @@ static inline void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
> >> >
> >> > static inline void tmio_mmc_complete_dma(struct tmio_mmc_host *host)
> >> > {
> >> > - if (host->dma_ops)
> >> > + if (host->dma_ops && host->dma_ops->complete)
> >> > host->dma_ops->complete(host);
> >> > }
> >>
> >> Is it? Now nothing will be completed?
> >>
> >> The old code did:
> >>
> >> complete(&host->dma_dataend);
> >>
> >> so perhaps
> >>
> >> else
> >> complete(&host->dma_dataend);
> >>
> >> with the "else" branch to be deleted when all drivers that need it provide
> >> their own complete callback?
> >
> > Thanks, I see that is still a problem.
> >
> > As there is only one other driver and its closerly related
> > perhaps it could just implement the callback in this patch?
>
> Yes, that sounds good to me.
> Else you need 3 patches:
> 1. Introduced .complete field,
> 2. Update driver to provide .complete handledr,
> 3. Update generic code.
Yes, and 3 patch seems a bit excessive in this case.
Sorry for letting this bug creep in to renesas-drivers.
Do you want a patch against your tree? I will plan to post v2 of
this patchset soon in any case.
next prev parent reply other threads:[~2017-06-16 7:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 13:09 [PATCH/RFC 0/5] mmc: renesas_sdhi: add support for R-Car Gen3 SDHI DMAC Simon Horman
2017-06-08 13:09 ` [PATCH/RFC 1/5] mmc: tmio: add max_segs and max_blk_count in tmio_mmc_data Simon Horman
2017-06-08 13:09 ` [PATCH/RFC 2/5] mmc: sh_mobile_sdhi: set max_segs and max_blk_count values R-Car Gen3 Simon Horman
2017-06-08 13:09 ` [PATCH/RFC 2/5] mmc: tmio: add complete to DMA ops Simon Horman
2017-06-09 7:35 ` Geert Uytterhoeven
2017-06-16 6:06 ` Simon Horman
2017-06-16 6:25 ` Geert Uytterhoeven
2017-06-16 7:04 ` Simon Horman
2017-06-16 7:09 ` Geert Uytterhoeven
2017-06-16 7:13 ` Simon Horman [this message]
2017-06-16 7:23 ` Geert Uytterhoeven
2017-06-16 7:33 ` Simon Horman
2017-06-16 10:03 ` Simon Horman
2017-06-16 10:09 ` Geert Uytterhoeven
2017-06-08 13:09 ` [PATCH/RFC 3/5] mmc: sh_mobile_sdhi: add some SoC specific data for R-Car Gen3 Simon Horman
2017-06-09 7:34 ` Geert Uytterhoeven
2017-06-16 7:55 ` Simon Horman
2017-06-08 13:09 ` [PATCH/RFC 3/5] mmc: tmio: add complete to DMA ops Simon Horman
2017-06-08 13:09 ` [PATCH/RFC 4/5] mmc: renesas_sdhi: add support for R-Car Gen3 SDHI DMAC Simon Horman
2017-06-08 13:09 ` [PATCH/RFC 5/5] mmc: renesas-sdhi: remove gen3 support from sysc dmac driver Simon Horman
2017-06-09 7:40 ` Geert Uytterhoeven
2017-06-09 8:40 ` Magnus Damm
2017-06-16 7:01 ` Simon Horman
2017-06-08 13:11 ` [PATCH/RFC 0/5] mmc: renesas_sdhi: add support for R-Car Gen3 SDHI DMAC Simon Horman
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=20170616071354.GE16534@verge.net.au \
--to=horms@verge.net.au \
--cc=geert@linux-m68k.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=ulf.hansson@linaro.org \
--cc=wsa+renesas@sang-engineering.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