title: How to read/write Character Device within a Linux kernel module
body: <p>I write the character device driver myself in LKM, which has simply:</p>
  
  <pre><code>dev_open(struct inode *inode, struct file *filp);
  dev_read (struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
  dev_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos)
  dev_release(struct inode *inode, struct file *filp)
  </code></pre>
  
  <p>Then in my kernel module, I also want to write to the character device, and the write must actually call my function:</p>
  
  <pre><code>dev_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos)
  </code></pre>
  
  <p>I've found a similar <a href="https://stackoverflow.com/questions/1184274">link</a> here at SE, but in this way it won't call my <code>dev_write()</code> function to write but some deeper like <code>vfs_write()</code>,right?</p>