All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Cc: <outreachy-kernel@googlegroups.com>
Subject: Re: [Outreachy kernel] [PATCH v2 4/4] staging: most: hdm-dim2: Use macro DIV_ROUND_UP
Date: Fri, 26 Feb 2016 06:35:06 +0000	[thread overview]
Message-ID: <20160226063505.GA13799@kroah.com> (raw)
In-Reply-To: <20160222122906.GA16722@Karyakshetra>

On Mon, Feb 22, 2016 at 05:59:06PM +0530, Bhaktipriya Shridhar wrote:
> The macro DIV_ROUND_UP performs the computation
> (((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
> This was done using the coccinelle script:
> @@
> expression e1;
> expression e2;
> @@
> (
> - ((e1) + e2 - 1) / (e2)
> + DIV_ROUND_UP(e1,e2)
> |
> - ((e1) + (e2 - 1)) / (e2)
> + DIV_ROUND_UP(e1,e2)
> )
> 
> Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
> ---
>  Changes in v2:
>    - None for this file.
>  drivers/staging/most/hdm-dim2/dim2_hal.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c
> index 3c52450..03da89e 100644
> --- a/drivers/staging/most/hdm-dim2/dim2_hal.c
> +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c
> @@ -120,7 +120,7 @@ static int alloc_dbr(u16 size)
>  		return DBR_SIZE; /* out of memory */
> 
>  	for (i = 0; i < DBR_MAP_SIZE; i++) {
> -		u32 const blocks = (size + DBR_BLOCK_SIZE - 1) / DBR_BLOCK_SIZE;
> +		u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE);
>  		u32 mask = ~((~(u32)0) << blocks);
> 
>  		do {
> @@ -140,7 +140,7 @@ static int alloc_dbr(u16 size)
>  static void free_dbr(int offs, int size)
>  {
>  	int block_idx = offs / DBR_BLOCK_SIZE;
> -	u32 const blocks = (size + DBR_BLOCK_SIZE - 1) / DBR_BLOCK_SIZE;
> +	u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE);
>  	u32 mask = ~((~(u32)0) << blocks);
> 
>  	mask <<= block_idx % 32;

This patch breaks the build :(

ALWAYS test-build your patches.

greg k-h


      reply	other threads:[~2016-02-26  6:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 12:29 [PATCH v2 4/4] staging: most: hdm-dim2: Use macro DIV_ROUND_UP Bhaktipriya Shridhar
2016-02-26  6:35 ` Greg KH [this message]

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=20160226063505.GA13799@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bhaktipriya96@gmail.com \
    --cc=outreachy-kernel@googlegroups.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.