From 13962d976f5798b8ad0b970654bb878101b24fb4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 18 Jan 2013 10:45:07 -0700 Subject: [PATCH] staging: comedi: addi_apci_16xx: remove unnecessary comments A lot of the comments in hwdrv_apci16xx.c have whitespace damage and are simply unnecessary. Just remove them to make the code a bit more readable. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci16xx.c | 233 ------------------ 1 file changed, 233 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c index e5496019e610..ec39b6f40be6 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c @@ -100,7 +100,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour | -101 : Data size error | +----------------------------------------------------------------------------+ */ - static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -114,97 +113,53 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, unsigned char b_NumberOfPort = (unsigned char) (this_board->i_NbrTTLChannel / 8); - /************************/ /* Test the buffer size */ - /************************/ - if (insn->n >= 1) { - /*******************/ /* Get the command */ - /* **************** */ - b_Command = (unsigned char) data[0]; - /********************/ /* Test the command */ - /********************/ - if ((b_Command == APCI16XX_TTL_INIT) || (b_Command == APCI16XX_TTL_INITDIRECTION) || (b_Command == APCI16XX_TTL_OUTPUTMEMORY)) { - /***************************************/ /* Test the initialisation buffer size */ - /***************************************/ - if ((b_Command == APCI16XX_TTL_INITDIRECTION) && ((unsigned char) (insn->n - 1) != b_NumberOfPort)) { - /*******************/ - /* Data size error */ - /*******************/ - printk("\nBuffer size error"); i_ReturnValue = -101; } if ((b_Command == APCI16XX_TTL_OUTPUTMEMORY) && ((unsigned char) (insn->n) != 2)) { - /*******************/ - /* Data size error */ - /*******************/ - printk("\nBuffer size error"); i_ReturnValue = -101; } } else { - /************************/ - /* Config command error */ - /************************/ - printk("\nCommand selection error"); i_ReturnValue = -100; } } else { - /*******************/ - /* Data size error */ - /*******************/ - printk("\nBuffer size error"); i_ReturnValue = -101; } - /**************************************************************************/ /* Test if no error occur and APCI16XX_TTL_INITDIRECTION command selected */ - /**************************************************************************/ - if ((i_ReturnValue >= 0) && (b_Command == APCI16XX_TTL_INITDIRECTION)) { memset(devpriv->ul_TTLPortConfiguration, 0, sizeof(devpriv->ul_TTLPortConfiguration)); - /*************************************/ /* Test the port direction selection */ - /*************************************/ - for (b_Cpt = 1; (b_Cpt <= b_NumberOfPort) && (i_ReturnValue >= 0); b_Cpt++) { - /**********************/ /* Test the direction */ - /**********************/ - if ((data[b_Cpt] != 0) && (data[b_Cpt] != 0xFF)) { - /************************/ - /* Port direction error */ - /************************/ - printk("\nPort %d direction selection error", (int) b_Cpt); i_ReturnValue = -(int) b_Cpt; } - /**************************/ /* Save the configuration */ - /**************************/ - devpriv->ul_TTLPortConfiguration[(b_Cpt - 1) / 4] = devpriv->ul_TTLPortConfiguration[(b_Cpt - 1) / 4] | (data[b_Cpt] << (8 * ((b_Cpt - @@ -212,27 +167,15 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, } } - /**************************/ /* Test if no error occur */ - /**************************/ - if (i_ReturnValue >= 0) { - /***********************************/ /* Test if TTL port initilaisation */ - /***********************************/ - if ((b_Command == APCI16XX_TTL_INIT) || (b_Command == APCI16XX_TTL_INITDIRECTION)) { - /******************************/ /* Set all port configuration */ - /******************************/ - for (b_Cpt = 0; b_Cpt <= b_NumberOfPort; b_Cpt++) { if ((b_Cpt % 4) == 0) { - /*************************/ /* Set the configuration */ - /*************************/ - outl(devpriv-> ul_TTLPortConfiguration[b_Cpt / 4], @@ -242,10 +185,7 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, } } - /************************************************/ /* Test if output memory initialisation command */ - /************************************************/ - if (b_Command == APCI16XX_TTL_OUTPUTMEMORY) { if (data[1]) { devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; @@ -257,12 +197,6 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, return i_ReturnValue; } -/* -+----------------------------------------------------------------------------+ -| INPUT FUNCTIONS | -+----------------------------------------------------------------------------+ -*/ - /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI16XX_InsnBitsReadTTLIO | @@ -297,7 +231,6 @@ static int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev, | -103 : The selected TTL digital input is wrong | +----------------------------------------------------------------------------+ */ - static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -314,32 +247,17 @@ static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev, unsigned char *pb_Status; unsigned int dw_Status; - /************************/ /* Test the buffer size */ - /************************/ - if (insn->n >= 1) { - /*******************/ /* Get the command */ - /* **************** */ - b_Command = (unsigned char) data[0]; - /********************/ /* Test the command */ - /********************/ - if ((b_Command == APCI16XX_TTL_READCHANNEL) || (b_Command == APCI16XX_TTL_READPORT)) { - /**************************/ /* Test the selected port */ - /**************************/ - if (b_SelectedPort < b_NumberOfPort) { - /**********************/ /* Test if input port */ - /**********************/ - if (((devpriv->ul_TTLPortConfiguration [b_SelectedPort / 4] >> (8 * @@ -347,78 +265,43 @@ static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev, % 4))) & 0xFF) == 0) { - /***************************/ /* Test the channel number */ - /***************************/ - if ((b_Command == APCI16XX_TTL_READCHANNEL) && (b_InputChannel > 7)) { - /*******************************************/ - /* The selected TTL digital input is wrong */ - /*******************************************/ - printk("\nChannel selection error"); i_ReturnValue = -103; } } else { - /****************************************/ - /* The selected TTL input port is wrong */ - /****************************************/ - printk("\nPort selection error"); i_ReturnValue = -102; } } else { - /****************************************/ - /* The selected TTL input port is wrong */ - /****************************************/ - printk("\nPort selection error"); i_ReturnValue = -102; } } else { - /************************/ - /* Config command error */ - /************************/ - printk("\nCommand selection error"); i_ReturnValue = -100; } } else { - /*******************/ - /* Data size error */ - /*******************/ - printk("\nBuffer size error"); i_ReturnValue = -101; } - /**************************/ /* Test if no error occur */ - /**************************/ - if (i_ReturnValue >= 0) { pb_Status = (unsigned char *) &data[0]; - /*******************************/ /* Get the digital inpu status */ - /*******************************/ - dw_Status = inl(devpriv->iobase + 8 + ((b_SelectedPort / 4) * 4)); dw_Status = (dw_Status >> (8 * (b_SelectedPort % 4))) & 0xFF; - /***********************/ /* Save the port value */ - /***********************/ - *pb_Status = (unsigned char) dw_Status; - /***************************************/ /* Test if read channel status command */ - /***************************************/ - if (b_Command == APCI16XX_TTL_READCHANNEL) { *pb_Status = (*pb_Status >> b_InputChannel) & 1; } @@ -448,7 +331,6 @@ static int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -462,16 +344,10 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, unsigned char b_NumberOfPort = 0; unsigned int *pls_ReadData = data; - /********************/ /* Test the command */ - /********************/ - if ((b_Command == APCI16XX_TTL_READ_ALL_INPUTS) || (b_Command == APCI16XX_TTL_READ_ALL_OUTPUTS)) { - /**********************************/ /* Get the number of 32-Bit ports */ - /**********************************/ - b_NumberOfPort = (unsigned char) (this_board->i_NbrTTLChannel / 32); if ((b_NumberOfPort * 32) < @@ -479,70 +355,41 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, b_NumberOfPort = b_NumberOfPort + 1; } - /************************/ /* Test the buffer size */ - /************************/ - if (insn->n >= b_NumberOfPort) { if (b_Command == APCI16XX_TTL_READ_ALL_INPUTS) { - /**************************/ /* Read all digital input */ - /**************************/ - for (b_Cpt = 0; b_Cpt < b_NumberOfPort; b_Cpt++) { - /************************/ /* Read the 32-Bit port */ - /************************/ - pls_ReadData[b_Cpt] = inl(devpriv->iobase + 8 + (b_Cpt * 4)); - /**************************************/ /* Mask all channels used als outputs */ - /**************************************/ - pls_ReadData[b_Cpt] = pls_ReadData[b_Cpt] & (~devpriv-> ul_TTLPortConfiguration[b_Cpt]); } } else { - /****************************/ /* Read all digital outputs */ - /****************************/ - for (b_Cpt = 0; b_Cpt < b_NumberOfPort; b_Cpt++) { - /************************/ /* Read the 32-Bit port */ - /************************/ - pls_ReadData[b_Cpt] = inl(devpriv->iobase + 20 + (b_Cpt * 4)); - /**************************************/ /* Mask all channels used als outputs */ - /**************************************/ - pls_ReadData[b_Cpt] = pls_ReadData[b_Cpt] & devpriv-> ul_TTLPortConfiguration[b_Cpt]; } } } else { - /*******************/ - /* Data size error */ - /*******************/ - printk("\nBuffer size error"); i_ReturnValue = -101; } } else { - /*****************/ - /* Command error */ - /*****************/ - printk("\nCommand selection error"); i_ReturnValue = -100; } @@ -550,12 +397,6 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, return i_ReturnValue; } -/* -+----------------------------------------------------------------------------+ -| OUTPUT FUNCTIONS | -+----------------------------------------------------------------------------+ -*/ - /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI16XX_InsnBitsWriteTTLIO | @@ -592,7 +433,6 @@ static int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev, | -104 : Output memory disabled | +----------------------------------------------------------------------------+ */ - static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -608,34 +448,19 @@ static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev, unsigned char b_OutputChannel = CR_CHAN(insn->chanspec); unsigned int dw_Status = 0; - /************************/ /* Test the buffer size */ - /************************/ - if (insn->n >= 1) { - /*******************/ /* Get the command */ - /* **************** */ - b_Command = (unsigned char) data[0]; - /********************/ /* Test the command */ - /********************/ - if ((b_Command == APCI16XX_TTL_WRITECHANNEL_ON) || (b_Command == APCI16XX_TTL_WRITEPORT_ON) || (b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) || (b_Command == APCI16XX_TTL_WRITEPORT_OFF)) { - /**************************/ /* Test the selected port */ - /**************************/ - if (b_SelectedPort < b_NumberOfPort) { - /***********************/ /* Test if output port */ - /***********************/ - if (((devpriv->ul_TTLPortConfiguration [b_SelectedPort / 4] >> (8 * @@ -643,126 +468,71 @@ static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev, % 4))) & 0xFF) == 0xFF) { - /***************************/ /* Test the channel number */ - /***************************/ - if (((b_Command == APCI16XX_TTL_WRITECHANNEL_ON) || (b_Command == APCI16XX_TTL_WRITECHANNEL_OFF)) && (b_OutputChannel > 7)) { - /********************************************/ - /* The selected TTL digital output is wrong */ - /********************************************/ - printk("\nChannel selection error"); i_ReturnValue = -103; } if (((b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) || (b_Command == APCI16XX_TTL_WRITEPORT_OFF)) && (devpriv->b_OutputMemoryStatus == ADDIDATA_DISABLE)) { - /********************************************/ - /* The selected TTL digital output is wrong */ - /********************************************/ - printk("\nOutput memory disabled"); i_ReturnValue = -104; } - /************************/ /* Test the buffer size */ - /************************/ - if (((b_Command == APCI16XX_TTL_WRITEPORT_ON) || (b_Command == APCI16XX_TTL_WRITEPORT_OFF)) && (insn->n < 2)) { - /*******************/ - /* Data size error */ - /*******************/ - printk("\nBuffer size error"); i_ReturnValue = -101; } } else { - /*****************************************/ - /* The selected TTL output port is wrong */ - /*****************************************/ - printk("\nPort selection error %lX", (unsigned long)devpriv-> ul_TTLPortConfiguration[0]); i_ReturnValue = -102; } } else { - /****************************************/ - /* The selected TTL output port is wrong */ - /****************************************/ - printk("\nPort selection error %d %d", b_SelectedPort, b_NumberOfPort); i_ReturnValue = -102; } } else { - /************************/ - /* Config command error */ - /************************/ - printk("\nCommand selection error"); i_ReturnValue = -100; } } else { - /*******************/ - /* Data size error */ - /*******************/ - printk("\nBuffer size error"); i_ReturnValue = -101; } - /**************************/ /* Test if no error occur */ - /**************************/ - if (i_ReturnValue >= 0) { - /********************************/ /* Get the digital output state */ - /********************************/ - dw_Status = inl(devpriv->iobase + 20 + ((b_SelectedPort / 4) * 4)); - /**********************************/ /* Test if output memory not used */ - /**********************************/ - if (devpriv->b_OutputMemoryStatus == ADDIDATA_DISABLE) { - /*********************************/ /* Clear the selected port value */ - /*********************************/ - dw_Status = dw_Status & (0xFFFFFFFFUL - (0xFFUL << (8 * (b_SelectedPort % 4)))); } - /******************************/ /* Test if setting channel ON */ - /******************************/ - if (b_Command == APCI16XX_TTL_WRITECHANNEL_ON) { dw_Status = dw_Status | (1UL << ((8 * (b_SelectedPort % 4)) + b_OutputChannel)); } - /***************************/ /* Test if setting port ON */ - /***************************/ - if (b_Command == APCI16XX_TTL_WRITEPORT_ON) { dw_Status = dw_Status | ((data[1] & 0xFF) << (8 * (b_SelectedPort % 4))); } - /*******************************/ /* Test if setting channel OFF */ - /*******************************/ - if (b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) { dw_Status = dw_Status & (0xFFFFFFFFUL - @@ -770,10 +540,7 @@ static int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev, b_OutputChannel))); } - /****************************/ /* Test if setting port OFF */ - /****************************/ - if (b_Command == APCI16XX_TTL_WRITEPORT_OFF) { dw_Status = dw_Status & (0xFFFFFFFFUL - -- 2.39.5