All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: dan.j.williams@intel.com, laurent.pinchart@ideasonboard.com,
	horms@verge.net.au, kuninori.morimoto.gx@renesas.com,
	robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	dmaengine@vger.kernel.org, linux-sh@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/2] dmaengine: usb-dmac: Add Renesas USB DMA Controller (USB-DMAC) driver
Date: Wed, 18 Mar 2015 08:34:15 +0000	[thread overview]
Message-ID: <20150318082215.GF32683@intel.com> (raw)
In-Reply-To: <1426052394-5556-3-git-send-email-yoshihiro.shimoda.uh@renesas.com>

On Wed, Mar 11, 2015 at 02:39:54PM +0900, Yoshihiro Shimoda wrote:
> +static struct dma_async_tx_descriptor *
> +usb_dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
> +		       unsigned int sg_len, enum dma_transfer_direction dir,
> +		       unsigned long dma_flags, void *context)
> +{
> +	struct usb_dmac_chan *uchan = to_usb_dmac_chan(chan);
> +	struct usb_dmac_desc *desc;
> +
> +	/* A client driver will use dmaengine_prep_slave_single() */
> +	if (sg_len != 1) {
and why is that?

> +static enum dma_status usb_dmac_tx_status(struct dma_chan *chan,
> +					  dma_cookie_t cookie,
> +					  struct dma_tx_state *txstate)
> +{
> +	struct usb_dmac_chan *uchan = to_usb_dmac_chan(chan);
> +	enum dma_status status;
> +	unsigned long flags;
> +	unsigned int residue;
> +
> +	status = dma_cookie_status(chan, cookie, txstate);
> +	/* a client driver will get residue after DMA_COMPLETE */
can you explain this comment?

> +	if (!txstate)
> +		return status;
> +
> +	spin_lock_irqsave(&uchan->vc.lock, flags);
> +	residue = uchan->residue;
how is this related to the cookie for which request is made?
> +static void usb_dmac_chan_tasklet(unsigned long data)
> +{
> +	struct usb_dmac_chan *chan = (struct usb_dmac_chan *)data;
> +	struct usb_dmac_desc *desc = chan->desc;
> +
> +	spin_lock_irq(&chan->vc.lock);
> +
> +	/* This driver assumes a transfer finishes if desc is not NULL */
> +	if (desc) {
> +		chan->residue = usb_dmac_chan_get_last_residue(chan, desc);
why should this be for channel and not the descriptor which is completed, so
you overwrite this before user has chance to query ?

Looking at this, so you issue a transaction of 100bytes, will you get
completion even if 100bytes have not been transfered, If so how does dma
decide theat transfer is complete even if 100bytes are not transferred yet?

> +		vchan_cookie_complete(&desc->vd);
> +	}
> +
> +	/* (Re)start the next transfer if this driver has a next desc */
> +	usb_dmac_chan_start_xfer(chan);
why not do this in irq :)


> +#ifdef CONFIG_PM
> +static int usb_dmac_runtime_suspend(struct device *dev)
> +{
> +	struct usb_dmac *dmac = dev_get_drvdata(dev);
> +	int i;
> +
> +	for (i = 0; i < dmac->n_channels; ++i)
> +		usb_dmac_chan_halt(&dmac->channels[i]);
> +
> +	return 0;
> +}
> +
> +static int usb_dmac_runtime_resume(struct device *dev)
> +{
> +	struct usb_dmac *dmac = dev_get_drvdata(dev);
> +
> +	return usb_dmac_init(dmac);
> +}
> +#endif
> +
> +static const struct dev_pm_ops usb_dmac_pm = {
> +	SET_RUNTIME_PM_OPS(usb_dmac_runtime_suspend, usb_dmac_runtime_resume,
since you are using SET_RUNTIME_PM_OPS, you dont need to wrap this with
ifdef CONFIG_PM

> +
> +static void usb_dmac_chan_remove(struct usb_dmac_chan *uchan)
> +{
> +	tasklet_kill(&uchan->task);
that part is good, but how about disabling irq? you can still get insterrupt

-- 
~Vinod


WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vinod.koul@intel.com>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: dan.j.williams@intel.com, laurent.pinchart@ideasonboard.com,
	horms@verge.net.au, kuninori.morimoto.gx@renesas.com,
	robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	dmaengine@vger.kernel.org, linux-sh@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/2] dmaengine: usb-dmac: Add Renesas USB DMA Controller (USB-DMAC) driver
Date: Wed, 18 Mar 2015 13:52:15 +0530	[thread overview]
Message-ID: <20150318082215.GF32683@intel.com> (raw)
In-Reply-To: <1426052394-5556-3-git-send-email-yoshihiro.shimoda.uh@renesas.com>

On Wed, Mar 11, 2015 at 02:39:54PM +0900, Yoshihiro Shimoda wrote:
> +static struct dma_async_tx_descriptor *
> +usb_dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
> +		       unsigned int sg_len, enum dma_transfer_direction dir,
> +		       unsigned long dma_flags, void *context)
> +{
> +	struct usb_dmac_chan *uchan = to_usb_dmac_chan(chan);
> +	struct usb_dmac_desc *desc;
> +
> +	/* A client driver will use dmaengine_prep_slave_single() */
> +	if (sg_len != 1) {
and why is that?

> +static enum dma_status usb_dmac_tx_status(struct dma_chan *chan,
> +					  dma_cookie_t cookie,
> +					  struct dma_tx_state *txstate)
> +{
> +	struct usb_dmac_chan *uchan = to_usb_dmac_chan(chan);
> +	enum dma_status status;
> +	unsigned long flags;
> +	unsigned int residue;
> +
> +	status = dma_cookie_status(chan, cookie, txstate);
> +	/* a client driver will get residue after DMA_COMPLETE */
can you explain this comment?

> +	if (!txstate)
> +		return status;
> +
> +	spin_lock_irqsave(&uchan->vc.lock, flags);
> +	residue = uchan->residue;
how is this related to the cookie for which request is made?
> +static void usb_dmac_chan_tasklet(unsigned long data)
> +{
> +	struct usb_dmac_chan *chan = (struct usb_dmac_chan *)data;
> +	struct usb_dmac_desc *desc = chan->desc;
> +
> +	spin_lock_irq(&chan->vc.lock);
> +
> +	/* This driver assumes a transfer finishes if desc is not NULL */
> +	if (desc) {
> +		chan->residue = usb_dmac_chan_get_last_residue(chan, desc);
why should this be for channel and not the descriptor which is completed, so
you overwrite this before user has chance to query ?

Looking at this, so you issue a transaction of 100bytes, will you get
completion even if 100bytes have not been transfered, If so how does dma
decide theat transfer is complete even if 100bytes are not transferred yet?

> +		vchan_cookie_complete(&desc->vd);
> +	}
> +
> +	/* (Re)start the next transfer if this driver has a next desc */
> +	usb_dmac_chan_start_xfer(chan);
why not do this in irq :)


> +#ifdef CONFIG_PM
> +static int usb_dmac_runtime_suspend(struct device *dev)
> +{
> +	struct usb_dmac *dmac = dev_get_drvdata(dev);
> +	int i;
> +
> +	for (i = 0; i < dmac->n_channels; ++i)
> +		usb_dmac_chan_halt(&dmac->channels[i]);
> +
> +	return 0;
> +}
> +
> +static int usb_dmac_runtime_resume(struct device *dev)
> +{
> +	struct usb_dmac *dmac = dev_get_drvdata(dev);
> +
> +	return usb_dmac_init(dmac);
> +}
> +#endif
> +
> +static const struct dev_pm_ops usb_dmac_pm = {
> +	SET_RUNTIME_PM_OPS(usb_dmac_runtime_suspend, usb_dmac_runtime_resume,
since you are using SET_RUNTIME_PM_OPS, you dont need to wrap this with
ifdef CONFIG_PM

> +
> +static void usb_dmac_chan_remove(struct usb_dmac_chan *uchan)
> +{
> +	tasklet_kill(&uchan->task);
that part is good, but how about disabling irq? you can still get insterrupt

-- 
~Vinod


  reply	other threads:[~2015-03-18  8:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11  5:39 [PATCH v2 0/2] dmaengine: usb-dmac: Add Renesas USB DMA Controller Yoshihiro Shimoda
2015-03-11  5:39 ` Yoshihiro Shimoda
2015-03-11  5:39 ` [PATCH v2 1/2] dmaengine: renesas,usb-dmac: Add device tree bindings documentation Yoshihiro Shimoda
2015-03-11  5:39   ` Yoshihiro Shimoda
2015-03-11  5:39 ` [PATCH v2 2/2] dmaengine: usb-dmac: Add Renesas USB DMA Controller (USB-DMAC) driver Yoshihiro Shimoda
2015-03-11  5:39   ` Yoshihiro Shimoda
2015-03-18  8:22   ` Vinod Koul [this message]
2015-03-18  8:34     ` Vinod Koul
2015-03-19  8:12     ` yoshihiro shimoda
2015-03-19  8:12       ` yoshihiro shimoda
     [not found]       ` <SIXPR06MB33355F6F0532539A23ED8A9D8010-ptTgG45MbEnBsD+8QL/kzr9PrO6axcR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2015-03-19  9:59         ` Vinod Koul
2015-03-19 10:11           ` Vinod Koul
2015-03-23  2:32           ` yoshihiro shimoda
2015-03-23  2:32             ` yoshihiro shimoda
2015-04-01  3:43             ` Vinod Koul
2015-04-01  3:55               ` Vinod Koul
2015-04-01  4:09               ` Yoshihiro Shimoda
2015-04-01  4:09                 ` Yoshihiro Shimoda

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=20150318082215.GF32683@intel.com \
    --to=vinod.koul@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=horms@verge.net.au \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-sh@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.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 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.