#define PCI_DEVICE_ID_JR3_4_CHANNEL 0x3114
struct jr3_pci_dev_private {
-
- struct pci_dev *pci_dev;
int pci_enabled;
struct jr3_t __iomem *iobase;
int n_channels;
};
struct poll_delay_t {
-
int min;
int max;
};
};
/* Hotplug firmware loading stuff */
-static int comedi_load_firmware(struct comedi_device *dev, char *name,
+static int comedi_load_firmware(struct comedi_device *dev, const char *name,
int (*cb)(struct comedi_device *dev,
const u8 *data, size_t size))
{
+ struct pci_dev *pcidev = comedi_to_pci_dev(dev);
int result = 0;
const struct firmware *fw;
char *firmware_path;
static const char *prefix = "comedi/";
- struct jr3_pci_dev_private *devpriv = dev->private;
firmware_path = kmalloc(strlen(prefix) + strlen(name) + 1, GFP_KERNEL);
if (!firmware_path) {
firmware_path[0] = '\0';
strcat(firmware_path, prefix);
strcat(firmware_path, name);
- result = request_firmware(&fw, firmware_path,
- &devpriv->pci_dev->dev);
+ result = request_firmware(&fw, firmware_path, &pcidev->dev);
if (result == 0) {
if (!cb)
result = -EINVAL;
return -EINVAL;
break;
}
- devpriv->pci_dev = pcidev;
dev->board_name = "jr3_pci";
result = comedi_pci_enable(pcidev, "jr3_pci");
static void jr3_pci_detach(struct comedi_device *dev)
{
int i;
+ struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct jr3_pci_dev_private *devpriv = dev->private;
if (devpriv) {
if (devpriv->iobase)
iounmap(devpriv->iobase);
if (devpriv->pci_enabled)
- comedi_pci_disable(devpriv->pci_dev);
+ comedi_pci_disable(pcidev);
}
}