title: Connecting character device and physical PCIe driver
body: <p>I am modifying an existing Linux device driver and library API. My modification is to allow multiple devices (it is currently hard-coded for one device). One concept I don't understand is the mapping between the character device and the PCIe device itself.</p>
  
  <p>When initializing the driver in the probe method, I create a character device (or multiple). The library API makes a <code>IOCTL</code> call using the file descriptor from this character device. However in the driver itself, it is maintaining a global variable for the device that contains the PCI information. So my next step is to maintain state information for all the PCI device. </p>
  
  <p>What I don't understand is what the link is between the character devices I created and the PCIe state information in the driver. From my understanding the character device is created, and when I open it, or <code>IOCTL</code> into it, those commands are mapped through the driver. I am not sure how to link that character device that I am receiving through to the device structure that I want to control though.</p>