linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Axel Lin <axel.lin@ingics.com>
Cc: Chris Ball <chris@printf.net>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Jarkko Lavinen <jarkko.lavinen@nokia.com>,
	linux-omap@vger.kernel.org, linux-mmc@vger.kernel.org,
	Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: Re: [PATCH] mmc: omap: Use DIV_ROUND_UP instead of open coded
Date: Fri, 2 May 2014 08:39:15 -0700	[thread overview]
Message-ID: <20140502153915.GA3014@atomide.com> (raw)
In-Reply-To: <1398596216.21067.1.camel@phoenix>

* Axel Lin <axel.lin@ingics.com> [140427 03:58]:
> This also makes the intention more clear.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Added Jarkko Nikula to cc.

Tony

> ---
>  drivers/mmc/host/omap.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
> index 5c2e58b..711981e 100644
> --- a/drivers/mmc/host/omap.c
> +++ b/drivers/mmc/host/omap.c
> @@ -177,7 +177,7 @@ static void mmc_omap_fclk_offdelay(struct mmc_omap_slot *slot)
>  	unsigned long tick_ns;
>  
>  	if (slot != NULL && slot->host->fclk_enabled && slot->fclk_freq > 0) {
> -		tick_ns = (1000000000 + slot->fclk_freq - 1) / slot->fclk_freq;
> +		tick_ns = DIV_ROUND_UP(1000000000, slot->fclk_freq);
>  		ndelay(8 * tick_ns);
>  	}
>  }
> @@ -435,7 +435,7 @@ static void mmc_omap_send_stop_work(struct work_struct *work)
>  	struct mmc_data *data = host->stop_data;
>  	unsigned long tick_ns;
>  
> -	tick_ns = (1000000000 + slot->fclk_freq - 1)/slot->fclk_freq;
> +	tick_ns = DIV_ROUND_UP(1000000000, slot->fclk_freq);
>  	ndelay(8*tick_ns);
>  
>  	mmc_omap_start_command(host, data->stop);
> @@ -477,7 +477,7 @@ mmc_omap_send_abort(struct mmc_omap_host *host, int maxloops)
>  	u16 stat = 0;
>  
>  	/* Sending abort takes 80 clocks. Have some extra and round up */
> -	timeout = (120*1000000 + slot->fclk_freq - 1)/slot->fclk_freq;
> +	timeout = DIV_ROUND_UP(120 * 1000000, slot->fclk_freq);
>  	restarts = 0;
>  	while (restarts < maxloops) {
>  		OMAP_MMC_WRITE(host, STAT, 0xFFFF);
> @@ -677,8 +677,8 @@ mmc_omap_xfer_data(struct mmc_omap_host *host, int write)
>  	if (n > host->buffer_bytes_left)
>  		n = host->buffer_bytes_left;
>  
> -	nwords = n / 2;
> -	nwords += n & 1; /* handle odd number of bytes to transfer */
> +	/* Round up to handle odd number of bytes to transfer */
> +	nwords = DIV_ROUND_UP(n, 2);
>  
>  	host->buffer_bytes_left -= n;
>  	host->total_bytes_left -= n;
> -- 
> 1.8.3.2
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-05-02 15:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-27 10:56 [PATCH] mmc: omap: Use DIV_ROUND_UP instead of open coded Axel Lin
2014-05-02 15:39 ` Tony Lindgren [this message]
2014-05-02 20:30   ` Joachim Eastwood
  -- strict thread matches above, loose matches on Subject: below --
2013-09-01  7:07 Axel Lin

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=20140502153915.GA3014@atomide.com \
    --to=tony@atomide.com \
    --cc=axel.lin@ingics.com \
    --cc=chris@printf.net \
    --cc=jarkko.lavinen@nokia.com \
    --cc=jarkko.nikula@bitmer.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=ulf.hansson@linaro.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).