[PATCH 08/40] staging: comedi: me4000: remove thisboard macro

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

 



This macro relies on a local variable having a specific name.
Remove it and use the comedi_board() helper to get the pointer.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/me4000.c | 14 ++++++++------
 drivers/staging/comedi/drivers/me4000.h |  2 --
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c
index 3ffaa39..a3d9136 100644
--- a/drivers/staging/comedi/drivers/me4000.c
+++ b/drivers/staging/comedi/drivers/me4000.c
@@ -221,7 +221,7 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct pci_dev *pci_device = NULL;
 	int result, i;
-	struct me4000_board *board;
+	const struct me4000_board *board;
 
 	/* Allocate private memory */
 	if (alloc_private(dev, sizeof(struct me4000_info)) < 0)
@@ -254,9 +254,7 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it)
 						}
 					}
 					dev->board_ptr = me4000_boards + i;
-					board =
-					    (struct me4000_board *)
-					    dev->board_ptr;
+					board = comedi_board(dev);
 					info->pci_dev_p = pci_device;
 					goto found;
 				}
@@ -445,6 +443,7 @@ static int init_board_info(struct comedi_device *dev, struct pci_dev *pci_dev_p)
 
 static int init_ao_context(struct comedi_device *dev)
 {
+	const struct me4000_board *thisboard = comedi_board(dev);
 	int i;
 
 	for (i = 0; i < thisboard->ao_nchan; i++) {
@@ -726,7 +725,7 @@ static int me4000_ai_insn_read(struct comedi_device *dev,
 			       struct comedi_subdevice *subdevice,
 			       struct comedi_insn *insn, unsigned int *data)
 {
-
+	const struct me4000_board *thisboard = comedi_board(dev);
 	int chan = CR_CHAN(insn->chanspec);
 	int rang = CR_RANGE(insn->chanspec);
 	int aref = CR_AREF(insn->chanspec);
@@ -864,6 +863,7 @@ static int me4000_ai_cancel(struct comedi_device *dev,
 static int ai_check_chanlist(struct comedi_device *dev,
 			     struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
+	const struct me4000_board *thisboard = comedi_board(dev);
 	int aref;
 	int i;
 
@@ -1658,7 +1658,7 @@ static int me4000_ao_insn_write(struct comedi_device *dev,
 				struct comedi_subdevice *s,
 				struct comedi_insn *insn, unsigned int *data)
 {
-
+	const struct me4000_board *thisboard = comedi_board(dev);
 	int chan = CR_CHAN(insn->chanspec);
 	int rang = CR_RANGE(insn->chanspec);
 	int aref = CR_AREF(insn->chanspec);
@@ -2098,12 +2098,14 @@ static int me4000_cnt_insn_write(struct comedi_device *dev,
 
 static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
+	const struct me4000_board *thisboard;
 	struct comedi_subdevice *s;
 	int result;
 
 	result = me4000_probe(dev, it);
 	if (result)
 		return result;
+	thisboard = comedi_board(dev);
 
 	result = comedi_alloc_subdevices(dev, 4);
 	if (result)
diff --git a/drivers/staging/comedi/drivers/me4000.h b/drivers/staging/comedi/drivers/me4000.h
index ab6094a..b2cfecb 100644
--- a/drivers/staging/comedi/drivers/me4000.h
+++ b/drivers/staging/comedi/drivers/me4000.h
@@ -269,8 +269,6 @@ struct me4000_board {
 	int has_counter;
 };
 
-#define thisboard ((const struct me4000_board *)dev->board_ptr)
-
 /*=============================================================================
   Global board and subdevice information structures
   ===========================================================================*/
-- 
1.7.11

_______________________________________________
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