title: Userspace vs kernel space driver
body: <p>I am looking to write a PWM driver. I know that there are two ways we can control a hardware driver:  </p>
  
  <ol>
  <li>User space driver.  </li>
  <li>Kernel space driver</li>
  </ol>
  
  <p>If in general (do not consider a PWM driver case) we have to make a decision whether to go for user space or kernel space driver. Then what factors we have to take into consideration apart from these?</p>
  
  <ol>
  <li>User space driver can directly mmap() /dev/mem memory to their virtual address space and need no context switching.</li>
  <li>Userspace driver cannot have interrupt handlers implemented (They have to poll for interrupt).</li>
  <li>Userspace driver cannot perform DMA (As DMA capable memory can be allocated from kernel space).</li>
  </ol>