From: Ian Abbott Date: Mon, 16 May 2011 15:06:32 +0000 (+0100) Subject: addi-data: Get rid of redundant ps_BoardInfo X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e4fc938e31d04b652ade40f7103a0f59c5983d7e;p=comedi.git addi-data: Get rid of redundant ps_BoardInfo 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 --- diff --git a/comedi/drivers/addi-data/addi_common.c b/comedi/drivers/addi-data/addi_common.c index cd03a4eb..01870467 100644 --- a/comedi/drivers/addi-data/addi_common.c +++ b/comedi/drivers/addi-data/addi_common.c @@ -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); diff --git a/comedi/drivers/addi-data/addi_common.h b/comedi/drivers/addi-data/addi_common.h index a944404a..acace3e8 100644 --- a/comedi/drivers/addi-data/addi_common.h +++ b/comedi/drivers/addi-data/addi_common.h @@ -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 diff --git a/comedi/drivers/addi-data/hwdrv_apci16xx.c b/comedi/drivers/addi-data/hwdrv_apci16xx.c index 02f91017..7aad781f 100755 --- a/comedi/drivers/addi-data/hwdrv_apci16xx.c +++ b/comedi/drivers/addi-data/hwdrv_apci16xx.c @@ -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; diff --git a/comedi/drivers/addi-data/hwdrv_apci3xxx.c b/comedi/drivers/addi-data/hwdrv_apci3xxx.c index 1858b7c3..b2c192a7 100755 --- a/comedi/drivers/addi-data/hwdrv_apci3xxx.c +++ b/comedi/drivers/addi-data/hwdrv_apci3xxx.c @@ -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 */