[PATCH 2/3] staging: comedi: amplc_pc263: add helper macros to check bus type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add helper macro IS_ISA_BOARD(board) to check if the driver supports ISA
boards and this is an ISA board, and IS_PCI_BOARD(board) to check if the
driver supports PCI boards and this is a PCI board.

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
---
 drivers/staging/comedi/drivers/amplc_pc263.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c
index b1216a5..94eb612 100644
--- a/drivers/staging/comedi/drivers/amplc_pc263.c
+++ b/drivers/staging/comedi/drivers/amplc_pc263.c
@@ -72,6 +72,10 @@ struct pc263_board {
 	enum pc263_bustype bustype;
 	enum pc263_model model;
 };
+
+#define IS_ISA_BOARD(board)	(DO_ISA && (board)->bustype == isa_bustype)
+#define IS_PCI_BOARD(board)	(DO_PCI && (board)->bustype == pci_bustype)
+
 static const struct pc263_board pc263_boards[] = {
 #if DO_ISA
 	{
@@ -190,9 +194,9 @@ static void pc263_report_attach(struct comedi_device *dev)
 	struct pci_dev *pcidev = comedi_to_pci_dev(dev);
 	char tmpbuf[40];
 
-	if (DO_ISA && thisboard->bustype == isa_bustype)
+	if (IS_ISA_BOARD(thisboard))
 		snprintf(tmpbuf, sizeof(tmpbuf), "(base %#lx) ", dev->iobase);
-	else if (DO_PCI && thisboard->bustype == pci_bustype)
+	else if (IS_PCI_BOARD(thisboard))
 		snprintf(tmpbuf, sizeof(tmpbuf), "(pci %s) ",
 			 pci_name(pcidev));
 	else
@@ -260,13 +264,13 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	dev_info(dev->class_dev, PC263_DRIVER_NAME ": attach\n");
 
 	/* Process options and reserve resources according to bus type. */
-	if (DO_ISA && thisboard->bustype == isa_bustype) {
+	if (IS_ISA_BOARD(thisboard)) {
 		unsigned long iobase = it->options[0];
 		ret = pc263_request_region(dev, iobase, PC263_IO_SIZE);
 		if (ret < 0)
 			return ret;
 		return pc263_common_attach(dev, iobase);
-	} else if (DO_PCI && thisboard->bustype == pci_bustype) {
+	} else if (IS_PCI_BOARD(thisboard)) {
 		struct pci_dev *pci_dev;
 
 		pci_dev = pc263_find_pci_dev(dev, it);
-- 
1.7.8.6

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux