<div class="gmail_quote">On Fri, Oct 16, 2009 at 9:13 PM, Bryan O&#39;Sullivan <span dir="ltr">&lt;<a href="mailto:bos@serpentine.com">bos@serpentine.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im">You don&#39;t need anything special for this. A Linux kernel &quot;struct device&quot; has a &quot;void *driver_data&quot; member which is private for your use, and intended for precisely this purpose. Global persistent state makes no more sense for kernel drivers than for most other code: how would it work if you had two mice plugged into your system?</div>

<div><br></div></div></blockquote><div><br></div><div>Thanks Bryan - your thought on this is pure and true :-)</div><div><br></div><div>Although I&#39;m just making a toy driver, I wanted to exercise the bits a real one would need, and wrongly thought persistent state would matter. You&#39;re quite right though - generally, things that matter should go in the per device store, which can easily be kmalloc()ed/kfree()ed on open/close, picked up and passed into Haskell as a Ptr on write/read (so avoiding even the need to understand the C struct in Haskell), then peeked and poked.</div>
<div><br></div><div>My driver can now accumulate data as I wanted, and I don&#39;t feel like I&#39;ve cheated.</div><div><br></div><div>Alan</div><div><br></div></div>-- <br>... the PA system was moaning unctuously, like a lady hippopotamus reading A. E. Housman ...&quot;<br>
  -- James Blish, &quot;They Shall Have Stars&quot;<br>