Re: [PATCH 6/7] mmc_spi: convert timeout handling to jiffies andavoid busy waiting

From: Pierre Ossman
Date: Sun Mar 15 2009 - 07:37:31 EST


On Wed, 11 Mar 2009 14:35:03 +0100
Wolfgang MÃes <wolfgang.mues@xxxxxxxxxxxx> wrote:

> @@ -816,8 +819,11 @@ mmc_spi_data_do(struct mmc_spi_host *hos
> else
> clock_rate = spi->max_speed_hz;
>
> - timeout = ktime_add_ns(ktime_set(0, 0), data->timeout_ns +
> - data->timeout_clks * 1000000 / clock_rate);
> + timeout = data->timeout_ns +
> + data->timeout_clks * 1000000 / clock_rate;
> + timeout = usecs_to_jiffies((unsigned int)(timeout / 1000));
> + if (!timeout)
> + timeout = 1;
>

Does this round properly upwards? Having a timeout 6 ms shorter than it
should be can be a real problem (although the huge timeout your other
patch introduces means we probably won't be affected by it).

Rgds
--
-- Pierre Ossman

WARNING: This correspondence is being monitored by the
Swedish government. Make sure your server uses encryption
for SMTP traffic and consider using PGP for end-to-end
encryption.

Attachment: signature.asc
Description: PGP signature