addi-data: Get rid of redundant ps_BoardInfo
authorIan Abbott <abbotti@mev.co.uk>
Mon, 16 May 2011 15:06:32 +0000 (16:06 +0100)
committerIan Abbott <abbotti@mev.co.uk>
Mon, 16 May 2011 15:06:32 +0000 (16:06 +0100)
The ps_BoardInfo pointer in the device private data is redundant as we
can just use the this_board macro to access the same data, as is done
elsewhere in the code.  Get rid of the pointer and change the code to
use the this_board macro instead.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
comedi/drivers/addi-data/addi_common.c
comedi/drivers/addi-data/addi_common.h
comedi/drivers/addi-data/hwdrv_apci16xx.c
comedi/drivers/addi-data/hwdrv_apci3xxx.c

index cd03a4eb4ba1dbb9e89e413fa256ac4fca5222be..01870467877cc225af5b1a916e5ca49150b1cdd4 100644 (file)
@@ -2628,13 +2628,11 @@ static int i_ADDI_Attach(comedi_device * dev, comedi_devconfig * it)
                devpriv->i_IobaseAmcc = (INT) iobase_a; //AMCC base address...
                devpriv->i_IobaseAddon = (INT) iobase_addon;    //ADD ON base address....
                devpriv->i_IobaseReserved = (INT) iobase_reserved;
-               devpriv->ps_BoardInfo = this_board;
        } else {
                dev->board_name = this_board->pc_DriverName;
                dev->iobase = (unsigned long)io_addr[2];
                devpriv->amcc = card;
                devpriv->iobase = (INT) io_addr[2];
-               devpriv->ps_BoardInfo = this_board;
                devpriv->i_IobaseReserved = (INT) io_addr[3];
                printk("\nioremap begin");
                devpriv->dw_AiBase =
@@ -2953,8 +2951,8 @@ static int i_ADDI_Detach(comedi_device * dev)
                        comedi_free_irq(dev->irq, dev);
                }
 
-               if ((devpriv->ps_BoardInfo->pc_EepromChip == NULL)
-                       || (strcmp(devpriv->ps_BoardInfo->pc_EepromChip,
+               if ((this_board->pc_EepromChip == NULL)
+                       || (strcmp(this_board->pc_EepromChip,
                                        ADDIDATA_9054) != 0)) {
                        if (devpriv->allocated) {
                                i_pci_card_free(devpriv->amcc);
index a944404a4db70d08c32ad0365a50d0cfd54af91b..acace3e88e3513d367e90810e76ff5f3dce1626f 100644 (file)
@@ -435,7 +435,6 @@ typedef struct {
        BYTE b_ExttrigEnable;   //  To enable or disable external trigger
 
        struct task_struct *tsk_Current;        // Pointer to the current process
-       const boardtype *ps_BoardInfo;
 
        // Hardware board infos for 1710
 
index 02f91017e0cd439b8d05263ab132f2b916979278..7aad781f2ae208098b04f0adddfb402e626e912c 100755 (executable)
@@ -97,7 +97,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(comedi_device * dev,
        BYTE b_Command = 0;
        BYTE b_Cpt = 0;
        BYTE b_NumberOfPort =
-               (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
+               (BYTE) (this_board->i_NbrTTLChannel / 8);
 
        /************************/
        /* Test the buffer size */
@@ -289,7 +289,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(comedi_device * dev,
        INT i_ReturnValue = insn->n;
        BYTE b_Command = 0;
        BYTE b_NumberOfPort =
-               (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
+               (BYTE) (this_board->i_NbrTTLChannel / 8);
        BYTE b_SelectedPort = CR_RANGE(insn->chanspec);
        BYTE b_InputChannel = CR_CHAN(insn->chanspec);
        BYTE *pb_Status;
@@ -450,9 +450,9 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(comedi_device * dev,
           /**********************************/
 
                b_NumberOfPort =
-                       (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 32);
+                       (BYTE) (this_board->i_NbrTTLChannel / 32);
                if ((b_NumberOfPort * 32) <
-                       devpriv->ps_BoardInfo->i_NbrTTLChannel) {
+                       this_board->i_NbrTTLChannel) {
                        b_NumberOfPort = b_NumberOfPort + 1;
                }
 
@@ -576,7 +576,7 @@ int i_APCI16XX_InsnBitsWriteTTLIO(comedi_device * dev,
        INT i_ReturnValue = insn->n;
        BYTE b_Command = 0;
        BYTE b_NumberOfPort =
-               (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
+               (BYTE) (this_board->i_NbrTTLChannel / 8);
        BYTE b_SelectedPort = CR_RANGE(insn->chanspec);
        BYTE b_OutputChannel = CR_CHAN(insn->chanspec);
        DWORD dw_Status = 0;
index 1858b7c3206c1bb92c73c0f18a0c676443e276c0..b2c192a72bc3becd12dcddb8d21ff792f56626ba 100755 (executable)
@@ -141,8 +141,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(comedi_device * dev,
                /* Test the time base */
           /**********************/
 
-               if ((devpriv->ps_BoardInfo->
-                               b_AvailableConvertUnit & (1 << b_TimeBase)) !=
+               if ((this_board->b_AvailableConvertUnit & (1 << b_TimeBase)) !=
                        0) {
              /*******************************/
                        /* Test the convert time value */
@@ -170,7 +169,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(comedi_device * dev,
                                        if ((b_SingleDiff == APCI3XXX_SINGLE)
                                                || (b_SingleDiff ==
                                                        APCI3XXX_DIFF)) {
-                                               if (((b_SingleDiff == APCI3XXX_SINGLE) && (devpriv->s_EeParameters.i_NbrAiChannel == 0)) || ((b_SingleDiff == APCI3XXX_DIFF) && (devpriv->ps_BoardInfo->i_NbrAiChannelDiff == 0))) {
+                                               if (((b_SingleDiff == APCI3XXX_SINGLE) && (devpriv->s_EeParameters.i_NbrAiChannel == 0)) || ((b_SingleDiff == APCI3XXX_DIFF) && (this_board->i_NbrAiChannelDiff == 0))) {
                           /*******************************/
                                                        /* Single/Diff selection error */
                           /*******************************/
@@ -377,8 +376,7 @@ int i_APCI3XXX_InsnReadAnalogInput(comedi_device * dev,
 
                if (((b_Channel < devpriv->s_EeParameters.i_NbrAiChannel)
                                && (devpriv->b_SingelDiff == APCI3XXX_SINGLE))
-                       || ((b_Channel < devpriv->ps_BoardInfo->
-                                       i_NbrAiChannelDiff)
+                       || ((b_Channel < this_board->i_NbrAiChannelDiff)
                                && (devpriv->b_SingelDiff == APCI3XXX_DIFF))) {
              /**********************************/
                        /* Test the channel configuration */