#define DRV_NAME "das08"
-#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) || IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
-#define DO_COMEDI_DRIVER_REGISTER
-#endif
+#define DO_COMEDI_DRIVER_REGISTER \
+ (IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) || \
+ IS_ENABLED(CONFIG_COMEDI_DAS08_PCI))
#define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307
#define PCI_DEVICE_ID_PCIDAS08 0x29
return 2;
}
-#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA)
-static int das08jr_di_rbits(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int __maybe_unused
+das08jr_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
data[0] = 0;
data[1] = inb(dev->iobase + DAS08JR_DIO);
return 2;
}
-#endif
-#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA)
-static int das08jr_do_wbits(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int __maybe_unused
+das08jr_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
struct das08_private_struct *devpriv = dev->private;
return 2;
}
-#endif
-#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA)
-static int das08jr_ao_winsn(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int __maybe_unused
+das08jr_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
int n;
int lsb, msb;
return n;
}
-#endif
/*
*
* a different method to force an update.
*
*/
-#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA)
-static int das08ao_ao_winsn(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int __maybe_unused
+das08ao_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
+ struct comedi_insn *insn, unsigned int *data)
{
int n;
int lsb, msb;
return n;
}
-#endif
static unsigned int i8254_read_channel_low(unsigned int base, int chan)
{
return 2;
}
-#ifdef DO_COMEDI_DRIVER_REGISTER
+#if DO_COMEDI_DRIVER_REGISTER
static const struct das08_board_struct das08_boards[] = {
#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA)
{
}
EXPORT_SYMBOL_GPL(das08_common_attach);
-#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
static int das08_pci_attach_common(struct comedi_device *dev,
struct pci_dev *pdev)
{
unsigned long pci_iobase;
struct das08_private_struct *devpriv = dev->private;
+ if (!IS_ENABLED(CONFIG_COMEDI_DAS08_PCI))
+ return -EINVAL;
+
devpriv->pdev = pdev;
/* enable PCI device and reserve I/O spaces */
if (comedi_pci_enable(pdev, dev->driver->driver_name)) {
#endif
return das08_common_attach(dev, iobase);
}
-#endif
-#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
static const struct das08_board_struct *
das08_find_pci_board(struct pci_dev *pdev)
{
+#if DO_COMEDI_DRIVER_REGISTER
unsigned int i;
for (i = 0; i < ARRAY_SIZE(das08_boards); i++)
if (das08_boards[i].bustype == pci &&
pdev->device == das08_boards[i].id)
return &das08_boards[i];
+#endif
return NULL;
}
-#endif
-#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
/* only called in the PCI probe path, via comedi_pci_auto_config() */
-static int __devinit das08_attach_pci(struct comedi_device *dev,
- struct pci_dev *pdev)
+static int __devinit __maybe_unused
+das08_attach_pci(struct comedi_device *dev, struct pci_dev *pdev)
{
int ret;
+ if (!IS_ENABLED(CONFIG_COMEDI_DAS08_PCI))
+ return -EINVAL;
ret = alloc_private(dev, sizeof(struct das08_private_struct));
if (ret < 0)
return ret;
}
return das08_pci_attach_common(dev, pdev);
}
-#endif
-#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
static struct pci_dev *das08_find_pci(struct comedi_device *dev,
int bus, int slot)
{
thisboard->name);
return NULL;
}
-#endif
-#ifdef DO_COMEDI_DRIVER_REGISTER
-static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
+static int __maybe_unused
+das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
const struct das08_board_struct *thisboard = comedi_board(dev);
struct das08_private_struct *devpriv;
} else
return -EIO;
}
-#endif /* DO_COMEDI_DRIVER_REGISTER */
void das08_common_detach(struct comedi_device *dev)
{
}
EXPORT_SYMBOL_GPL(das08_common_detach);
-#ifdef DO_COMEDI_DRIVER_REGISTER
-static void das08_detach(struct comedi_device *dev)
+static void __maybe_unused das08_detach(struct comedi_device *dev)
{
const struct das08_board_struct *thisboard = comedi_board(dev);
struct das08_private_struct *devpriv = dev->private;
}
}
}
-#endif /* DO_COMEDI_DRIVER_REGISTER */
-#ifdef DO_COMEDI_DRIVER_REGISTER
+#if DO_COMEDI_DRIVER_REGISTER
static struct comedi_driver das08_driver = {
.driver_name = DRV_NAME,
.module = THIS_MODULE,
.attach = das08_attach,
-#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
.attach_pci = das08_attach_pci,
-#endif
.detach = das08_detach,
.board_name = &das08_boards[0].name,
.num_names = sizeof(das08_boards) / sizeof(struct das08_board_struct),
};
#endif /* CONFIG_COMEDI_DAS08_PCI */
-#ifdef DO_COMEDI_DRIVER_REGISTER
+#if DO_COMEDI_DRIVER_REGISTER
#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
module_comedi_pci_driver(das08_driver, das08_pci_driver);
#else