All of lore.kernel.org
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] dmaengine: at_hdmac: add cyclic DMA operation support
Date: Wed, 06 Apr 2011 17:45:33 +0200	[thread overview]
Message-ID: <4D9C8A9D.9070008@atmel.com> (raw)
In-Reply-To: <1302098555.27103.10.camel@vkoul-udesk3>

Le 06/04/2011 16:02, Koul, Vinod :
> On Wed, 2011-04-06 at 14:50 +0200, Nicolas Ferre wrote:
>> Le 06/04/2011 12:08, Koul, Vinod :
>>> On Fri, 2011-04-01 at 19:19 +0200, Nicolas Ferre wrote:
>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>>>> ---
>>>>  drivers/dma/at_hdmac.c      |  188 +++++++++++++++++++++++++++++++++++++++---
>>>>  drivers/dma/at_hdmac_regs.h |   14 +++-
>>>>  2 files changed, 186 insertions(+), 16 deletions(-)
>>>>
>>>> +static void atc_handle_cyclic(struct at_dma_chan *atchan)
>>>> +{
>>>> +	struct at_desc			*first = atc_first_active(atchan);
>>>> +	struct dma_async_tx_descriptor	*txd = &first->txd;
>>>> +	dma_async_tx_callback		callback = txd->callback;
>>>> +	void				*param = txd->callback_param;
>>>> +
>>>> +	dev_vdbg(chan2dev(&atchan->chan_common),
>>>> +			"new cyclic period llp 0x%08x\n",
>>>> +			channel_readl(atchan, DSCR));
>>>> +
>>>> +	if (callback)
>>>> +		callback(param);
>>>> +}
>>> You dont seem to be doing much expect calling callback, so doesn't it
>>> make sense to write so much code for just calling callback? 
>>
>> I do not totally follow you here: you mean that I should reduce the
>> amount of variables in this function or is it a more global comment
>> about my way of handling cyclic operations?
> Well, in handling of cyclic operation you are only calling the callback
> if set. If you plan to add more functionality to this function in future
> then okay, otherwise you may reconsider this and avoid the function as
> you are not doing much here, if it reduces code size. This is okay this
> way also.
> I had no comment on variables as I understand first two are unavoidable

As far as code size and execution path is concerned, this function is
expanded by the compiler as an inline one and I checked that it only
takes a few lines of assembly (without function call) if the debug trace
is not requested (~7 lines into atc_tasklet() with one call to
atc_first_active() which is needed anyway).

I would prefer to keep this simple "pseudo-inline" function just for a
matter of code clarity.

Best regards,
-- 
Nicolas Ferre

WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: "Koul, Vinod" <vinod.koul@intel.com>
Cc: dan.j.williams@intel.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] dmaengine: at_hdmac: add cyclic DMA operation support
Date: Wed, 06 Apr 2011 17:45:33 +0200	[thread overview]
Message-ID: <4D9C8A9D.9070008@atmel.com> (raw)
In-Reply-To: <1302098555.27103.10.camel@vkoul-udesk3>

Le 06/04/2011 16:02, Koul, Vinod :
> On Wed, 2011-04-06 at 14:50 +0200, Nicolas Ferre wrote:
>> Le 06/04/2011 12:08, Koul, Vinod :
>>> On Fri, 2011-04-01 at 19:19 +0200, Nicolas Ferre wrote:
>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>>>> ---
>>>>  drivers/dma/at_hdmac.c      |  188 +++++++++++++++++++++++++++++++++++++++---
>>>>  drivers/dma/at_hdmac_regs.h |   14 +++-
>>>>  2 files changed, 186 insertions(+), 16 deletions(-)
>>>>
>>>> +static void atc_handle_cyclic(struct at_dma_chan *atchan)
>>>> +{
>>>> +	struct at_desc			*first = atc_first_active(atchan);
>>>> +	struct dma_async_tx_descriptor	*txd = &first->txd;
>>>> +	dma_async_tx_callback		callback = txd->callback;
>>>> +	void				*param = txd->callback_param;
>>>> +
>>>> +	dev_vdbg(chan2dev(&atchan->chan_common),
>>>> +			"new cyclic period llp 0x%08x\n",
>>>> +			channel_readl(atchan, DSCR));
>>>> +
>>>> +	if (callback)
>>>> +		callback(param);
>>>> +}
>>> You dont seem to be doing much expect calling callback, so doesn't it
>>> make sense to write so much code for just calling callback? 
>>
>> I do not totally follow you here: you mean that I should reduce the
>> amount of variables in this function or is it a more global comment
>> about my way of handling cyclic operations?
> Well, in handling of cyclic operation you are only calling the callback
> if set. If you plan to add more functionality to this function in future
> then okay, otherwise you may reconsider this and avoid the function as
> you are not doing much here, if it reduces code size. This is okay this
> way also.
> I had no comment on variables as I understand first two are unavoidable

