Re: [PATCH] AT32AP700X PS/2 controller (PSIF): remove msleep call from atomic context
From: Marjan Fojkar <hidden>
Date: 2009-12-19 11:57:58
Hans-Christian Egtvedt wrote:
On Sun, 13 Dec 2009 20:49:37 -0800 Dmitry Torokhov [off-list ref] wrote:quoted
Hi Martin, On Sun, Dec 13, 2009 at 02:25:25PM +0100, Marjan Fojkar wrote:quoted
From: Marjan Fojkar <redacted> The patch removes msleep call from atomic context. To achieve that, the driver PSIF leaves atomic context before the call in order to enable interrupts to be performed safely. When the call is done, the driver jumps back to atomic context.Yes, msleep is not allowed in atomic context, however serio's write() method is supposed to be callable from atomic context so msleep is not available there period. I scanned the datasheet quickly and did not see any restriction on the frequency of reading status register so I think we should do what i8042 driver does - udelay(50).Sure udelay(50) will work fine, you can poll the registers as fast as you would like. Only disadvantage with udelay is that it will block all other threads. But I would guess that most of the times a character should be sent to the peripheral, the hardware will be ready since the speed is quite low bandwidth.
So, the final conclusion is udelay(50), I presume? :)