title: Use do_mmap() in Linux device driver
body: <p>The device we work at now need to have a user space virtual memory address, we try to use do_mmap() as below:</p>
  
  <pre><code>*uvaddr = (void *)do_mmap(0, 0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS, 0);
  </code></pre>
  
  <p>But we got following error</p>
  
  <pre><code>Unable to handle kernel paging request for data at ad8
  </code></pre>
  
  <p>Is it okay to use "do_mmap()" in a device driver? If not, any correct way to do it?</p>