dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Vinod Koul <vkoul@kernel.org>, <dmaengine@vger.kernel.org>,
	Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH v1 1/4] dmaengine: Refactor dmaengine_check_align() to be bit operations only
Date: Wed, 26 Feb 2020 14:35:51 +0200	[thread overview]
Message-ID: <c853b1fc-de60-faae-d2f9-290c52e65e39@ti.com> (raw)
In-Reply-To: <20200226101842.29426-1-andriy.shevchenko@linux.intel.com>



On 2/26/20 12:18 PM, Andy Shevchenko wrote:
> There is no need to have branch and temporary variable in the function.
> Simple convert it to be a set of bit and arithmetic operations.

Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  include/linux/dmaengine.h | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index 64461fc64e1b..9f3f5582816a 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -1155,14 +1155,7 @@ static inline dma_cookie_t dmaengine_submit(struct dma_async_tx_descriptor *desc
>  static inline bool dmaengine_check_align(enum dmaengine_alignment align,
>  					 size_t off1, size_t off2, size_t len)
>  {
> -	size_t mask;
> -
> -	if (!align)
> -		return true;
> -	mask = (1 << align) - 1;
> -	if (mask & (off1 | off2 | len))
> -		return false;
> -	return true;
> +	return !(((1 << align) - 1) & (off1 | off2 | len));
>  }
>  
>  static inline bool is_dma_copy_aligned(struct dma_device *dev, size_t off1,
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

  parent reply	other threads:[~2020-02-26 12:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 10:18 [PATCH v1 1/4] dmaengine: Refactor dmaengine_check_align() to be bit operations only Andy Shevchenko
2020-02-26 10:18 ` [PATCH v1 2/4] dmaengine: Use negative condition for better readability Andy Shevchenko
2020-02-26 12:36   ` Peter Ujfalusi
2020-02-26 10:18 ` [PATCH v1 3/4] dmaengine: Drop redundant 'else' keyword Andy Shevchenko
2020-02-26 12:37   ` Peter Ujfalusi
2020-02-26 13:44     ` Andy Shevchenko
2020-02-26 10:18 ` [PATCH v1 4/4] dmaengine: consistently return string literal from switch-case Andy Shevchenko
2020-02-26 12:35   ` Peter Ujfalusi
2020-02-26 12:35 ` Peter Ujfalusi [this message]
2020-03-02  7:18 ` [PATCH v1 1/4] dmaengine: Refactor dmaengine_check_align() to be bit operations only 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=c853b1fc-de60-faae-d2f9-290c52e65e39@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=vkoul@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).