Hello Nishanth, Manjunath, a comment on cpu_relax() and udelay(). On Mon, 26 Oct 2009, Menon, Nishanth wrote: > > -----Original Message----- > > From: G, Manjunath Kondaiah > > > > As per your comments for other patches when ever there is udelay usage, > > cpu_relax is the better option. I see there are lot of udelay(...) calls > > used in this patch. Why can't you use cpu_relax() or schedule(). > > Any specific reason? > > > Donʼt really want to do cpu_relax in irq_locked context.. There are no restrictions on the calling context for cpu_relax(). [ schedule(), of course, does have restrictions. ] I don't understand the use of the udelay(10). Could you please explain this further? Is it the case that if the register bit doesn't change within 50 reads, that it is then not likely to change for 10 microseconds? If that isn't how the device works, then using udelay(10) will just waste power busy-looping in the CPU. I would rather see this code using udelay(1) between each register read if you want to ensure that you read the register for at least 50 microseconds. This would also simplify your timeout loops considerably, which seem unnecessarily complicated. But if the scenario above is how the device is expected to respond, then these loops should have some comments to explain why the extra complexity and power consumption of a 10 microsecond busy-loop after every 50 reads is the right thing to do. regards, - Paul