Staging: comedi: replace for loop with msleep()
[pandora-kernel.git] / drivers / staging / comedi / drivers / addi-data / hwdrv_apci3200.c
index 8981b0f..9b53255 100644 (file)
@@ -3,13 +3,13 @@
 
 Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
 
-        ADDI-DATA GmbH
-        Dieselstrasse 3
-        D-77833 Ottersweier
-        Tel: +19(0)7223/9493-0
-        Fax: +49(0)7223/9493-92
-        http://www.addi-data-com
-        info@addi-data.com
+       ADDI-DATA GmbH
+       Dieselstrasse 3
+       D-77833 Ottersweier
+       Tel: +19(0)7223/9493-0
+       Fax: +49(0)7223/9493-92
+       http://www.addi-data-com
+       info@addi-data.com
 
 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
 
@@ -112,7 +112,7 @@ struct str_BoardInfos s_BoardInfos[100];    /*  100 will be the max number of board
 
 int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
        unsigned int dw_PCIBoardEepromAddress,
-       unsigned short w_EepromStartAddress, unsigned short * pw_DataRead)
+       unsigned short w_EepromStartAddress, unsigned short *pw_DataRead)
 {
        unsigned int dw_eeprom_busy = 0;
        int i_Counter = 0;
@@ -132,8 +132,7 @@ int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
                                inl(dw_PCIBoardEepromAddress +
                                AMCC_OP_REG_MCSR);
                        dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
-               }
-               while (dw_eeprom_busy == EEPROM_BUSY);
+               } while (dw_eeprom_busy == EEPROM_BUSY);
 
                for (i_Counter = 0; i_Counter < 2; i_Counter++) {
                        b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256;        /* Read the low 8 bit part */
@@ -150,8 +149,7 @@ int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
                                        inl(dw_PCIBoardEepromAddress +
                                        AMCC_OP_REG_MCSR);
                                dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
-                       }
-                       while (dw_eeprom_busy == EEPROM_BUSY);
+                       } while (dw_eeprom_busy == EEPROM_BUSY);
 
                        /* Load the low address */
                        outb(b_SelectedAddressLow,
@@ -164,8 +162,7 @@ int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
                                        inl(dw_PCIBoardEepromAddress +
                                        AMCC_OP_REG_MCSR);
                                dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
-                       }
-                       while (dw_eeprom_busy == EEPROM_BUSY);
+                       } while (dw_eeprom_busy == EEPROM_BUSY);
 
                        /* Select the load high address mode */
                        outb(NVCMD_LOAD_HIGH,
@@ -178,8 +175,7 @@ int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
                                        inl(dw_PCIBoardEepromAddress +
                                        AMCC_OP_REG_MCSR);
                                dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
-                       }
-                       while (dw_eeprom_busy == EEPROM_BUSY);
+                       } while (dw_eeprom_busy == EEPROM_BUSY);
 
                        /* Load the high address */
                        outb(b_SelectedAddressHigh,
@@ -192,8 +188,7 @@ int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
                                        inl(dw_PCIBoardEepromAddress +
                                        AMCC_OP_REG_MCSR);
                                dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
-                       }
-                       while (dw_eeprom_busy == EEPROM_BUSY);
+                       } while (dw_eeprom_busy == EEPROM_BUSY);
 
                        /* Select the READ mode */
                        outb(NVCMD_BEGIN_READ,
@@ -206,8 +201,7 @@ int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
                                        inl(dw_PCIBoardEepromAddress +
                                        AMCC_OP_REG_MCSR);
                                dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
-                       }
-                       while (dw_eeprom_busy == EEPROM_BUSY);
+                       } while (dw_eeprom_busy == EEPROM_BUSY);
 
                        /* Read data into the EEPROM */
                        *pb_ReadByte =
@@ -220,18 +214,17 @@ int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
                                        inl(dw_PCIBoardEepromAddress +
                                        AMCC_OP_REG_MCSR);
                                dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
-                       }
-                       while (dw_eeprom_busy == EEPROM_BUSY);
+                       } while (dw_eeprom_busy == EEPROM_BUSY);
 
                        /* Select the upper address part */
-                       if (i_Counter == 0) {
+                       if (i_Counter == 0)
                                b_ReadLowByte = pb_ReadByte[0];
-                       } else {
+                       else
                                b_ReadHighByte = pb_ReadByte[0];
-                       }
+
 
                        /* Sleep */
-                       for (i = 0; i < 10000; i++) ;
+                       msleep(1);
 
                }
                w_ReadWord =
@@ -243,7 +236,7 @@ int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
                w_EepromStartAddress += 2;      /*  to read the next word */
 
        }                       /*  for (...) i_NbOfWordsToRead */
-       return (0);
+       return 0;
 }
 
 /*+----------------------------------------------------------------------------+*/
@@ -453,9 +446,9 @@ void v_GetAPCI3200EepromCalibrationValue(unsigned int dw_PCIBoardEepromAddress,
        }
 }
 