As far as code size and execution path is concerned, this function is
expanded by the compiler as an inline one and I checked that it only
takes a few lines of assembly (without function call) if the debug trace
is not requested (~7 lines into atc_tasklet() with one call to
atc_first_active() which is needed anyway).

I would prefer to keep this simple "pseudo-inline" function just for a
matter of code clarity.

Best regards,
-- 
Nicolas Ferre


  reply	other threads:[~2011-04-06 15:45 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01 17:19 [PATCH 1/5] dmaengine: at_hdmac: modify way to use interrupts Nicolas Ferre
2011-04-01 17:19 ` Nicolas Ferre
2011-04-01 17:19 ` [PATCH 2/5] dmaengine: at_hdmac: add cyclic DMA operation support Nicolas Ferre
2011-04-01 17:19   ` Nicolas Ferre
2011-04-06 10:08   ` Koul, Vinod
2011-04-06 10:08     ` Koul, Vinod
2011-04-06 12:50     ` Nicolas Ferre
2011-04-06 12:50       ` Nicolas Ferre
2011-04-06 14:02       ` Koul, Vinod
2011-04-06 14:02         ` Koul, Vinod
2011-04-06 15:45         ` Nicolas Ferre [this message]
2011-04-06 15:45           ` Nicolas Ferre
2011-04-01 17:19 ` [PATCH 3/5] dmaengine: at_hdmac: debug information sg_len for prep_slave_sg Nicolas Ferre
2011-04-01 17:19   ` Nicolas Ferre
2011-04-01 17:19 ` [PATCH 4/5] dmaengine: at_hdmac: remove channel status testing in tasklet Nicolas Ferre
2011-04-01 17:19   ` Nicolas Ferre
2011-04-01 17:19 ` [PATCH 5/5] dmaengine: at_hdmac: specialize AHB interfaces to optimize transfers Nicolas Ferre
2011-04-01 17:19   ` Nicolas Ferre
2011-04-22 17:41 ` [PATCH v2 1/5] dmaengine: at_hdmac: modify way to use interrupts Nicolas Ferre
2011-04-22 17:41   ` Nicolas Ferre
2011-04-26  4:02   ` Koul, Vinod
2011-04-26  4:02     ` Koul, Vinod
2011-04-26  4:06     ` Koul, Vinod
2011-04-26  4:06       ` Koul, Vinod
2011-04-26  4:34     ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-26  4:34       ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-26  4:24       ` Koul, Vinod
2011-04-26  4:24         ` Koul, Vinod
2011-04-30 14:57         ` [PATCH v3 " Nicolas Ferre
2011-04-30 14:57           ` [PATCH v3 2/5] dmaengine: at_hdmac: add cyclic DMA operation support Nicolas Ferre
2011-04-30 14:57           ` [PATCH v3 3/5] dmaengine: at_hdmac: debug information sg_len for prep_slave_sg Nicolas Ferre
2011-04-30 14:57           ` [PATCH v3 5/5] dmaengine: at_hdmac: specialize AHB interfaces to optimize transfers Nicolas Ferre
2011-05-02 10:14           ` [PATCH v3 1/5] dmaengine: at_hdmac: modify way to use interrupts Koul, Vinod
2011-05-02 10:14             ` Koul, Vinod
2011-04-30 14:57         ` [PATCH v3 4/5] dmaengine: at_hdmac: remove channel status testing in tasklet Nicolas Ferre
2011-04-30 14:57           ` Nicolas Ferre
2011-04-22 17:41 ` [PATCH v2 2/5] dmaengine: at_hdmac: add cyclic DMA operation support Nicolas Ferre
2011-04-22 17:41   ` Nicolas Ferre
2011-04-22 17:41 ` [PATCH v2 3/5] dmaengine: at_hdmac: debug information sg_len for prep_slave_sg Nicolas Ferre
2011-04-22 17:41   ` Nicolas Ferre
2011-04-22 17:42 ` [PATCH v2 4/5] dmaengine: at_hdmac: remove channel status testing in tasklet Nicolas Ferre
2011-04-22 17:42   ` Nicolas Ferre
2011-04-22 17:42 ` [PATCH v2 5/5] dmaengine: at_hdmac: specialize AHB interfaces to optimize transfers Nicolas Ferre
2011-04-22 17:42   ` Nicolas Ferre

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=4D9C8A9D.9070008@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.