I'm writing a PCIe driver/module for a custom device. Since the device is hot pluggable, it can disappear at any time.
Here how I setup up the pci_driver structure:
struct pci_driver my_pci_driver = {
.name = "my_pci_driver",
.id_table = ids,
.probe = "my_pci_driver_probe",
.remove = "my_pci_driver_remove"
};
But I don't know how to correctly handle the remove event. When the .remove function is called, I have several processes that have handle opened with the driver and performing several ioctl.
So what is the correct way to handle remove of a device ? How can I safely wait for currently running ioctl to finish and then properly remove the device from my driver?