title: Device Specific Data Structure with Platform Driver and Character Device Interface
body: <p>I'm struggling with understanding the linkup between a platform device driver with a character device interface and storing data in a device specific data structure.</p>
  
  <p>I created a struct keeping track of data related to my device, and then add it to the devices struct at the probe function:</p>
  
  <pre><code>dev_set_drvdata(dev, data_struct);
  </code></pre>
  
  <p>I also keep a global copy of <code>data_struct</code>.</p>
  
  <p>I register a misc device so that I can <code>mmap()</code> and access the device through <code>ioctl()</code> commands. If I want to access this device's <code>data_struct</code>, and currently I access it through the global copy. Is there another way through the <code>inode</code> or <code>file</code> pointers to access the data I stored in the devices struct?</p>
  
  <p>I currently only allow one instance of the device, but I want to make sure I implement this correctly for future implementations where there might be multiple devices using the same driver.</p>