-int i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev,
-       unsigned int ui_Channel_num, unsigned int * CJCCurrentSource,
-       unsigned int * ChannelCurrentSource, unsigned int * ChannelGainFactor)
+int i_APCI3200_GetChannelCalibrationValue(struct comedi_device *dev,
+       unsigned int ui_Channel_num, unsigned int *CJCCurrentSource,
+       unsigned int *ChannelCurrentSource, unsigned int *ChannelGainFactor)
 {
        int i_DiffChannel = 0;
        int i_Module = 0;
@@ -522,7 +515,7 @@ int i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev,
 #endif
        /* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
-       return (0);
+       return 0;
 }
 
 /* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
@@ -550,8 +543,8 @@ int i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev,
   +----------------------------------------------------------------------------+
 */
 
-int i_APCI3200_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-       struct comedi_insn * insn, unsigned int * data)
+int i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_insn *insn, unsigned int *data)
 {
        unsigned int ui_Temp = 0;
        unsigned int ui_NoOfChannel = 0;
@@ -608,8 +601,8 @@ int i_APCI3200_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdev
   |                                                                                                                                     |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-       struct comedi_insn * insn, unsigned int * data)
+int i_APCI3200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_insn *insn, unsigned int *data)
 {
 
        if ((data[0] != 0) && (data[0] != 1)) {
@@ -653,8 +646,8 @@ int i_APCI3200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
   |                                                                             |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-       struct comedi_insn * insn, unsigned int * data)
+int i_APCI3200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_insn *insn, unsigned int *data)
 {
        unsigned int ui_Temp = 0, ui_Temp1 = 0;
        unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec);  /*  get the channel */
@@ -766,8 +759,8 @@ int i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
   |                                                                             |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-       struct comedi_insn * insn, unsigned int * data)
+int i_APCI3200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_insn *insn, unsigned int *data)
 {
        unsigned int ui_Temp;
        unsigned int ui_NoOfChannel;
@@ -874,8 +867,8 @@ int i_APCI3200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
   |                                                                             |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s,
-       struct comedi_insn * insn, unsigned int * data)
+int i_APCI3200_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_insn *insn, unsigned int *data)
 {
 
        unsigned int ul_Config = 0, ul_Temp = 0;
@@ -1361,8 +1354,8 @@ int i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde
   |                                                                             |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s,
-       struct comedi_insn * insn, unsigned int * data)
+int i_APCI3200_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_insn *insn, unsigned int *data)
 {
        unsigned int ui_DummyValue = 0;
        int i_ConvertCJCCalibration;
@@ -1651,8 +1644,8 @@ int i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi
   |                                                                             |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev,
-       struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev,
+       struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
        unsigned int ui_EOC = 0;
        unsigned int ui_ChannelNo = 0;
@@ -1776,7 +1769,7 @@ int i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev,
   |                                                                             |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, unsigned int * data)
+int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, unsigned int *data)
 {
        unsigned int ui_Temp = 0, ui_EOC = 0;
        unsigned int ui_CommandRegister = 0;
@@ -1912,7 +1905,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, unsigned i
   |                                                                             |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, unsigned int * data)
+int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int *data)
 {
        unsigned int ui_EOC = 0;
        int ui_CommandRegister = 0;
@@ -2048,7 +2041,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, unsigned int
   +----------------------------------------------------------------------------+
 */
 
-int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data)
+int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data)
 {
        unsigned int ui_EOC = 0;
        int ui_CommandRegister = 0;
@@ -2167,7 +2160,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data)
   |                                                                             |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data)
+int i_APCI3200_ReadCJCCalOffset(struct comedi_device *dev, unsigned int *data)
 {
        unsigned int ui_EOC = 0;
        int ui_CommandRegister = 0;
@@ -2283,7 +2276,7 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data)
   |                                                                             |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data)
+int i_APCI3200_ReadCJCCalGain(struct comedi_device *dev, unsigned int *data)
 {
        unsigned int ui_EOC = 0;
        int ui_CommandRegister = 0;
@@ -2404,8 +2397,8 @@ int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data)
   +----------------------------------------------------------------------------+
 */
 
-int i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev,
-       struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device *dev,
+       struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
        unsigned int ui_Configuration = 0;
        int i_Temp;             /* ,i_TimeUnit; */
@@ -2529,8 +2522,8 @@ int i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev,
   +----------------------------------------------------------------------------+
 */
 
-int i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device * dev,
-       struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device *dev,
+       struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
        i_APCI3200_Reset(dev);
        return insn->n;
@@ -2560,8 +2553,8 @@ int i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device * dev,
   +----------------------------------------------------------------------------+
 */
 
-int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s,
-       struct comedi_cmd * cmd)
+int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_cmd *cmd)
 {
 
        int err = 0;
@@ -2764,7 +2757,7 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
   +----------------------------------------------------------------------------+
 */
 
-int i_APCI3200_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_subdevice * s)
+int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s)
 {
        unsigned int ui_Configuration = 0;
        /* i_InterruptFlag=0; */
@@ -2814,7 +2807,7 @@ int i_APCI3200_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_s
   +----------------------------------------------------------------------------+
 */
 
-int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s)
+int i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s)
 {
        struct comedi_cmd *cmd = &s->async->cmd;
        unsigned int ui_Configuration = 0;
@@ -3001,7 +2994,7 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd
   +----------------------------------------------------------------------------+
 */
 
-int i_APCI3200_Reset(struct comedi_device * dev)
+int i_APCI3200_Reset(struct comedi_device *dev)
 {
        int i_Temp;
        unsigned int dw_Dummy;
@@ -3499,7 +3492,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
   |                                                                                                                                 |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_InterruptHandleEos(struct comedi_device * dev)
+int i_APCI3200_InterruptHandleEos(struct comedi_device *dev)
 {
        unsigned int ui_StatusRegister = 0;
        struct comedi_subdevice *s = dev->subdevices + 0;