mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Jonas Jensen <jonas.jensen@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, arm@kernel.org,
	vinod.koul@intel.com, djbw@fb.com, arnd@arndb.de
Subject: Re: [PATCH v6] dmaengine: Add MOXA ART DMA engine driver
Date: Fri, 2 Aug 2013 14:51:01 +0100	[thread overview]
Message-ID: <20130802135101.GQ23006@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1375450125-29767-1-git-send-email-jonas.jensen@gmail.com>

On Fri, Aug 02, 2013 at 03:28:45PM +0200, Jonas Jensen wrote:
> +struct moxart_dma_chan {
> +	struct dma_chan			chan;
> +	int				ch_num;
> +	bool				allocated;
> +	int				error_flag;
> +	struct moxart_dma_reg		*reg;
> +	void				(*callback)(void *param);
> +	void				*callback_param;
> +	struct completion		dma_complete;

Is this completion used anywhere?

> +	struct dma_slave_config		cfg;
> +	struct dma_async_tx_descriptor	tx_desc;
> +	unsigned int			line;
> +};
...
> +static dma_cookie_t moxart_tx_submit(struct dma_async_tx_descriptor *tx)
> +{
> +	struct moxart_dma_chan *mchan = to_moxart_dma_chan(tx->chan);
> +	struct moxart_dma_container *mc = to_dma_container(mchan->chan.device);
> +	dma_cookie_t cookie;
> +	u32 ctrl;
> +	unsigned long flags;
> +
> +	mchan->callback = tx->callback;
> +	mchan->callback_param = tx->callback_param;

As 'mchan' contains the tx descriptor, I don't know why you feel that you
need to copy these.

> +static irqreturn_t moxart_dma_interrupt(int irq, void *devid)
> +{
> +	struct moxart_dma_container *mc = to_dma_container(devid);
> +	struct moxart_dma_chan *mchan = &mc->slave_chans[0];
> +	unsigned int i;
> +	u32 ctrl;
> +
> +	pr_debug("%s\n", __func__);
> +
> +	for (i = 0; i < APB_DMA_MAX_CHANNEL; i++, mchan++) {
> +		if (mchan->allocated) {
> +			ctrl = readl(&mchan->reg->ctrl);
> +			if (ctrl & APB_DMA_FIN_INT_STS) {
> +				ctrl &= ~APB_DMA_FIN_INT_STS;
> +				dma_cookie_complete(&mchan->tx_desc);
> +			}
> +			if (ctrl & APB_DMA_ERR_INT_STS) {
> +				ctrl &= ~APB_DMA_ERR_INT_STS;
> +				mchan->error_flag = 1;
> +			}
> +			if (mchan->callback) {
> +				pr_debug("%s: call callback for mchan=%p\n",
> +					 __func__, mchan);
> +				mchan->callback(mchan->callback_param);

Calling the callback from interrupt context is not on.

2/ Specify a completion callback.  The callback routine runs in tasklet
   context if the offload engine driver supports interrupts, or it is
   called in application context if the operation is carried out
   synchronously in software.

That can be found in Documentation/crypto/async-tx-api.txt and applies
to all DMA engine implementations (which is the underlying implementation
of the async-tx API.)

  reply	other threads:[~2013-08-02 13:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  8:51 [PATCH] " Jonas Jensen
2013-07-10  9:30 ` Russell King - ARM Linux
2013-07-10  9:48   ` Jonas Jensen
2013-07-10 12:43 ` [PATCH v2] " Jonas Jensen
2013-07-17 10:06   ` [PATCH v3] " Jonas Jensen
2013-07-29 13:44     ` [PATCH v4] " Jonas Jensen
2013-07-29 16:35       ` Arnd Bergmann
2013-08-02 12:28         ` Jonas Jensen
2013-08-02 19:28           ` Arnd Bergmann
2013-08-02 12:03       ` [PATCH v5] " Jonas Jensen
2013-08-02 13:28         ` [PATCH v6] " Jonas Jensen
2013-08-02 13:51           ` Russell King - ARM Linux [this message]
2013-08-02 14:09           ` Mark Rutland
2013-08-05 14:37           ` [PATCH v7] " Jonas Jensen
2013-08-05 16:57             ` Mark Rutland
2013-08-05 20:49             ` Arnd Bergmann
2013-08-06 12:38             ` [PATCH v8] " Jonas Jensen
2013-08-06 18:42               ` Arnd Bergmann
2013-08-07 15:13               ` Mark Rutland
2013-10-07 13:42                 ` Jonas Jensen
2013-10-07 13:13               ` [PATCH v9] " Jonas Jensen
2013-10-07 14:10                 ` [PATCH v10] " Jonas Jensen
2013-10-07 15:12                   ` Mark Rutland
2013-10-08  9:53                     ` Jonas Jensen
2013-10-08 12:55                       ` Mark Rutland
2013-10-08  8:42                   ` [PATCH v11] " Jonas Jensen
2013-11-13 13:59                     ` Vinod Koul
2013-11-13 17:16                       ` Arnd Bergmann
2013-12-06 14:27                     ` [PATCH v12] " Jonas Jensen
2013-12-11 15:13                       ` [PATCH v13] " Jonas Jensen
2013-12-11 21:27                         ` Arnd Bergmann
2013-12-12  9:16                         ` Andy Shevchenko
2013-12-12 12:32                         ` [PATCH v14] " Jonas Jensen
2013-12-13 16:02                           ` Lars-Peter Clausen
2013-12-16 10:24                           ` [PATCH v15] " Jonas Jensen
2014-01-17  8:46                             ` [PATCH v16] " Jonas Jensen
2014-01-17 14:42                               ` Arnd Bergmann
2014-01-20  7:07                               ` Vinod Koul

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=20130802135101.GQ23006@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=arm@kernel.org \
    --cc=arnd@arndb.de \
    --cc=djbw@fb.com \
    --cc=jonas.jensen@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vinod.koul@intel.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

all inboxes | Powered by JetHome®