#endif
};
-/*
- * Useful for shorthand access to the particular board structure
- */
-#define thisboard ((const struct pc263_board *)dev->board_ptr)
-
/* this structure is for data unique to this hardware driver. If
several hardware drivers keep similar information in this structure,
feel free to suggest moving the variable to the struct comedi_device struct.
struct pci_dev *pci_dev;
};
-#define devpriv ((struct pc263_private *)dev->private)
-
/*
* This function looks for a PCI device matching the requested board name,
* bus and slot.
static struct pci_dev *
pc263_find_pci(struct comedi_device *dev, int bus, int slot)
{
+ const struct pc263_board *thisboard = comedi_board(dev);
struct pci_dev *pci_dev = NULL;
/* Look for matching PCI device. */
if (pci_dev->device == pc263_boards[i].devid) {
/* Change board_ptr to matched board. */
dev->board_ptr = &pc263_boards[i];
+ thisboard = comedi_board(dev);
break;
}
}
static void pc263_report_attach(struct comedi_device *dev)
{
+ const struct pc263_board *thisboard = comedi_board(dev);
+ struct pc263_private *devpriv = dev->private;
char tmpbuf[40];
if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) &&
*/
static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
+ const struct pc263_board *thisboard = comedi_board(dev);
struct comedi_subdevice *s;
unsigned long iobase = 0;
int ret;
return ret;
} else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) &&
thisboard->bustype == pci_bustype) {
+ struct pc263_private *devpriv;
struct pci_dev *pci_dev = NULL;
int bus, slot;
dev_err(dev->class_dev, "error! out of memory!\n");
return ret;
}
+ devpriv = dev->private;
bus = it->options[0];
slot = it->options[1];
pci_dev = pc263_find_pci(dev, bus, slot);
if (pci_dev == NULL)
return -EIO;
+ thisboard = comedi_board(dev); /* replaced wildcard board */
devpriv->pci_dev = pci_dev;
ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME);
if (ret < 0) {
static void pc263_detach(struct comedi_device *dev)
{
+ struct pc263_private *devpriv = dev->private;
+
if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && devpriv &&
devpriv->pci_dev) {
if (dev->iobase)