Re: [PATCH] mmc: omap: Use DIV_ROUND_UP instead of open coded

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2 May 2014 17:39, Tony Lindgren <tony@xxxxxxxxxxx> wrote:
> * Axel Lin <axel.lin@xxxxxxxxxx> [140427 03:58]:
>> This also makes the intention more clear.

While you are at it you may want to use some nice defines from time.h

>> Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx>
>
> 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);

Use NSEC_PER_SEC from time.h

>>               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);

Same here NSEC_PER_SEC.

>>       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);

USEC_PER_SEC from time.h

regards
Joachim Eastwood
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux