<br><br>On Thursday, August 20, 2015,  &lt;<a href="mailto:victorascroft@gmail.com">victorascroft@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 15-08-20 19:02:50, Woody Wu wrote:<br>
&gt; On Thursday, August 20, 2015, John de la Garza &lt;<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;john@jjdev.com&#39;)">john@jjdev.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; On Thu, Aug 20, 2015 at 01:45:34PM +0800, Woody Wu wrote:<br>
&gt; &gt; &gt; I did not see the message.  Actually my interrupt handler is calling<br>
&gt; &gt; &gt; i2c_transfer which in turn used msleep() somewhere in its code.  Is this<br>
&gt; &gt; &gt; normal or dangerous?<br>
&gt; &gt;<br>
&gt; &gt; Can you have the interrupt handler put the work on a workqueue<br>
&gt; &gt; and quickly return?<br>
&gt; &gt;<br>
&gt;<br>
&gt; Yes, that is an option.  But I firstly need to know the old code is really<br>
&gt; bad. The interrupt is triggered by an i2c touchscreen, and  the interrupt<br>
&gt; handler use the i2c core code to start the i2c transferring.  I see in the<br>
&gt; i2c adapter code a msleep() was invoked at beginning of transfer.  I doubt<br>
&gt; that this is a potential problem.  But you know the i2c touchscreen driver<br>
&gt; code is also part of the mainline, so I am not sure my option.  You guys<br>
&gt; can check the code of atmel_mXT224_ts.c, the i2c adapter code is i2c_s3c.c<br>
<br>
I checked the code. The kernel release I am checking in is 4.1.5. From what<br>
I can see there is only atmel_mxt_ts.c and not atmel_mXT224_ts.c in drivers/<br>
input/touchscreen. In this code, it is requesting a threaded irq with the<br>
top handler being specified as null and the bottom handler specified.<br>
<br>
Since the bottom handler is being used where i2c_transfer is called and<br>
as such though on a quick check I do not see the msleep() call, even if<br>
the msleep were called while in the bottom handler context it would be fine.<br>
<br>
I do not know which code you are referring to but in hard interrupt context<br>
atleast you can never ever call any function which can sleep. It is just<br>
gonna blow in some way.<br>
<br>
- Sanchayan.<br>
</blockquote><div><br></div><div>The file name you said is right.  The kernel version I am using is 3.1.x, but I guess it does no much matter to the question. The interrupt handler of the atmel_mxt_ts called i2c_transfer() which indeed called the actual i2c adapter&#39;s transfer method. In my platform, the i2c adapter is a s3c i2c controller, so I was checking the code in i2c/busses/i2c_s3c.c, from this file I saw the msleep() was called in  i2c_doxfer()-&gt;i2c_set_master() call sequence. I think you can find he similar things in 4.1.5.</div><div><br></div><div>Thanks.</div><div>-woody</div><br><br>-- <br>Sent from Gmail Mobile<br>