Re: [v4 1/2] mmc: Move mmc_delay() to include/linux/mmc/core.h

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

 



On 12/22/2012 03:39 AM, Arnd Bergmann wrote:
On Friday 21 December 2012, Chunhe Lan wrote:
+static inline void mmc_delay(unsigned int ms)
+{
+       ktime_t end = ktime_add_us(ktime_get(), ms * 1000);
+
+       while (1) {
+               s64 remaining;
+
+               cond_resched();
+               remaining = ktime_to_us(ktime_sub(end, ktime_get()));
+               if (remaining < 0)
+                       break;
+
+               udelay(min_t(u32, remaining, 100));
+       }
+}
The new logic is more accurate than the old one, but it still wastes
a lot of energy and CPU cycles. Could you perhaps use an hrtimer to
set the exact timeout and actually sleep?
    I think that does not have to use hrtimer, and it makes a fuss.
    And mmc structure has not included the hrtimer variable.

Thanks,
Chunhe

	Arnd




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


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux