Browse Source

Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (342 commits)
  Staging: comedi: fix build errors
  Staging: udlfb: update to version 0.2.3
  Staging: udlfb: fix some sparse warnings.
  Staging: udlfb: clean up checkpatch warnings in udlfb.c
  Staging: udlfb: clean up checkpatch warnings in udlfb.h
  Staging: udlfb: add udlfb driver to build
  Staging: add udlfb driver
  Staging: pata_rdc: remove pointless comments
  Staging: pata_rdc: remove DRIVER macros
  Staging: pata_rdc: remove dbgprintf macro
  Staging: pata_rdc: remove broken flag
  Staging: pata_rdc: fix build warnings
  Staging: pata_rdc: use PCI_DEVICE
  Staging: pata_rdc: remove function prototypes
  Staging: pata_rdc: coding style fixes
  Staging: pata_rdc: convert code to work in 2.6.29
  Staging: pata_rdc: add driver to the build system
  Staging: add pata_rdc driver
  Staging: remove obsolete serqt_usb driver
  Staging: serqt_usb2 add the driver to the build
  ...
Linus Torvalds 16 năm trước cách đây
mục cha
commit
fb20871a54
100 tập tin đã thay đổi với 8194 bổ sung7885 xóa
  1. 1 0
      MAINTAINERS
  2. 12 2
      drivers/staging/Kconfig
  3. 6 1
      drivers/staging/Makefile
  4. 4 5
      drivers/staging/agnx/debug.h
  5. 23 34
      drivers/staging/agnx/pci.c
  6. 2 2
      drivers/staging/agnx/phy.c
  7. 1 1
      drivers/staging/agnx/phy.h
  8. 1 1
      drivers/staging/agnx/sta.c
  9. 1 1
      drivers/staging/agnx/sta.h
  10. 15 19
      drivers/staging/altpciechdma/altpciechdma.c
  11. 9 1
      drivers/staging/android/Kconfig
  12. 1 0
      drivers/staging/android/Makefile
  13. 274 162
      drivers/staging/android/binder.c
  14. 6 6
      drivers/staging/android/logger.c
  15. 69 32
      drivers/staging/android/lowmemorykiller.c
  16. 5 4
      drivers/staging/android/ram_console.c
  17. 43 55
      drivers/staging/android/timed_gpio.c
  18. 3 1
      drivers/staging/android/timed_gpio.h
  19. 121 0
      drivers/staging/android/timed_output.c
  20. 37 0
      drivers/staging/android/timed_output.h
  21. 1 1
      drivers/staging/asus_oled/asus_oled.c
  22. 1 2
      drivers/staging/b3dfg/b3dfg.c
  23. 2 9
      drivers/staging/comedi/Kconfig
  24. 0 5
      drivers/staging/comedi/Makefile
  25. 0 1
      drivers/staging/comedi/comedi.h
  26. 405 99
      drivers/staging/comedi/comedi_fops.c
  27. 0 7
      drivers/staging/comedi/comedi_ksyms.c
  28. 0 149
      drivers/staging/comedi/comedi_rt.h
  29. 14 3
      drivers/staging/comedi/comedidev.h
  30. 9 10
      drivers/staging/comedi/drivers.c
  31. 23 27
      drivers/staging/comedi/drivers/8253.h
  32. 13 10
      drivers/staging/comedi/drivers/8255.c
  33. 7 7
      drivers/staging/comedi/drivers/8255.h
  34. 4 1
      drivers/staging/comedi/drivers/Makefile
  35. 11 11
      drivers/staging/comedi/drivers/acl7225b.c
  36. 186 186
      drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.c
  37. 16 16
      drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.h
  38. 201 201
      drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c
  39. 18 18
      drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.h
  40. 157 152
      drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.c
  41. 4 4
      drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.h
  42. 506 506
      drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c
  43. 94 94
      drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.h
  44. 102 102
      drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.c
  45. 4 4
      drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.h
  46. 657 657
      drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.c
  47. 35 35
      drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.h
  48. 114 116
      drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.c
  49. 3 3
      drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.h
  50. 216 216
      drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c
  51. 4 4
      drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.h
  52. 99 99
      drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.c
  53. 4 4
      drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.h
  54. 56 63
      drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c
  55. 3 3
      drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.h
  56. 6 6
      drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h
  57. 93 98
      drivers/staging/comedi/drivers/addi-data/addi_common.c
  58. 171 185
      drivers/staging/comedi/drivers/addi-data/addi_common.h
  59. 218 220
      drivers/staging/comedi/drivers/addi-data/addi_eeprom.c
  60. 21 22
      drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h
  61. 85 84
      drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c
  62. 1 1
      drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.h
  63. 110 104
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c
  64. 17 17
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h
  65. 54 52
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c
  66. 15 14
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.h
  67. 266 266
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
  68. 2 2
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.h
  69. 87 87
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c
  70. 15 14
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.h
  71. 265 242
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
  72. 27 25
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.h
  73. 67 67
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c
  74. 68 68
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c
  75. 14 12
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.h
  76. 88 88
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c
  77. 17 15
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.h
  78. 87 87
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c
  79. 13 13
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.h
  80. 512 543
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
  81. 75 67
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h
  82. 847 854
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c
  83. 90 86
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h
  84. 113 112
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c
  85. 24 20
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h
  86. 136 138
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c
  87. 1 1
      drivers/staging/comedi/drivers/addi_apci_035.c
  88. 87 90
      drivers/staging/comedi/drivers/adl_pci6208.c
  89. 11 11
      drivers/staging/comedi/drivers/adl_pci7296.c
  90. 16 16
      drivers/staging/comedi/drivers/adl_pci7432.c
  91. 86 239
      drivers/staging/comedi/drivers/adl_pci8164.c
  92. 68 67
      drivers/staging/comedi/drivers/adl_pci9111.c
  93. 326 322
      drivers/staging/comedi/drivers/adl_pci9118.c
  94. 41 41
      drivers/staging/comedi/drivers/adq12b.c
  95. 176 172
      drivers/staging/comedi/drivers/adv_pci1710.c
  96. 62 60
      drivers/staging/comedi/drivers/adv_pci1723.c
  97. 60 52
      drivers/staging/comedi/drivers/adv_pci_dio.c
  98. 23 23
      drivers/staging/comedi/drivers/aio_aio12_8.c
  99. 22 22
      drivers/staging/comedi/drivers/aio_iiro_16.c
  100. 8 8
      drivers/staging/comedi/drivers/am9513.h

+ 1 - 0
MAINTAINERS

@@ -5479,6 +5479,7 @@ STAGING SUBSYSTEM
 P:	Greg Kroah-Hartman
 M:	gregkh@suse.de
 T:	quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
+L:	devel@driverdev.osuosl.org
 S:	Maintained
 F:	drivers/staging/
 

+ 12 - 2
drivers/staging/Kconfig

@@ -85,6 +85,8 @@ source "drivers/staging/altpciechdma/Kconfig"
 
 source "drivers/staging/rtl8187se/Kconfig"
 
+source "drivers/staging/rtl8192su/Kconfig"
+
 source "drivers/staging/rspiusb/Kconfig"
 
 source "drivers/staging/mimio/Kconfig"
@@ -113,11 +115,19 @@ source "drivers/staging/heci/Kconfig"
 
 source "drivers/staging/line6/Kconfig"
 
-source "drivers/staging/serqt_usb/Kconfig"
-
 source "drivers/gpu/drm/radeon/Kconfig"
 
 source "drivers/staging/octeon/Kconfig"
 
+source "drivers/staging/serqt_usb2/Kconfig"
+
+source "drivers/staging/vt6655/Kconfig"
+
+source "drivers/staging/cpc-usb/Kconfig"
+
+source "drivers/staging/pata_rdc/Kconfig"
+
+source "drivers/staging/udlfb/Kconfig"
+
 endif # !STAGING_EXCLUDE_BUILD
 endif # STAGING

+ 6 - 1
drivers/staging/Makefile

@@ -25,6 +25,7 @@ obj-$(CONFIG_ASUS_OLED)		+= asus_oled/
 obj-$(CONFIG_PANEL)		+= panel/
 obj-$(CONFIG_ALTERA_PCIE_CHDMA)	+= altpciechdma/
 obj-$(CONFIG_RTL8187SE)		+= rtl8187se/
+obj-$(CONFIG_RTL8192SU)		+= rtl8192su/
 obj-$(CONFIG_USB_RSPI)		+= rspiusb/
 obj-$(CONFIG_INPUT_MIMIO)	+= mimio/
 obj-$(CONFIG_TRANZPORT)		+= frontier/
@@ -39,5 +40,9 @@ obj-$(CONFIG_IDE_PHISON)	+= phison/
 obj-$(CONFIG_PLAN9AUTH)		+= p9auth/
 obj-$(CONFIG_HECI)		+= heci/
 obj-$(CONFIG_LINE6_USB)		+= line6/
-obj-$(CONFIG_USB_SERIAL_QUATECH_ESU100)	+= serqt_usb/
+obj-$(CONFIG_USB_SERIAL_QUATECH2)	+= serqt_usb2/
 obj-$(CONFIG_OCTEON_ETHERNET)	+= octeon/
+obj-$(CONFIG_VT6655)		+= vt6655/
+obj-$(CONFIG_USB_CPC)		+= cpc-usb/
+obj-$(CONFIG_RDC_17F3101X)	+= pata_rdc/
+obj-$(CONFIG_FB_UDL)		+= udlfb/

+ 4 - 5
drivers/staging/agnx/debug.h

@@ -312,7 +312,6 @@ static inline void dump_ieee80211_hdr(struct ieee80211_hdr *hdr, char *tag)
 {
 	u16 fctl;
 	int hdrlen;
-	DECLARE_MAC_BUF(mac);
 
 	fctl = le16_to_cpu(hdr->frame_control);
 	switch (fctl & IEEE80211_FCTL_FTYPE) {
@@ -375,13 +374,13 @@ static inline void dump_ieee80211_hdr(struct ieee80211_hdr *hdr, char *tag)
 		printk("FC=0x%04x DUR=0x%04x",
 		       fctl, le16_to_cpu(hdr->duration_id));
 	if (hdrlen >= 10)
-		printk(" A1=%s", print_mac(mac, hdr->addr1));
+		printk(" A1=%pM", hdr->addr1);
 	if (hdrlen >= 16)
-		printk(" A2=%s", print_mac(mac, hdr->addr2));
+		printk(" A2=%pM", hdr->addr2);
 	if (hdrlen >= 24)
-		printk(" A3=%s", print_mac(mac, hdr->addr3));
+		printk(" A3=%pM", hdr->addr3);
 	if (hdrlen >= 30)
-		printk(" A4=%s", print_mac(mac, hdr->addr4));
+		printk(" A4=%pM", hdr->addr4);
 	printk("\n");
 }
 

+ 23 - 34
drivers/staging/agnx/pci.c

@@ -58,15 +58,17 @@ static inline void agnx_interrupt_ack(struct agnx_priv *priv, u32 *reason)
 			*reason |= AGNX_STAT_TXM;
 		}
 	}
-/*	if (*reason & AGNX_STAT_X) {
+#if 0
+	if (*reason & AGNX_STAT_X) {
 		reg = ioread32(ctl + AGNX_INT_STAT);
 		iowrite32(reg, ctl + AGNX_INT_STAT);
-		/* FIXME reinit interrupt mask *\/
+		/* FIXME reinit interrupt mask */
 		reg = 0xc390bf9 & ~IRQ_TX_BEACON;
 		reg &= ~IRQ_TX_DISABLE;
 		iowrite32(reg, ctl + AGNX_INT_MASK);
 		iowrite32(0x800, ctl + AGNX_CIR_BLKCTL);
-	} */
+	}
+#endif
 } /* agnx_interrupt_ack */
 
 static irqreturn_t agnx_interrupt_handler(int irq, void *dev_id)
@@ -150,8 +152,7 @@ static int agnx_get_mac_address(struct agnx_priv *priv)
 	*((u32 *)(priv->mac_addr + 2)) = cpu_to_le32(reg);
 
 	if (!is_valid_ether_addr(priv->mac_addr)) {
-		DECLARE_MAC_BUF(mbuf);
-		printk(KERN_WARNING PFX "read mac %s\n", print_mac(mbuf, priv->mac_addr));
+		printk(KERN_WARNING PFX "read mac %pM\n", priv->mac_addr);
 		printk(KERN_WARNING PFX "Invalid hwaddr! Using random hwaddr\n");
 		random_ether_addr(priv->mac_addr);
 	}
@@ -220,7 +221,7 @@ static void agnx_periodic_work_handler(struct work_struct *work)
 	/* TODO Recalibrate*/
 /*	calibrate_oscillator(priv); */
 /*	antenna_calibrate(priv); */
-/*	agnx_send_packet(priv, 997); /
+/*	agnx_send_packet(priv, 997); */
 	/* FIXME */
 /* 	if (debug == 3) */
 /*                 delay = msecs_to_jiffies(AGNX_PERIODIC_DELAY); */
@@ -455,47 +456,35 @@ static int __devinit agnx_pci_probe(struct pci_dev *pdev,
 {
 	struct ieee80211_hw *dev;
 	struct agnx_priv *priv;
-	u32 mem_addr0, mem_len0;
-	u32 mem_addr1, mem_len1;
 	int err;
-	DECLARE_MAC_BUF(mac);
 
 	err = pci_enable_device(pdev);
 	if (err) {
-		printk(KERN_ERR PFX "Can't enable new PCI device\n");
+		dev_err(&pdev->dev, "can't enable pci device\n");
 		return err;
 	}
 
-	/* get pci resource */
-	mem_addr0 = pci_resource_start(pdev, 0);
-	mem_len0 = pci_resource_len(pdev, 0);
-	mem_addr1 = pci_resource_start(pdev, 1);
-	mem_len1 = pci_resource_len(pdev, 1);
-	printk(KERN_DEBUG PFX "Memaddr0 is %x, length is %x\n", mem_addr0, mem_len0);
-	printk(KERN_DEBUG PFX "Memaddr1 is %x, length is %x\n", mem_addr1, mem_len1);
-
 	err = pci_request_regions(pdev, "agnx-pci");
 	if (err) {
-		printk(KERN_ERR PFX "Can't obtain PCI resource\n");
+		dev_err(&pdev->dev, "can't reserve PCI resources\n");
 		return err;
 	}
 
 	if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) ||
 	    pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
-		printk(KERN_ERR PFX "No suitable DMA available\n");
+		dev_err(&pdev->dev, "no suitable DMA available\n");
+		err = -EIO;
 		goto err_free_reg;
 	}
 
 	pci_set_master(pdev);
-	printk(KERN_DEBUG PFX "pdev->irq is %d\n", pdev->irq);
 
 	dev = ieee80211_alloc_hw(sizeof(*priv), &agnx_ops);
 	if (!dev) {
-		printk(KERN_ERR PFX "ieee80211 alloc failed\n");
+		dev_err(&pdev->dev, "ieee80211 alloc failed\n");
 		err = -ENOMEM;
 		goto err_free_reg;
 	}
-	/* init priv  */
 	priv = dev->priv;
 	memset(priv, 0, sizeof(*priv));
 	priv->mode = NL80211_IFTYPE_MONITOR;
@@ -504,17 +493,17 @@ static int __devinit agnx_pci_probe(struct pci_dev *pdev,
 	spin_lock_init(&priv->lock);
 	priv->init_status = AGNX_UNINIT;
 
-	/* Map mem #1 and #2 */
-	priv->ctl = pci_iomap(pdev, 0, mem_len0);
-/*	printk(KERN_DEBUG PFX"MEM1 mapped address is 0x%p\n", priv->ctl); */
+	priv->ctl = pci_iomap(pdev, 0, 0);
+/*	dev_dbg(&pdev->dev, "MEM1 mapped address is 0x%p\n", priv->ctl); */
 	if (!priv->ctl) {
-		printk(KERN_ERR PFX "Can't map device memory\n");
+		dev_err(&pdev->dev, "can't map device memory\n");
+		err = -ENOMEM;
 		goto err_free_dev;
 	}
-	priv->data = pci_iomap(pdev, 1, mem_len1);
-	printk(KERN_DEBUG PFX "MEM2 mapped address is 0x%p\n", priv->data);
+	priv->data = pci_iomap(pdev, 1, 0);
 	if (!priv->data) {
-		printk(KERN_ERR PFX "Can't map device memory\n");
+		dev_err(&pdev->dev, "can't map device memory\n");
+		err = -ENOMEM;
 		goto err_iounmap2;
 	}
 
@@ -555,15 +544,15 @@ static int __devinit agnx_pci_probe(struct pci_dev *pdev,
 
 	err = ieee80211_register_hw(dev);
 	if (err) {
-		printk(KERN_ERR PFX "Can't register hardware\n");
+		dev_err(&pdev->dev, "can't register hardware\n");
 		goto err_iounmap;
 	}
 
 	agnx_hw_reset(priv);
 
-
-	printk(PFX "%s: hwaddr %s, Rev 0x%02x\n", wiphy_name(dev->wiphy),
-	       print_mac(mac, dev->wiphy->perm_addr), priv->revid);
+	dev_info(&pdev->dev, "%s: hwaddr %pM, Rev 0x%02x\n",
+		wiphy_name(dev->wiphy),
+		dev->wiphy->perm_addr, priv->revid);
 	return 0;
 
  err_iounmap:

+ 2 - 2
drivers/staging/agnx/phy.c

@@ -118,7 +118,7 @@ static void mac_address_set(struct agnx_priv *priv)
 	iowrite32(reg, ctl + AGNX_RXM_MACLO);
 }
 
-static void receiver_bssid_set(struct agnx_priv *priv, u8 *bssid)
+static void receiver_bssid_set(struct agnx_priv *priv, const u8 *bssid)
 {
 	void __iomem *ctl = priv->ctl;
 	u32 reg;
@@ -954,7 +954,7 @@ int agnx_set_ssid(struct agnx_priv *priv, u8 *ssid, size_t ssid_len)
 	return 0;
 }
 
-void agnx_set_bssid(struct agnx_priv *priv, u8 *bssid)
+void agnx_set_bssid(struct agnx_priv *priv, const u8 *bssid)
 {
 	receiver_bssid_set(priv, bssid);
 }

+ 1 - 1
drivers/staging/agnx/phy.h

@@ -401,7 +401,7 @@ u8 read_from_eeprom(struct agnx_priv *priv, u16 address);
 void agnx_hw_init(struct agnx_priv *priv);
 int agnx_hw_reset(struct agnx_priv *priv);
 int agnx_set_ssid(struct agnx_priv *priv, u8 *ssid, size_t ssid_len);
-void agnx_set_bssid(struct agnx_priv *priv, u8 *bssid);
+void agnx_set_bssid(struct agnx_priv *priv, const u8 *bssid);
 void enable_power_saving(struct agnx_priv *priv);
 void disable_power_saving(struct agnx_priv *priv);
 void calibrate_antenna_period(unsigned long data);

+ 1 - 1
drivers/staging/agnx/sta.c

@@ -22,7 +22,7 @@ void hash_read(struct agnx_priv *priv, u32 reghi, u32 reglo, u8 sta_id)
 	printk(PFX "RX hash cmd are : %.8x%.8x\n", reghi, reglo);
 }
 
-void hash_write(struct agnx_priv *priv, u8 *mac_addr, u8 sta_id)
+void hash_write(struct agnx_priv *priv, const u8 *mac_addr, u8 sta_id)
 {
 	void __iomem *ctl = priv->ctl;
 	u32 reghi, reglo;

+ 1 - 1
drivers/staging/agnx/sta.h

@@ -201,7 +201,7 @@ struct agnx_beacon_hdr {
 	/* 802.11(abg) beacon */
 } __attribute__((__packed__));
 
-void hash_write(struct agnx_priv *priv, u8 *mac_addr, u8 sta_id);
+void hash_write(struct agnx_priv *priv, const u8 *mac_addr, u8 sta_id);
 void hash_dump(struct agnx_priv *priv, u8 sta_id);
 void hash_read(struct agnx_priv *priv, u32 reghi, u32 reglo, u8 sta_id);
 void hash_delete(struct agnx_priv *priv, u32 reghi, u32 reglo, u8 sta_id);

+ 15 - 19
drivers/staging/altpciechdma/altpciechdma.c

@@ -399,6 +399,7 @@ static inline void ape_chdma_desc_set(struct ape_chdma_desc *desc, dma_addr_t ad
 	desc->rc_addr_l = cpu_to_le32(pci_dma_l(addr));
 }
 
+#if ALTPCIECHDMA_CDEV
 /*
  * ape_sg_to_chdma_table() - Create a device descriptor table from a scatterlist.
  *
@@ -456,6 +457,7 @@ static int ape_sg_to_chdma_table(struct scatterlist *sgl, int nents, int first,
 	j++;
 	return j;
 }
+#endif
 
 /* compare buffers */
 static inline int compare(u32 *p, u32 *q, int len)
@@ -540,8 +542,8 @@ static int __devinit dma_test(struct ape_dev *ape, struct pci_dev *dev)
 		printk(KERN_DEBUG "Could not allocate coherent DMA buffer.\n");
 		goto fail;
 	}
-	printk(KERN_DEBUG "Allocated cache-coherent DMA buffer (virtual address = 0x%016llx, bus address = 0x%016llx).\n",
-		(u64)buffer_virt, (u64)buffer_bus);
+	printk(KERN_DEBUG "Allocated cache-coherent DMA buffer (virtual address = %p, bus address = 0x%016llx).\n",
+	       buffer_virt, (u64)buffer_bus);
 
 	/* fill first half of buffer with its virtual address as data */
 	for (i = 0; i < 4 * PAGE_SIZE; i += 4)
@@ -783,7 +785,7 @@ static int __devinit probe(struct pci_dev *dev, const struct pci_device_id *id)
 		goto err_ape;
 	}
 	ape->pci_dev = dev;
-	dev->dev.driver_data = (void *)ape;
+	dev_set_drvdata(&dev->dev, ape);
 	printk(KERN_DEBUG "probe() ape = 0x%p\n", ape);
 
 	printk(KERN_DEBUG "sizeof(struct ape_chdma_table) = %d.\n",
@@ -801,8 +803,8 @@ static int __devinit probe(struct pci_dev *dev, const struct pci_device_id *id)
 		goto err_table;
 	}
 
-	printk(KERN_DEBUG "table_virt = 0x%16llx, table_bus = 0x%16llx.\n",
-		(u64)ape->table_virt, (u64)ape->table_bus);
+	printk(KERN_DEBUG "table_virt = %p, table_bus = 0x%16llx.\n",
+		ape->table_virt, (u64)ape->table_bus);
 
 	/* enable device */
 	rc = pci_enable_device(dev);
@@ -913,9 +915,11 @@ static int __devinit probe(struct pci_dev *dev, const struct pci_device_id *id)
 	rc = 0;
 	printk(KERN_DEBUG "probe() successful.\n");
 	goto end;
+#if ALTPCIECHDMA_CDEV
 err_cdev:
 	/* unmap the BARs */
 	unmap_bars(ape, dev);
+#endif
 err_map:
 	/* free allocated irq */
 	if (ape->irq_line >= 0)
@@ -930,7 +934,7 @@ static int __devinit probe(struct pci_dev *dev, const struct pci_device_id *id)
 		pci_release_regions(dev);
 err_mask:
 err_regions:
-err_rev:
+/*err_rev:*/
 /* clean up everything before device enable() */
 err_enable:
 	if (ape->table_virt)
@@ -946,19 +950,11 @@ static int __devinit probe(struct pci_dev *dev, const struct pci_device_id *id)
 
 static void __devexit remove(struct pci_dev *dev)
 {
-	struct ape_dev *ape;
+	struct ape_dev *ape = dev_get_drvdata(&dev->dev);
+
 	printk(KERN_DEBUG "remove(0x%p)\n", dev);
-	if ((dev == 0) || (dev->dev.driver_data == 0)) {
-		printk(KERN_DEBUG "remove(dev = 0x%p) dev->dev.driver_data = 0x%p\n",
-			dev, (dev? dev->dev.driver_data: NULL));
-		return;
-	}
-	ape = (struct ape_dev *)dev->dev.driver_data;
-	printk(KERN_DEBUG "remove(dev = 0x%p) where dev->dev.driver_data = 0x%p\n", dev, ape);
-	if (ape->pci_dev != dev) {
-		printk(KERN_DEBUG "dev->dev.driver_data->pci_dev (0x%08lx) != dev (0x%08lx)\n",
-		(unsigned long)ape->pci_dev, (unsigned long)dev);
-	}
+	printk(KERN_DEBUG "remove(dev = 0x%p) where ape = 0x%p\n", dev, ape);
+
 	/* remove character device */
 #if ALTPCIECHDMA_CDEV
 	sg_exit(ape);
@@ -1151,7 +1147,7 @@ static struct pci_driver pci_driver = {
 	.name = DRV_NAME,
 	.id_table = ids,
 	.probe = probe,
-	.remove = remove,
+	.remove = __devexit_p(remove),
 	/* resume, suspend are optional */
 };
 

+ 9 - 1
drivers/staging/android/Kconfig

@@ -6,6 +6,8 @@ config ANDROID
 	---help---
 	  Enable support for various drivers needed on the Android platform
 
+if ANDROID
+
 config ANDROID_BINDER_IPC
 	bool "Android Binder IPC Driver"
 	default n
@@ -73,9 +75,13 @@ config ANDROID_RAM_CONSOLE_EARLY_SIZE
 	default 0
 	depends on ANDROID_RAM_CONSOLE_EARLY_INIT
 
+config ANDROID_TIMED_OUTPUT
+	bool "Timed output class driver"
+	default y
+
 config ANDROID_TIMED_GPIO
 	tristate "Android timed gpio driver"
-	depends on GENERIC_GPIO
+	depends on GENERIC_GPIO && ANDROID_TIMED_OUTPUT
 	default n
 
 config ANDROID_LOW_MEMORY_KILLER
@@ -84,4 +90,6 @@ config ANDROID_LOW_MEMORY_KILLER
 	---help---
 	  Register processes to be killed when memory is low
 
+endif # if ANDROID
+
 endmenu

+ 1 - 0
drivers/staging/android/Makefile

@@ -1,5 +1,6 @@
 obj-$(CONFIG_ANDROID_BINDER_IPC)	+= binder.o
 obj-$(CONFIG_ANDROID_LOGGER)		+= logger.o
 obj-$(CONFIG_ANDROID_RAM_CONSOLE)	+= ram_console.o
+obj-$(CONFIG_ANDROID_TIMED_OUTPUT)	+= timed_output.o
 obj-$(CONFIG_ANDROID_TIMED_GPIO)	+= timed_gpio.o
 obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER)	+= lowmemorykiller.o

+ 274 - 162
drivers/staging/android/binder.c

@@ -44,8 +44,8 @@ static struct hlist_head binder_dead_nodes;
 static HLIST_HEAD(binder_deferred_list);
 static DEFINE_MUTEX(binder_deferred_lock);
 
-static int binder_read_proc_proc(
-	char *page, char **start, off_t off, int count, int *eof, void *data);
+static int binder_read_proc_proc(char *page, char **start, off_t off,
+				 int count, int *eof, void *data);
 
 /* This is only defined in include/asm-arm/sizes.h */
 #ifndef SZ_1K
@@ -81,12 +81,15 @@ enum {
 static uint32_t binder_debug_mask = BINDER_DEBUG_USER_ERROR |
 	BINDER_DEBUG_FAILED_TRANSACTION | BINDER_DEBUG_DEAD_TRANSACTION;
 module_param_named(debug_mask, binder_debug_mask, uint, S_IWUSR | S_IRUGO);
+
 static int binder_debug_no_lock;
 module_param_named(proc_no_lock, binder_debug_no_lock, bool, S_IWUSR | S_IRUGO);
+
 static DECLARE_WAIT_QUEUE_HEAD(binder_user_error_wait);
 static int binder_stop_on_user_error;
-static int binder_set_stop_on_user_error(
-	const char *val, struct kernel_param *kp)
+
+static int binder_set_stop_on_user_error(const char *val,
+					 struct kernel_param *kp)
 {
 	int ret;
 	ret = param_set_int(val, kp);
@@ -185,13 +188,13 @@ struct binder_node {
 	int local_strong_refs;
 	void __user *ptr;
 	void __user *cookie;
-	unsigned has_strong_ref : 1;
-	unsigned pending_strong_ref : 1;
-	unsigned has_weak_ref : 1;
-	unsigned pending_weak_ref : 1;
-	unsigned has_async_transaction : 1;
-	unsigned accept_fds : 1;
-	int min_priority : 8;
+	unsigned has_strong_ref:1;
+	unsigned pending_strong_ref:1;
+	unsigned has_weak_ref:1;
+	unsigned pending_weak_ref:1;
+	unsigned has_async_transaction:1;
+	unsigned accept_fds:1;
+	unsigned min_priority:8;
 	struct list_head async_todo;
 };
 
@@ -221,10 +224,10 @@ struct binder_buffer {
 	struct list_head entry; /* free and allocated entries by addesss */
 	struct rb_node rb_node; /* free entry by size or allocated entry */
 				/* by address */
-	unsigned free : 1;
-	unsigned allow_user_free : 1;
-	unsigned async_transaction : 1;
-	unsigned debug_id : 29;
+	unsigned free:1;
+	unsigned allow_user_free:1;
+	unsigned async_transaction:1;
+	unsigned debug_id:29;
 
 	struct binder_transaction *transaction;
 
@@ -306,8 +309,8 @@ struct binder_transaction {
 	struct binder_proc *to_proc;
 	struct binder_thread *to_thread;
 	struct binder_transaction *to_parent;
-	unsigned need_reply : 1;
-	/*unsigned is_dead : 1;*/ /* not used at the moment */
+	unsigned need_reply:1;
+	/* unsigned is_dead:1; */	/* not used at the moment */
 
 	struct binder_buffer *buffer;
 	unsigned int	code;
@@ -474,8 +477,8 @@ static void binder_set_nice(long nice)
 	binder_user_error("binder: %d RLIMIT_NICE not set\n", current->pid);
 }
 
-static size_t binder_buffer_size(
-	struct binder_proc *proc, struct binder_buffer *buffer)
+static size_t binder_buffer_size(struct binder_proc *proc,
+				 struct binder_buffer *buffer)
 {
 	if (list_is_last(&buffer->entry, &proc->buffers))
 		return proc->buffer + proc->buffer_size - (void *)buffer->data;
@@ -484,8 +487,8 @@ static size_t binder_buffer_size(
 			struct binder_buffer, entry) - (size_t)buffer->data;
 }
 
-static void binder_insert_free_buffer(
-	struct binder_proc *proc, struct binder_buffer *new_buffer)
+static void binder_insert_free_buffer(struct binder_proc *proc,
+				      struct binder_buffer *new_buffer)
 {
 	struct rb_node **p = &proc->free_buffers.rb_node;
 	struct rb_node *parent = NULL;
@@ -517,8 +520,8 @@ static void binder_insert_free_buffer(
 	rb_insert_color(&new_buffer->rb_node, &proc->free_buffers);
 }
 
-static void binder_insert_allocated_buffer(
-	struct binder_proc *proc, struct binder_buffer *new_buffer)
+static void binder_insert_allocated_buffer(struct binder_proc *proc,
+					   struct binder_buffer *new_buffer)
 {
 	struct rb_node **p = &proc->allocated_buffers.rb_node;
 	struct rb_node *parent = NULL;
@@ -542,8 +545,8 @@ static void binder_insert_allocated_buffer(
 	rb_insert_color(&new_buffer->rb_node, &proc->allocated_buffers);
 }
 
-static struct binder_buffer *binder_buffer_lookup(
-	struct binder_proc *proc, void __user *user_ptr)
+static struct binder_buffer *binder_buffer_lookup(struct binder_proc *proc,
+						  void __user *user_ptr)
 {
 	struct rb_node *n = proc->allocated_buffers.rb_node;
 	struct binder_buffer *buffer;
@@ -567,7 +570,8 @@ static struct binder_buffer *binder_buffer_lookup(
 }
 
 static int binder_update_page_range(struct binder_proc *proc, int allocate,
-	void *start, void *end, struct vm_area_struct *vma)
+				    void *start, void *end,
+				    struct vm_area_struct *vma)
 {
 	void *page_addr;
 	unsigned long user_page_addr;
@@ -664,7 +668,8 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
 }
 
 static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
-	size_t data_size, size_t offsets_size, int is_async)
+					      size_t data_size,
+					      size_t offsets_size, int is_async)
 {
 	struct rb_node *n = proc->free_buffers.rb_node;
 	struct binder_buffer *buffer;
@@ -692,8 +697,9 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
 	if (is_async &&
 	    proc->free_async_space < size + sizeof(struct binder_buffer)) {
 		if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
-			printk(KERN_ERR "binder: %d: binder_alloc_buf size %zd f"
-			       "ailed, no async space left\n", proc->pid, size);
+			printk(KERN_ERR
+			       "binder: %d: binder_alloc_buf size %zd failed, "
+			       "no async space left\n", proc->pid, size);
 		return NULL;
 	}
 
@@ -777,8 +783,8 @@ static void *buffer_end_page(struct binder_buffer *buffer)
 	return (void *)(((uintptr_t)(buffer + 1) - 1) & PAGE_MASK);
 }
 
-static void binder_delete_free_buffer(
-	struct binder_proc *proc, struct binder_buffer *buffer)
+static void binder_delete_free_buffer(struct binder_proc *proc,
+				      struct binder_buffer *buffer)
 {
 	struct binder_buffer *prev, *next = NULL;
 	int free_page_end = 1;
@@ -824,8 +830,8 @@ static void binder_delete_free_buffer(
 	}
 }
 
-static void binder_free_buf(
-	struct binder_proc *proc, struct binder_buffer *buffer)
+static void binder_free_buf(struct binder_proc *proc,
+			    struct binder_buffer *buffer)
 {
 	size_t size, buffer_size;
 
@@ -877,8 +883,8 @@ static void binder_free_buf(
 	binder_insert_free_buffer(proc, buffer);
 }
 
-static struct binder_node *
-binder_get_node(struct binder_proc *proc, void __user *ptr)
+static struct binder_node *binder_get_node(struct binder_proc *proc,
+					   void __user *ptr)
 {
 	struct rb_node *n = proc->nodes.rb_node;
 	struct binder_node *node;
@@ -896,8 +902,9 @@ binder_get_node(struct binder_proc *proc, void __user *ptr)
 	return NULL;
 }
 
-static struct binder_node *
-binder_new_node(struct binder_proc *proc, void __user *ptr, void __user *cookie)
+static struct binder_node *binder_new_node(struct binder_proc *proc,
+					   void __user *ptr,
+					   void __user *cookie)
 {
 	struct rb_node **p = &proc->nodes.rb_node;
 	struct rb_node *parent = NULL;
@@ -935,9 +942,8 @@ binder_new_node(struct binder_proc *proc, void __user *ptr, void __user *cookie)
 	return node;
 }
 
-static int
-binder_inc_node(struct binder_node *node, int strong, int internal,
-		struct list_head *target_list)
+static int binder_inc_node(struct binder_node *node, int strong, int internal,
+			   struct list_head *target_list)
 {
 	if (strong) {
 		if (internal) {
@@ -971,8 +977,7 @@ binder_inc_node(struct binder_node *node, int strong, int internal,
 	return 0;
 }
 
-static int
-binder_dec_node(struct binder_node *node, int strong, int internal)
+static int binder_dec_node(struct binder_node *node, int strong, int internal)
 {
 	if (strong) {
 		if (internal)
@@ -1014,8 +1019,8 @@ binder_dec_node(struct binder_node *node, int strong, int internal)
 }
 
 
-static struct binder_ref *
-binder_get_ref(struct binder_proc *proc, uint32_t desc)
+static struct binder_ref *binder_get_ref(struct binder_proc *proc,
+					 uint32_t desc)
 {
 	struct rb_node *n = proc->refs_by_desc.rb_node;
 	struct binder_ref *ref;
@@ -1033,8 +1038,8 @@ binder_get_ref(struct binder_proc *proc, uint32_t desc)
 	return NULL;
 }
 
-static struct binder_ref *
-binder_get_ref_for_node(struct binder_proc *proc, struct binder_node *node)
+static struct binder_ref *binder_get_ref_for_node(struct binder_proc *proc,
+						  struct binder_node *node)
 {
 	struct rb_node *n;
 	struct rb_node **p = &proc->refs_by_node.rb_node;
@@ -1099,8 +1104,7 @@ binder_get_ref_for_node(struct binder_proc *proc, struct binder_node *node)
 	return new_ref;
 }
 
-static void
-binder_delete_ref(struct binder_ref *ref)
+static void binder_delete_ref(struct binder_ref *ref)
 {
 	if (binder_debug_mask & BINDER_DEBUG_INTERNAL_REFS)
 		printk(KERN_INFO "binder: %d delete ref %d desc %d for "
@@ -1125,9 +1129,8 @@ binder_delete_ref(struct binder_ref *ref)
 	binder_stats.obj_deleted[BINDER_STAT_REF]++;
 }
 
-static int
-binder_inc_ref(
-	struct binder_ref *ref, int strong, struct list_head *target_list)
+static int binder_inc_ref(struct binder_ref *ref, int strong,
+			  struct list_head *target_list)
 {
 	int ret;
 	if (strong) {
@@ -1149,8 +1152,7 @@ binder_inc_ref(
 }
 
 
-static int
-binder_dec_ref(struct binder_ref *ref, int strong)
+static int binder_dec_ref(struct binder_ref *ref, int strong)
 {
 	if (strong) {
 		if (ref->strong == 0) {
@@ -1182,9 +1184,8 @@ binder_dec_ref(struct binder_ref *ref, int strong)
 	return 0;
 }
 
-static void
-binder_pop_transaction(
-	struct binder_thread *target_thread, struct binder_transaction *t)
+static void binder_pop_transaction(struct binder_thread *target_thread,
+				   struct binder_transaction *t)
 {
 	if (target_thread) {
 		BUG_ON(target_thread->transaction_stack != t);
@@ -1200,8 +1201,8 @@ binder_pop_transaction(
 	binder_stats.obj_deleted[BINDER_STAT_TRANSACTION]++;
 }
 
-static void
-binder_send_failed_reply(struct binder_transaction *t, uint32_t error_code)
+static void binder_send_failed_reply(struct binder_transaction *t,
+				     uint32_t error_code)
 {
 	struct binder_thread *target_thread;
 	BUG_ON(t->flags & TF_ONE_WAY);
@@ -1253,13 +1254,13 @@ binder_send_failed_reply(struct binder_transaction *t, uint32_t error_code)
 	}
 }
 
-static void
-binder_transaction_buffer_release(struct binder_proc *proc,
-			struct binder_buffer *buffer, size_t *failed_at);
+static void binder_transaction_buffer_release(struct binder_proc *proc,
+					      struct binder_buffer *buffer,
+					      size_t *failed_at);
 
-static void
-binder_transaction(struct binder_proc *proc, struct binder_thread *thread,
-	struct binder_transaction_data *tr, int reply)
+static void binder_transaction(struct binder_proc *proc,
+			       struct binder_thread *thread,
+			       struct binder_transaction_data *tr, int reply)
 {
 	struct binder_transaction *t;
 	struct binder_work *tcomplete;
@@ -1661,8 +1662,9 @@ binder_transaction(struct binder_proc *proc, struct binder_thread *thread,
 		thread->return_error = return_error;
 }
 
-static void
-binder_transaction_buffer_release(struct binder_proc *proc, struct binder_buffer *buffer, size_t *failed_at)
+static void binder_transaction_buffer_release(struct binder_proc *proc,
+					      struct binder_buffer *buffer,
+					      size_t *failed_at)
 {
 	size_t *offp, *off_end;
 	int debug_id = buffer->debug_id;
@@ -1730,9 +1732,8 @@ binder_transaction_buffer_release(struct binder_proc *proc, struct binder_buffer
 	}
 }
 
-int
-binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
-		    void __user *buffer, int size, signed long *consumed)
+int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
+			void __user *buffer, int size, signed long *consumed)
 {
 	uint32_t cmd;
 	void __user *ptr = buffer + *consumed;
@@ -2104,7 +2105,8 @@ binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
 		} break;
 
 		default:
-			printk(KERN_ERR "binder: %d:%d unknown command %d\n", proc->pid, thread->pid, cmd);
+			printk(KERN_ERR "binder: %d:%d unknown command %d\n",
+			       proc->pid, thread->pid, cmd);
 			return -EINVAL;
 		}
 		*consumed = ptr - buffer;
@@ -2112,8 +2114,8 @@ binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
 	return 0;
 }
 
-void
-binder_stat_br(struct binder_proc *proc, struct binder_thread *thread, uint32_t cmd)
+void binder_stat_br(struct binder_proc *proc, struct binder_thread *thread,
+		    uint32_t cmd)
 {
 	if (_IOC_NR(cmd) < ARRAY_SIZE(binder_stats.br)) {
 		binder_stats.br[_IOC_NR(cmd)]++;
@@ -2122,22 +2124,23 @@ binder_stat_br(struct binder_proc *proc, struct binder_thread *thread, uint32_t
 	}
 }
 
-static int
-binder_has_proc_work(struct binder_proc *proc, struct binder_thread *thread)
+static int binder_has_proc_work(struct binder_proc *proc,
+				struct binder_thread *thread)
 {
-	return !list_empty(&proc->todo) || (thread->looper & BINDER_LOOPER_STATE_NEED_RETURN);
+	return !list_empty(&proc->todo) ||
+		(thread->looper & BINDER_LOOPER_STATE_NEED_RETURN);
 }
 
-static int
-binder_has_thread_work(struct binder_thread *thread)
+static int binder_has_thread_work(struct binder_thread *thread)
 {
 	return !list_empty(&thread->todo) || thread->return_error != BR_OK ||
 		(thread->looper & BINDER_LOOPER_STATE_NEED_RETURN);
 }
 
-static int
-binder_thread_read(struct binder_proc *proc, struct binder_thread *thread,
-	void  __user *buffer, int size, signed long *consumed, int non_block)
+static int binder_thread_read(struct binder_proc *proc,
+			      struct binder_thread *thread,
+			      void  __user *buffer, int size,
+			      signed long *consumed, int non_block)
 {
 	void __user *ptr = buffer + *consumed;
 	void __user *end = buffer + size;
@@ -2152,7 +2155,8 @@ binder_thread_read(struct binder_proc *proc, struct binder_thread *thread,
 	}
 
 retry:
-	wait_for_proc_work = thread->transaction_stack == NULL && list_empty(&thread->todo);
+	wait_for_proc_work = thread->transaction_stack == NULL &&
+				list_empty(&thread->todo);
 
 	if (thread->return_error != BR_OK && ptr < end) {
 		if (thread->return_error2 != BR_OK) {
@@ -2182,7 +2186,8 @@ binder_thread_read(struct binder_proc *proc, struct binder_thread *thread,
 				"for process work before calling BC_REGISTER_"
 				"LOOPER or BC_ENTER_LOOPER (state %x)\n",
 				proc->pid, thread->pid, thread->looper);
-			wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2);
+			wait_event_interruptible(binder_user_error_wait,
+						 binder_stop_on_user_error < 2);
 		}
 		binder_set_nice(proc->default_priority);
 		if (non_block) {
@@ -2304,8 +2309,10 @@ binder_thread_read(struct binder_proc *proc, struct binder_thread *thread,
 		case BINDER_WORK_DEAD_BINDER:
 		case BINDER_WORK_DEAD_BINDER_AND_CLEAR:
 		case BINDER_WORK_CLEAR_DEATH_NOTIFICATION: {
-			struct binder_ref_death *death = container_of(w, struct binder_ref_death, work);
+			struct binder_ref_death *death;
 			uint32_t cmd;
+
+			death = container_of(w, struct binder_ref_death, work);
 			if (w->type == BINDER_WORK_CLEAR_DEATH_NOTIFICATION)
 				cmd = BR_CLEAR_DEATH_NOTIFICATION_DONE;
 			else
@@ -2362,15 +2369,19 @@ binder_thread_read(struct binder_proc *proc, struct binder_thread *thread,
 
 		if (t->from) {
 			struct task_struct *sender = t->from->proc->tsk;
-			tr.sender_pid = task_tgid_nr_ns(sender, current->nsproxy->pid_ns);
+			tr.sender_pid = task_tgid_nr_ns(sender,
+							current->nsproxy->pid_ns);
 		} else {
 			tr.sender_pid = 0;
 		}
 
 		tr.data_size = t->buffer->data_size;
 		tr.offsets_size = t->buffer->offsets_size;
-		tr.data.ptr.buffer = (void *)t->buffer->data + proc->user_buffer_offset;
-		tr.data.ptr.offsets = tr.data.ptr.buffer + ALIGN(t->buffer->data_size, sizeof(void *));
+		tr.data.ptr.buffer = (void *)t->buffer->data +
+					proc->user_buffer_offset;
+		tr.data.ptr.offsets = tr.data.ptr.buffer +
+					ALIGN(t->buffer->data_size,
+					    sizeof(void *));
 
 		if (put_user(cmd, (uint32_t __user *)ptr))
 			return -EFAULT;
@@ -2384,7 +2395,8 @@ binder_thread_read(struct binder_proc *proc, struct binder_thread *thread,
 			printk(KERN_INFO "binder: %d:%d %s %d %d:%d, cmd %d"
 				"size %zd-%zd ptr %p-%p\n",
 			       proc->pid, thread->pid,
-			       (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" : "BR_REPLY",
+			       (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" :
+							 "BR_REPLY",
 			       t->debug_id, t->from ? t->from->proc->pid : 0,
 			       t->from ? t->from->pid : 0, cmd,
 			       t->buffer->data_size, t->buffer->offsets_size,
@@ -2430,7 +2442,9 @@ static void binder_release_work(struct list_head *list)
 		list_del_init(&w->entry);
 		switch (w->type) {
 		case BINDER_WORK_TRANSACTION: {
-			struct binder_transaction *t = container_of(w, struct binder_transaction, work);
+			struct binder_transaction *t;
+
+			t = container_of(w, struct binder_transaction, work);
 			if (t->buffer->target_node && !(t->flags & TF_ONE_WAY))
 				binder_send_failed_reply(t, BR_DEAD_REPLY);
 		} break;
@@ -2480,7 +2494,8 @@ static struct binder_thread *binder_get_thread(struct binder_proc *proc)
 	return thread;
 }
 
-static int binder_free_thread(struct binder_proc *proc, struct binder_thread *thread)
+static int binder_free_thread(struct binder_proc *proc,
+			      struct binder_thread *thread)
 {
 	struct binder_transaction *t;
 	struct binder_transaction *send_reply = NULL;
@@ -2493,8 +2508,10 @@ static int binder_free_thread(struct binder_proc *proc, struct binder_thread *th
 	while (t) {
 		active_transactions++;
 		if (binder_debug_mask & BINDER_DEBUG_DEAD_TRANSACTION)
-			printk(KERN_INFO "binder: release %d:%d transaction %d %s, still active\n",
-			       proc->pid, thread->pid, t->debug_id, (t->to_thread == thread) ? "in" : "out");
+			printk(KERN_INFO "binder: release %d:%d transaction %d "
+			       "%s, still active\n", proc->pid, thread->pid,
+			       t->debug_id,
+			       (t->to_thread == thread) ? "in" : "out");
 		if (t->to_thread == thread) {
 			t->to_proc = NULL;
 			t->to_thread = NULL;
@@ -2517,7 +2534,8 @@ static int binder_free_thread(struct binder_proc *proc, struct binder_thread *th
 	return active_transactions;
 }
 
-static unsigned int binder_poll(struct file *filp, struct poll_table_struct *wait)
+static unsigned int binder_poll(struct file *filp,
+				struct poll_table_struct *wait)
 {
 	struct binder_proc *proc = filp->private_data;
 	struct binder_thread *thread = NULL;
@@ -2778,7 +2796,8 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
 	proc->files = get_files_struct(current);
 	proc->vma = vma;
 
-	/*printk(KERN_INFO "binder_mmap: %d %lx-%lx maps %p\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer);*/
+	/*printk(KERN_INFO "binder_mmap: %d %lx-%lx maps %p\n",
+		 proc->pid, vma->vm_start, vma->vm_end, proc->buffer);*/
 	return 0;
 
 err_alloc_small_buf_failed:
@@ -2790,7 +2809,8 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
 err_get_vm_area_failed:
 err_already_mapped:
 err_bad_arg:
-	printk(KERN_ERR "binder_mmap: %d %lx-%lx %s failed %d\n", proc->pid, vma->vm_start, vma->vm_end, failure_string, ret);
+	printk(KERN_ERR "binder_mmap: %d %lx-%lx %s failed %d\n",
+	       proc->pid, vma->vm_start, vma->vm_end, failure_string, ret);
 	return ret;
 }
 
@@ -2799,7 +2819,8 @@ static int binder_open(struct inode *nodp, struct file *filp)
 	struct binder_proc *proc;
 
 	if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
-		printk(KERN_INFO "binder_open: %d:%d\n", current->group_leader->pid, current->pid);
+		printk(KERN_INFO "binder_open: %d:%d\n",
+		       current->group_leader->pid, current->pid);
 
 	proc = kzalloc(sizeof(*proc), GFP_KERNEL);
 	if (proc == NULL)
@@ -2821,7 +2842,9 @@ static int binder_open(struct inode *nodp, struct file *filp)
 		char strbuf[11];
 		snprintf(strbuf, sizeof(strbuf), "%u", proc->pid);
 		remove_proc_entry(strbuf, binder_proc_dir_entry_proc);
-		create_proc_read_entry(strbuf, S_IRUGO, binder_proc_dir_entry_proc, binder_read_proc_proc, proc);
+		create_proc_read_entry(strbuf, S_IRUGO,
+				       binder_proc_dir_entry_proc,
+				       binder_read_proc_proc, proc);
 	}
 
 	return 0;
@@ -2925,12 +2948,15 @@ static void binder_deferred_release(struct binder_proc *proc)
 				}
 			}
 			if (binder_debug_mask & BINDER_DEBUG_DEAD_BINDER)
-				printk(KERN_INFO "binder: node %d now dead, refs %d, death %d\n", node->debug_id, incoming_refs, death);
+				printk(KERN_INFO "binder: node %d now dead, "
+				       "refs %d, death %d\n", node->debug_id,
+				       incoming_refs, death);
 		}
 	}
 	outgoing_refs = 0;
 	while ((n = rb_first(&proc->refs_by_desc))) {
-		struct binder_ref *ref = rb_entry(n, struct binder_ref, rb_node_desc);
+		struct binder_ref *ref = rb_entry(n, struct binder_ref,
+						  rb_node_desc);
 		outgoing_refs++;
 		binder_delete_ref(ref);
 	}
@@ -2938,12 +2964,15 @@ static void binder_deferred_release(struct binder_proc *proc)
 	buffers = 0;
 
 	while ((n = rb_first(&proc->allocated_buffers))) {
-		struct binder_buffer *buffer = rb_entry(n, struct binder_buffer, rb_node);
+		struct binder_buffer *buffer = rb_entry(n, struct binder_buffer,
+							rb_node);
 		t = buffer->transaction;
 		if (t) {
 			t->buffer = NULL;
 			buffer->transaction = NULL;
-			printk(KERN_ERR "binder: release proc %d, transaction %d, not freed\n", proc->pid, t->debug_id);
+			printk(KERN_ERR "binder: release proc %d, "
+			       "transaction %d, not freed\n",
+			       proc->pid, t->debug_id);
 			/*BUG();*/
 		}
 		binder_free_buf(proc, buffer);
@@ -2957,8 +2986,13 @@ static void binder_deferred_release(struct binder_proc *proc)
 		int i;
 		for (i = 0; i < proc->buffer_size / PAGE_SIZE; i++) {
 			if (proc->pages[i]) {
-				if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
-					printk(KERN_INFO "binder_release: %d: page %d at %p not freed\n", proc->pid, i, proc->buffer + i * PAGE_SIZE);
+				if (binder_debug_mask &
+				    BINDER_DEBUG_BUFFER_ALLOC)
+					printk(KERN_INFO
+					       "binder_release: %d: "
+					       "page %d at %p not freed\n",
+					       proc->pid, i,
+					       proc->buffer + i * PAGE_SIZE);
 				__free_page(proc->pages[i]);
 				page_count++;
 			}
@@ -2970,8 +3004,12 @@ static void binder_deferred_release(struct binder_proc *proc)
 	put_task_struct(proc->tsk);
 
 	if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
-		printk(KERN_INFO "binder_release: %d threads %d, nodes %d (ref %d), refs %d, active transactions %d, buffers %d, pages %d\n",
-		       proc->pid, threads, nodes, incoming_refs, outgoing_refs, active_transactions, buffers, page_count);
+		printk(KERN_INFO
+		       "binder_release: %d threads %d, nodes %d (ref %d), "
+		       "refs %d, active transactions %d, buffers %d, "
+		       "pages %d\n",
+		       proc->pid, threads, nodes, incoming_refs, outgoing_refs,
+		       active_transactions, buffers, page_count);
 
 	kfree(proc);
 }
@@ -2998,9 +3036,11 @@ static void binder_deferred_func(struct work_struct *work)
 		mutex_unlock(&binder_deferred_lock);
 
 		files = NULL;
-		if (defer & BINDER_DEFERRED_PUT_FILES)
-			if ((files = proc->files))
+		if (defer & BINDER_DEFERRED_PUT_FILES) {
+			files = proc->files;
+			if (files)
 				proc->files = NULL;
+		}
 
 		if (defer & BINDER_DEFERRED_FLUSH)
 			binder_deferred_flush(proc);
@@ -3027,10 +3067,14 @@ static void binder_defer_work(struct binder_proc *proc, int defer)
 	mutex_unlock(&binder_deferred_lock);
 }
 
-static char *print_binder_transaction(char *buf, char *end, const char *prefix, struct binder_transaction *t)
+static char *print_binder_transaction(char *buf, char *end, const char *prefix,
+				      struct binder_transaction *t)
 {
-	buf += snprintf(buf, end - buf, "%s %d: %p from %d:%d to %d:%d code %x flags %x pri %ld r%d",
-			prefix, t->debug_id, t, t->from ? t->from->proc->pid : 0,
+	buf += snprintf(buf, end - buf,
+			"%s %d: %p from %d:%d to %d:%d code %x "
+			"flags %x pri %ld r%d",
+			prefix, t->debug_id, t,
+			t->from ? t->from->proc->pid : 0,
 			t->from ? t->from->pid : 0,
 			t->to_proc ? t->to_proc->pid : 0,
 			t->to_thread ? t->to_thread->pid : 0,
@@ -3053,7 +3097,8 @@ static char *print_binder_transaction(char *buf, char *end, const char *prefix,
 	return buf;
 }
 
-static char *print_binder_buffer(char *buf, char *end, const char *prefix, struct binder_buffer *buffer)
+static char *print_binder_buffer(char *buf, char *end, const char *prefix,
+				 struct binder_buffer *buffer)
 {
 	buf += snprintf(buf, end - buf, "%s %d: %p size %zd:%zd %s\n",
 			prefix, buffer->debug_id, buffer->data,
@@ -3063,7 +3108,8 @@ static char *print_binder_buffer(char *buf, char *end, const char *prefix, struc
 }
 
 static char *print_binder_work(char *buf, char *end, const char *prefix,
-	const char *transaction_prefix, struct binder_work *w)
+			       const char *transaction_prefix,
+			       struct binder_work *w)
 {
 	struct binder_node *node;
 	struct binder_transaction *t;
@@ -3080,7 +3126,8 @@ static char *print_binder_work(char *buf, char *end, const char *prefix,
 	case BINDER_WORK_NODE:
 		node = container_of(w, struct binder_node, work);
 		buf += snprintf(buf, end - buf, "%snode work %d: u%p c%p\n",
-				prefix, node->debug_id, node->ptr, node->cookie);
+				prefix, node->debug_id, node->ptr,
+				node->cookie);
 		break;
 	case BINDER_WORK_DEAD_BINDER:
 		buf += snprintf(buf, end - buf, "%shas dead binder\n", prefix);
@@ -3101,27 +3148,33 @@ static char *print_binder_work(char *buf, char *end, const char *prefix,
 	return buf;
 }
 
-static char *print_binder_thread(char *buf, char *end, struct binder_thread *thread, int print_always)
+static char *print_binder_thread(char *buf, char *end,
+				 struct binder_thread *thread,
+				 int print_always)
 {
 	struct binder_transaction *t;
 	struct binder_work *w;
 	char *start_buf = buf;
 	char *header_buf;
 
-	buf += snprintf(buf, end - buf, "  thread %d: l %02x\n", thread->pid, thread->looper);
+	buf += snprintf(buf, end - buf, "  thread %d: l %02x\n",
+			thread->pid, thread->looper);
 	header_buf = buf;
 	t = thread->transaction_stack;
 	while (t) {
 		if (buf >= end)
 			break;
 		if (t->from == thread) {
-			buf = print_binder_transaction(buf, end, "    outgoing transaction", t);
+			buf = print_binder_transaction(buf, end,
+						"    outgoing transaction", t);
 			t = t->from_parent;
 		} else if (t->to_thread == thread) {
-			buf = print_binder_transaction(buf, end, "    incoming transaction", t);
+			buf = print_binder_transaction(buf, end,
+						"    incoming transaction", t);
 			t = t->to_parent;
 		} else {
-			buf = print_binder_transaction(buf, end, "    bad transaction", t);
+			buf = print_binder_transaction(buf, end,
+						"    bad transaction", t);
 			t = NULL;
 		}
 	}
@@ -3142,11 +3195,14 @@ static char *print_binder_node(char *buf, char *end, struct binder_node *node)
 	struct hlist_node *pos;
 	struct binder_work *w;
 	int count;
+
 	count = 0;
 	hlist_for_each_entry(ref, pos, &node->refs, node_entry)
 		count++;
 
-	buf += snprintf(buf, end - buf, "  node %d: u%p c%p hs %d hw %d ls %d lw %d is %d iw %d",
+	buf += snprintf(buf, end - buf,
+			"  node %d: u%p c%p hs %d hw %d ls %d lw %d "
+			"is %d iw %d",
 			node->debug_id, node->ptr, node->cookie,
 			node->has_strong_ref, node->has_weak_ref,
 			node->local_strong_refs, node->local_weak_refs,
@@ -3175,13 +3231,16 @@ static char *print_binder_node(char *buf, char *end, struct binder_node *node)
 
 static char *print_binder_ref(char *buf, char *end, struct binder_ref *ref)
 {
-	buf += snprintf(buf, end - buf, "  ref %d: desc %d %snode %d s %d w %d d %p\n",
-			ref->debug_id, ref->desc, ref->node->proc ? "" : "dead ",
-			ref->node->debug_id, ref->strong, ref->weak, ref->death);
+	buf += snprintf(buf, end - buf,
+			"  ref %d: desc %d %snode %d s %d w %d d %p\n",
+			ref->debug_id, ref->desc,
+			ref->node->proc ? "" : "dead ", ref->node->debug_id,
+			ref->strong, ref->weak, ref->death);
 	return buf;
 }
 
-static char *print_binder_proc(char *buf, char *end, struct binder_proc *proc, int print_all)
+static char *print_binder_proc(char *buf, char *end,
+			       struct binder_proc *proc, int print_all)
 {
 	struct binder_work *w;
 	struct rb_node *n;
@@ -3191,19 +3250,34 @@ static char *print_binder_proc(char *buf, char *end, struct binder_proc *proc, i
 	buf += snprintf(buf, end - buf, "proc %d\n", proc->pid);
 	header_buf = buf;
 
-	for (n = rb_first(&proc->threads); n != NULL && buf < end; n = rb_next(n))
-		buf = print_binder_thread(buf, end, rb_entry(n, struct binder_thread, rb_node), print_all);
-	for (n = rb_first(&proc->nodes); n != NULL && buf < end; n = rb_next(n)) {
-		struct binder_node *node = rb_entry(n, struct binder_node, rb_node);
+	for (n = rb_first(&proc->threads);
+	     n != NULL && buf < end;
+	     n = rb_next(n))
+		buf = print_binder_thread(buf, end,
+					  rb_entry(n, struct binder_thread,
+						   rb_node), print_all);
+	for (n = rb_first(&proc->nodes);
+	     n != NULL && buf < end;
+	     n = rb_next(n)) {
+		struct binder_node *node = rb_entry(n, struct binder_node,
+						    rb_node);
 		if (print_all || node->has_async_transaction)
 			buf = print_binder_node(buf, end, node);
 	}
 	if (print_all) {
-		for (n = rb_first(&proc->refs_by_desc); n != NULL && buf < end; n = rb_next(n))
-			buf = print_binder_ref(buf, end, rb_entry(n, struct binder_ref, rb_node_desc));
-	}
-	for (n = rb_first(&proc->allocated_buffers); n != NULL && buf < end; n = rb_next(n))
-		buf = print_binder_buffer(buf, end, "  buffer", rb_entry(n, struct binder_buffer, rb_node));
+		for (n = rb_first(&proc->refs_by_desc);
+		     n != NULL && buf < end;
+		     n = rb_next(n))
+			buf = print_binder_ref(buf, end,
+					       rb_entry(n, struct binder_ref,
+							rb_node_desc));
+	}
+	for (n = rb_first(&proc->allocated_buffers);
+	     n != NULL && buf < end;
+	     n = rb_next(n))
+		buf = print_binder_buffer(buf, end, "  buffer",
+					  rb_entry(n, struct binder_buffer,
+						   rb_node));
 	list_for_each_entry(w, &proc->todo, entry) {
 		if (buf >= end)
 			break;
@@ -3213,7 +3287,8 @@ static char *print_binder_proc(char *buf, char *end, struct binder_proc *proc, i
 	list_for_each_entry(w, &proc->delivered_death, entry) {
 		if (buf >= end)
 			break;
-		buf += snprintf(buf, end - buf, "  has delivered dead binder\n");
+		buf += snprintf(buf, end - buf,
+				"  has delivered dead binder\n");
 		break;
 	}
 	if (!print_all && buf == header_buf)
@@ -3272,20 +3347,24 @@ static const char *binder_objstat_strings[] = {
 	"transaction_complete"
 };
 
-static char *print_binder_stats(char *buf, char *end, const char *prefix, struct binder_stats *stats)
+static char *print_binder_stats(char *buf, char *end, const char *prefix,
+				struct binder_stats *stats)
 {
 	int i;
 
-	BUILD_BUG_ON(ARRAY_SIZE(stats->bc) != ARRAY_SIZE(binder_command_strings));
+	BUILD_BUG_ON(ARRAY_SIZE(stats->bc) !=
+			ARRAY_SIZE(binder_command_strings));
 	for (i = 0; i < ARRAY_SIZE(stats->bc); i++) {
 		if (stats->bc[i])
 			buf += snprintf(buf, end - buf, "%s%s: %d\n", prefix,
-					binder_command_strings[i], stats->bc[i]);
+					binder_command_strings[i],
+					stats->bc[i]);
 		if (buf >= end)
 			return buf;
 	}
 
-	BUILD_BUG_ON(ARRAY_SIZE(stats->br) != ARRAY_SIZE(binder_return_strings));
+	BUILD_BUG_ON(ARRAY_SIZE(stats->br) !=
+			ARRAY_SIZE(binder_return_strings));
 	for (i = 0; i < ARRAY_SIZE(stats->br); i++) {
 		if (stats->br[i])
 			buf += snprintf(buf, end - buf, "%s%s: %d\n", prefix,
@@ -3294,13 +3373,17 @@ static char *print_binder_stats(char *buf, char *end, const char *prefix, struct
 			return buf;
 	}
 
-	BUILD_BUG_ON(ARRAY_SIZE(stats->obj_created) != ARRAY_SIZE(binder_objstat_strings));
-	BUILD_BUG_ON(ARRAY_SIZE(stats->obj_created) != ARRAY_SIZE(stats->obj_deleted));
+	BUILD_BUG_ON(ARRAY_SIZE(stats->obj_created) !=
+			ARRAY_SIZE(binder_objstat_strings));
+	BUILD_BUG_ON(ARRAY_SIZE(stats->obj_created) !=
+			ARRAY_SIZE(stats->obj_deleted));
 	for (i = 0; i < ARRAY_SIZE(stats->obj_created); i++) {
 		if (stats->obj_created[i] || stats->obj_deleted[i])
-			buf += snprintf(buf, end - buf, "%s%s: active %d total %d\n", prefix,
+			buf += snprintf(buf, end - buf,
+					"%s%s: active %d total %d\n", prefix,
 					binder_objstat_strings[i],
-					stats->obj_created[i] - stats->obj_deleted[i],
+					stats->obj_created[i] -
+						stats->obj_deleted[i],
 					stats->obj_created[i]);
 		if (buf >= end)
 			return buf;
@@ -3308,7 +3391,8 @@ static char *print_binder_stats(char *buf, char *end, const char *prefix, struct
 	return buf;
 }
 
-static char *print_binder_proc_stats(char *buf, char *end, struct binder_proc *proc)
+static char *print_binder_proc_stats(char *buf, char *end,
+				     struct binder_proc *proc)
 {
 	struct binder_work *w;
 	struct rb_node *n;
@@ -3340,12 +3424,14 @@ static char *print_binder_proc_stats(char *buf, char *end, struct binder_proc *p
 	strong = 0;
 	weak = 0;
 	for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) {
-		struct binder_ref *ref = rb_entry(n, struct binder_ref, rb_node_desc);
+		struct binder_ref *ref = rb_entry(n, struct binder_ref,
+						  rb_node_desc);
 		count++;
 		strong += ref->strong;
 		weak += ref->weak;
 	}
-	buf += snprintf(buf, end - buf, "  refs: %d s %d w %d\n", count, strong, weak);
+	buf += snprintf(buf, end - buf, "  refs: %d s %d w %d\n",
+			count, strong, weak);
 	if (buf >= end)
 		return buf;
 
@@ -3376,8 +3462,8 @@ static char *print_binder_proc_stats(char *buf, char *end, struct binder_proc *p
 }
 
 
-static int binder_read_proc_state(
-	char *page, char **start, off_t off, int count, int *eof, void *data)
+static int binder_read_proc_state(char *page, char **start, off_t off,
+				  int count, int *eof, void *data)
 {
 	struct binder_proc *proc;
 	struct hlist_node *pos;
@@ -3424,8 +3510,8 @@ static int binder_read_proc_state(
 	return len < count ? len  : count;
 }
 
-static int binder_read_proc_stats(
-	char *page, char **start, off_t off, int count, int *eof, void *data)
+static int binder_read_proc_stats(char *page, char **start, off_t off,
+				  int count, int *eof, void *data)
 {
 	struct binder_proc *proc;
 	struct hlist_node *pos;
@@ -3464,8 +3550,8 @@ static int binder_read_proc_stats(
 	return len < count ? len  : count;
 }
 
-static int binder_read_proc_transactions(
-	char *page, char **start, off_t off, int count, int *eof, void *data)
+static int binder_read_proc_transactions(char *page, char **start, off_t off,
+					 int count, int *eof, void *data)
 {
 	struct binder_proc *proc;
 	struct hlist_node *pos;
@@ -3502,8 +3588,8 @@ static int binder_read_proc_transactions(
 	return len < count ? len  : count;
 }
 
-static int binder_read_proc_proc(
-	char *page, char **start, off_t off, int count, int *eof, void *data)
+static int binder_read_proc_proc(char *page, char **start, off_t off,
+				 int count, int *eof, void *data)
 {
 	struct binder_proc *proc = data;
 	int len = 0;
@@ -3533,9 +3619,12 @@ static int binder_read_proc_proc(
 	return len < count ? len  : count;
 }
 
-static char *print_binder_transaction_log_entry(char *buf, char *end, struct binder_transaction_log_entry *e)
+static char *print_binder_transaction_log_entry(char *buf, char *end,
+					struct binder_transaction_log_entry *e)
 {
-	buf += snprintf(buf, end - buf, "%d: %s from %d:%d to %d:%d node %d handle %d size %d:%d\n",
+	buf += snprintf(buf, end - buf,
+			"%d: %s from %d:%d to %d:%d node %d handle %d "
+			"size %d:%d\n",
 			e->debug_id, (e->call_type == 2) ? "reply" :
 			((e->call_type == 1) ? "async" : "call "), e->from_proc,
 			e->from_thread, e->to_proc, e->to_thread, e->to_node,
@@ -3559,13 +3648,15 @@ static int binder_read_proc_transaction_log(
 		for (i = log->next; i < ARRAY_SIZE(log->entry); i++) {
 			if (buf >= end)
 				break;
-			buf = print_binder_transaction_log_entry(buf, end, &log->entry[i]);
+			buf = print_binder_transaction_log_entry(buf, end,
+								&log->entry[i]);
 		}
 	}
 	for (i = 0; i < log->next; i++) {
 		if (buf >= end)
 			break;
-		buf = print_binder_transaction_log_entry(buf, end, &log->entry[i]);
+		buf = print_binder_transaction_log_entry(buf, end,
+							 &log->entry[i]);
 	}
 
 	*start = page + off;
@@ -3579,7 +3670,7 @@ static int binder_read_proc_transaction_log(
 	return len < count ? len  : count;
 }
 
-static struct file_operations binder_fops = {
+static const struct file_operations binder_fops = {
 	.owner = THIS_MODULE,
 	.poll = binder_poll,
 	.unlocked_ioctl = binder_ioctl,
@@ -3601,14 +3692,35 @@ static int __init binder_init(void)
 
 	binder_proc_dir_entry_root = proc_mkdir("binder", NULL);
 	if (binder_proc_dir_entry_root)
-		binder_proc_dir_entry_proc = proc_mkdir("proc", binder_proc_dir_entry_root);
+		binder_proc_dir_entry_proc = proc_mkdir("proc",
+						binder_proc_dir_entry_root);
 	ret = misc_register(&binder_miscdev);
 	if (binder_proc_dir_entry_root) {
-		create_proc_read_entry("state", S_IRUGO, binder_proc_dir_entry_root, binder_read_proc_state, NULL);
-		create_proc_read_entry("stats", S_IRUGO, binder_proc_dir_entry_root, binder_read_proc_stats, NULL);
-		create_proc_read_entry("transactions", S_IRUGO, binder_proc_dir_entry_root, binder_read_proc_transactions, NULL);
-		create_proc_read_entry("transaction_log", S_IRUGO, binder_proc_dir_entry_root, binder_read_proc_transaction_log, &binder_transaction_log);
-		create_proc_read_entry("failed_transaction_log", S_IRUGO, binder_proc_dir_entry_root, binder_read_proc_transaction_log, &binder_transaction_log_failed);
+		create_proc_read_entry("state",
+				       S_IRUGO,
+				       binder_proc_dir_entry_root,
+				       binder_read_proc_state,
+				       NULL);
+		create_proc_read_entry("stats",
+				       S_IRUGO,
+				       binder_proc_dir_entry_root,
+				       binder_read_proc_stats,
+				       NULL);
+		create_proc_read_entry("transactions",
+				       S_IRUGO,
+				       binder_proc_dir_entry_root,
+				       binder_read_proc_transactions,
+				       NULL);
+		create_proc_read_entry("transaction_log",
+				       S_IRUGO,
+				       binder_proc_dir_entry_root,
+				       binder_read_proc_transaction_log,
+				       &binder_transaction_log);
+		create_proc_read_entry("failed_transaction_log",
+				       S_IRUGO,
+				       binder_proc_dir_entry_root,
+				       binder_read_proc_transaction_log,
+				       &binder_transaction_log_failed);
 	}
 	return ret;
 }

+ 6 - 6
drivers/staging/android/logger.c

@@ -35,7 +35,7 @@
  * mutex 'mutex'.
  */
 struct logger_log {
-	unsigned char *		buffer;	/* the ring buffer itself */
+	unsigned char 		*buffer;/* the ring buffer itself */
 	struct miscdevice	misc;	/* misc device representing the log */
 	wait_queue_head_t	wq;	/* wait queue for readers */
 	struct list_head	readers; /* this log's readers */
@@ -52,7 +52,7 @@ struct logger_log {
  * reference counting. The structure is protected by log->mutex.
  */
 struct logger_reader {
-	struct logger_log *	log;	/* associated log */
+	struct logger_log	*log;	/* associated log */
 	struct list_head	list;	/* entry in logger_log's list */
 	size_t			r_off;	/* current read head offset */
 };
@@ -74,7 +74,7 @@ struct logger_reader {
  * file->logger_log. Thus what file->private_data points at depends on whether
  * or not the file was opened for reading. This function hides that dirtiness.
  */
-static inline struct logger_log * file_get_log(struct file *file)
+static inline struct logger_log *file_get_log(struct file *file)
 {
 	if (file->f_mode & FMODE_READ) {
 		struct logger_reader *reader = file->private_data;
@@ -379,7 +379,7 @@ ssize_t logger_aio_write(struct kiocb *iocb, const struct iovec *iov,
 	return ret;
 }
 
-static struct logger_log * get_log_from_minor(int);
+static struct logger_log *get_log_from_minor(int);
 
 /*
  * logger_open - the log's open() file operation
@@ -519,7 +519,7 @@ static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	return ret;
 }
 
-static struct file_operations logger_fops = {
+static const struct file_operations logger_fops = {
 	.owner = THIS_MODULE,
 	.read = logger_read,
 	.aio_write = logger_aio_write,
@@ -557,7 +557,7 @@ DEFINE_LOGGER_DEVICE(log_main, LOGGER_LOG_MAIN, 64*1024)
 DEFINE_LOGGER_DEVICE(log_events, LOGGER_LOG_EVENTS, 256*1024)
 DEFINE_LOGGER_DEVICE(log_radio, LOGGER_LOG_RADIO, 64*1024)
 
-static struct logger_log * get_log_from_minor(int minor)
+static struct logger_log *get_log_from_minor(int minor)
 {
 	if (log_main.misc.minor == minor)
 		return &log_main;

+ 69 - 32
drivers/staging/android/lowmemorykiller.c

@@ -34,18 +34,24 @@ static int lowmem_adj[6] = {
 };
 static int lowmem_adj_size = 4;
 static size_t lowmem_minfree[6] = {
-	3*512, // 6MB
-	2*1024, // 8MB
-	4*1024, // 16MB
-	16*1024, // 64MB
+	3 * 512,	/* 6MB */
+	2 * 1024,	/* 8MB */
+	4 * 1024,	/* 16MB */
+	16 * 1024,	/* 64MB */
 };
 static int lowmem_minfree_size = 4;
 
-#define lowmem_print(level, x...) do { if(lowmem_debug_level >= (level)) printk(x); } while(0)
+#define lowmem_print(level, x...)			\
+	do {						\
+		if (lowmem_debug_level >= (level))	\
+			printk(x);			\
+	} while (0)
 
 module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR);
-module_param_array_named(adj, lowmem_adj, int, &lowmem_adj_size, S_IRUGO | S_IWUSR);
-module_param_array_named(minfree, lowmem_minfree, uint, &lowmem_minfree_size, S_IRUGO | S_IWUSR);
+module_param_array_named(adj, lowmem_adj, int, &lowmem_adj_size,
+			 S_IRUGO | S_IWUSR);
+module_param_array_named(minfree, lowmem_minfree, uint, &lowmem_minfree_size,
+			 S_IRUGO | S_IWUSR);
 module_param_named(debug_level, lowmem_debug_level, uint, S_IRUGO | S_IWUSR);
 
 static int lowmem_shrink(int nr_to_scan, gfp_t gfp_mask)
@@ -57,46 +63,77 @@ static int lowmem_shrink(int nr_to_scan, gfp_t gfp_mask)
 	int i;
 	int min_adj = OOM_ADJUST_MAX + 1;
 	int selected_tasksize = 0;
+	int selected_oom_adj;
 	int array_size = ARRAY_SIZE(lowmem_adj);
-	int other_free = global_page_state(NR_FREE_PAGES) + global_page_state(NR_FILE_PAGES);
-	if(lowmem_adj_size < array_size)
+	int other_free = global_page_state(NR_FREE_PAGES);
+	int other_file = global_page_state(NR_FILE_PAGES);
+
+	if (lowmem_adj_size < array_size)
 		array_size = lowmem_adj_size;
-	if(lowmem_minfree_size < array_size)
+	if (lowmem_minfree_size < array_size)
 		array_size = lowmem_minfree_size;
-	for(i = 0; i < array_size; i++) {
-		if(other_free < lowmem_minfree[i]) {
+	for (i = 0; i < array_size; i++) {
+		if (other_free < lowmem_minfree[i] &&
+		    other_file < lowmem_minfree[i]) {
 			min_adj = lowmem_adj[i];
 			break;
 		}
 	}
-	if(nr_to_scan > 0)
-		lowmem_print(3, "lowmem_shrink %d, %x, ofree %d, ma %d\n", nr_to_scan, gfp_mask, other_free, min_adj);
+	if (nr_to_scan > 0)
+		lowmem_print(3, "lowmem_shrink %d, %x, ofree %d %d, ma %d\n",
+			     nr_to_scan, gfp_mask, other_free, other_file,
+			     min_adj);
+	rem = global_page_state(NR_ACTIVE_ANON) +
+		global_page_state(NR_ACTIVE_FILE) +
+		global_page_state(NR_INACTIVE_ANON) +
+		global_page_state(NR_INACTIVE_FILE);
+	if (nr_to_scan <= 0 || min_adj == OOM_ADJUST_MAX + 1) {
+		lowmem_print(5, "lowmem_shrink %d, %x, return %d\n",
+			     nr_to_scan, gfp_mask, rem);
+		return rem;
+	}
+	selected_oom_adj = min_adj;
+
 	read_lock(&tasklist_lock);
 	for_each_process(p) {
-		if(p->oomkilladj >= 0 && p->mm) {
-			tasksize = get_mm_rss(p->mm);
-			if(nr_to_scan > 0 && tasksize > 0 && p->oomkilladj >= min_adj) {
-				if(selected == NULL ||
-				   p->oomkilladj > selected->oomkilladj ||
-				   (p->oomkilladj == selected->oomkilladj &&
-				    tasksize > selected_tasksize)) {
-					selected = p;
-					selected_tasksize = tasksize;
-					lowmem_print(2, "select %d (%s), adj %d, size %d, to kill\n",
-					             p->pid, p->comm, p->oomkilladj, tasksize);
-				}
-			}
-			rem += tasksize;
+		int oom_adj;
+
+		task_lock(p);
+		if (!p->mm) {
+			task_unlock(p);
+			continue;
+		}
+		oom_adj = p->oomkilladj;
+		if (oom_adj < min_adj) {
+			task_unlock(p);
+			continue;
+		}
+		tasksize = get_mm_rss(p->mm);
+		task_unlock(p);
+		if (tasksize <= 0)
+			continue;
+		if (selected) {
+			if (oom_adj < selected_oom_adj)
+				continue;
+			if (oom_adj == selected_oom_adj &&
+			    tasksize <= selected_tasksize)
+				continue;
 		}
+		selected = p;
+		selected_tasksize = tasksize;
+		selected_oom_adj = oom_adj;
+		lowmem_print(2, "select %d (%s), adj %d, size %d, to kill\n",
+			     p->pid, p->comm, oom_adj, tasksize);
 	}
-	if(selected != NULL) {
+	if (selected) {
 		lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n",
-		             selected->pid, selected->comm,
-		             selected->oomkilladj, selected_tasksize);
+			     selected->pid, selected->comm,
+			     selected_oom_adj, selected_tasksize);
 		force_sig(SIGKILL, selected);
 		rem -= selected_tasksize;
 	}
-	lowmem_print(4, "lowmem_shrink %d, %x, return %d\n", nr_to_scan, gfp_mask, rem);
+	lowmem_print(4, "lowmem_shrink %d, %x, return %d\n",
+		     nr_to_scan, gfp_mask, rem);
 	read_unlock(&tasklist_lock);
 	return rem;
 }

+ 5 - 4
drivers/staging/android/ram_console.c

@@ -20,7 +20,7 @@
 #include <linux/proc_fs.h>
 #include <linux/string.h>
 #include <linux/uaccess.h>
-#include <asm/io.h>
+#include <linux/io.h>
 
 #ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
 #include <linux/rslib.h>
@@ -225,8 +225,9 @@ static int __init ram_console_init(struct ram_console_buffer *buffer,
 		buffer_size - sizeof(struct ram_console_buffer);
 
 	if (ram_console_buffer_size > buffer_size) {
-		pr_err("ram_console: buffer %p, invalid size %zu, datasize %zu\n",
-		       buffer, buffer_size, ram_console_buffer_size);
+		pr_err("ram_console: buffer %p, invalid size %zu, "
+		       "datasize %zu\n", buffer, buffer_size,
+		       ram_console_buffer_size);
 		return 0;
 	}
 
@@ -365,7 +366,7 @@ static ssize_t ram_console_read_old(struct file *file, char __user *buf,
 	return count;
 }
 
-static struct file_operations ram_console_file_ops = {
+static const struct file_operations ram_console_file_ops = {
 	.owner = THIS_MODULE,
 	.read = ram_console_read_old,
 };

+ 43 - 55
drivers/staging/android/timed_gpio.c

@@ -20,13 +20,12 @@
 #include <linux/err.h>
 #include <linux/gpio.h>
 
+#include "timed_output.h"
 #include "timed_gpio.h"
 
 
-static struct class *timed_gpio_class;
-
 struct timed_gpio_data {
-	struct device *dev;
+	struct timed_output_dev dev;
 	struct hrtimer timer;
 	spinlock_t lock;
 	unsigned 	gpio;
@@ -36,70 +35,62 @@ struct timed_gpio_data {
 
 static enum hrtimer_restart gpio_timer_func(struct hrtimer *timer)
 {
-	struct timed_gpio_data *gpio_data = container_of(timer, struct timed_gpio_data, timer);
+	struct timed_gpio_data *data =
+		container_of(timer, struct timed_gpio_data, timer);
 
-	gpio_direction_output(gpio_data->gpio, gpio_data->active_low ? 1 : 0);
+	gpio_direction_output(data->gpio, data->active_low ? 1 : 0);
 	return HRTIMER_NORESTART;
 }
 
-static ssize_t gpio_enable_show(struct device *dev, struct device_attribute *attr, char *buf)
+static int gpio_get_time(struct timed_output_dev *dev)
 {
-	struct timed_gpio_data *gpio_data = dev_get_drvdata(dev);
-	int remaining;
+	struct timed_gpio_data	*data =
+		container_of(dev, struct timed_gpio_data, dev);
 
-	if (hrtimer_active(&gpio_data->timer)) {
-		ktime_t r = hrtimer_get_remaining(&gpio_data->timer);
+	if (hrtimer_active(&data->timer)) {
+		ktime_t r = hrtimer_get_remaining(&data->timer);
 		struct timeval t = ktime_to_timeval(r);
-		remaining = t.tv_sec * 1000 + t.tv_usec / 1000;
+		return t.tv_sec * 1000 + t.tv_usec / 1000;
 	} else
-		remaining = 0;
-
-	return sprintf(buf, "%d\n", remaining);
+		return 0;
 }
 
-static ssize_t gpio_enable_store(
-		struct device *dev, struct device_attribute *attr,
-		const char *buf, size_t size)
+static void gpio_enable(struct timed_output_dev *dev, int value)
 {
-	struct timed_gpio_data *gpio_data = dev_get_drvdata(dev);
-	int value;
+	struct timed_gpio_data	*data =
+		container_of(dev, struct timed_gpio_data, dev);
 	unsigned long	flags;
 
-	sscanf(buf, "%d", &value);
-
-	spin_lock_irqsave(&gpio_data->lock, flags);
+	spin_lock_irqsave(&data->lock, flags);
 
 	/* cancel previous timer and set GPIO according to value */
-	hrtimer_cancel(&gpio_data->timer);
-	gpio_direction_output(gpio_data->gpio, gpio_data->active_low ? !value : !!value);
+	hrtimer_cancel(&data->timer);
+	gpio_direction_output(data->gpio, data->active_low ? !value : !!value);
 
 	if (value > 0) {
-		if (value > gpio_data->max_timeout)
-			value = gpio_data->max_timeout;
+		if (value > data->max_timeout)
+			value = data->max_timeout;
 
-		hrtimer_start(&gpio_data->timer,
-						ktime_set(value / 1000, (value % 1000) * 1000000),
-						HRTIMER_MODE_REL);
+		hrtimer_start(&data->timer,
+			ktime_set(value / 1000, (value % 1000) * 1000000),
+			HRTIMER_MODE_REL);
 	}
 
-	spin_unlock_irqrestore(&gpio_data->lock, flags);
-
-	return size;
+	spin_unlock_irqrestore(&data->lock, flags);
 }
 
-static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, gpio_enable_show, gpio_enable_store);
-
 static int timed_gpio_probe(struct platform_device *pdev)
 {
 	struct timed_gpio_platform_data *pdata = pdev->dev.platform_data;
 	struct timed_gpio *cur_gpio;
 	struct timed_gpio_data *gpio_data, *gpio_dat;
-	int i, ret = 0;
+	int i, j, ret = 0;
 
 	if (!pdata)
 		return -EBUSY;
 
-	gpio_data = kzalloc(sizeof(struct timed_gpio_data) * pdata->num_gpios, GFP_KERNEL);
+	gpio_data = kzalloc(sizeof(struct timed_gpio_data) * pdata->num_gpios,
+			GFP_KERNEL);
 	if (!gpio_data)
 		return -ENOMEM;
 
@@ -107,23 +98,26 @@ static int timed_gpio_probe(struct platform_device *pdev)
 		cur_gpio = &pdata->gpios[i];
 		gpio_dat = &gpio_data[i];
 
-		hrtimer_init(&gpio_dat->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+		hrtimer_init(&gpio_dat->timer, CLOCK_MONOTONIC,
+				HRTIMER_MODE_REL);
 		gpio_dat->timer.function = gpio_timer_func;
 		spin_lock_init(&gpio_dat->lock);
 
+		gpio_dat->dev.name = cur_gpio->name;
+		gpio_dat->dev.get_time = gpio_get_time;
+		gpio_dat->dev.enable = gpio_enable;
+		ret = timed_output_dev_register(&gpio_dat->dev);
+		if (ret < 0) {
+			for (j = 0; j < i; j++)
+				timed_output_dev_unregister(&gpio_data[i].dev);
+			kfree(gpio_data);
+			return ret;
+		}
+
 		gpio_dat->gpio = cur_gpio->gpio;
 		gpio_dat->max_timeout = cur_gpio->max_timeout;
 		gpio_dat->active_low = cur_gpio->active_low;
 		gpio_direction_output(gpio_dat->gpio, gpio_dat->active_low);
-
-		gpio_dat->dev = device_create(timed_gpio_class, &pdev->dev, 0, "%s", cur_gpio->name);
-		if (unlikely(IS_ERR(gpio_dat->dev)))
-			return PTR_ERR(gpio_dat->dev);
-
-		dev_set_drvdata(gpio_dat->dev, gpio_dat);
-		ret = device_create_file(gpio_dat->dev, &dev_attr_enable);
-		if (ret)
-			return ret;
 	}
 
 	platform_set_drvdata(pdev, gpio_data);
@@ -137,10 +131,8 @@ static int timed_gpio_remove(struct platform_device *pdev)
 	struct timed_gpio_data *gpio_data = platform_get_drvdata(pdev);
 	int i;
 
-	for (i = 0; i < pdata->num_gpios; i++) {
-		device_remove_file(gpio_data[i].dev, &dev_attr_enable);
-		device_unregister(gpio_data[i].dev);
-	}
+	for (i = 0; i < pdata->num_gpios; i++)
+		timed_output_dev_unregister(&gpio_data[i].dev);
 
 	kfree(gpio_data);
 
@@ -151,22 +143,18 @@ static struct platform_driver timed_gpio_driver = {
 	.probe		= timed_gpio_probe,
 	.remove		= timed_gpio_remove,
 	.driver		= {
-		.name		= "timed-gpio",
+		.name		= TIMED_GPIO_NAME,
 		.owner		= THIS_MODULE,
 	},
 };
 
 static int __init timed_gpio_init(void)
 {
-	timed_gpio_class = class_create(THIS_MODULE, "timed_output");
-	if (IS_ERR(timed_gpio_class))
-		return PTR_ERR(timed_gpio_class);
 	return platform_driver_register(&timed_gpio_driver);
 }
 
 static void __exit timed_gpio_exit(void)
 {
-	class_destroy(timed_gpio_class);
 	platform_driver_unregister(&timed_gpio_driver);
 }
 

+ 3 - 1
drivers/staging/android/timed_gpio.h

@@ -16,10 +16,12 @@
 #ifndef _LINUX_TIMED_GPIO_H
 #define _LINUX_TIMED_GPIO_H
 
+#define TIMED_GPIO_NAME "timed-gpio"
+
 struct timed_gpio {
 	const char *name;
 	unsigned 	gpio;
-	int     max_timeout;
+	int		max_timeout;
 	u8 		active_low;
 };
 

+ 121 - 0
drivers/staging/android/timed_output.c

@@ -0,0 +1,121 @@
+/* drivers/misc/timed_output.c
+ *
+ * Copyright (C) 2009 Google, Inc.
+ * Author: Mike Lockwood <lockwood@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/device.h>
+#include <linux/fs.h>
+#include <linux/err.h>
+
+#include "timed_output.h"
+
+static struct class *timed_output_class;
+static atomic_t device_count;
+
+static ssize_t enable_show(struct device *dev, struct device_attribute *attr,
+		char *buf)
+{
+	struct timed_output_dev *tdev = dev_get_drvdata(dev);
+	int remaining = tdev->get_time(tdev);
+
+	return sprintf(buf, "%d\n", remaining);
+}
+
+static ssize_t enable_store(
+		struct device *dev, struct device_attribute *attr,
+		const char *buf, size_t size)
+{
+	struct timed_output_dev *tdev = dev_get_drvdata(dev);
+	int value;
+
+	sscanf(buf, "%d", &value);
+	tdev->enable(tdev, value);
+
+	return size;
+}
+
+static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, enable_show, enable_store);
+
+static int create_timed_output_class(void)
+{
+	if (!timed_output_class) {
+		timed_output_class = class_create(THIS_MODULE, "timed_output");
+		if (IS_ERR(timed_output_class))
+			return PTR_ERR(timed_output_class);
+		atomic_set(&device_count, 0);
+	}
+
+	return 0;
+}
+
+int timed_output_dev_register(struct timed_output_dev *tdev)
+{
+	int ret;
+
+	if (!tdev || !tdev->name || !tdev->enable || !tdev->get_time)
+		return -EINVAL;
+
+	ret = create_timed_output_class();
+	if (ret < 0)
+		return ret;
+
+	tdev->index = atomic_inc_return(&device_count);
+	tdev->dev = device_create(timed_output_class, NULL,
+		MKDEV(0, tdev->index), NULL, tdev->name);
+	if (IS_ERR(tdev->dev))
+		return PTR_ERR(tdev->dev);
+
+	ret = device_create_file(tdev->dev, &dev_attr_enable);
+	if (ret < 0)
+		goto err_create_file;
+
+	dev_set_drvdata(tdev->dev, tdev);
+	tdev->state = 0;
+	return 0;
+
+err_create_file:
+	device_destroy(timed_output_class, MKDEV(0, tdev->index));
+	printk(KERN_ERR "timed_output: Failed to register driver %s\n",
+			tdev->name);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(timed_output_dev_register);
+
+void timed_output_dev_unregister(struct timed_output_dev *tdev)
+{
+	device_remove_file(tdev->dev, &dev_attr_enable);
+	device_destroy(timed_output_class, MKDEV(0, tdev->index));
+	dev_set_drvdata(tdev->dev, NULL);
+}
+EXPORT_SYMBOL_GPL(timed_output_dev_unregister);
+
+static int __init timed_output_init(void)
+{
+	return create_timed_output_class();
+}
+
+static void __exit timed_output_exit(void)
+{
+	class_destroy(timed_output_class);
+}
+
+module_init(timed_output_init);
+module_exit(timed_output_exit);
+
+MODULE_AUTHOR("Mike Lockwood <lockwood@android.com>");
+MODULE_DESCRIPTION("timed output class driver");
+MODULE_LICENSE("GPL");

+ 37 - 0
drivers/staging/android/timed_output.h

@@ -0,0 +1,37 @@
+/* include/linux/timed_output.h
+ *
+ * Copyright (C) 2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+*/
+
+#ifndef _LINUX_TIMED_OUTPUT_H
+#define _LINUX_TIMED_OUTPUT_H
+
+struct timed_output_dev {
+	const char	*name;
+
+	/* enable the output and set the timer */
+	void	(*enable)(struct timed_output_dev *sdev, int timeout);
+
+	/* returns the current number of milliseconds remaining on the timer */
+	int		(*get_time)(struct timed_output_dev *sdev);
+
+	/* private data */
+	struct device	*dev;
+	int		index;
+	int		state;
+};
+
+extern int timed_output_dev_register(struct timed_output_dev *dev);
+extern void timed_output_dev_unregister(struct timed_output_dev *dev);
+
+#endif

+ 1 - 1
drivers/staging/asus_oled/asus_oled.c

@@ -516,7 +516,7 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev, const char *buf, siz
 	max_offs = odev->width * odev->height;
 
 	while (offs < count && odev->buf_offs < max_offs) {
-		int ret;
+		int ret = 0;
 
 		if (buf[offs] == '1' || buf[offs] == '#') {
 			ret = append_values(odev, 1, 1);

+ 1 - 2
drivers/staging/b3dfg/b3dfg.c

@@ -35,14 +35,13 @@
 #include <linux/poll.h>
 #include <linux/wait.h>
 #include <linux/mm.h>
-#include <linux/version.h>
 #include <linux/uaccess.h>
 
 static unsigned int b3dfg_nbuf = 2;
 
 module_param_named(buffer_count, b3dfg_nbuf, uint, 0444);
 
-MODULE_PARM_DESC(buffer_count, "Number of buffers (min 2, default 2)\n");
+MODULE_PARM_DESC(buffer_count, "Number of buffers (min 2, default 2)");
 
 MODULE_AUTHOR("Daniel Drake <ddrake@brontes3d.com>");
 MODULE_DESCRIPTION("Brontes frame grabber driver");

+ 2 - 9
drivers/staging/comedi/Kconfig

@@ -13,13 +13,6 @@ config COMEDI_DEBUG
 	  This is an option for use by developers; most people should
 	  say N here. This enables comedi core and driver debugging.
 
-config COMEDI_RT
-	tristate "Comedi Real-time support"
-	depends on COMEDI && RT
-	default N
-	---help---
-	  Enable Real time support for the Comedi core.
-
 config COMEDI_PCI_DRIVERS
 	tristate "Comedi PCI drivers"
 	depends on COMEDI && PCI
@@ -29,10 +22,10 @@ config COMEDI_PCI_DRIVERS
 
 config COMEDI_PCMCIA_DRIVERS
 	tristate "Comedi PCMCIA drivers"
-	depends on COMEDI && PCMCIAI
+	depends on COMEDI && PCMCIA && PCCARD
 	default N
 	---help---
-	  Enable lots of comedi PCMCIA drivers to be built
+	  Enable lots of comedi PCMCIA and PCCARD drivers to be built
 
 config COMEDI_USB_DRIVERS
 	tristate "Comedi USB drivers"

+ 0 - 5
drivers/staging/comedi/Makefile

@@ -1,5 +1,4 @@
 obj-$(CONFIG_COMEDI) += comedi.o
-obj-$(CONFIG_COMEDI_RT) += comedi_rt.o
 
 obj-$(CONFIG_COMEDI)	+= kcomedilib/
 obj-$(CONFIG_COMEDI)	+= drivers/
@@ -11,7 +10,3 @@ comedi-objs :=		\
 	drivers.o	\
 	comedi_compat32.o \
 	comedi_ksyms.o	\
-
-comedi_rt-objs :=	\
-	rt_pend_tq.o	\
-	rt.o

+ 0 - 1
drivers/staging/comedi/comedi.h

@@ -188,7 +188,6 @@ extern "C" {
 #define SDF_WRITABLE	0x00020000	/* subdevice can be written (e.g. analog output) */
 #define SDF_WRITEABLE	SDF_WRITABLE	/* spelling error in API */
 #define SDF_INTERNAL	0x00040000	/* subdevice does not have externally visible lines */
-#define SDF_RT		0x00080000	/* DEPRECATED: subdevice is RT capable */
 #define SDF_GROUND	0x00100000	/* can do aref=ground */
 #define SDF_COMMON	0x00200000	/* can do aref=common */
 #define SDF_DIFF	0x00400000	/* can do aref=diff */

+ 405 - 99
drivers/staging/comedi/comedi_fops.c

@@ -44,6 +44,7 @@
 #include <linux/fs.h>
 #include "comedidev.h"
 #include <linux/cdev.h>
+#include <linux/stat.h>
 
 #include <linux/io.h>
 #include <linux/uaccess.h>
@@ -92,6 +93,15 @@ static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s);
 static int comedi_fasync(int fd, struct file *file, int on);
 
 static int is_device_busy(struct comedi_device *dev);
+static int resize_async_buffer(struct comedi_device *dev,
+			       struct comedi_subdevice *s,
+			       struct comedi_async *async, unsigned new_size);
+
+/* declarations for sysfs attribute files */
+static struct device_attribute dev_attr_max_read_buffer_kb;
+static struct device_attribute dev_attr_read_buffer_kb;
+static struct device_attribute dev_attr_max_write_buffer_kb;
+static struct device_attribute dev_attr_write_buffer_kb;
 
 #ifdef HAVE_UNLOCKED_IOCTL
 static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd,
@@ -277,7 +287,7 @@ static int do_bufconfig_ioctl(struct comedi_device *dev, void *arg)
 	struct comedi_bufconfig bc;
 	struct comedi_async *async;
 	struct comedi_subdevice *s;
-	int ret = 0;
+	int retval = 0;
 
 	if (copy_from_user(&bc, arg, sizeof(struct comedi_bufconfig)))
 		return -EFAULT;
@@ -303,37 +313,9 @@ static int do_bufconfig_ioctl(struct comedi_device *dev, void *arg)
 	}
 
 	if (bc.size) {
-		if (bc.size > async->max_bufsize)
-			return -EPERM;
-
-		if (s->busy) {
-			DPRINTK("subdevice is busy, cannot resize buffer\n");
-			return -EBUSY;
-		}
-		if (async->mmap_count) {
-			DPRINTK("subdevice is mmapped, cannot resize buffer\n");
-			return -EBUSY;
-		}
-
-		if (!async->prealloc_buf)
-			return -EINVAL;
-
-		/* make sure buffer is an integral number of pages
-		 * (we round up) */
-		bc.size = (bc.size + PAGE_SIZE - 1) & PAGE_MASK;
-
-		ret = comedi_buf_alloc(dev, s, bc.size);
-		if (ret < 0)
-			return ret;
-
-		if (s->buf_change) {
-			ret = s->buf_change(dev, s, bc.size);
-			if (ret < 0)
-				return ret;
-		}
-
-		DPRINTK("comedi%i subd %d buffer resized to %i bytes\n",
-			dev->minor, bc.subdevice, async->prealloc_bufsz);
+		retval = resize_async_buffer(dev, s, async, bc.size);
+		if (retval < 0)
+			return retval;
 	}
 
 	bc.size = async->prealloc_bufsz;
@@ -746,7 +728,7 @@ static int check_insn_config_length(struct comedi_insn *insn, unsigned int *data
 	/* by default we allow the insn since we don't have checks for
 	 * all possible cases yet */
 	default:
-		rt_printk("comedi: no check for data length of config insn id "
+		printk("comedi: no check for data length of config insn id "
 			  "%i is implemented.\n"
 			  " Add a check to %s in %s.\n"
 			  " Assuming n=%i is correct.\n", data[0], __func__,
@@ -1097,13 +1079,6 @@ static int do_cmd_ioctl(struct comedi_device *dev, void *arg, void *file)
 
 	comedi_set_subdevice_runflags(s, ~0, SRF_USER | SRF_RUNNING);
 
-#ifdef CONFIG_COMEDI_RT
-	if (async->cmd.flags & TRIG_RT) {
-		if (comedi_switch_to_rt(dev) == 0)
-			comedi_set_subdevice_runflags(s, SRF_RT, SRF_RT);
-	}
-#endif
-
 	ret = s->do_cmd(dev, s);
 	if (ret == 0)
 		return 0;
@@ -1237,12 +1212,12 @@ static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg, void *file
 		return -EINVAL;
 	s = dev->subdevices + arg;
 
-	comedi_spin_lock_irqsave(&s->spin_lock, flags);
+	spin_lock_irqsave(&s->spin_lock, flags);
 	if (s->busy || s->lock)
 		ret = -EBUSY;
 	else
 		s->lock = file;
-	comedi_spin_unlock_irqrestore(&s->spin_lock, flags);
+	spin_unlock_irqrestore(&s->spin_lock, flags);
 
 	if (ret < 0)
 		return ret;
@@ -1738,12 +1713,6 @@ void do_become_nonbusy(struct comedi_device *dev, struct comedi_subdevice *s)
 	struct comedi_async *async = s->async;
 
 	comedi_set_subdevice_runflags(s, SRF_RUNNING, 0);
-#ifdef CONFIG_COMEDI_RT
-	if (comedi_get_subdevice_runflags(s) & SRF_RT) {
-		comedi_switch_to_non_rt(dev);
-		comedi_set_subdevice_runflags(s, SRF_RT, 0);
-	}
-#endif
 	if (async) {
 		comedi_reset_async_buf(async);
 		async->inttrig = NULL;
@@ -1970,8 +1939,6 @@ static int __init comedi_init(void)
 		}
 	}
 
-	comedi_rt_init();
-
 	comedi_register_ioctl32();
 
 	return 0;
@@ -1992,8 +1959,6 @@ static void __exit comedi_cleanup(void)
 
 	comedi_proc_cleanup();
 
-	comedi_rt_cleanup();
-
 	comedi_unregister_ioctl32();
 }
 
@@ -2002,8 +1967,7 @@ module_exit(comedi_cleanup);
 
 void comedi_error(const struct comedi_device *dev, const char *s)
 {
-	rt_printk("comedi%d: %s: %s\n", dev->minor, dev->driver->driver_name,
-		  s);
+	printk("comedi%d: %s: %s\n", dev->minor, dev->driver->driver_name, s);
 }
 
 void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
@@ -2034,34 +1998,18 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
 
 	if (async->cb_mask & s->async->events) {
 		if (comedi_get_subdevice_runflags(s) & SRF_USER) {
-
-			if (dev->rt) {
-#ifdef CONFIG_COMEDI_RT
-				/* pend wake up */
-				comedi_rt_pend_wakeup(&async->wait_head);
-#else
-				printk
-				    ("BUG: comedi_event() code unreachable\n");
-#endif
-			} else {
-				wake_up_interruptible(&async->wait_head);
-				if (s->subdev_flags & SDF_CMD_READ) {
-					kill_fasync(&dev->async_queue, SIGIO,
-						    POLL_IN);
-				}
-				if (s->subdev_flags & SDF_CMD_WRITE) {
-					kill_fasync(&dev->async_queue, SIGIO,
-						    POLL_OUT);
-				}
+			wake_up_interruptible(&async->wait_head);
+			if (s->subdev_flags & SDF_CMD_READ) {
+				kill_fasync(&dev->async_queue, SIGIO,
+					    POLL_IN);
+			}
+			if (s->subdev_flags & SDF_CMD_WRITE) {
+				kill_fasync(&dev->async_queue, SIGIO,
+					    POLL_OUT);
 			}
 		} else {
 			if (async->cb_func)
 				async->cb_func(s->async->events, async->cb_arg);
-			/* XXX bug here.  If subdevice A is rt, and
-			 * subdevice B tries to callback to a normal
-			 * linux kernel function, it will be at the
-			 * wrong priority.  Since this isn't very
-			 * common, I'm not going to worry about it. */
 		}
 	}
 	s->async->events = 0;
@@ -2072,10 +2020,10 @@ void comedi_set_subdevice_runflags(struct comedi_subdevice *s, unsigned mask,
 {
 	unsigned long flags;
 
-	comedi_spin_lock_irqsave(&s->spin_lock, flags);
+	spin_lock_irqsave(&s->spin_lock, flags);
 	s->runflags &= ~mask;
 	s->runflags |= (bits & mask);
-	comedi_spin_unlock_irqrestore(&s->spin_lock, flags);
+	spin_unlock_irqrestore(&s->spin_lock, flags);
 }
 
 unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s)
@@ -2083,9 +2031,9 @@ unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s)
 	unsigned long flags;
 	unsigned runflags;
 
-	comedi_spin_lock_irqsave(&s->spin_lock, flags);
+	spin_lock_irqsave(&s->spin_lock, flags);
 	runflags = s->runflags;
-	comedi_spin_unlock_irqrestore(&s->spin_lock, flags);
+	spin_unlock_irqrestore(&s->spin_lock, flags);
 	return runflags;
 }
 
@@ -2132,6 +2080,7 @@ int comedi_alloc_board_minor(struct device *hardware_device)
 	struct comedi_device_file_info *info;
 	struct device *csdev;
 	unsigned i;
+	int retval;
 
 	info = kzalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL);
 	if (info == NULL)
@@ -2142,20 +2091,19 @@ int comedi_alloc_board_minor(struct device *hardware_device)
 		return -ENOMEM;
 	}
 	comedi_device_init(info->device);
-	comedi_spin_lock_irqsave(&comedi_file_info_table_lock, flags);
+	spin_lock_irqsave(&comedi_file_info_table_lock, flags);
 	for (i = 0; i < COMEDI_NUM_BOARD_MINORS; ++i) {
 		if (comedi_file_info_table[i] == NULL) {
 			comedi_file_info_table[i] = info;
 			break;
 		}
 	}
-	comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
+	spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
 	if (i == COMEDI_NUM_BOARD_MINORS) {
 		comedi_device_cleanup(info->device);
 		kfree(info->device);
 		kfree(info);
-		rt_printk
-		    ("comedi: error: ran out of minor numbers for board device files.\n");
+		printk(KERN_ERR "comedi: error: ran out of minor numbers for board device files.\n");
 		return -EBUSY;
 	}
 	info->device->minor = i;
@@ -2164,7 +2112,35 @@ int comedi_alloc_board_minor(struct device *hardware_device)
 				     hardware_device, "comedi%i", i);
 	if (!IS_ERR(csdev))
 		info->device->class_dev = csdev;
-
+	dev_set_drvdata(csdev, info);
+	retval = device_create_file(csdev, &dev_attr_max_read_buffer_kb);
+	if (retval) {
+		printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
+			dev_attr_max_read_buffer_kb.attr.name);
+		comedi_free_board_minor(i);
+		return retval;
+	}
+	retval = device_create_file(csdev, &dev_attr_read_buffer_kb);
+	if (retval) {
+		printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
+			dev_attr_read_buffer_kb.attr.name);
+		comedi_free_board_minor(i);
+		return retval;
+	}
+	retval = device_create_file(csdev, &dev_attr_max_write_buffer_kb);
+	if (retval) {
+		printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
+			dev_attr_max_write_buffer_kb.attr.name);
+		comedi_free_board_minor(i);
+		return retval;
+	}
+	retval = device_create_file(csdev, &dev_attr_write_buffer_kb);
+	if (retval) {
+		printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
+			dev_attr_write_buffer_kb.attr.name);
+		comedi_free_board_minor(i);
+		return retval;
+	}
 	return i;
 }
 
@@ -2174,10 +2150,10 @@ void comedi_free_board_minor(unsigned minor)
 	struct comedi_device_file_info *info;
 
 	BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS);
-	comedi_spin_lock_irqsave(&comedi_file_info_table_lock, flags);
+	spin_lock_irqsave(&comedi_file_info_table_lock, flags);
 	info = comedi_file_info_table[minor];
 	comedi_file_info_table[minor] = NULL;
-	comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
+	spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
 
 	if (info) {
 		struct comedi_device *dev = info->device;
@@ -2193,12 +2169,14 @@ void comedi_free_board_minor(unsigned minor)
 	}
 }
 
-int comedi_alloc_subdevice_minor(struct comedi_device *dev, struct comedi_subdevice *s)
+int comedi_alloc_subdevice_minor(struct comedi_device *dev,
+				 struct comedi_subdevice *s)
 {
 	unsigned long flags;
 	struct comedi_device_file_info *info;
 	struct device *csdev;
 	unsigned i;
+	int retval;
 
 	info = kmalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL);
 	if (info == NULL)
@@ -2206,18 +2184,17 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, struct comedi_subdev
 	info->device = dev;
 	info->read_subdevice = s;
 	info->write_subdevice = s;
-	comedi_spin_lock_irqsave(&comedi_file_info_table_lock, flags);
+	spin_lock_irqsave(&comedi_file_info_table_lock, flags);
 	for (i = COMEDI_FIRST_SUBDEVICE_MINOR; i < COMEDI_NUM_MINORS; ++i) {
 		if (comedi_file_info_table[i] == NULL) {
 			comedi_file_info_table[i] = info;
 			break;
 		}
 	}
-	comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
+	spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
 	if (i == COMEDI_NUM_MINORS) {
 		kfree(info);
-		rt_printk
-		    ("comedi: error: ran out of minor numbers for board device files.\n");
+		printk(KERN_ERR "comedi: error: ran out of minor numbers for board device files.\n");
 		return -EBUSY;
 	}
 	s->minor = i;
@@ -2227,7 +2204,35 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, struct comedi_subdev
 				     (int)(s - dev->subdevices));
 	if (!IS_ERR(csdev))
 		s->class_dev = csdev;
-
+	dev_set_drvdata(csdev, info);
+	retval = device_create_file(csdev, &dev_attr_max_read_buffer_kb);
+	if (retval) {
+		printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
+			dev_attr_max_read_buffer_kb.attr.name);
+		comedi_free_subdevice_minor(s);
+		return retval;
+	}
+	retval = device_create_file(csdev, &dev_attr_read_buffer_kb);
+	if (retval) {
+		printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
+			dev_attr_read_buffer_kb.attr.name);
+		comedi_free_subdevice_minor(s);
+		return retval;
+	}
+	retval = device_create_file(csdev, &dev_attr_max_write_buffer_kb);
+	if (retval) {
+		printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
+			dev_attr_max_write_buffer_kb.attr.name);
+		comedi_free_subdevice_minor(s);
+		return retval;
+	}
+	retval = device_create_file(csdev, &dev_attr_write_buffer_kb);
+	if (retval) {
+		printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
+			dev_attr_write_buffer_kb.attr.name);
+		comedi_free_subdevice_minor(s);
+		return retval;
+	}
 	return i;
 }
 
@@ -2244,10 +2249,10 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s)
 	BUG_ON(s->minor >= COMEDI_NUM_MINORS);
 	BUG_ON(s->minor < COMEDI_FIRST_SUBDEVICE_MINOR);
 
-	comedi_spin_lock_irqsave(&comedi_file_info_table_lock, flags);
+	spin_lock_irqsave(&comedi_file_info_table_lock, flags);
 	info = comedi_file_info_table[s->minor];
 	comedi_file_info_table[s->minor] = NULL;
-	comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
+	spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
 
 	if (s->class_dev) {
 		device_destroy(comedi_class, MKDEV(COMEDI_MAJOR, s->minor));
@@ -2262,8 +2267,309 @@ struct comedi_device_file_info *comedi_get_device_file_info(unsigned minor)
 	struct comedi_device_file_info *info;
 
 	BUG_ON(minor >= COMEDI_NUM_MINORS);
-	comedi_spin_lock_irqsave(&comedi_file_info_table_lock, flags);
+	spin_lock_irqsave(&comedi_file_info_table_lock, flags);
 	info = comedi_file_info_table[minor];
-	comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
+	spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
 	return info;
 }
+
+static int resize_async_buffer(struct comedi_device *dev,
+			       struct comedi_subdevice *s,
+			       struct comedi_async *async, unsigned new_size)
+{
+	int retval;
+
+	if (new_size > async->max_bufsize)
+		return -EPERM;
+
+	if (s->busy) {
+		DPRINTK("subdevice is busy, cannot resize buffer\n");
+		return -EBUSY;
+	}
+	if (async->mmap_count) {
+		DPRINTK("subdevice is mmapped, cannot resize buffer\n");
+		return -EBUSY;
+	}
+
+	if (!async->prealloc_buf)
+		return -EINVAL;
+
+	/* make sure buffer is an integral number of pages
+		* (we round up) */
+	new_size = (new_size + PAGE_SIZE - 1) & PAGE_MASK;
+
+	retval = comedi_buf_alloc(dev, s, new_size);
+	if (retval < 0)
+		return retval;
+
+	if (s->buf_change) {
+		retval = s->buf_change(dev, s, new_size);
+		if (retval < 0)
+			return retval;
+	}
+
+	DPRINTK("comedi%i subd %d buffer resized to %i bytes\n",
+		dev->minor, s - dev->subdevices, async->prealloc_bufsz);
+	return 0;
+}
+
+/* sysfs attribute files */
+
+static const unsigned bytes_per_kibi = 1024;
+
+static ssize_t show_max_read_buffer_kb(struct device *dev,
+				       struct device_attribute *attr, char *buf)
+{
+	ssize_t retval;
+	struct comedi_device_file_info *info = dev_get_drvdata(dev);
+	unsigned max_buffer_size_kb = 0;
+	struct comedi_subdevice *const read_subdevice =
+					comedi_get_read_subdevice(info);
+
+	mutex_lock(&info->device->mutex);
+	if (read_subdevice &&
+	    (read_subdevice->subdev_flags & SDF_CMD_READ) &&
+	    read_subdevice->async) {
+		max_buffer_size_kb = read_subdevice->async->max_bufsize /
+					bytes_per_kibi;
+	}
+	retval =  snprintf(buf, PAGE_SIZE, "%i\n", max_buffer_size_kb);
+	mutex_unlock(&info->device->mutex);
+
+	return retval;
+}
+
+static ssize_t store_max_read_buffer_kb(struct device *dev,
+					struct device_attribute *attr,
+					const char *buf, size_t count)
+{
+	struct comedi_device_file_info *info = dev_get_drvdata(dev);
+	unsigned long new_max_size_kb;
+	uint64_t new_max_size;
+	struct comedi_subdevice *const read_subdevice =
+					comedi_get_read_subdevice(info);
+
+	if (strict_strtoul(buf, 10, &new_max_size_kb))
+		return -EINVAL;
+	if (new_max_size_kb != (uint32_t)new_max_size_kb)
+		return -EINVAL;
+	new_max_size = ((uint64_t)new_max_size_kb) * bytes_per_kibi;
+	if (new_max_size != (uint32_t)new_max_size)
+		return -EINVAL;
+
+	mutex_lock(&info->device->mutex);
+	if (read_subdevice == NULL ||
+	    (read_subdevice->subdev_flags & SDF_CMD_READ) == 0 ||
+	    read_subdevice->async == NULL) {
+		mutex_unlock(&info->device->mutex);
+		return -EINVAL;
+	}
+	read_subdevice->async->max_bufsize = new_max_size;
+	mutex_unlock(&info->device->mutex);
+
+	return count;
+}
+
+static struct device_attribute dev_attr_max_read_buffer_kb = {
+	.attr = {
+			.name = "max_read_buffer_kb",
+			.mode = S_IRUGO | S_IWUSR
+		},
+	.show = &show_max_read_buffer_kb,
+	.store = &store_max_read_buffer_kb
+};
+
+static ssize_t show_read_buffer_kb(struct device *dev,
+				   struct device_attribute *attr, char *buf)
+{
+	ssize_t retval;
+	struct comedi_device_file_info *info = dev_get_drvdata(dev);
+	unsigned buffer_size_kb = 0;
+	struct comedi_subdevice *const read_subdevice =
+					comedi_get_read_subdevice(info);
+
+	mutex_lock(&info->device->mutex);
+	if (read_subdevice &&
+		(read_subdevice->subdev_flags & SDF_CMD_READ) &&
+		read_subdevice->async) {
+		buffer_size_kb = read_subdevice->async->prealloc_bufsz /
+					bytes_per_kibi;
+	}
+	retval =  snprintf(buf, PAGE_SIZE, "%i\n", buffer_size_kb);
+	mutex_unlock(&info->device->mutex);
+
+	return retval;
+}
+
+static ssize_t store_read_buffer_kb(struct device *dev,
+				    struct device_attribute *attr,
+				    const char *buf, size_t count)
+{
+	struct comedi_device_file_info *info = dev_get_drvdata(dev);
+	unsigned long new_size_kb;
+	uint64_t new_size;
+	int retval;
+	struct comedi_subdevice *const read_subdevice =
+					comedi_get_read_subdevice(info);
+
+	if (strict_strtoul(buf, 10, &new_size_kb))
+		return -EINVAL;
+	if (new_size_kb != (uint32_t)new_size_kb)
+		return -EINVAL;
+	new_size = ((uint64_t)new_size_kb) * bytes_per_kibi;
+	if (new_size != (uint32_t)new_size)
+		return -EINVAL;
+
+	mutex_lock(&info->device->mutex);
+	if (read_subdevice == NULL ||
+	    (read_subdevice->subdev_flags & SDF_CMD_READ) == 0 ||
+	    read_subdevice->async == NULL) {
+		mutex_unlock(&info->device->mutex);
+		return -EINVAL;
+	}
+	retval = resize_async_buffer(info->device, read_subdevice,
+				     read_subdevice->async, new_size);
+	mutex_unlock(&info->device->mutex);
+
+	if (retval < 0)
+		return retval;
+	return count;
+}
+
+static struct device_attribute dev_attr_read_buffer_kb = {
+	.attr = {
+			.name = "read_buffer_kb",
+			.mode = S_IRUGO | S_IWUSR | S_IWGRP
+		},
+	.show = &show_read_buffer_kb,
+	.store = &store_read_buffer_kb
+};
+
+static ssize_t show_max_write_buffer_kb(struct device *dev,
+					struct device_attribute *attr,
+					char *buf)
+{
+	ssize_t retval;
+	struct comedi_device_file_info *info = dev_get_drvdata(dev);
+	unsigned max_buffer_size_kb = 0;
+	struct comedi_subdevice *const write_subdevice =
+					comedi_get_write_subdevice(info);
+
+	mutex_lock(&info->device->mutex);
+	if (write_subdevice &&
+	    (write_subdevice->subdev_flags & SDF_CMD_WRITE) &&
+	    write_subdevice->async) {
+		max_buffer_size_kb = write_subdevice->async->max_bufsize /
+					bytes_per_kibi;
+	}
+	retval =  snprintf(buf, PAGE_SIZE, "%i\n", max_buffer_size_kb);
+	mutex_unlock(&info->device->mutex);
+
+	return retval;
+}
+
+static ssize_t store_max_write_buffer_kb(struct device *dev,
+					 struct device_attribute *attr,
+					 const char *buf, size_t count)
+{
+	struct comedi_device_file_info *info = dev_get_drvdata(dev);
+	unsigned long new_max_size_kb;
+	uint64_t new_max_size;
+	struct comedi_subdevice *const write_subdevice =
+					comedi_get_write_subdevice(info);
+
+	if (strict_strtoul(buf, 10, &new_max_size_kb))
+		return -EINVAL;
+	if (new_max_size_kb != (uint32_t)new_max_size_kb)
+		return -EINVAL;
+	new_max_size = ((uint64_t)new_max_size_kb) * bytes_per_kibi;
+	if (new_max_size != (uint32_t)new_max_size)
+		return -EINVAL;
+
+	mutex_lock(&info->device->mutex);
+	if (write_subdevice == NULL ||
+	    (write_subdevice->subdev_flags & SDF_CMD_WRITE) == 0 ||
+	    write_subdevice->async == NULL) {
+		mutex_unlock(&info->device->mutex);
+		return -EINVAL;
+	}
+	write_subdevice->async->max_bufsize = new_max_size;
+	mutex_unlock(&info->device->mutex);
+
+	return count;
+}
+
+static struct device_attribute dev_attr_max_write_buffer_kb = {
+	.attr = {
+			.name = "max_write_buffer_kb",
+			.mode = S_IRUGO | S_IWUSR
+		},
+	.show = &show_max_write_buffer_kb,
+	.store = &store_max_write_buffer_kb
+};
+
+static ssize_t show_write_buffer_kb(struct device *dev,
+				    struct device_attribute *attr, char *buf)
+{
+	ssize_t retval;
+	struct comedi_device_file_info *info = dev_get_drvdata(dev);
+	unsigned buffer_size_kb = 0;
+	struct comedi_subdevice *const write_subdevice =
+					comedi_get_write_subdevice(info);
+
+	mutex_lock(&info->device->mutex);
+	if (write_subdevice &&
+	    (write_subdevice->subdev_flags & SDF_CMD_WRITE) &&
+	    write_subdevice->async) {
+		buffer_size_kb = write_subdevice->async->prealloc_bufsz /
+					bytes_per_kibi;
+	}
+	retval =  snprintf(buf, PAGE_SIZE, "%i\n", buffer_size_kb);
+	mutex_unlock(&info->device->mutex);
+
+	return retval;
+}
+
+static ssize_t store_write_buffer_kb(struct device *dev,
+				     struct device_attribute *attr,
+				     const char *buf, size_t count)
+{
+	struct comedi_device_file_info *info = dev_get_drvdata(dev);
+	unsigned long new_size_kb;
+	uint64_t new_size;
+	int retval;
+	struct comedi_subdevice *const write_subdevice =
+					comedi_get_write_subdevice(info);
+
+	if (strict_strtoul(buf, 10, &new_size_kb))
+		return -EINVAL;
+	if (new_size_kb != (uint32_t)new_size_kb)
+		return -EINVAL;
+	new_size = ((uint64_t)new_size_kb) * bytes_per_kibi;
+	if (new_size != (uint32_t)new_size)
+		return -EINVAL;
+
+	mutex_lock(&info->device->mutex);
+	if (write_subdevice == NULL ||
+	    (write_subdevice->subdev_flags & SDF_CMD_WRITE) == 0 ||
+	    write_subdevice->async == NULL) {
+		mutex_unlock(&info->device->mutex);
+		return -EINVAL;
+	}
+	retval = resize_async_buffer(info->device, write_subdevice,
+		write_subdevice->async, new_size);
+	mutex_unlock(&info->device->mutex);
+
+	if (retval < 0)
+		return retval;
+	return count;
+}
+
+static struct device_attribute dev_attr_write_buffer_kb = {
+	.attr = {
+			.name = "write_buffer_kb",
+			.mode = S_IRUGO | S_IWUSR | S_IWGRP
+		},
+	.show = &show_write_buffer_kb,
+	.store = &store_write_buffer_kb
+};

+ 0 - 7
drivers/staging/comedi/comedi_ksyms.c

@@ -46,13 +46,6 @@ EXPORT_SYMBOL(range_bipolar2_5);
 EXPORT_SYMBOL(range_unipolar10);
 EXPORT_SYMBOL(range_unipolar5);
 EXPORT_SYMBOL(range_unknown);
-#ifdef CONFIG_COMEDI_RT
-EXPORT_SYMBOL(comedi_free_irq);
-EXPORT_SYMBOL(comedi_request_irq);
-EXPORT_SYMBOL(comedi_switch_to_rt);
-EXPORT_SYMBOL(comedi_switch_to_non_rt);
-EXPORT_SYMBOL(rt_pend_call);
-#endif
 #ifdef CONFIG_COMEDI_DEBUG
 EXPORT_SYMBOL(comedi_debug);
 #endif

+ 0 - 149
drivers/staging/comedi/comedi_rt.h

@@ -1,149 +0,0 @@
-/*
-    module/comedi_rt.h
-    header file for real-time structures, variables, and constants
-
-    COMEDI - Linux Control and Measurement Device Interface
-    Copyright (C) 1997-2000 David A. Schleef <ds@schleef.org>
-
-    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.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef _COMEDI_RT_H
-#define _COMEDI_RT_H
-
-#ifndef _COMEDIDEV_H
-#error comedi_rt.h should only be included by comedidev.h
-#endif
-
-#include <linux/kdev_t.h>
-#include <linux/slab.h>
-#include <linux/errno.h>
-#include <linux/spinlock.h>
-#include <linux/delay.h>
-
-#ifdef CONFIG_COMEDI_RT
-
-#ifdef CONFIG_COMEDI_RTAI
-#include <rtai.h>
-#include <rtai_sched.h>
-#include <rtai_version.h>
-#endif
-#ifdef CONFIG_COMEDI_RTL
-#include <rtl_core.h>
-#include <rtl_time.h>
-/* #ifdef RTLINUX_VERSION_CODE */
-#include <rtl_sync.h>
-/* #endif */
-#define rt_printk rtl_printf
-#endif
-#ifdef CONFIG_COMEDI_FUSION
-#define rt_printk(format, args...) printk(format , ## args)
-#endif /* CONFIG_COMEDI_FUSION */
-#ifdef CONFIG_PRIORITY_IRQ
-#define rt_printk printk
-#endif
-
-int comedi_request_irq(unsigned int irq, irqreturn_t(*handler) (int,
-		void *PT_REGS_ARG), unsigned long flags, const char *device,
-		struct comedi_device *dev_id);
-void comedi_free_irq(unsigned int irq, struct comedi_device *dev_id);
-void comedi_rt_init(void);
-void comedi_rt_cleanup(void);
-int comedi_switch_to_rt(struct comedi_device *dev);
-void comedi_switch_to_non_rt(struct comedi_device *dev);
-void comedi_rt_pend_wakeup(wait_queue_head_t *q);
-extern int rt_pend_call(void (*func) (int arg1, void *arg2), int arg1,
-	void *arg2);
-
-#else
-
-#define comedi_request_irq(a, b, c, d, e) request_irq(a, b, c, d, e)
-#define comedi_free_irq(a, b) free_irq(a, b)
-#define comedi_rt_init() do {} while (0)
-#define comedi_rt_cleanup() do {} while (0)
-#define comedi_switch_to_rt(a) (-1)
-#define comedi_switch_to_non_rt(a) do {} while (0)
-#define comedi_rt_pend_wakeup(a) do {} while (0)
-
-#define rt_printk(format, args...)	printk(format, ##args)
-
-#endif
-
-/* Define a spin_lock_irqsave function that will work with rt or without.
- * Use inline functions instead of just macros to enforce some type checking.
- */
-#define comedi_spin_lock_irqsave(lock_ptr, flags) \
-	(flags = __comedi_spin_lock_irqsave(lock_ptr))
-
-static inline unsigned long __comedi_spin_lock_irqsave(spinlock_t *lock_ptr)
-{
-	unsigned long flags;
-
-#if defined(CONFIG_COMEDI_RTAI)
-	flags = rt_spin_lock_irqsave(lock_ptr);
-
-#elif defined(CONFIG_COMEDI_RTL)
-	rtl_spin_lock_irqsave(lock_ptr, flags);
-
-#elif defined(CONFIG_COMEDI_RTL_V1)
-	rtl_spin_lock_irqsave(lock_ptr, flags);
-
-#elif defined(CONFIG_COMEDI_FUSION)
-	rthal_spin_lock_irqsave(lock_ptr, flags);
-#else
-	spin_lock_irqsave(lock_ptr, flags);
-
-#endif
-
-	return flags;
-}
-
-static inline void comedi_spin_unlock_irqrestore(spinlock_t *lock_ptr,
-	unsigned long flags)
-{
-
-#if defined(CONFIG_COMEDI_RTAI)
-	rt_spin_unlock_irqrestore(flags, lock_ptr);
-
-#elif defined(CONFIG_COMEDI_RTL)
-	rtl_spin_unlock_irqrestore(lock_ptr, flags);
-
-#elif defined(CONFIG_COMEDI_RTL_V1)
-	rtl_spin_unlock_irqrestore(lock_ptr, flags);
-#elif defined(CONFIG_COMEDI_FUSION)
-	rthal_spin_unlock_irqrestore(lock_ptr, flags);
-#else
-	spin_unlock_irqrestore(lock_ptr, flags);
-
-#endif
-
-}
-
-/* define a RT safe udelay */
-static inline void comedi_udelay(unsigned int usec)
-{
-#if defined(CONFIG_COMEDI_RTAI)
-	static const int nanosec_per_usec = 1000;
-	rt_busy_sleep(usec * nanosec_per_usec);
-#elif defined(CONFIG_COMEDI_RTL)
-	static const int nanosec_per_usec = 1000;
-	rtl_delay(usec * nanosec_per_usec);
-#else
-	udelay(usec);
-#endif
-}
-
-#endif

+ 14 - 3
drivers/staging/comedi/comedidev.h

@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/kdev_t.h>
 #include <linux/slab.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
@@ -35,10 +36,10 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/vmalloc.h>
-#include "interrupt.h"
 #include <linux/dma-mapping.h>
 #include <linux/uaccess.h>
 #include <linux/io.h>
+#include <linux/timer.h>
 
 #include "comedi.h"
 
@@ -264,7 +265,6 @@ struct comedi_device {
 	const char *board_name;
 	const void *board_ptr;
 	int attached;
-	int rt;
 	spinlock_t spinlock;
 	struct mutex mutex;
 	int in_request_module;
@@ -524,6 +524,17 @@ struct usb_device;	/* forward declaration */
 int comedi_usb_auto_config(struct usb_device *usbdev, const char *board_name);
 void comedi_usb_auto_unconfig(struct usb_device *usbdev);
 
-#include "comedi_rt.h"
+#ifdef CONFIG_COMEDI_PCI_DRIVERS
+	#define CONFIG_COMEDI_PCI
+#endif
+#ifdef CONFIG_COMEDI_PCI_DRIVERS_MODULE
+	#define CONFIG_COMEDI_PCI
+#endif
+#ifdef CONFIG_COMEDI_PCMCIA_DRIVERS
+	#define CONFIG_COMEDI_PCMCIA
+#endif
+#ifdef CONFIG_COMEDI_PCMCIA_DRIVERS_MODULE
+	#define CONFIG_COMEDI_PCMCIA
+#endif
 
 #endif /* _COMEDIDEV_H */

+ 9 - 10
drivers/staging/comedi/drivers.c

@@ -198,7 +198,7 @@ int comedi_driver_unregister(struct comedi_driver *driver)
 		struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(i);
 		struct comedi_device *dev;
 
-		if(dev_file_info == NULL) continue;
+		if (dev_file_info == NULL) continue;
 		dev = dev_file_info->device;
 
 		mutex_lock(&dev->mutex);
@@ -554,7 +554,7 @@ unsigned int comedi_buf_munge(struct comedi_async *async, unsigned int num_bytes
 
 		block_size = num_bytes - count;
 		if (block_size < 0) {
-			rt_printk("%s: %s: bug! block_size is negative\n",
+			printk("%s: %s: bug! block_size is negative\n",
 				__FILE__, __func__);
 			break;
 		}
@@ -633,8 +633,7 @@ unsigned comedi_buf_write_free(struct comedi_async *async, unsigned int nbytes)
 {
 	if ((int)(async->buf_write_count + nbytes -
 			async->buf_write_alloc_count) > 0) {
-		rt_printk
-			("comedi: attempted to write-free more bytes than have been write-allocated.\n");
+		printk("comedi: attempted to write-free more bytes than have been write-allocated.\n");
 		nbytes = async->buf_write_alloc_count - async->buf_write_count;
 	}
 	async->buf_write_count += nbytes;
@@ -667,8 +666,7 @@ unsigned comedi_buf_read_free(struct comedi_async *async, unsigned int nbytes)
 	smp_mb();
 	if ((int)(async->buf_read_count + nbytes -
 			async->buf_read_alloc_count) > 0) {
-		rt_printk
-			("comedi: attempted to read-free more bytes than have been read-allocated.\n");
+		printk("comedi: attempted to read-free more bytes than have been read-allocated.\n");
 		nbytes = async->buf_read_alloc_count - async->buf_read_count;
 	}
 	async->buf_read_count += nbytes;
@@ -801,7 +799,7 @@ int comedi_auto_config(struct device *hardware_device, const char *board_name, c
 	}
 
 	minor = comedi_alloc_board_minor(hardware_device);
-	if(minor < 0) return minor;
+	if (minor < 0) return minor;
 
 	private_data = kmalloc(sizeof(unsigned), GFP_KERNEL);
 	if (private_data == NULL) {
@@ -824,7 +822,7 @@ int comedi_auto_config(struct device *hardware_device, const char *board_name, c
 	mutex_unlock(&dev_file_info->device->mutex);
 
 cleanup:
-	if(retval < 0)
+	if (retval < 0)
 	{
 		kfree(private_data);
 		comedi_free_board_minor(minor);
@@ -835,7 +833,7 @@ int comedi_auto_config(struct device *hardware_device, const char *board_name, c
 void comedi_auto_unconfig(struct device *hardware_device)
 {
 	unsigned *minor = (unsigned *)dev_get_drvdata(hardware_device);
-	if(minor == NULL) return;
+	if (minor == NULL) return;
 
 	BUG_ON(*minor >= COMEDI_NUM_BOARD_MINORS);
 
@@ -853,7 +851,8 @@ int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name)
 	/*  pci slot */
 	options[1] = PCI_SLOT(pcidev->devfn);
 
-	return comedi_auto_config(&pcidev->dev, board_name, options, sizeof(options) / sizeof(options[0]));
+	return comedi_auto_config(&pcidev->dev, board_name,
+				  options, ARRAY_SIZE(options));
 }
 
 void comedi_pci_auto_unconfig(struct pci_dev *pcidev)

+ 23 - 27
drivers/staging/comedi/drivers/8253.h

@@ -24,11 +24,7 @@
 #ifndef _8253_H
 #define _8253_H
 
-#ifndef CMDTEST
-#include "../comedi.h"
-#else
 #include "../comedi.h"
-#endif
 
 #define i8253_cascade_ns_to_timer i8253_cascade_ns_to_timer_2div
 
@@ -205,7 +201,7 @@ static inline void i8253_cascade_ns_to_timer_2div(int i8253_osc_base,
 	}
 
 	*nanosec = div1 * div2 * i8253_osc_base;
-	*d1 = div1 & 0xffff;	// masking is done since counter maps zero to 0x10000
+	*d1 = div1 & 0xffff;	/*  masking is done since counter maps zero to 0x10000 */
 	*d2 = div2 & 0xffff;
 	return;
 }
@@ -247,12 +243,12 @@ static inline int i8254_load(unsigned long base_address, unsigned int regshift,
 		return -1;
 
 	byte = counter_number << 6;
-	byte |= 0x30;		// load low then high byte
-	byte |= (mode << 1);	// set counter mode
+	byte |= 0x30;		/*  load low then high byte */
+	byte |= (mode << 1);	/*  set counter mode */
 	outb(byte, base_address + (i8254_control_reg << regshift));
-	byte = count & 0xff;	// lsb of counter value
+	byte = count & 0xff;	/*  lsb of counter value */
 	outb(byte, base_address + (counter_number << regshift));
-	byte = (count >> 8) & 0xff;	// msb of counter value
+	byte = (count >> 8) & 0xff;	/*  msb of counter value */
 	outb(byte, base_address + (counter_number << regshift));
 
 	return 0;
@@ -273,12 +269,12 @@ static inline int i8254_mm_load(void *base_address, unsigned int regshift,
 		return -1;
 
 	byte = counter_number << 6;
-	byte |= 0x30;		// load low then high byte
-	byte |= (mode << 1);	// set counter mode
+	byte |= 0x30;		/*  load low then high byte */
+	byte |= (mode << 1);	/*  set counter mode */
 	writeb(byte, base_address + (i8254_control_reg << regshift));
-	byte = count & 0xff;	// lsb of counter value
+	byte = count & 0xff;	/*  lsb of counter value */
 	writeb(byte, base_address + (counter_number << regshift));
-	byte = (count >> 8) & 0xff;	// msb of counter value
+	byte = (count >> 8) & 0xff;	/*  msb of counter value */
 	writeb(byte, base_address + (counter_number << regshift));
 
 	return 0;
@@ -294,13 +290,13 @@ static inline int i8254_read(unsigned long base_address, unsigned int regshift,
 	if (counter_number > 2)
 		return -1;
 
-	// latch counter
+	/*  latch counter */
 	byte = counter_number << 6;
 	outb(byte, base_address + (i8254_control_reg << regshift));
 
-	// read lsb
+	/*  read lsb */
 	ret = inb(base_address + (counter_number << regshift));
-	// read msb
+	/*  read msb */
 	ret += inb(base_address + (counter_number << regshift)) << 8;
 
 	return ret;
@@ -315,13 +311,13 @@ static inline int i8254_mm_read(void *base_address, unsigned int regshift,
 	if (counter_number > 2)
 		return -1;
 
-	// latch counter
+	/*  latch counter */
 	byte = counter_number << 6;
 	writeb(byte, base_address + (i8254_control_reg << regshift));
 
-	// read lsb
+	/*  read lsb */
 	ret = readb(base_address + (counter_number << regshift));
-	// read msb
+	/*  read msb */
 	ret += readb(base_address + (counter_number << regshift)) << 8;
 
 	return ret;
@@ -336,9 +332,9 @@ static inline void i8254_write(unsigned long base_address,
 	if (counter_number > 2)
 		return;
 
-	byte = count & 0xff;	// lsb of counter value
+	byte = count & 0xff;	/*  lsb of counter value */
 	outb(byte, base_address + (counter_number << regshift));
-	byte = (count >> 8) & 0xff;	// msb of counter value
+	byte = (count >> 8) & 0xff;	/*  msb of counter value */
 	outb(byte, base_address + (counter_number << regshift));
 }
 
@@ -350,9 +346,9 @@ static inline void i8254_mm_write(void *base_address,
 	if (counter_number > 2)
 		return;
 
-	byte = count & 0xff;	// lsb of counter value
+	byte = count & 0xff;	/*  lsb of counter value */
 	writeb(byte, base_address + (counter_number << regshift));
-	byte = (count >> 8) & 0xff;	// msb of counter value
+	byte = (count >> 8) & 0xff;	/*  msb of counter value */
 	writeb(byte, base_address + (counter_number << regshift));
 }
 
@@ -374,8 +370,8 @@ static inline int i8254_set_mode(unsigned long base_address,
 		return -1;
 
 	byte = counter_number << 6;
-	byte |= 0x30;		// load low then high byte
-	byte |= mode;		// set counter mode and BCD|binary
+	byte |= 0x30;		/*  load low then high byte */
+	byte |= mode;		/*  set counter mode and BCD|binary */
 	outb(byte, base_address + (i8254_control_reg << regshift));
 
 	return 0;
@@ -392,8 +388,8 @@ static inline int i8254_mm_set_mode(void *base_address,
 		return -1;
 
 	byte = counter_number << 6;
-	byte |= 0x30;		// load low then high byte
-	byte |= mode;		// set counter mode and BCD|binary
+	byte |= 0x30;		/*  load low then high byte */
+	byte |= mode;		/*  set counter mode and BCD|binary */
 	writeb(byte, base_address + (i8254_control_reg << regshift));
 
 	return 0;

+ 13 - 10
drivers/staging/comedi/drivers/8255.c

@@ -108,10 +108,10 @@ struct subdev_8255_struct {
 static int dev_8255_attach(struct comedi_device *dev, struct comedi_devconfig * it);
 static int dev_8255_detach(struct comedi_device *dev);
 static struct comedi_driver driver_8255 = {
-      driver_name:"8255",
-      module:THIS_MODULE,
-      attach:dev_8255_attach,
-      detach:dev_8255_detach,
+	.driver_name = "8255",
+	.module = THIS_MODULE,
+	.attach = dev_8255_attach,
+	.detach = dev_8255_detach,
 };
 
 COMEDI_INITCLEANUP(driver_8255);
@@ -144,7 +144,7 @@ static int subdev_8255_cb(int dir, int port, int data, unsigned long arg)
 }
 
 static int subdev_8255_insn(struct comedi_device *dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+	struct comedi_insn *insn, unsigned int *data)
 {
 	if (data[0]) {
 		s->state &= ~data[0];
@@ -169,7 +169,7 @@ static int subdev_8255_insn(struct comedi_device *dev, struct comedi_subdevice *
 }
 
 static int subdev_8255_insn_config(struct comedi_device *dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+	struct comedi_insn *insn, unsigned int *data)
 {
 	unsigned int mask;
 	unsigned int bits;
@@ -223,7 +223,7 @@ static void do_config(struct comedi_device *dev, struct comedi_subdevice * s)
 }
 
 static int subdev_8255_cmdtest(struct comedi_device *dev, struct comedi_subdevice * s,
-	struct comedi_cmd * cmd)
+	struct comedi_cmd *cmd)
 {
 	int err = 0;
 	unsigned int tmp;
@@ -361,8 +361,10 @@ int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice * s,
 void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice * s)
 {
 	if (s->private) {
-		if (subdevpriv->have_irq) {
-		}
+		/* this test does nothing, so comment it out
+		 * if (subdevpriv->have_irq) {
+		 * }
+		 */
 
 		kfree(s->private);
 	}
@@ -394,7 +396,8 @@ static int dev_8255_attach(struct comedi_device *dev, struct comedi_devconfig *
 		return -EINVAL;
 	}
 
-	if ((ret = alloc_subdevices(dev, i)) < 0)
+	ret = alloc_subdevices(dev, i);
+	if (ret < 0)
 		return ret;
 
 	for (i = 0; i < dev->n_subdevices; i++) {

+ 7 - 7
drivers/staging/comedi/drivers/8255.h

@@ -28,16 +28,16 @@
 
 #if defined(CONFIG_COMEDI_8255) || defined(CONFIG_COMEDI_8255_MODULE)
 
-int subdev_8255_init(struct comedi_device * dev, struct comedi_subdevice * s,
+int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
 	int (*cb) (int, int, int, unsigned long), unsigned long arg);
-int subdev_8255_init_irq(struct comedi_device * dev, struct comedi_subdevice * s,
+int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s,
 	int (*cb) (int, int, int, unsigned long), unsigned long arg);
-void subdev_8255_cleanup(struct comedi_device * dev, struct comedi_subdevice * s);
-void subdev_8255_interrupt(struct comedi_device * dev, struct comedi_subdevice * s);
+void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice *s);
+void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice *s);
 
 #else
 
-static inline int subdev_8255_init(struct comedi_device * dev, struct comedi_subdevice * s,
+static inline int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
 	void *x, unsigned long y)
 {
 	printk("8255 support not configured -- disabling subdevice\n");
@@ -47,8 +47,8 @@ static inline int subdev_8255_init(struct comedi_device * dev, struct comedi_sub
 	return 0;
 }
 
-static inline void subdev_8255_cleanup(struct comedi_device * dev,
-	struct comedi_subdevice * s)
+static inline void subdev_8255_cleanup(struct comedi_device *dev,
+	struct comedi_subdevice *s)
 {
 }
 

+ 4 - 1
drivers/staging/comedi/drivers/Makefile

@@ -6,6 +6,7 @@ obj-$(CONFIG_COMEDI)			+= comedi_fc.o
 obj-$(CONFIG_COMEDI)			+= comedi_bond.o
 obj-$(CONFIG_COMEDI)			+= comedi_test.o
 obj-$(CONFIG_COMEDI)			+= comedi_parport.o
+obj-$(CONFIG_COMEDI)			+= pcm_common.o
 
 # Comedi PCI drivers
 obj-$(CONFIG_COMEDI_PCI_DRIVERS)	+= 8255.o
@@ -125,6 +126,8 @@ obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS)	+= ni_mio_cs.o
 obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS)	+= quatech_daqp_cs.o
 
 # Comedi USB drivers
+obj-$(CONFIG_COMEDI_USB_DRIVERS)	+= dt9812.o
 obj-$(CONFIG_COMEDI_USB_DRIVERS)	+= usbdux.o
 obj-$(CONFIG_COMEDI_USB_DRIVERS)	+= usbduxfast.o
-obj-$(CONFIG_COMEDI_USB_DRIVERS)	+= dt9812.o
+obj-$(CONFIG_COMEDI_USB_DRIVERS)	+= vmk80xx.o
+

+ 11 - 11
drivers/staging/comedi/drivers/acl7225b.c

@@ -26,8 +26,8 @@ static int acl7225b_attach(struct comedi_device *dev, struct comedi_devconfig *
 static int acl7225b_detach(struct comedi_device *dev);
 
 struct boardtype {
-	const char *name;	// driver name
-	int io_range;		// len of I/O space
+	const char *name;	/*  driver name */
+	int io_range;		/*  len of I/O space */
 };
 
 static const struct boardtype boardtypes[] = {
@@ -39,19 +39,19 @@ static const struct boardtype boardtypes[] = {
 #define this_board ((const struct boardtype *)dev->board_ptr)
 
 static struct comedi_driver driver_acl7225b = {
-      driver_name:"acl7225b",
-      module:THIS_MODULE,
-      attach:acl7225b_attach,
-      detach:acl7225b_detach,
-      board_name:&boardtypes[0].name,
-      num_names:n_boardtypes,
-      offset:sizeof(struct boardtype),
+	.driver_name = "acl7225b",
+	.module = THIS_MODULE,
+	.attach = acl7225b_attach,
+	.detach = acl7225b_detach,
+	.board_name = &boardtypes[0].name,
+	.num_names = n_boardtypes,
+	.offset = sizeof(struct boardtype),
 };
 
 COMEDI_INITCLEANUP(driver_acl7225b);
 
 static int acl7225b_do_insn(struct comedi_device *dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+	struct comedi_insn *insn, unsigned int *data)
 {
 	if (insn->n != 2)
 		return -EINVAL;
@@ -72,7 +72,7 @@ static int acl7225b_do_insn(struct comedi_device *dev, struct comedi_subdevice *
 }
 
 static int acl7225b_di_insn(struct comedi_device *dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+	struct comedi_insn *insn, unsigned int *data)
 {
 	if (insn->n != 2)
 		return -EINVAL;

+ 186 - 186
drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.c

@@ -23,16 +23,16 @@
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_     i_APCI1710_InitTimer                         |
-|                               (BYTE_   b_BoardHandle,                      |
-|                                BYTE_   b_ModulNbr,                         |
-|                                BYTE_   b_TimerNbr,                         |
-|                                BYTE_   b_TimerMode,                        |
+|                               (unsigned char_   b_BoardHandle,                      |
+|                                unsigned char_   b_ModulNbr,                         |
+|                                unsigned char_   b_TimerNbr,                         |
+|                                unsigned char_   b_TimerMode,                        |
 |                                ULONG_ ul_ReloadValue,                      |
-|                                BYTE_   b_InputClockSelection,              |
-|                                BYTE_   b_InputClockLevel,                  |
-|                                BYTE_   b_OutputLevel,                      |
-|                                BYTE_   b_HardwareGateLevel)
-INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s,
+|                                unsigned char_   b_InputClockSelection,              |
+|                                unsigned char_   b_InputClockLevel,                  |
+|                                unsigned char_   b_OutputLevel,                      |
+|                                unsigned char_   b_HardwareGateLevel)
+int i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s,
 	struct comedi_insn *insn,unsigned int *data)
 |
 +----------------------------------------------------------------------------+
@@ -148,13 +148,13 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s,
 |  +--------------------------------+------------------------------------+   |
 |                                                                            |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_   b_BoardHandle        : Handle of board         |
+| Input Parameters  : unsigned char_   b_BoardHandle        : Handle of board         |
 |                                                    APCI-1710               |
-|                     BYTE_   b_ModulNbr           : Module number to        |
+|                     unsigned char_   b_ModulNbr           : Module number to        |
 |                                                    configure (0 to 3)      |
-|                     BYTE_   b_TimerNbr           : Timer number to         |
+|                     unsigned char_   b_TimerNbr           : Timer number to         |
 |                                                    configure (0 to 2)      |
-|                     BYTE_   b_TimerMode          : Timer mode selection    |
+|                     unsigned char_   b_TimerMode          : Timer mode selection    |
 |                                                    (0 to 5)                |
 |                                                    0: Interrupt on terminal|
 |                                                       count                |
@@ -173,21 +173,21 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s,
 |                                                     or division factor     |
 |                                                     See timer mode         |
 |                                                     description table.     |
-|                     BYTE_   b_InputClockSelection : Selection from input   |
+|                     unsigned char_   b_InputClockSelection : Selection from input   |
 |                                                     timer clock.           |
 |                                                     See input clock        |
 |                                                     selection table.       |
-|                     BYTE_   b_InputClockLevel     : Selection from input   |
+|                     unsigned char_   b_InputClockLevel     : Selection from input   |
 |                                                     clock level.           |
 |                                                     0 : Low active         |
 |                                                         (Input inverted)   |
 |                                                     1 : High active        |
-|                     BYTE_   b_OutputLevel,        : Selection from output  |
+|                     unsigned char_   b_OutputLevel,        : Selection from output  |
 |                                                     clock level.           |
 |                                                     0 : Low active         |
 |                                                     1 : High active        |
 |                                                         (Output inverted)  |
-|                     BYTE_   b_HardwareGateLevel   : Selection from         |
+|                     unsigned char_   b_HardwareGateLevel   : Selection from         |
 |                                                     hardware gate level.   |
 |                                                     0 : Low active         |
 |                                                         (Input inverted)   |
@@ -195,14 +195,14 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s,
 |                                                     If you will not used   |
 |                                                     the hardware gate set  |
 |                                                     this value to 0.
-|b_ModulNbr        = (BYTE) CR_AREF(insn->chanspec);
-	b_TimerNbr		  = (BYTE) CR_CHAN(insn->chanspec);
-	b_TimerMode		  = (BYTE) data[0];
-	ul_ReloadValue	  = (ULONG) data[1];
-	b_InputClockSelection	=(BYTE) data[2];
-	b_InputClockLevel		=(BYTE) data[3];
-	b_OutputLevel			=(BYTE) data[4];
-	b_HardwareGateLevel		=(BYTE) data[5];
+|b_ModulNbr        = (unsigned char) CR_AREF(insn->chanspec);
+	b_TimerNbr		  = (unsigned char) CR_CHAN(insn->chanspec);
+	b_TimerMode		  = (unsigned char) data[0];
+	ul_ReloadValue	  = (unsigned int) data[1];
+	b_InputClockSelection	=(unsigned char) data[2];
+	b_InputClockLevel		=(unsigned char) data[3];
+	b_OutputLevel			=(unsigned char) data[4];
+	b_HardwareGateLevel		=(unsigned char) data[5];
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -219,33 +219,33 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_subdevice * s,
-				   struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnConfigInitTimer(struct comedi_device *dev, struct comedi_subdevice *s,
+				   struct comedi_insn *insn, unsigned int *data)
 {
 
-	INT i_ReturnValue = 0;
-	BYTE b_ModulNbr;
-	BYTE b_TimerNbr;
-	BYTE b_TimerMode;
-	ULONG ul_ReloadValue;
-	BYTE b_InputClockSelection;
-	BYTE b_InputClockLevel;
-	BYTE b_OutputLevel;
-	BYTE b_HardwareGateLevel;
+	int i_ReturnValue = 0;
+	unsigned char b_ModulNbr;
+	unsigned char b_TimerNbr;
+	unsigned char b_TimerMode;
+	unsigned int ul_ReloadValue;
+	unsigned char b_InputClockSelection;
+	unsigned char b_InputClockLevel;
+	unsigned char b_OutputLevel;
+	unsigned char b_HardwareGateLevel;
 
-	//BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz
-	DWORD dw_Test = 0;
-	//END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz
+	/* BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */
+	unsigned int dw_Test = 0;
+	/* END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */
 
 	i_ReturnValue = insn->n;
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec);
-	b_TimerMode = (BYTE) data[0];
-	ul_ReloadValue = (ULONG) data[1];
-	b_InputClockSelection = (BYTE) data[2];
-	b_InputClockLevel = (BYTE) data[3];
-	b_OutputLevel = (BYTE) data[4];
-	b_HardwareGateLevel = (BYTE) data[5];
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_TimerNbr = (unsigned char) CR_CHAN(insn->chanspec);
+	b_TimerMode = (unsigned char) data[0];
+	ul_ReloadValue = (unsigned int) data[1];
+	b_InputClockSelection = (unsigned char) data[2];
+	b_InputClockLevel = (unsigned char) data[3];
+	b_OutputLevel = (unsigned char) data[4];
+	b_HardwareGateLevel = (unsigned char) data[5];
 
 	/* Test the module number */
 	if (b_ModulNbr < 4) {
@@ -256,7 +256,7 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub
 			if (b_TimerNbr <= 2) {
 				/* Test the timer mode */
 				if (b_TimerMode <= 5) {
-					//BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz
+					/* BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */
 					/* Test te imput clock selection */
 					/*
 					   if (((b_TimerNbr == 0) && (b_InputClockSelection == 0)) ||
@@ -271,11 +271,11 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub
 					     ((b_InputClockSelection == APCI1710_PCI_BUS_CLOCK) ||
 					      (b_InputClockSelection == APCI1710_FRONT_CONNECTOR_INPUT) ||
 					      (b_InputClockSelection == APCI1710_10MHZ)))) {
-						//BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz
+						/* BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */
 						if (((b_InputClockSelection == APCI1710_10MHZ) &&
 						     ((devpriv->s_BoardInfos.dw_MolduleConfiguration[b_ModulNbr] & 0x0000FFFFUL) >= 0x3131)) ||
 						     (b_InputClockSelection != APCI1710_10MHZ)) {
-							//END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz
+							/* END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */
 							/* Test the input clock level selection */
 
 							if ((b_InputClockLevel == 0) ||
@@ -284,7 +284,7 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub
 								if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) {
 									/* Test the hardware gate level selection */
 									if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) {
-										//BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz
+										/* BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */
 										/* Test if version > 1.1 and clock selection = 10MHz */
 										if ((b_InputClockSelection == APCI1710_10MHZ) && ((devpriv->s_BoardInfos.dw_MolduleConfiguration[b_ModulNbr] & 0x0000FFFFUL) > 0x3131)) {
 											/* Test if 40MHz quartz on board */
@@ -297,7 +297,7 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub
 
 										/* Test if detection OK */
 										if (dw_Test == 1) {
-											//END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz
+											/* END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */
 											/* Initialisation OK */
 											devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].b_82X54Init = 1;
 
@@ -314,12 +314,12 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub
 											devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].b_HardwareGateLevel = b_HardwareGateLevel;
 
 											/* Set the configuration word and disable the timer */
-											//BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz
+											/* BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */
 											/*
 											   devpriv->s_ModuleInfo [b_ModulNbr].
 											   s_82X54ModuleInfo.
 											   s_82X54TimerInfo  [b_TimerNbr].
-											   dw_ConfigurationWord = (DWORD) (((b_HardwareGateLevel         << 0) & 0x1) |
+											   dw_ConfigurationWord = (unsigned int) (((b_HardwareGateLevel         << 0) & 0x1) |
 											   ((b_InputClockLevel           << 1) & 0x2) |
 											   (((~b_OutputLevel       & 1)  << 2) & 0x4) |
 											   ((b_InputClockSelection       << 4) & 0x10));
@@ -329,40 +329,40 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub
 												b_InputClockSelection = 2;
 											}
 
-											devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord = (DWORD)(((b_HardwareGateLevel << 0) & 0x1) | ((b_InputClockLevel << 1) & 0x2) | (((~b_OutputLevel & 1) << 2) & 0x4) | ((b_InputClockSelection << 4) & 0x30));
-											//END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz
+											devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord = (unsigned int)(((b_HardwareGateLevel << 0) & 0x1) | ((b_InputClockLevel << 1) & 0x2) | (((~b_OutputLevel & 1) << 2) & 0x4) | ((b_InputClockSelection << 4) & 0x30));
+											/* END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */
 											outl(devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord, devpriv->s_BoardInfos.ui_Address + 32 + (b_TimerNbr * 4) + (64 * b_ModulNbr));
 
 											/* Initialise the 82X54 Timer */
-											outl((DWORD) b_TimerMode, devpriv->s_BoardInfos.ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr));
+											outl((unsigned int) b_TimerMode, devpriv->s_BoardInfos.ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr));
 
 											/* Write the reload value */
 											outl(ul_ReloadValue, devpriv->s_BoardInfos.ui_Address + 0 + (b_TimerNbr * 4) + (64 * b_ModulNbr));
-											//BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz
-										}	// if (dw_Test == 1)
+											/* BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */
+										}	/*  if (dw_Test == 1) */
 										else {
 											/* Input timer clock selection is wrong */
 											i_ReturnValue = -6;
-										}	// if (dw_Test == 1)
-										//END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz
-									}	// if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1))
+										}	/*  if (dw_Test == 1) */
+										/* END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz */
+									}	/*  if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) */
 									else {
 										/* Selection from hardware gate level is wrong */
 										DPRINTK("Selection from hardware gate level is wrong\n");
 										i_ReturnValue = -9;
-									}	// if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1))
-								}	// if ((b_OutputLevel == 0) || (b_OutputLevel == 1))
+									}	/*  if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) */
+								}	/*  if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) */
 								else {
 									/* Selection from output clock level is wrong */
 									DPRINTK("Selection from output clock level is wrong\n");
 									i_ReturnValue = -8;
-								}	// if ((b_OutputLevel == 0) || (b_OutputLevel == 1))
-							}	// if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1))
+								}	/*  if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) */
+							}	/*  if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) */
 							else {
 								/* Selection from input clock level is wrong */
 								DPRINTK("Selection from input clock level is wrong\n");
 								i_ReturnValue = -7;
-							}	// if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1))
+							}	/*  if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) */
 						} else {
 							/* Input timer clock selection is wrong */
 							DPRINTK("Input timer clock selection is wrong\n");
@@ -373,18 +373,18 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub
 						DPRINTK("Input timer clock selection is wrong\n");
 						i_ReturnValue = -6;
 					}
-				}	// if ((b_TimerMode >= 0) && (b_TimerMode <= 5))
+				}	/*  if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) */
 				else {
 					/* Timer mode selection is wrong */
 					DPRINTK("Timer mode selection is wrong\n");
 					i_ReturnValue = -5;
-				}	// if ((b_TimerMode >= 0) && (b_TimerMode <= 5))
-			}	// if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2))
+				}	/*  if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) */
+			}	/*  if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */
 			else {
 				/* Timer selection wrong */
 				DPRINTK("Timer selection wrong\n");
 				i_ReturnValue = -3;
-			}	// if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2))
+			}	/*  if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */
 		} else {
 			/* The module is not a TIMER module */
 			DPRINTK("The module is not a TIMER module\n");
@@ -396,17 +396,17 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_     i_APCI1710_EnableTimer                       |
-|                               (BYTE_ b_BoardHandle,                        |
-|                                BYTE_ b_ModulNbr,                           |
-|                                BYTE_ b_TimerNbr,                           |
-|                                BYTE_ b_InterruptEnable)
-INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,struct comedi_subdevice *s,
+|                               (unsigned char_ b_BoardHandle,                        |
+|                                unsigned char_ b_ModulNbr,                           |
+|                                unsigned char_ b_TimerNbr,                           |
+|                                unsigned char_ b_InterruptEnable)
+int i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,struct comedi_subdevice *s,
 	struct comedi_insn *insn,unsigned int *data)                |
 +----------------------------------------------------------------------------+
 | Task              : Enable OR Disable the Timer (b_TimerNbr) from selected module     |
@@ -416,22 +416,22 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,struct come
 |                     generate a interrupt after the timer value reach       |
 |                     the zero. See function "i_APCI1710_SetBoardIntRoutineX"|
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_   b_BoardHandle     : Handle of board            |
+| Input Parameters  : unsigned char_   b_BoardHandle     : Handle of board            |
 |                                                 APCI-1710                  |
-|                     BYTE_   b_ModulNbr        : Selected module number     |
+|                     unsigned char_   b_ModulNbr        : Selected module number     |
 |                                                 (0 to 3)                   |
-|                     BYTE_   b_TimerNbr        : Timer number to enable     |
+|                     unsigned char_   b_TimerNbr        : Timer number to enable     |
 |                                                 (0 to 2)                   |
-|                     BYTE_   b_InterruptEnable : Enable or disable the      |
+|                     unsigned char_   b_InterruptEnable : Enable or disable the      |
 |                                                 timer interrupt.           |
 |                                                 APCI1710_ENABLE :          |
 |                                                 Enable the timer interrupt |
 |                                                 APCI1710_DISABLE :         |
 |                                                 Disable the timer interrupt|
 i_ReturnValue=insn->n;
-	b_ModulNbr        = (BYTE) CR_AREF(insn->chanspec);
-	b_TimerNbr		  = (BYTE) CR_CHAN(insn->chanspec);
-	b_ActionType      = (BYTE) data[0]; // enable disable
+	b_ModulNbr        = (unsigned char) CR_AREF(insn->chanspec);
+	b_TimerNbr		  = (unsigned char) CR_CHAN(insn->chanspec);
+	b_ActionType      = (unsigned char) data[0]; /*  enable disable */
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -448,21 +448,21 @@ i_ReturnValue=insn->n;
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev,
-					   struct comedi_subdevice * s,
-					   struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,
+					   struct comedi_subdevice *s,
+					   struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_DummyRead;
-	BYTE b_ModulNbr;
-	BYTE b_TimerNbr;
-	BYTE b_ActionType;
-	BYTE b_InterruptEnable;
+	int i_ReturnValue = 0;
+	unsigned int dw_DummyRead;
+	unsigned char b_ModulNbr;
+	unsigned char b_TimerNbr;
+	unsigned char b_ActionType;
+	unsigned char b_InterruptEnable;
 
 	i_ReturnValue = insn->n;
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec);
-	b_ActionType = (BYTE) data[0];	// enable disable
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_TimerNbr = (unsigned char) CR_CHAN(insn->chanspec);
+	b_ActionType = (unsigned char) data[0];	/*  enable disable */
 
 	/* Test the module number */
 	if (b_ModulNbr < 4) {
@@ -475,7 +475,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev,
 
 					switch (b_ActionType) {
 					case APCI1710_ENABLE:
-						b_InterruptEnable = (BYTE) data[1];
+						b_InterruptEnable = (unsigned char) data[1];
 						/* Test the interrupt selection */
 						if ((b_InterruptEnable == APCI1710_ENABLE) ||
 						    (b_InterruptEnable == APCI1710_DISABLE)) {
@@ -487,9 +487,9 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev,
 								devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord = devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord | 0x8;
 
 								outl(devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord, devpriv->s_BoardInfos.ui_Address + 32 + (b_TimerNbr * 4) + (64 * b_ModulNbr));
-								devpriv->tsk_Current = current;	// Save the current process task structure
+								devpriv->tsk_Current = current;	/*  Save the current process task structure */
 
-							}	// if (b_InterruptEnable == APCI1710_ENABLE)
+							}	/*  if (b_InterruptEnable == APCI1710_ENABLE) */
 							else {
 								/* Disable the interrupt */
 								devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord = devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord & 0xF7;
@@ -498,7 +498,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev,
 
 								/* Save the interrupt flag */
 								devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.b_InterruptMask = devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.b_InterruptMask & (0xFF - (1 << b_TimerNbr));
-							}	// if (b_InterruptEnable == APCI1710_ENABLE)
+							}	/*  if (b_InterruptEnable == APCI1710_ENABLE) */
 
 							/* Test if error occur */
 							if (i_ReturnValue >= 0) {
@@ -530,7 +530,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev,
 						/* Disable the timer */
 						outl(0, devpriv->s_BoardInfos.ui_Address + 44 + (b_TimerNbr * 4) + (64 * b_ModulNbr));
 						break;
-					}	// Switch end
+					}	/*  Switch end */
 				} else {
 					/* Timer not initialised see function */
 					DPRINTK ("Timer not initialised see function\n");
@@ -540,7 +540,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev,
 				/* Timer selection wrong */
 				DPRINTK("Timer selection wrong\n");
 				i_ReturnValue = -3;
-			}	// if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2))
+			}	/*  if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */
 		} else {
 			/* The module is not a TIMER module */
 			DPRINTK("The module is not a TIMER module\n");
@@ -552,24 +552,24 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_     i_APCI1710_ReadAllTimerValue                 |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
 |                                        PULONG_ pul_TimerValueArray)
-INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev,struct comedi_subdevice *s,
+int i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev,struct comedi_subdevice *s,
 	struct comedi_insn *insn,unsigned int *data)        |
 +----------------------------------------------------------------------------+
 | Task              : Return the all timer values from selected timer        |
 |                     module (b_ModulNbr).                                   |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_   b_BoardHandle     : Handle of board            |
+| Input Parameters  : unsigned char_   b_BoardHandle     : Handle of board            |
 |                                                 APCI-1710                  |
-|                     BYTE_   b_ModulNbr        : Selected module number     |
+|                     unsigned char_   b_ModulNbr        : Selected module number     |
 |                                                 (0 to 3)                   |
 +----------------------------------------------------------------------------+
 | Output Parameters : PULONG_ pul_TimerValueArray : Timer value array.       |
@@ -590,16 +590,16 @@ INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev,struct comedi_sub
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s,
 				     struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	BYTE b_ModulNbr, b_ReadType;
-	PULONG pul_TimerValueArray;
+	int i_ReturnValue = 0;
+	unsigned char b_ModulNbr, b_ReadType;
+	unsigned int *pul_TimerValueArray;
 
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_ReadType = CR_CHAN(insn->chanspec);
-	pul_TimerValueArray = (PULONG) data;
+	pul_TimerValueArray = (unsigned int *) data;
 	i_ReturnValue = insn->n;
 
 	switch (b_ReadType) {
@@ -662,8 +662,8 @@ INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_su
 			i_ReturnValue = -2;
 		}
 
-	}			// End of Switch
-	return (i_ReturnValue);
+	}			/*  End of Switch */
+	return i_ReturnValue;
 }
 
 /*
@@ -681,11 +681,11 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice * s,
-			     struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnBitsTimer(struct comedi_device *dev, struct comedi_subdevice *s,
+			     struct comedi_insn *insn, unsigned int *data)
 {
-	BYTE b_BitsType;
-	INT i_ReturnValue = 0;
+	unsigned char b_BitsType;
+	int i_ReturnValue = 0;
 	b_BitsType = data[0];
 
 	printk("\n82X54");
@@ -693,30 +693,30 @@ INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice
 	switch (b_BitsType) {
 	case APCI1710_TIMER_READVALUE:
 		i_ReturnValue = i_APCI1710_ReadTimerValue(dev,
-							  (BYTE)CR_AREF(insn->chanspec),
-							  (BYTE)CR_CHAN(insn->chanspec),
-							  (PULONG) & data[0]);
+							  (unsigned char)CR_AREF(insn->chanspec),
+							  (unsigned char)CR_CHAN(insn->chanspec),
+							  (unsigned int *) &data[0]);
 		break;
 
 	case APCI1710_TIMER_GETOUTPUTLEVEL:
 		i_ReturnValue = i_APCI1710_GetTimerOutputLevel(dev,
-							       (BYTE)CR_AREF(insn->chanspec),
-							       (BYTE)CR_CHAN(insn->chanspec),
-							       (PBYTE) &data[0]);
+							       (unsigned char)CR_AREF(insn->chanspec),
+							       (unsigned char)CR_CHAN(insn->chanspec),
+							       (unsigned char *) &data[0]);
 		break;
 
 	case APCI1710_TIMER_GETPROGRESSSTATUS:
 		i_ReturnValue = i_APCI1710_GetTimerProgressStatus(dev,
-								  (BYTE)CR_AREF(insn->chanspec),
-								  (BYTE)CR_CHAN(insn->chanspec),
-								  (PBYTE)&data[0]);
+								  (unsigned char)CR_AREF(insn->chanspec),
+								  (unsigned char)CR_CHAN(insn->chanspec),
+								  (unsigned char *)&data[0]);
 		break;
 
 	case APCI1710_TIMER_WRITEVALUE:
 		i_ReturnValue = i_APCI1710_WriteTimerValue(dev,
-							   (BYTE)CR_AREF(insn->chanspec),
-							   (BYTE)CR_CHAN(insn->chanspec),
-							   (ULONG)data[1]);
+							   (unsigned char)CR_AREF(insn->chanspec),
+							   (unsigned char)CR_CHAN(insn->chanspec),
+							   (unsigned int)data[1]);
 
 		break;
 
@@ -727,25 +727,25 @@ INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice
 
 	if (i_ReturnValue >= 0)
 		i_ReturnValue = insn->n;
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_     i_APCI1710_ReadTimerValue                    |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
-|                                        BYTE_     b_TimerNbr,               |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
+|                                        unsigned char_     b_TimerNbr,               |
 |                                        PULONG_ pul_TimerValue)             |
 +----------------------------------------------------------------------------+
 | Task              : Return the timer value from selected digital timer     |
 |                     (b_TimerNbr) from selected timer  module (b_ModulNbr). |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_   b_BoardHandle     : Handle of board            |
+| Input Parameters  : unsigned char_   b_BoardHandle     : Handle of board            |
 |                                                 APCI-1710                  |
-|                     BYTE_   b_ModulNbr        : Selected module number     |
+|                     unsigned char_   b_ModulNbr        : Selected module number     |
 |                                                 (0 to 3)                   |
-|                     BYTE_   b_TimerNbr        : Timer number to read       |
+|                     unsigned char_   b_TimerNbr        : Timer number to read       |
 |                                                 (0 to 2)                   |
 +----------------------------------------------------------------------------+
 | Output Parameters : PULONG_ pul_TimerValue    : Timer value                |
@@ -760,11 +760,11 @@ INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_ReadTimerValue(struct comedi_device * dev,
-			      BYTE b_ModulNbr, BYTE b_TimerNbr,
-			      PULONG pul_TimerValue)
+int i_APCI1710_ReadTimerValue(struct comedi_device *dev,
+			      unsigned char b_ModulNbr, unsigned char b_TimerNbr,
+			      unsigned int *pul_TimerValue)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/* Test the module number */
 	if (b_ModulNbr < 4) {
@@ -800,7 +800,7 @@ INT i_APCI1710_ReadTimerValue(struct comedi_device * dev,
 				/* Timer selection wrong */
 				DPRINTK("Timer selection wrong\n");
 				i_ReturnValue = -3;
-			}	// if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2))
+			}	/*  if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */
 		} else {
 			/* The module is not a TIMER module */
 			DPRINTK("The module is not a TIMER module\n");
@@ -812,29 +812,29 @@ INT i_APCI1710_ReadTimerValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 	/*
 	   +----------------------------------------------------------------------------+
 	   | Function Name     : _INT_     i_APCI1710_GetTimerOutputLevel               |
-	   |                                       (BYTE_     b_BoardHandle,            |
-	   |                                        BYTE_     b_ModulNbr,               |
-	   |                                        BYTE_     b_TimerNbr,               |
-	   |                                        PBYTE_   pb_OutputLevel)            |
+	   |                                       (unsigned char_     b_BoardHandle,            |
+	   |                                        unsigned char_     b_ModulNbr,               |
+	   |                                        unsigned char_     b_TimerNbr,               |
+	   |                                        unsigned char *_   pb_OutputLevel)            |
 	   +----------------------------------------------------------------------------+
 	   | Task              : Return the output signal level (pb_OutputLevel) from   |
 	   |                     selected digital timer (b_TimerNbr) from selected timer|
 	   |                     module (b_ModulNbr).                                   |
 	   +----------------------------------------------------------------------------+
-	   | Input Parameters  : BYTE_   b_BoardHandle     : Handle of board            |
+	   | Input Parameters  : unsigned char_   b_BoardHandle     : Handle of board            |
 	   |                                                 APCI-1710                  |
-	   |                     BYTE_   b_ModulNbr        : Selected module number     |
+	   |                     unsigned char_   b_ModulNbr        : Selected module number     |
 	   |                                                 (0 to 3)                   |
-	   |                     BYTE_   b_TimerNbr        : Timer number to test       |
+	   |                     unsigned char_   b_TimerNbr        : Timer number to test       |
 	   |                                                 (0 to 2)                   |
 	   +----------------------------------------------------------------------------+
-	   | Output Parameters : PBYTE_ pb_OutputLevel     : Output signal level        |
+	   | Output Parameters : unsigned char *_ pb_OutputLevel     : Output signal level        |
 	   |                                                 0 : The output is low      |
 	   |                                                 1 : The output is high     |
 	   +----------------------------------------------------------------------------+
@@ -848,12 +848,12 @@ INT i_APCI1710_ReadTimerValue(struct comedi_device * dev,
 	   +----------------------------------------------------------------------------+
 	 */
 
-INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev,
-				   BYTE b_ModulNbr, BYTE b_TimerNbr,
-				   PBYTE pb_OutputLevel)
+int i_APCI1710_GetTimerOutputLevel(struct comedi_device *dev,
+				   unsigned char b_ModulNbr, unsigned char b_TimerNbr,
+				   unsigned char *pb_OutputLevel)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_TimerStatus;
+	int i_ReturnValue = 0;
+	unsigned int dw_TimerStatus;
 
 	/* Test the module number */
 	if (b_ModulNbr < 4) {
@@ -869,7 +869,7 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev,
 					/* Read the timer status */
 					dw_TimerStatus = inl(devpriv->s_BoardInfos.ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr));
 
-					*pb_OutputLevel = (BYTE) (((dw_TimerStatus >> 7) & 1) ^ devpriv-> s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].b_OutputLevel);
+					*pb_OutputLevel = (unsigned char) (((dw_TimerStatus >> 7) & 1) ^ devpriv-> s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].b_OutputLevel);
 				} else {
 					/* Timer not initialised see function */
 					DPRINTK("Timer not initialised see function\n");
@@ -879,7 +879,7 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev,
 				/* Timer selection wrong */
 				DPRINTK("Timer selection wrong\n");
 				i_ReturnValue = -3;
-			}	// if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2))
+			}	/*  if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */
 		} else {
 			/* The module is not a TIMER module */
 			DPRINTK("The module is not a TIMER module\n");
@@ -891,29 +891,29 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_     i_APCI1710_GetTimerProgressStatus            |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
-|                                        BYTE_     b_TimerNbr,               |
-|                                        PBYTE_   pb_TimerStatus)            |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
+|                                        unsigned char_     b_TimerNbr,               |
+|                                        unsigned char *_   pb_TimerStatus)            |
 +----------------------------------------------------------------------------+
 | Task              : Return the progress status (pb_TimerStatus) from       |
 |                     selected digital timer (b_TimerNbr) from selected timer|
 |                     module (b_ModulNbr).                                   |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_   b_BoardHandle     : Handle of board            |
+| Input Parameters  : unsigned char_   b_BoardHandle     : Handle of board            |
 |                                                 APCI-1710                  |
-|                     BYTE_   b_ModulNbr        : Selected module number     |
+|                     unsigned char_   b_ModulNbr        : Selected module number     |
 |                                                 (0 to 3)                   |
-|                     BYTE_   b_TimerNbr        : Timer number to test       |
+|                     unsigned char_   b_TimerNbr        : Timer number to test       |
 |                                                 (0 to 2)                   |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_TimerStatus     : Output signal level        |
+| Output Parameters : unsigned char *_ pb_TimerStatus     : Output signal level        |
 |                                                 0 : Timer not in progress  |
 |                                                 1 : Timer in progress      |
 +----------------------------------------------------------------------------+
@@ -927,12 +927,12 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev,
-				      BYTE b_ModulNbr, BYTE b_TimerNbr,
-				      PBYTE pb_TimerStatus)
+int i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev,
+				      unsigned char b_ModulNbr, unsigned char b_TimerNbr,
+				      unsigned char *pb_TimerStatus)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_TimerStatus;
+	int i_ReturnValue = 0;
+	unsigned int dw_TimerStatus;
 
 	/* Test the module number */
 	if (b_ModulNbr < 4) {
@@ -949,7 +949,7 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev,
 					/* Read the timer status */
 					dw_TimerStatus = inl(devpriv->s_BoardInfos.ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr));
 
-					*pb_TimerStatus = (BYTE) ((dw_TimerStatus) >> 8) & 1;
+					*pb_TimerStatus = (unsigned char) ((dw_TimerStatus) >> 8) & 1;
 					printk("ProgressStatus : %d", *pb_TimerStatus);
 				} else {
 					/* Timer not initialised see function */
@@ -958,7 +958,7 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev,
 			} else {
 				/* Timer selection wrong */
 				i_ReturnValue = -3;
-			}	// if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2))
+			}	/*  if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */
 		} else {
 			/* The module is not a TIMER module */
 
@@ -976,9 +976,9 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev,
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_     i_APCI1710_WriteTimerValue                   |
-|                                       (BYTE_   b_BoardHandle,              |
-|                                        BYTE_   b_ModulNbr,                 |
-|                                        BYTE_   b_TimerNbr,                 |
+|                                       (unsigned char_   b_BoardHandle,              |
+|                                        unsigned char_   b_ModulNbr,                 |
+|                                        unsigned char_   b_TimerNbr,                 |
 |                                        ULONG_ ul_WriteValue)               |
 +----------------------------------------------------------------------------+
 | Task              : Write the value (ul_WriteValue) into the selected timer|
@@ -986,11 +986,11 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev,
 |                     The action in depend of the time mode selection.       |
 |                     See timer mode description table.                      |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_   b_BoardHandle     : Handle of board            |
+| Input Parameters  : unsigned char_   b_BoardHandle     : Handle of board            |
 |                                                 APCI-1710                  |
-|                     BYTE_   b_ModulNbr        : Selected module number     |
+|                     unsigned char_   b_ModulNbr        : Selected module number     |
 |                                                 (0 to 3)                   |
-|                     BYTE_   b_TimerNbr        : Timer number to write      |
+|                     unsigned char_   b_TimerNbr        : Timer number to write      |
 |                                                 (0 to 2)                   |
 |                     ULONG_ ul_WriteValue      : Value to write             |
 +----------------------------------------------------------------------------+
@@ -1006,11 +1006,11 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_WriteTimerValue(struct comedi_device * dev,
-			       BYTE b_ModulNbr, BYTE b_TimerNbr,
-			       ULONG ul_WriteValue)
+int i_APCI1710_WriteTimerValue(struct comedi_device *dev,
+			       unsigned char b_ModulNbr, unsigned char b_TimerNbr,
+			       unsigned int ul_WriteValue)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/* Test the module number */
 	if (b_ModulNbr < 4) {
@@ -1031,7 +1031,7 @@ INT i_APCI1710_WriteTimerValue(struct comedi_device * dev,
 				/* Timer selection wrong */
 				DPRINTK("Timer selection wrong\n");
 				i_ReturnValue = -3;
-			}	// if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2))
+			}	/*  if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */
 		} else {
 			/* The module is not a TIMER module */
 			DPRINTK("The module is not a TIMER module\n");

+ 16 - 16
drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.h

@@ -34,40 +34,40 @@
 /*
  * 82X54 TIMER INISIALISATION FUNCTION
  */
-INT i_APCI1710_InsnConfigInitTimer(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnConfigInitTimer(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,
+int i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,
 					   struct comedi_subdevice *s,
 					   struct comedi_insn *insn, unsigned int *data);
 
 /*
  * 82X54 READ FUNCTION
  */
-INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s,
 				     struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_InsnBitsTimer(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnBitsTimer(struct comedi_device *dev, struct comedi_subdevice *s,
 			     struct comedi_insn *insn, unsigned int *data);
 
 /*
  * 82X54 READ & WRITE FUNCTION
  */
-INT i_APCI1710_ReadTimerValue(struct comedi_device *dev,
-			      BYTE b_ModulNbr, BYTE b_TimerNbr,
-			      PULONG pul_TimerValue);
+int i_APCI1710_ReadTimerValue(struct comedi_device *dev,
+			      unsigned char b_ModulNbr, unsigned char b_TimerNbr,
+			      unsigned int *pul_TimerValue);
 
-INT i_APCI1710_GetTimerOutputLevel(struct comedi_device *dev,
-				   BYTE b_ModulNbr, BYTE b_TimerNbr,
-				   PBYTE pb_OutputLevel);
+int i_APCI1710_GetTimerOutputLevel(struct comedi_device *dev,
+				   unsigned char b_ModulNbr, unsigned char b_TimerNbr,
+				   unsigned char *pb_OutputLevel);
 
-INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev,
-				      BYTE b_ModulNbr, BYTE b_TimerNbr,
-				      PBYTE pb_TimerStatus);
+int i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev,
+				      unsigned char b_ModulNbr, unsigned char b_TimerNbr,
+				      unsigned char *pb_TimerStatus);
 
 /*
  * 82X54 WRITE FUNCTION
  */
-INT i_APCI1710_WriteTimerValue(struct comedi_device *dev,
-			       BYTE b_ModulNbr, BYTE b_TimerNbr,
-			       ULONG ul_WriteValue);
+int i_APCI1710_WriteTimerValue(struct comedi_device *dev,
+			       unsigned char b_ModulNbr, unsigned char b_TimerNbr,
+			       unsigned int ul_WriteValue);

+ 201 - 201
drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c

@@ -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.
 
@@ -62,11 +62,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_     i_APCI1710_InitChrono                        |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
-|                                        BYTE_     b_ChronoMode,             |
-|                                        BYTE_     b_PCIInputClock,          |
-|                                        BYTE_     b_TimingUnit,             |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
+|                                        unsigned char_     b_ChronoMode,             |
+|                                        unsigned char_     b_PCIInputClock,          |
+|                                        unsigned char_     b_TimingUnit,             |
 |                                        ULONG_   ul_TimingInterval,         |
 |                                        PULONG_ pul_RealTimingInterval)
 
@@ -88,12 +88,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                     The mode 4 to 7 is appropriate for measuring the timing|
 |                     between  two event.                                    |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_   b_BoardHandle    : Handle of board APCI-1710   |
-| BYTE_   b_ModulNbr  CR_AREF(insn->chanspec)  : Module number to configure  |
+| Input Parameters  : unsigned char_   b_BoardHandle    : Handle of board APCI-1710   |
+| unsigned char_   b_ModulNbr  CR_AREF(insn->chanspec)  : Module number to configure  |
 |                                                (0 to 3)                    |
-| BYTE_   b_ChronoMode				data[0]    : Chronometer action mode     |
+| unsigned char_   b_ChronoMode				data[0]    : Chronometer action mode     |
 |                                                (0 to 7).                   |
-| BYTE_   b_PCIInputClock			data[1] : Selection from PCI bus clock|
+| unsigned char_   b_PCIInputClock			data[1] : Selection from PCI bus clock|
 |                                                - APCI1710_30MHZ :          |
 |                                                  The PC have a PCI bus     |
 |                                                  clock from 30 MHz         |
@@ -104,7 +104,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                                                  The APCI-1710 have a      |
 |                                                  integrated 40Mhz          |
 |                                                  quartz.                   |
-|               BYTE_   b_TimingUnit	data[2]    : Base timing unity (0 to 4) |
+|               unsigned char_   b_TimingUnit	data[2]    : Base timing unity (0 to 4) |
 |                                                 0 : ns                     |
 |                                                 1 : µs                     |
 |                                                 2 : ms                     |
@@ -131,23 +131,23 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	ULONG ul_TimerValue = 0;
-	ULONG ul_TimingInterval = 0;
-	ULONG ul_RealTimingInterval = 0;
+	int i_ReturnValue = 0;
+	unsigned int ul_TimerValue = 0;
+	unsigned int ul_TimingInterval = 0;
+	unsigned int ul_RealTimingInterval = 0;
 	double d_RealTimingInterval = 0;
-	DWORD dw_ModeArray[8] =
+	unsigned int dw_ModeArray[8] =
 		{ 0x01, 0x05, 0x00, 0x04, 0x02, 0x0E, 0x0A, 0x06 };
-	BYTE b_ModulNbr, b_ChronoMode, b_PCIInputClock, b_TimingUnit;
+	unsigned char b_ModulNbr, b_ChronoMode, b_PCIInputClock, b_TimingUnit;
 
 	b_ModulNbr = CR_AREF(insn->chanspec);
-	b_ChronoMode = (BYTE) data[0];
-	b_PCIInputClock = (BYTE) data[1];
-	b_TimingUnit = (BYTE) data[2];
-	ul_TimingInterval = (ULONG) data[3];
+	b_ChronoMode = (unsigned char) data[0];
+	b_PCIInputClock = (unsigned char) data[1];
+	b_TimingUnit = (unsigned char) data[2];
+	ul_TimingInterval = (unsigned int) data[3];
 	i_ReturnValue = insn->n;
 
 	/**************************/
@@ -214,7 +214,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 										ul_TimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_TimingInterval
 											*
 											(0.001 * b_PCIInputClock));
@@ -237,7 +237,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 										ul_RealTimingInterval
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_TimerValue
 											/
 											(0.001 * (double)b_PCIInputClock));
@@ -272,7 +272,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 										if (b_PCIInputClock != APCI1710_40MHZ) {
 											ul_TimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_TimerValue)
@@ -294,7 +294,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 										ul_TimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_TimingInterval
 											*
 											(1.0 * b_PCIInputClock));
@@ -317,7 +317,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 										ul_RealTimingInterval
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_TimerValue
 											/
 											(1.0 * (double)b_PCIInputClock));
@@ -354,7 +354,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 										if (b_PCIInputClock != APCI1710_40MHZ) {
 											ul_TimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_TimerValue)
@@ -400,7 +400,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 										ul_RealTimingInterval
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_TimerValue
 											/
 											(1000.0 * (double)b_PCIInputClock));
@@ -435,7 +435,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 										if (b_PCIInputClock != APCI1710_40MHZ) {
 											ul_TimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_TimerValue)
@@ -457,7 +457,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 										ul_TimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_TimingInterval
 											*
 											(1000000.0
@@ -482,7 +482,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 										ul_RealTimingInterval
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_TimerValue
 											/
 											(1000000.0
@@ -520,7 +520,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 										if (b_PCIInputClock != APCI1710_40MHZ) {
 											ul_TimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_TimerValue)
@@ -542,7 +542,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 										ul_TimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(ul_TimingInterval
 												*
@@ -570,7 +570,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 										ul_RealTimingInterval
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_TimerValue
 											/
 											(1000000.0
@@ -608,7 +608,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 										if (b_PCIInputClock != APCI1710_40MHZ) {
 											ul_TimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_TimerValue)
@@ -736,7 +736,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 							DPRINTK("Base timing selection is wrong\n");
 							i_ReturnValue = -7;
 						}
-					}	// if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4))
+					}	/*  if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
 					else {
 		       /***********************************/
 						/* Timing unity selection is wrong */
@@ -744,8 +744,8 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 						DPRINTK("Timing unity selection is wrong\n");
 						i_ReturnValue = -6;
-					}	// if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4))
-				}	// if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ))
+					}	/*  if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
+				}	/*  if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */
 				else {
 		    /*****************************************/
 					/* The selected PCI input clock is wrong */
@@ -753,8 +753,8 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 					DPRINTK("The selected PCI input clock is wrong\n");
 					i_ReturnValue = -5;
-				}	// if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ))
-			}	// if (b_ChronoMode >= 0 && b_ChronoMode <= 7)
+				}	/*  if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */
+			}	/*  if (b_ChronoMode >= 0 && b_ChronoMode <= 7) */
 			else {
 		 /***************************************/
 				/* Chronometer mode selection is wrong */
@@ -762,7 +762,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 
 				DPRINTK("Chronometer mode selection is wrong\n");
 				i_ReturnValue = -4;
-			}	// if (b_ChronoMode >= 0 && b_ChronoMode <= 7)
+			}	/*  if (b_ChronoMode >= 0 && b_ChronoMode <= 7) */
 		} else {
 	      /******************************************/
 			/* The module is not a Chronometer module */
@@ -780,17 +780,17 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su
 		i_ReturnValue = -2;
 	}
 	data[0] = ul_RealTimingInterval;
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_EnableChrono                          |
-|                                               (BYTE_ b_BoardHandle,        |
-|                                                BYTE_ b_ModulNbr,           |
-|                                                BYTE_ b_CycleMode,          |
-|                                                BYTE_ b_InterruptEnable)
-INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev,
+|                                               (unsigned char_ b_BoardHandle,        |
+|                                                unsigned char_ b_ModulNbr,           |
+|                                                unsigned char_ b_CycleMode,          |
+|                                                unsigned char_ b_InterruptEnable)
+int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev,
 struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)						 |
 +----------------------------------------------------------------------------+
 | Task              : Enable the chronometer from selected module            |
@@ -810,12 +810,12 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)						 |
 |                     witch the " i_APCI1710_EnableChrono" function, if no   |
 |                     stop signal occur this start signal is ignored.
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle  : Handle of board APCI-1710       |
-|                     BYTE_ b_ModulNbr   CR_AREF(chanspec)  : Selected module number (0 to 3) |
+| Input Parameters  : unsigned char_ b_BoardHandle  : Handle of board APCI-1710       |
+|                     unsigned char_ b_ModulNbr   CR_AREF(chanspec)  : Selected module number (0 to 3) |
                                   data[0]  ENABle/Disable chrono
-|                     BYTE_ b_CycleMode    : Selected the chronometer        |
+|                     unsigned char_ b_CycleMode    : Selected the chronometer        |
 |                                  data[1]           acquisition mode                |
-|                     BYTE_ b_InterruptEnable : Enable or disable the        |
+|                     unsigned char_ b_InterruptEnable : Enable or disable the        |
 |                                   data[2]            chronometer interrupt.       |
 |                                               APCI1710_ENABLE:             |
 |                                               Enable the chronometer       |
@@ -840,15 +840,15 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)						 |
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	BYTE b_ModulNbr, b_CycleMode, b_InterruptEnable, b_Action;
+	int i_ReturnValue = 0;
+	unsigned char b_ModulNbr, b_CycleMode, b_InterruptEnable, b_Action;
 	b_ModulNbr = CR_AREF(insn->chanspec);
-	b_Action = (BYTE) data[0];
-	b_CycleMode = (BYTE) data[1];
-	b_InterruptEnable = (BYTE) data[2];
+	b_Action = (unsigned char) data[0];
+	b_CycleMode = (unsigned char) data[1];
+	b_InterruptEnable = (unsigned char) data[2];
 	i_ReturnValue = insn->n;
 
 	/**************************/
@@ -951,7 +951,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev,
 									ui_Address
 									+ 32 +
 									(64 * b_ModulNbr));
-								devpriv->tsk_Current = current;	// Save the current process task structure
+								devpriv->tsk_Current = current;	/*  Save the current process task structure */
 							}
 
 			  /***********************************/
@@ -980,7 +980,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev,
 								36 +
 								(64 * b_ModulNbr));
 
-						}	// if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE))
+						}	/*  if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */
 						else {
 		       /********************************/
 							/* Interrupt parameter is wrong */
@@ -988,8 +988,8 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev,
 
 							DPRINTK("Interrupt parameter is wrong\n");
 							i_ReturnValue = -6;
-						}	// if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE))
-					}	// if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS))
+						}	/*  if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */
+					}	/*  if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */
 					else {
 		    /***********************************************/
 						/* Chronometer acquisition mode cycle is wrong */
@@ -997,7 +997,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev,
 
 						DPRINTK("Chronometer acquisition mode cycle is wrong\n");
 						i_ReturnValue = -5;
-					}	// if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS))
+					}	/*  if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */
 					break;
 
 				case APCI1710_DISABLE:
@@ -1046,7 +1046,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev,
 				default:
 					DPRINTK("Inputs wrong! Enable or Disable chrono\n");
 					i_ReturnValue = -8;
-				}	// switch ENABLE/DISABLE
+				}	/*  switch ENABLE/DISABLE */
 			} else {
 		 /*******************************/
 				/* Chronometer not initialised */
@@ -1072,7 +1072,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -1090,36 +1090,36 @@ struct comedi_insn *insn,unsigned int *data)                   |
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnReadChrono(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	BYTE b_ReadType;
-	INT i_ReturnValue = insn->n;
+	unsigned char b_ReadType;
+	int i_ReturnValue = insn->n;
 
 	b_ReadType = CR_CHAN(insn->chanspec);
 
 	switch (b_ReadType) {
 	case APCI1710_CHRONO_PROGRESS_STATUS:
 		i_ReturnValue = i_APCI1710_GetChronoProgressStatus(dev,
-			(BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
 		break;
 
 	case APCI1710_CHRONO_READVALUE:
 		i_ReturnValue = i_APCI1710_ReadChronoValue(dev,
-			(BYTE) CR_AREF(insn->chanspec),
-			(UINT) insn->unused[0],
-			(PBYTE) & data[0], (PULONG) & data[1]);
+			(unsigned char) CR_AREF(insn->chanspec),
+			(unsigned int) insn->unused[0],
+			(unsigned char *) &data[0], (unsigned int *) &data[1]);
 		break;
 
 	case APCI1710_CHRONO_CONVERTVALUE:
 		i_ReturnValue = i_APCI1710_ConvertChronoValue(dev,
-			(BYTE) CR_AREF(insn->chanspec),
-			(ULONG) insn->unused[0],
-			(PULONG) & data[0],
-			(PBYTE) & data[1],
-			(PBYTE) & data[2],
-			(PUINT) & data[3],
-			(PUINT) & data[4], (PUINT) & data[5]);
+			(unsigned char) CR_AREF(insn->chanspec),
+			(unsigned int) insn->unused[0],
+			(unsigned int *) &data[0],
+			(unsigned char *) &data[1],
+			(unsigned char *) &data[2],
+			(unsigned int *) &data[3],
+			(unsigned int *) &data[4], (unsigned int *) &data[5]);
 		break;
 
 	case APCI1710_CHRONO_READINTERRUPT:
@@ -1152,22 +1152,22 @@ INT i_APCI1710_InsnReadChrono(struct comedi_device * dev, struct comedi_subdevic
 
 	if (i_ReturnValue >= 0)
 		i_ReturnValue = insn->n;
-	return (i_ReturnValue);
+	return i_ReturnValue;
 
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_GetChronoProgressStatus               |
-|                               (BYTE_    b_BoardHandle,                     |
-|                                BYTE_    b_ModulNbr,                        |
-|                                PBYTE_  pb_ChronoStatus)                    |
+|                               (unsigned char_    b_BoardHandle,                     |
+|                                unsigned char_    b_ModulNbr,                        |
+|                                unsigned char *_  pb_ChronoStatus)                    |
 +----------------------------------------------------------------------------+
 | Task              : Return the chronometer status (pb_ChronoStatus) from   |
 |                     selected chronometer module (b_ModulNbr).              |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle  : Handle of board APCI-1710       |
-|                     BYTE_ b_ModulNbr     : Selected module number (0 to 3) |
+| Input Parameters  : unsigned char_ b_BoardHandle  : Handle of board APCI-1710       |
+|                     unsigned char_ b_ModulNbr     : Selected module number (0 to 3) |
 +----------------------------------------------------------------------------+
 | Output Parameters : PULONG_  pb_ChronoStatus : Return the chronometer      |
 |                                                status.                     |
@@ -1194,11 +1194,11 @@ INT i_APCI1710_InsnReadChrono(struct comedi_device * dev, struct comedi_subdevic
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev,
-	BYTE b_ModulNbr, PBYTE pb_ChronoStatus)
+int i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char *pb_ChronoStatus)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_Status;
+	int i_ReturnValue = 0;
+	unsigned int dw_Status;
 
 	/**************************/
 	/* Test the module number */
@@ -1233,7 +1233,7 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev,
 		    /******************/
 
 					*pb_ChronoStatus = 3;
-				}	// if ((dw_Status & 8) == 8)
+				}	/*  if ((dw_Status & 8) == 8) */
 				else {
 		    /*******************************/
 					/* Test if measurement stopped */
@@ -1245,7 +1245,7 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev,
 		       /***********************/
 
 						*pb_ChronoStatus = 2;
-					}	// if ((dw_Status & 2) == 2)
+					}	/*  if ((dw_Status & 2) == 2) */
 					else {
 		       /*******************************/
 						/* Test if measurement started */
@@ -1257,16 +1257,16 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev,
 			  /************************/
 
 							*pb_ChronoStatus = 1;
-						}	// if ((dw_Status & 1) == 1)
+						}	/*  if ((dw_Status & 1) == 1) */
 						else {
 			  /***************************/
 							/* Measurement not started */
 			  /***************************/
 
 							*pb_ChronoStatus = 0;
-						}	// if ((dw_Status & 1) == 1)
-					}	// if ((dw_Status & 2) == 2)
-				}	// if ((dw_Status & 8) == 8)
+						}	/*  if ((dw_Status & 1) == 1) */
+					}	/*  if ((dw_Status & 2) == 2) */
+				}	/*  if ((dw_Status & 8) == 8) */
 			} else {
 		 /*******************************/
 				/* Chronometer not initialised */
@@ -1289,16 +1289,16 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ReadChronoValue                       |
-|                               (BYTE_     b_BoardHandle,                    |
-|                                BYTE_     b_ModulNbr,                       |
-|                                UINT_    ui_TimeOut,                        |
-|                                PBYTE_   pb_ChronoStatus,                   |
+|                               (unsigned char_     b_BoardHandle,                    |
+|                                unsigned char_     b_ModulNbr,                       |
+|                                unsigned int_    ui_TimeOut,                        |
+|                                unsigned char *_   pb_ChronoStatus,                   |
 |                                PULONG_ pul_ChronoValue)                    |
 +----------------------------------------------------------------------------+
 | Task              : Return the chronometer status (pb_ChronoStatus) and the|
@@ -1323,8 +1323,8 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev,
 |                     "i_APCI1710_InitChrono" function and the time unity is |
 |                     the b_TimingUnit from "i_APCI1710_InitChrono" function|
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle  : Handle of board APCI-1710       |
-|                     BYTE_ b_ModulNbr     : Selected module number (0 to 3) |
+| Input Parameters  : unsigned char_ b_BoardHandle  : Handle of board APCI-1710       |
+|                     unsigned char_ b_ModulNbr     : Selected module number (0 to 3) |
 +----------------------------------------------------------------------------+
 | Output Parameters : PULONG_  pb_ChronoStatus : Return the chronometer      |
 |                                                status.                     |
@@ -1341,7 +1341,7 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev,
 |                                                   timing witch the         |
 |                                                   function                 |
 |                                                   "i_APCI1710_InitChrono"  |
-|                     PULONG  pul_ChronoValue  : Chronometer timing value.   |
+|                     unsigned int *  pul_ChronoValue  : Chronometer timing value.   |
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
 |                     -1: The handle parameter of the board is wrong         |
@@ -1355,13 +1355,13 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_ReadChronoValue(struct comedi_device * dev,
-	BYTE b_ModulNbr,
-	UINT ui_TimeOut, PBYTE pb_ChronoStatus, PULONG pul_ChronoValue)
+int i_APCI1710_ReadChronoValue(struct comedi_device *dev,
+	unsigned char b_ModulNbr,
+	unsigned int ui_TimeOut, unsigned char *pb_ChronoStatus, unsigned int *pul_ChronoValue)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_Status;
-	DWORD dw_TimeOut = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_Status;
+	unsigned int dw_TimeOut = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -1430,7 +1430,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev,
 							}
 
 							break;
-						}	// if ((dw_Status & 8) == 8)
+						}	/*  if ((dw_Status & 8) == 8) */
 						else {
 			     /*******************************/
 							/* Test if measurement stopped */
@@ -1464,7 +1464,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev,
 									outl(0, devpriv->s_BoardInfos.ui_Address + 36 + (64 * b_ModulNbr));
 								}
 								break;
-							}	// if ((dw_Status & 2) == 2)
+							}	/*  if ((dw_Status & 2) == 2) */
 							else {
 				/*******************************/
 								/* Test if measurement started */
@@ -1478,7 +1478,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev,
 									*pb_ChronoStatus
 										=
 										1;
-								}	// if ((dw_Status & 1) == 1)
+								}	/*  if ((dw_Status & 1) == 1) */
 								else {
 				   /***************************/
 									/* Measurement not started */
@@ -1487,9 +1487,9 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev,
 									*pb_ChronoStatus
 										=
 										0;
-								}	// if ((dw_Status & 1) == 1)
-							}	// if ((dw_Status & 2) == 2)
-						}	// if ((dw_Status & 8) == 8)
+								}	/*  if ((dw_Status & 1) == 1) */
+							}	/*  if ((dw_Status & 2) == 2) */
+						}	/*  if ((dw_Status & 8) == 8) */
 
 						if (dw_TimeOut == ui_TimeOut) {
 			     /*****************/
@@ -1507,7 +1507,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev,
 							mdelay(1000);
 
 						}
-					}	// for (;;)
+					}	/*  for (;;) */
 
 		       /*****************************/
 					/* Test if stop signal occur */
@@ -1575,39 +1575,39 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ConvertChronoValue                    |
-|                               (BYTE_     b_BoardHandle,                    |
-|                                BYTE_     b_ModulNbr,                       |
+|                               (unsigned char_     b_BoardHandle,                    |
+|                                unsigned char_     b_ModulNbr,                       |
 |                                ULONG_   ul_ChronoValue,                    |
 |                                PULONG_ pul_Hour,                           |
-|                                PBYTE_   pb_Minute,                         |
-|                                PBYTE_   pb_Second,                         |
-|                                PUINT_  pui_MilliSecond,                    |
-|                                PUINT_  pui_MicroSecond,                    |
-|                                PUINT_  pui_NanoSecond)                     |
+|                                unsigned char *_   pb_Minute,                         |
+|                                unsigned char *_   pb_Second,                         |
+|                                unsigned int *_  pui_MilliSecond,                    |
+|                                unsigned int *_  pui_MicroSecond,                    |
+|                                unsigned int *_  pui_NanoSecond)                     |
 +----------------------------------------------------------------------------+
 | Task              : Convert the chronometer measured timing                |
 |                     (ul_ChronoValue) in to h, mn, s, ms, µs, ns.           |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_   b_BoardHandle : Handle of board APCI-1710      |
-|                     BYTE_   b_ModulNbr    : Selected module number (0 to 3)|
+| Input Parameters  : unsigned char_   b_BoardHandle : Handle of board APCI-1710      |
+|                     unsigned char_   b_ModulNbr    : Selected module number (0 to 3)|
 |                     ULONG_ ul_ChronoValue : Measured chronometer timing    |
 |                                             value.                         |
 |                                             See"i_APCI1710_ReadChronoValue"|
 +----------------------------------------------------------------------------+
 | Output Parameters : PULONG_   pul_Hour        : Chronometer timing hour    |
-|                     PBYTE_     pb_Minute      : Chronometer timing minute  |
-|                     PBYTE_     pb_Second      : Chronometer timing second  |
-|                     PUINT_    pui_MilliSecond  : Chronometer timing mini   |
+|                     unsigned char *_     pb_Minute      : Chronometer timing minute  |
+|                     unsigned char *_     pb_Second      : Chronometer timing second  |
+|                     unsigned int *_    pui_MilliSecond  : Chronometer timing mini   |
 |                                                 second                     |
-|                     PUINT_    pui_MicroSecond : Chronometer timing micro   |
+|                     unsigned int *_    pui_MicroSecond : Chronometer timing micro   |
 |                                                 second                     |
-|                     PUINT_    pui_NanoSecond  : Chronometer timing nano    |
+|                     unsigned int *_    pui_NanoSecond  : Chronometer timing nano    |
 |                                                 second                     |
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
@@ -1619,15 +1619,15 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
-	BYTE b_ModulNbr,
-	ULONG ul_ChronoValue,
-	PULONG pul_Hour,
-	PBYTE pb_Minute,
-	PBYTE pb_Second,
-	PUINT pui_MilliSecond, PUINT pui_MicroSecond, PUINT pui_NanoSecond)
+int i_APCI1710_ConvertChronoValue(struct comedi_device *dev,
+	unsigned char b_ModulNbr,
+	unsigned int ul_ChronoValue,
+	unsigned int *pul_Hour,
+	unsigned char *pb_Minute,
+	unsigned char *pb_Second,
+	unsigned int *pui_MilliSecond, unsigned int *pui_MicroSecond, unsigned int *pui_NanoSecond)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 	double d_Hour;
 	double d_Minute;
 	double d_Second;
@@ -1681,7 +1681,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
 			    /**********************/
 
 					d_Hour = d_Hour / (double)60.0;
-					*pul_Hour = (ULONG) d_Hour;
+					*pul_Hour = (unsigned int) d_Hour;
 
 			    /************************/
 					/* Calculate the minute */
@@ -1689,7 +1689,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
 
 					d_Minute = d_Hour - *pul_Hour;
 					d_Minute = d_Minute * 60;
-					*pb_Minute = (BYTE) d_Minute;
+					*pb_Minute = (unsigned char) d_Minute;
 
 			    /************************/
 					/* Calculate the second */
@@ -1697,7 +1697,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
 
 					d_Second = d_Minute - *pb_Minute;
 					d_Second = d_Second * 60;
-					*pb_Second = (BYTE) d_Second;
+					*pb_Second = (unsigned char) d_Second;
 
 			    /*****************************/
 					/* Calculate the mini second */
@@ -1705,7 +1705,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
 
 					d_MilliSecond = d_Second - *pb_Second;
 					d_MilliSecond = d_MilliSecond * 1000;
-					*pui_MilliSecond = (UINT) d_MilliSecond;
+					*pui_MilliSecond = (unsigned int) d_MilliSecond;
 
 			    /******************************/
 					/* Calculate the micro second */
@@ -1715,7 +1715,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
 						d_MilliSecond -
 						*pui_MilliSecond;
 					d_MicroSecond = d_MicroSecond * 1000;
-					*pui_MicroSecond = (UINT) d_MicroSecond;
+					*pui_MicroSecond = (unsigned int) d_MicroSecond;
 
 			    /******************************/
 					/* Calculate the micro second */
@@ -1725,7 +1725,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
 						d_MicroSecond -
 						*pui_MicroSecond;
 					d_NanoSecond = d_NanoSecond * 1000;
-					*pui_NanoSecond = (UINT) d_NanoSecond;
+					*pui_NanoSecond = (unsigned int) d_NanoSecond;
 					break;
 				}
 
@@ -1752,21 +1752,21 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,struct comedi_subdevice *s,
+| Function Name     : int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,struct comedi_subdevice *s,
 	struct comedi_insn *insn,unsigned int *data)                    |
 +----------------------------------------------------------------------------+
 | Task              : Sets the output witch has been passed with the         |
 |                     parameter b_Channel. Setting an output means setting an|
 |                     output high.                                           |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle   : Handle of board APCI-1710      |
-|                     BYTE_ b_ModulNbr      : Selected module number (0 to 3)|
-|                     BYTE_ b_OutputChannel : Selection from digital output  |
+| Input Parameters  : unsigned char_ b_BoardHandle   : Handle of board APCI-1710      |
+|                     unsigned char_ b_ModulNbr      : Selected module number (0 to 3)|
+|                     unsigned char_ b_OutputChannel : Selection from digital output  |
 |                           CR_CHAN()                  channel (0 to 2)               |
 |                                              0 : Channel H                 |
 |                                              1 : Channel A                 |
@@ -1787,19 +1787,19 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_SetChronoChlOff                       |
-|                               (BYTE_  b_BoardHandle,                       |
-|                                BYTE_  b_ModulNbr,                          |
-|                                BYTE_  b_OutputChannel)                     |
+|                               (unsigned char_  b_BoardHandle,                       |
+|                                unsigned char_  b_ModulNbr,                          |
+|                                unsigned char_  b_OutputChannel)                     |
 +----------------------------------------------------------------------------+
 | Task              : Resets the output witch has been passed with the       |
 |                     parameter b_Channel. Resetting an output means setting |
 |                     an output low.                                         |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle   : Handle of board APCI-1710
+| Input Parameters  : unsigned char_ b_BoardHandle   : Handle of board APCI-1710
                         data[0] : Chl ON, Chl OFF , Chl Read , Port Read
 
-|                     BYTE_ b_ModulNbr  CR_AREF    : Selected module number (0 to 3)|
-|                     BYTE_ b_OutputChannel CR_CHAN : Selection from digital output  |
+|                     unsigned char_ b_ModulNbr  CR_AREF    : Selected module number (0 to 3)|
+|                     unsigned char_ b_OutputChannel CR_CHAN : Selection from digital output  |
 |                                             channel (0 to 2)               |
 |                                              0 : Channel H                 |
 |                                              1 : Channel A                 |
@@ -1820,24 +1820,24 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ReadChronoChlValue                    |
-|                               (BYTE_   b_BoardHandle,                      |
-|                                BYTE_   b_ModulNbr,                         |
-|                                BYTE_   b_InputChannel,                     |
-|                                PBYTE_ pb_ChannelStatus)                    |
+|                               (unsigned char_   b_BoardHandle,                      |
+|                                unsigned char_   b_ModulNbr,                         |
+|                                unsigned char_   b_InputChannel,                     |
+|                                unsigned char *_ pb_ChannelStatus)                    |
 +----------------------------------------------------------------------------+
 | Task              : Return the status from selected digital input          |
 |                     (b_InputChannel) from selected chronometer             |
 |                     module (b_ModulNbr).                                   |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle   : Handle of board APCI-1710      |
-|                     BYTE_ b_ModulNbr      : Selected module number (0 to 3)|
-|                     BYTE_ b_InputChannel  : Selection from digital input   |
+| Input Parameters  : unsigned char_ b_BoardHandle   : Handle of board APCI-1710      |
+|                     unsigned char_ b_ModulNbr      : Selected module number (0 to 3)|
+|                     unsigned char_ b_InputChannel  : Selection from digital input   |
 |                                             channel (0 to 2)               |
 |                                   CR_CHAN()             0 : Channel E               |
 |                                                1 : Channel F               |
 |                                                2 : Channel G               |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_ChannelStatus : Digital input channel status.|
+| Output Parameters : unsigned char *_ pb_ChannelStatus : Digital input channel status.|
 |                                data[0]                0 : Channel is not active   |
 |                                                1 : Channel is active       |
 +----------------------------------------------------------------------------+
@@ -1854,17 +1854,17 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ReadChronoPortValue                   |
-|                               (BYTE_   b_BoardHandle,                      |
-|                                BYTE_   b_ModulNbr,                         |
-|                                PBYTE_ pb_PortValue)                        |
+|                               (unsigned char_   b_BoardHandle,                      |
+|                                unsigned char_   b_ModulNbr,                         |
+|                                unsigned char *_ pb_PortValue)                        |
 +----------------------------------------------------------------------------+
 | Task              : Return the status from digital inputs port from        |
 |                     selected  (b_ModulNbr) chronometer module.             |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle   : Handle of board APCI-1710      |
-|                     BYTE_ b_ModulNbr      : Selected module number (0 to 3)|
+| Input Parameters  : unsigned char_ b_BoardHandle   : Handle of board APCI-1710      |
+|                     unsigned char_ b_ModulNbr      : Selected module number (0 to 3)|
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_PortValue   : Digital inputs port status.
+| Output Parameters : unsigned char *_ pb_PortValue   : Digital inputs port status.
 |                     data[0]
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
@@ -1876,18 +1876,18 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	BYTE b_ModulNbr, b_OutputChannel, b_InputChannel, b_IOType;
-	DWORD dw_Status;
-	PBYTE pb_ChannelStatus;
-	PBYTE pb_PortValue;
+	int i_ReturnValue = 0;
+	unsigned char b_ModulNbr, b_OutputChannel, b_InputChannel, b_IOType;
+	unsigned int dw_Status;
+	unsigned char *pb_ChannelStatus;
+	unsigned char *pb_PortValue;
 
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	i_ReturnValue = insn->n;
-	b_IOType = (BYTE) data[0];
+	b_IOType = (unsigned char) data[0];
 
 	/**************************/
 	/* Test the module number */
@@ -1915,14 +1915,14 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev,
 				case APCI1710_CHRONO_SET_CHANNELOFF:
 
 					b_OutputChannel =
-						(BYTE) CR_CHAN(insn->chanspec);
+						(unsigned char) CR_CHAN(insn->chanspec);
 					if (b_OutputChannel <= 2) {
 
 						outl(0, devpriv->s_BoardInfos.
 							ui_Address + 20 +
 							(b_OutputChannel * 4) +
 							(64 * b_ModulNbr));
-					}	// if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2))
+					}	/*  if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */
 					else {
 		    /****************************************/
 						/* The selected digital output is wrong */
@@ -1931,21 +1931,21 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev,
 						DPRINTK("The selected digital output is wrong\n");
 						i_ReturnValue = -4;
 
-					}	// if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2))
+					}	/*  if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */
 
 					break;
 
 				case APCI1710_CHRONO_SET_CHANNELON:
 
 					b_OutputChannel =
-						(BYTE) CR_CHAN(insn->chanspec);
+						(unsigned char) CR_CHAN(insn->chanspec);
 					if (b_OutputChannel <= 2) {
 
 						outl(1, devpriv->s_BoardInfos.
 							ui_Address + 20 +
 							(b_OutputChannel * 4) +
 							(64 * b_ModulNbr));
-					}	// if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2))
+					}	/*  if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */
 					else {
 		    /****************************************/
 						/* The selected digital output is wrong */
@@ -1954,7 +1954,7 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev,
 						DPRINTK("The selected digital output is wrong\n");
 						i_ReturnValue = -4;
 
-					}	// if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2))
+					}	/*  if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */
 
 					break;
 
@@ -1962,9 +1962,9 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev,
 		 /**********************************/
 					/* Test the digital input channel */
 		 /**********************************/
-					pb_ChannelStatus = (PBYTE) & data[0];
+					pb_ChannelStatus = (unsigned char *) &data[0];
 					b_InputChannel =
-						(BYTE) CR_CHAN(insn->chanspec);
+						(unsigned char) CR_CHAN(insn->chanspec);
 
 					if (b_InputChannel <= 2) {
 
@@ -1975,10 +1975,10 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev,
 							(64 * b_ModulNbr));
 
 						*pb_ChannelStatus =
-							(BYTE) (((dw_Status >>
+							(unsigned char) (((dw_Status >>
 									b_InputChannel)
 								& 1) ^ 1);
-					}	// if ((b_InputChannel >= 0) && (b_InputChannel <= 2))
+					}	/*  if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) */
 					else {
 		    /***************************************/
 						/* The selected digital input is wrong */
@@ -1986,13 +1986,13 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev,
 
 						DPRINTK("The selected digital input is wrong\n");
 						i_ReturnValue = -4;
-					}	// if ((b_InputChannel >= 0) && (b_InputChannel <= 2))
+					}	/*  if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) */
 
 					break;
 
 				case APCI1710_CHRONO_READ_PORT:
 
-					pb_PortValue = (PBYTE) & data[0];
+					pb_PortValue = (unsigned char *) &data[0];
 
 					dw_Status =
 						inl(devpriv->s_BoardInfos.
@@ -2000,7 +2000,7 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev,
 						(64 * b_ModulNbr));
 
 					*pb_PortValue =
-						(BYTE) ((dw_Status & 0x7) ^ 7);
+						(unsigned char) ((dw_Status & 0x7) ^ 7);
 					break;
 				}
 			} else {
@@ -2028,5 +2028,5 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }

+ 18 - 18
drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.h

@@ -35,10 +35,10 @@
 /*
  * CHRONOMETER INISIALISATION FUNCTION
  */
-INT i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev, struct comedi_subdevice *s,
 				    struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev,
+int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev,
 					    struct comedi_subdevice *s,
 					    struct comedi_insn *insn,
 					    unsigned int *data);
@@ -46,29 +46,29 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev,
 /*
  * CHRONOMETER READ FUNCTION
  */
-INT i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice *s,
 			      struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev,
-				       BYTE b_ModulNbr, PBYTE pb_ChronoStatus);
+int i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev,
+				       unsigned char b_ModulNbr, unsigned char *pb_ChronoStatus);
 
-INT i_APCI1710_ReadChronoValue(struct comedi_device *dev,
-			       BYTE b_ModulNbr,
-			       UINT ui_TimeOut, PBYTE pb_ChronoStatus,
-			       PULONG pul_ChronoValue);
+int i_APCI1710_ReadChronoValue(struct comedi_device *dev,
+			       unsigned char b_ModulNbr,
+			       unsigned int ui_TimeOut, unsigned char *pb_ChronoStatus,
+			       unsigned int *pul_ChronoValue);
 
-INT i_APCI1710_ConvertChronoValue(struct comedi_device *dev,
-				  BYTE b_ModulNbr,
-				  ULONG ul_ChronoValue,
-				  PULONG pul_Hour,
-				  PBYTE pb_Minute,
-				  PBYTE pb_Second,
-				  PUINT pui_MilliSecond, PUINT pui_MicroSecond,
-				  PUINT pui_NanoSecond);
+int i_APCI1710_ConvertChronoValue(struct comedi_device *dev,
+				  unsigned char b_ModulNbr,
+				  unsigned int ul_ChronoValue,
+				  unsigned int *pul_Hour,
+				  unsigned char *pb_Minute,
+				  unsigned char *pb_Second,
+				  unsigned int *pui_MilliSecond, unsigned int *pui_MicroSecond,
+				  unsigned int *pui_NanoSecond);
 
 /*
  * CHRONOMETER DIGITAL INPUT OUTPUT FUNCTION
  */
-INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,
+int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,
 				       struct comedi_subdevice *s, struct comedi_insn *insn,
 				       unsigned int *data);

+ 157 - 152
drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.c

@@ -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.
 
@@ -61,7 +61,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, |
+| Function Name     : int i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, |
 |						struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)|
 +----------------------------------------------------------------------------+
 | Task              : Configure the digital I/O operating mode from selected |
@@ -70,14 +70,14 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                     I/O.                                                   |
 +----------------------------------------------------------------------------+
 | Input Parameters  :													     |
-|                  BYTE_ b_ModulNbr      data[0]: Module number to               |
+|                  unsigned char_ b_ModulNbr      data[0]: Module number to               |
 |                                             configure (0 to 3)             |
-|                     BYTE_ b_ChannelAMode data[1]  : Channel A mode selection       |
+|                     unsigned char_ b_ChannelAMode data[1]  : Channel A mode selection       |
 |                                             0 : Channel used for digital   |
 |                                                 input                      |
 |                                             1 : Channel used for digital   |
 |                                                 output                     |
-|                     BYTE_ b_ChannelBMode data[2] : Channel B mode selection       |
+|                     unsigned char_ b_ChannelBMode data[2] : Channel B mode selection       |
 |                                             0 : Channel used for digital   |
 |                                                 input                      |
 |                                             1 : Channel used for digital   |
@@ -99,19 +99,19 @@ Activates and deactivates the digital output memory.
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	BYTE b_ModulNbr, b_ChannelAMode, b_ChannelBMode;
-	BYTE b_MemoryOnOff, b_ConfigType;
-	INT i_ReturnValue = 0;
-	DWORD dw_WriteConfig = 0;
-
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_ConfigType = (BYTE) data[0];	// Memory or  Init
-	b_ChannelAMode = (BYTE) data[1];
-	b_ChannelBMode = (BYTE) data[2];
-	b_MemoryOnOff = (BYTE) data[1];	// if memory operation
+	unsigned char b_ModulNbr, b_ChannelAMode, b_ChannelBMode;
+	unsigned char b_MemoryOnOff, b_ConfigType;
+	int i_ReturnValue = 0;
+	unsigned int dw_WriteConfig = 0;
+
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_ConfigType = (unsigned char) data[0];	/*  Memory or  Init */
+	b_ChannelAMode = (unsigned char) data[1];
+	b_ChannelBMode = (unsigned char) data[2];
+	b_MemoryOnOff = (unsigned char) data[1];	/*  if memory operation */
 	i_ReturnValue = insn->n;
 
 		/**************************/
@@ -126,7 +126,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub
 	switch (b_ConfigType) {
 	case APCI1710_DIGIO_MEMORYONOFF:
 
-		if (b_MemoryOnOff)	// If Memory ON
+		if (b_MemoryOnOff)	/*  If Memory ON */
 		{
 		 /****************************/
 			/* Set the output memory on */
@@ -140,7 +140,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub
 		 /***************************/
 			devpriv->s_ModuleInfo[b_ModulNbr].
 				s_DigitalIOInfo.dw_OutputMemory = 0;
-		} else		// If memory off
+		} else		/*  If memory off */
 		{
 		 /*****************************/
 			/* Set the output memory off */
@@ -197,7 +197,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub
 	/*****************************************/
 
 					dw_WriteConfig =
-						(DWORD) (b_ChannelAMode |
+						(unsigned int) (b_ChannelAMode |
 						(b_ChannelBMode * 2));
 
 	/***************************/
@@ -233,7 +233,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub
 			DPRINTK("The module is not a digital I/O module\n");
 			i_ReturnValue = -3;
 		}
-	}			// end of Switch
+	}			/*  end of Switch */
 	printk("Return Value %d\n", i_ReturnValue);
 	return i_ReturnValue;
 }
@@ -257,9 +257,9 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub
 
 
 |
-|  BYTE_ b_ModulNbr  CR_AREF(chanspec)          : Selected module number   |
+|  unsigned char_ b_ModulNbr  CR_AREF(chanspec)          : Selected module number   |
 |                                                   (0 to 3)                 |
-|  BYTE_ b_InputChannel CR_CHAN(chanspec)        : Selection from digital   |
+|  unsigned char_ b_InputChannel CR_CHAN(chanspec)        : Selection from digital   |
 |                                                   input ( 0 to 6)          |
 |                                                      0 : Channel C         |
 |                                                      1 : Channel D         |
@@ -288,22 +288,22 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub
 +----------------------------------------------------------------------------+
 */
 
-//_INT_   i_APCI1710_ReadDigitalIOChlValue      (BYTE_    b_BoardHandle,
-//                                             BYTE_    b_ModulNbr,
-//                                             BYTE_    b_InputChannel,
-//
-//                                             PBYTE_  pb_ChannelStatus)
-INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+/* _INT_   i_APCI1710_ReadDigitalIOChlValue      (unsigned char_    b_BoardHandle, */
+/*
+* unsigned char_ b_ModulNbr, unsigned char_ b_InputChannel,
+* unsigned char *_ pb_ChannelStatus)
+*/
+int i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg;
-	BYTE b_ModulNbr, b_InputChannel;
-	PBYTE pb_ChannelStatus;
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_InputChannel = (BYTE) CR_CHAN(insn->chanspec);
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg;
+	unsigned char b_ModulNbr, b_InputChannel;
+	unsigned char *pb_ChannelStatus;
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_InputChannel = (unsigned char) CR_CHAN(insn->chanspec);
 	data[0] = 0;
-	pb_ChannelStatus = (PBYTE) & data[0];
+	pb_ChannelStatus = (unsigned char *) &data[0];
 	i_ReturnValue = insn->n;
 
 	/**************************/
@@ -356,7 +356,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 								i_ReturnValue =
 									-6;
 							}
-						}	// if (b_InputChannel == 5)
+						}	/*  if (b_InputChannel == 5) */
 						else {
 			  /***************************/
 							/* Test the channel B mode */
@@ -375,8 +375,8 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 								i_ReturnValue =
 									-7;
 							}
-						}	// if (b_InputChannel == 5)
-					}	// if (b_InputChannel > 4)
+						}	/*  if (b_InputChannel == 5) */
+					}	/*  if (b_InputChannel > 4) */
 
 		    /***********************/
 					/* Test if error occur */
@@ -387,11 +387,10 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 						/* Read all digital input */
 		       /**************************/
 
-						//INPDW (ps_APCI1710Variable->
-						//   s_Board [b_BoardHandle].
-						//   s_BoardInfos.
-						//  ui_Address + (64 * b_ModulNbr),
-						// &dw_StatusReg);
+/*
+* INPDW (ps_APCI1710Variable-> s_Board [b_BoardHandle].
+* s_BoardInfos. ui_Address + (64 * b_ModulNbr), &dw_StatusReg);
+*/
 
 						dw_StatusReg =
 							inl(devpriv->
@@ -400,11 +399,11 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 							(64 * b_ModulNbr));
 
 						*pb_ChannelStatus =
-							(BYTE) ((dw_StatusReg ^
+							(unsigned char) ((dw_StatusReg ^
 								0x1C) >>
 							b_InputChannel) & 1;
 
-					}	// if (i_ReturnValue == 0)
+					}	/*  if (i_ReturnValue == 0) */
 				} else {
 		    /*******************************/
 					/* Digital I/O not initialised */
@@ -434,7 +433,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -445,7 +444,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT i_APCI1710_InsnWriteDigitalIOChlOnOff(comedi_device
+| Function Name     : int i_APCI1710_InsnWriteDigitalIOChlOnOff(comedi_device
 |*dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)
 
 +----------------------------------------------------------------------------+
@@ -453,9 +452,9 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 |                     parameter b_Channel. Setting an output means setting   |
 |                     an ouput high.                                         |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle   : Handle of board APCI-1710      |
-|                     BYTE_ b_ModulNbr (aref )    : Selected module number (0 to 3)|
-|                     BYTE_ b_OutputChannel (CR_CHAN) : Selection from digital output  |
+| Input Parameters  : unsigned char_ b_BoardHandle   : Handle of board APCI-1710      |
+|                     unsigned char_ b_ModulNbr (aref )    : Selected module number (0 to 3)|
+|                     unsigned char_ b_OutputChannel (CR_CHAN) : Selection from digital output  |
 |                                             channel (0 to 2)               |
 |                                                0 : Channel H               |
 |                                                1 : Channel A               |
@@ -478,15 +477,16 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-//_INT_   i_APCI1710_SetDigitalIOChlOn    (BYTE_ b_BoardHandle,
-//                                       BYTE_ b_ModulNbr,
-//                                       BYTE_ b_OutputChannel)
-INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+/*
+* _INT_ i_APCI1710_SetDigitalIOChlOn (unsigned char_ b_BoardHandle,
+* unsigned char_ b_ModulNbr, unsigned char_ b_OutputChannel)
+*/
+int i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_WriteValue = 0;
-	BYTE b_ModulNbr, b_OutputChannel;
+	int i_ReturnValue = 0;
+	unsigned int dw_WriteValue = 0;
+	unsigned char b_ModulNbr, b_OutputChannel;
 	i_ReturnValue = insn->n;
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_OutputChannel = CR_CHAN(insn->chanspec);
@@ -602,7 +602,7 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev,
 								1 <<
 								b_OutputChannel;
 						}
-					}	// set channel off
+					}	/*  set channel off */
 					else {
 						if (devpriv->
 							s_ModuleInfo
@@ -627,23 +627,24 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev,
 								dw_OutputMemory
 								= dw_WriteValue;
 						} else {
-		       /*****************************/
+							/*****************************/
 							/* Digital Output Memory OFF */
-		       /*****************************/
-							// +Use previously the function "i_APCI1710_SetDigitalIOMemoryOn"
+							/*****************************/
+							/*  +Use previously the function "i_APCI1710_SetDigitalIOMemoryOn" */
 							i_ReturnValue = -8;
 						}
 
 					}
-		    /*******************/
+					/*******************/
 					/* Write the value */
-		    /*******************/
+					/*******************/
 
-					//OUTPDW (ps_APCI1710Variable->
-					//    s_Board [b_BoardHandle].
-					//   s_BoardInfos.
-					//   ui_Address + (64 * b_ModulNbr),
-					//   dw_WriteValue);
+					/* OUTPDW (ps_APCI1710Variable->
+					 * s_Board [b_BoardHandle].
+					 * s_BoardInfos. ui_Address + (64 * b_ModulNbr),
+					 * dw_WriteValue);
+					 */
+*/
 					outl(dw_WriteValue,
 						devpriv->s_BoardInfos.
 						ui_Address + (64 * b_ModulNbr));
@@ -670,7 +671,7 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -690,19 +691,19 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev,
 |                     from selected digital I/O module (b_ModulNbr)
 +----------------------------------------------------------------------------+
 | Input Parameters  :
-	BYTE_ b_BoardHandle   : Handle of board APCI-1710      |
-|   BYTE_ b_ModulNbr  CR_AREF(aref)    : Selected module number (0 to 3)|
-|   BYTE_ b_PortValue CR_CHAN(chanspec) : Output Value ( 0 To 7 )
+	unsigned char_ b_BoardHandle   : Handle of board APCI-1710      |
+|   unsigned char_ b_ModulNbr  CR_AREF(aref)    : Selected module number (0 to 3)|
+|   unsigned char_ b_PortValue CR_CHAN(chanspec) : Output Value ( 0 To 7 )
 |                       data[0]           read or write port
-                        data[1]            if write then indicate ON or OFF
+|                       data[1]            if write then indicate ON or OFF
 
-                        if read : data[1] will return port status.
+|                       if read : data[1] will return port status.
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
 | Return Value      :
 
-                INPUT :
+|                INPUT :
 
 					  0: No error                                            |
 |                    -1: The handle parameter of the board is wrong          |
@@ -725,75 +726,78 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-//_INT_   i_APCI1710_SetDigitalIOPortOn   (BYTE_ b_BoardHandle,
-//                                       BYTE_ b_ModulNbr,
-//                                       BYTE_ b_PortValue)
-INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+/*
+ * _INT_ i_APCI1710_SetDigitalIOPortOn (unsigned char_
+ * b_BoardHandle, unsigned char_ b_ModulNbr, unsigned char_
+ * b_PortValue)
+*/
+int i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_WriteValue = 0;
-	DWORD dw_StatusReg;
-	BYTE b_ModulNbr, b_PortValue;
-	BYTE b_PortOperation, b_PortOnOFF;
-
-	PBYTE pb_PortValue;
-
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_PortOperation = (BYTE) data[0];	// Input or output
-	b_PortOnOFF = (BYTE) data[1];	// if output then On or Off
-	b_PortValue = (BYTE) data[2];	// if out put then Value
+	int i_ReturnValue = 0;
+	unsigned int dw_WriteValue = 0;
+	unsigned int dw_StatusReg;
+	unsigned char b_ModulNbr, b_PortValue;
+	unsigned char b_PortOperation, b_PortOnOFF;
+
+	unsigned char *pb_PortValue;
+
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_PortOperation = (unsigned char) data[0];	/*  Input or output */
+	b_PortOnOFF = (unsigned char) data[1];	/*  if output then On or Off */
+	b_PortValue = (unsigned char) data[2];	/*  if out put then Value */
 	i_ReturnValue = insn->n;
-	pb_PortValue = (PBYTE) & data[0];
-// if input then read value
+	pb_PortValue = (unsigned char *) &data[0];
+/* if input then read value */
 
 	switch (b_PortOperation) {
 	case APCI1710_INPUT:
-	/**************************/
+		/**************************/
 		/* Test the module number */
-	/**************************/
+		/**************************/
 
 		if (b_ModulNbr < 4) {
-	   /*******************************/
+			/*******************************/
 			/* Test if digital I/O counter */
-	   /*******************************/
+			/*******************************/
 
 			if ((devpriv->s_BoardInfos.
 					dw_MolduleConfiguration[b_ModulNbr] &
 					0xFFFF0000UL) == APCI1710_DIGITAL_IO) {
-	      /**********************************************/
+				/**********************************************/
 				/* Test if the digital I/O module initialised */
-	      /**********************************************/
+				/**********************************************/
 
 				if (devpriv->s_ModuleInfo[b_ModulNbr].
 					s_DigitalIOInfo.b_DigitalInit == 1) {
-		 /**************************/
+					/**************************/
 					/* Read all digital input */
-		 /**************************/
+					/**************************/
 
-					//INPDW (ps_APCI1710Variable->
-					//      s_Board [b_BoardHandle].
-					//      s_BoardInfos.
-					//      ui_Address + (64 * b_ModulNbr),
-					//      &dw_StatusReg);
+					/* INPDW (ps_APCI1710Variable->
+					 * s_Board [b_BoardHandle].
+					 * s_BoardInfos.
+					 * ui_Address + (64 * b_ModulNbr),
+					 * &dw_StatusReg);
+					 */
 
 					dw_StatusReg =
 						inl(devpriv->s_BoardInfos.
 						ui_Address + (64 * b_ModulNbr));
 					*pb_PortValue =
-						(BYTE) (dw_StatusReg ^ 0x1C);
+						(unsigned char) (dw_StatusReg ^ 0x1C);
 
 				} else {
-		 /*******************************/
+					/*******************************/
 					/* Digital I/O not initialised */
-		 /*******************************/
+					/*******************************/
 
 					i_ReturnValue = -4;
 				}
 			} else {
-	      /******************************************/
+				/******************************************/
 				/* The module is not a digital I/O module */
-	      /******************************************/
+				/******************************************/
 
 				i_ReturnValue = -3;
 			}
@@ -853,11 +857,11 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 								i_ReturnValue =
 									-6;
 							}
-						}	// if ((b_PortValue & 2) == 2)
+						}	/*  if ((b_PortValue & 2) == 2) */
 
-		    /**************************/
+						/**************************/
 						/* Test if channel B used */
-		    /**************************/
+						/**************************/
 
 						if ((b_PortValue & 4) == 4) {
 							if (devpriv->
@@ -866,33 +870,33 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 								s_DigitalIOInfo.
 								b_ChannelBMode
 								!= 1) {
-			  /*******************************************/
+								/*******************************************/
 								/* The digital channel B is used for input */
-			  /*******************************************/
+								/*******************************************/
 
 								i_ReturnValue =
 									-7;
 							}
-						}	// if ((b_PortValue & 4) == 4)
+						}	/*  if ((b_PortValue & 4) == 4) */
 
-		    /***********************/
+						/***********************/
 						/* Test if error occur */
-		    /***********************/
+						/***********************/
 
 						if (i_ReturnValue >= 0) {
 
-							//if(data[1])
-							//{
+							/* if(data[1]) { */
+
 							switch (b_PortOnOFF) {
-			   /*********************************/
+								/*********************************/
 								/* Test if set Port ON                   */
-		       /*********************************/
+								/*********************************/
 
 							case APCI1710_ON:
 
-		       /*********************************/
+								/*********************************/
 								/* Test if output memory enabled */
-		       /*********************************/
+								/*********************************/
 
 								if (devpriv->
 									s_ModuleInfo
@@ -924,7 +928,7 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 								}
 								break;
 
-								// If Set PORT  OFF
+								/*  If Set PORT  OFF */
 							case APCI1710_OFF:
 
 			   /*********************************/
@@ -957,25 +961,26 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 										=
 										dw_WriteValue;
 								} else {
-			  /*****************************/
+									/*****************************/
 									/* Digital Output Memory OFF */
-			  /*****************************/
+									/*****************************/
 
 									i_ReturnValue
 										=
 										-8;
 								}
-							}	// switch
+							}	/*  switch */
 
-		       /*******************/
+							/*******************/
 							/* Write the value */
-		       /*******************/
+							/*******************/
+
+							/* OUTPDW (ps_APCI1710Variable->
+							 * s_Board [b_BoardHandle].
+							 * s_BoardInfos.
+							 * ui_Address + (64 * b_ModulNbr),
+							 * dw_WriteValue); */
 
-							//  OUTPDW (ps_APCI1710Variable->
-							//      s_Board [b_BoardHandle].
-							//      s_BoardInfos.
-							//      ui_Address + (64 * b_ModulNbr),
-							//      dw_WriteValue);
 							outl(dw_WriteValue,
 								devpriv->
 								s_BoardInfos.
@@ -983,16 +988,16 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 								(64 * b_ModulNbr));
 						}
 					} else {
-		    /**********************/
+						/**********************/
 						/* Output value wrong */
-		    /**********************/
+						/**********************/
 
 						i_ReturnValue = -4;
 					}
 				} else {
-		 /*******************************/
+					/*******************************/
 					/* Digital I/O not initialised */
-		 /*******************************/
+					/*******************************/
 
 					i_ReturnValue = -5;
 				}
@@ -1015,6 +1020,6 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 	default:
 		i_ReturnValue = -9;
 		DPRINTK("NO INPUT/OUTPUT specified\n");
-	}			//switch INPUT / OUTPUT
-	return (i_ReturnValue);
+	}			/* switch INPUT / OUTPUT */
+	return i_ReturnValue;
 }

+ 4 - 4
drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.h

@@ -27,20 +27,20 @@
 /*
  * DIGITAL I/O INISIALISATION FUNCTION
  */
-INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 
 /*
  * INPUT OUTPUT  FUNCTIONS
  */
-INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device *dev,
+int i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device *dev,
 					 struct comedi_subdevice *s,
 					 struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device *dev,
+int i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device *dev,
 					  struct comedi_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device *dev,
+int i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device *dev,
 					  struct comedi_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);

+ 506 - 506
drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c

@@ -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.
 
@@ -61,7 +61,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 
 /*
 +----------------------------------------------------------------------------+
-| INT	i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev,struct comedi_subdevice *s,
+| int	i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev,struct comedi_subdevice *s,
 struct comedi_insn *insn,unsigned int *data)
 
 +----------------------------------------------------------------------------+
@@ -75,58 +75,58 @@ struct comedi_insn *insn,unsigned int *data)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_ConfigType;
-	INT i_ReturnValue = 0;
+	unsigned int ui_ConfigType;
+	int i_ReturnValue = 0;
 	ui_ConfigType = CR_CHAN(insn->chanspec);
 
 	printk("\nINC_CPT");
 
-	devpriv->tsk_Current = current;	// Save the current process task structure
+	devpriv->tsk_Current = current;	/*  Save the current process task structure */
 	switch (ui_ConfigType) {
 	case APCI1710_INCCPT_INITCOUNTER:
 		i_ReturnValue = i_APCI1710_InitCounter(dev,
 			CR_AREF(insn->chanspec),
-			(BYTE) data[0],
-			(BYTE) data[1],
-			(BYTE) data[2], (BYTE) data[3], (BYTE) data[4]);
+			(unsigned char) data[0],
+			(unsigned char) data[1],
+			(unsigned char) data[2], (unsigned char) data[3], (unsigned char) data[4]);
 		break;
 
 	case APCI1710_INCCPT_COUNTERAUTOTEST:
 		i_ReturnValue = i_APCI1710_CounterAutoTest(dev,
-			(PBYTE) & data[0]);
+			(unsigned char *) &data[0]);
 		break;
 
 	case APCI1710_INCCPT_INITINDEX:
 		i_ReturnValue = i_APCI1710_InitIndex(dev,
 			CR_AREF(insn->chanspec),
-			(BYTE) data[0],
-			(BYTE) data[1], (BYTE) data[2], (BYTE) data[3]);
+			(unsigned char) data[0],
+			(unsigned char) data[1], (unsigned char) data[2], (unsigned char) data[3]);
 		break;
 
 	case APCI1710_INCCPT_INITREFERENCE:
 		i_ReturnValue = i_APCI1710_InitReference(dev,
-			CR_AREF(insn->chanspec), (BYTE) data[0]);
+			CR_AREF(insn->chanspec), (unsigned char) data[0]);
 		break;
 
 	case APCI1710_INCCPT_INITEXTERNALSTROBE:
 		i_ReturnValue = i_APCI1710_InitExternalStrobe(dev,
 			CR_AREF(insn->chanspec),
-			(BYTE) data[0], (BYTE) data[1]);
+			(unsigned char) data[0], (unsigned char) data[1]);
 		break;
 
 	case APCI1710_INCCPT_INITCOMPARELOGIC:
 		i_ReturnValue = i_APCI1710_InitCompareLogic(dev,
-			CR_AREF(insn->chanspec), (UINT) data[0]);
+			CR_AREF(insn->chanspec), (unsigned int) data[0]);
 		break;
 
 	case APCI1710_INCCPT_INITFREQUENCYMEASUREMENT:
 		i_ReturnValue = i_APCI1710_InitFrequencyMeasurement(dev,
 			CR_AREF(insn->chanspec),
-			(BYTE) data[0],
-			(BYTE) data[1], (ULONG) data[2], (PULONG) & data[0]);
+			(unsigned char) data[0],
+			(unsigned char) data[1], (unsigned int) data[2], (unsigned int *) &data[0]);
 		break;
 
 	default:
@@ -136,19 +136,19 @@ INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdev
 
 	if (i_ReturnValue >= 0)
 		i_ReturnValue = insn->n;
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_InitCounter                           |
-|                               (BYTE_          b_BoardHandle,               |
-|                                BYTE_          b_ModulNbr,                  |
-|                                BYTE_          b_CounterRange,              |
-|                                BYTE_          b_FirstCounterModus,         |
-|                                BYTE_          b_FirstCounterOption,        |
-|                                BYTE_          b_SecondCounterModus,        |
-|                                BYTE_          b_SecondCounterOption)       |
+|                               (unsigned char_          b_BoardHandle,               |
+|                                unsigned char_          b_ModulNbr,                  |
+|                                unsigned char_          b_CounterRange,              |
+|                                unsigned char_          b_FirstCounterModus,         |
+|                                unsigned char_          b_FirstCounterOption,        |
+|                                unsigned char_          b_SecondCounterModus,        |
+|                                unsigned char_          b_SecondCounterOption)       |
 +----------------------------------------------------------------------------+
 | Task              : Configure the counter operating mode from selected     |
 |                     module (b_ModulNbr). You must calling this function be |
@@ -273,17 +273,17 @@ INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdev
 | +----------------------+--------------------+----------------------------+ |
 |                                                                            |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle         : Handle of board APCI-1710|
-|                     BYTE_ b_ModulNbr            : Module number to         |
+| Input Parameters  : unsigned char_ b_BoardHandle         : Handle of board APCI-1710|
+|                     unsigned char_ b_ModulNbr            : Module number to         |
 |                                                   configure (0 to 3)       |
-|                     BYTE_ b_CounterRange        : Selection form counter   |
+|                     unsigned char_ b_CounterRange        : Selection form counter   |
 |                                                   range.                   |
-|                     BYTE_ b_FirstCounterModus   : First counter operating  |
+|                     unsigned char_ b_FirstCounterModus   : First counter operating  |
 |                                                   mode.                    |
-|                     BYTE_ b_FirstCounterOption  : First counter  option.   |
-|                     BYTE_ b_SecondCounterModus  : Second counter operating |
+|                     unsigned char_ b_FirstCounterOption  : First counter  option.   |
+|                     unsigned char_ b_SecondCounterModus  : Second counter operating |
 |                                                   mode.                    |
-|                     BYTE_ b_SecondCounterOption : Second counter  option.  |
+|                     unsigned char_ b_SecondCounterOption : Second counter  option.  |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -299,14 +299,14 @@ INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdev
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InitCounter(struct comedi_device * dev,
-	BYTE b_ModulNbr,
-	BYTE b_CounterRange,
-	BYTE b_FirstCounterModus,
-	BYTE b_FirstCounterOption,
-	BYTE b_SecondCounterModus, BYTE b_SecondCounterOption)
+int i_APCI1710_InitCounter(struct comedi_device *dev,
+	unsigned char b_ModulNbr,
+	unsigned char b_CounterRange,
+	unsigned char b_FirstCounterModus,
+	unsigned char b_FirstCounterOption,
+	unsigned char b_SecondCounterModus, unsigned char b_SecondCounterOption)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/*******************************/
 	/* Test if incremental counter */
@@ -502,14 +502,14 @@ INT i_APCI1710_InitCounter(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_CounterAutoTest                       |
-|                                               (BYTE_     b_BoardHandle,    |
-|                                                PBYTE_   pb_TestStatus)     |
+|                                               (unsigned char_     b_BoardHandle,    |
+|                                                unsigned char *_   pb_TestStatus)     |
 +----------------------------------------------------------------------------+
 | Task              : A test mode is intended for testing the component and  |
 |                     the connected periphery. All the 8-bit counter chains  |
@@ -535,9 +535,9 @@ INT i_APCI1710_InitCounter(struct comedi_device * dev,
 |              |    1000         | Error detected of counter 3 |             |
 |              +-----------------+-----------------------------+             |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_   b_BoardHandle : Handle of board APCI-1710      |  |
+| Input Parameters  : unsigned char_   b_BoardHandle : Handle of board APCI-1710      |  |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_TestStatus  : Auto test conclusion. See table|
+| Output Parameters : unsigned char *_ pb_TestStatus  : Auto test conclusion. See table|
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
 |                     -1: The handle parameter of the board is wrong         |
@@ -545,11 +545,11 @@ INT i_APCI1710_InitCounter(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus)
+int i_APCI1710_CounterAutoTest(struct comedi_device *dev, unsigned char *pb_TestStatus)
 {
-	BYTE b_ModulCpt = 0;
-	INT i_ReturnValue = 0;
-	DWORD dw_LathchValue;
+	unsigned char b_ModulCpt = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_LathchValue;
 
 	*pb_TestStatus = 0;
 
@@ -627,17 +627,17 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus)
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : _INT_ i_APCI1710_InitIndex (BYTE_ b_BoardHandle,       |
-|                                                 BYTE_ b_ModulNbr,          |
-|                                                 BYTE_ b_ReferenceAction,   |
-|                                                 BYTE_ b_IndexOperation,    |
-|                                                 BYTE_ b_AutoMode,          |
-|                                                 BYTE_ b_InterruptEnable)   |
+| Function Name     : _INT_ i_APCI1710_InitIndex (unsigned char_ b_BoardHandle,       |
+|                                                 unsigned char_ b_ModulNbr,          |
+|                                                 unsigned char_ b_ReferenceAction,   |
+|                                                 unsigned char_ b_IndexOperation,    |
+|                                                 unsigned char_ b_AutoMode,          |
+|                                                 unsigned char_ b_InterruptEnable)   |
 +----------------------------------------------------------------------------+
 | Task              : Initialise the index corresponding to the selected     |
 |                     module (b_ModulNbr). If a INDEX flag occur, you have   |
@@ -665,10 +665,10 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus)
 |           |                        | value is cleared (32-Bit)          |  |
 |           +------------------------+------------------------------------+  |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
-|                     BYTE_ b_ReferenceAction : Determine if the reference   |
+|                     unsigned char_ b_ReferenceAction : Determine if the reference   |
 |                                               must set or no for the       |
 |                                               acceptance from index        |
 |                                               APCI1710_ENABLE :            |
@@ -677,15 +677,15 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus)
 |                                               APCI1710_DISABLE :           |
 |                                                  Reference have not        |
 |                                                  importance                |
-|                     BYTE_ b_IndexOperation  : Index operating mode.        |
+|                     unsigned char_ b_IndexOperation  : Index operating mode.        |
 |                                               See table.                   |
-|                     BYTE_ b_AutoMode        : Enable or disable the        |
+|                     unsigned char_ b_AutoMode        : Enable or disable the        |
 |                                               automatic index reset.       |
 |                                               APCI1710_ENABLE :            |
 |                                                 Enable the automatic mode  |
 |                                               APCI1710_DISABLE :           |
 |                                                 Disable the automatic mode |
-|                     BYTE_ b_InterruptEnable : Enable or disable the        |
+|                     unsigned char_ b_InterruptEnable : Enable or disable the        |
 |                                               interrupt.                   |
 |                                               APCI1710_ENABLE :            |
 |                                               Enable the interrupt         |
@@ -708,12 +708,12 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InitIndex(struct comedi_device * dev,
-	BYTE b_ModulNbr,
-	BYTE b_ReferenceAction,
-	BYTE b_IndexOperation, BYTE b_AutoMode, BYTE b_InterruptEnable)
+int i_APCI1710_InitIndex(struct comedi_device *dev,
+	unsigned char b_ModulNbr,
+	unsigned char b_ReferenceAction,
+	unsigned char b_IndexOperation, unsigned char b_AutoMode, unsigned char b_InterruptEnable)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -902,7 +902,7 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev,
 									b_ModeRegister4
 									|
 									APCI1710_ENABLE_LATCH_AND_CLEAR;
-							}	// if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER)
+							}	/*  if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER) */
 							else {
 				/*****************************************/
 								/* Clear the latch and clear flag (DQ27) */
@@ -975,7 +975,7 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev,
 										&
 										(~APCI1710_INDEX_LATCH_COUNTER);
 								}
-							}	// // if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER)
+							}	/*  // if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER) */
 
 							if (b_AutoMode ==
 								APCI1710_DISABLE)
@@ -1113,15 +1113,15 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_InitReference                         |
-|                                                (BYTE_ b_BoardHandle,       |
-|                                                 BYTE_ b_ModulNbr,          |
-|                                                 BYTE_ b_ReferenceLevel)    |
+|                                                (unsigned char_ b_BoardHandle,       |
+|                                                 unsigned char_ b_ModulNbr,          |
+|                                                 unsigned char_ b_ReferenceLevel)    |
 +----------------------------------------------------------------------------+
 | Task              : Initialise the reference corresponding to the selected |
 |                     module (b_ModulNbr).                                   |
@@ -1136,10 +1136,10 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev,
 |             |   APCI1710_HIGH    |  Reference occur if "1" |               |
 |             +--------------------+-------------------------+               |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
-|                     BYTE_ b_ReferenceLevel  : Reference level.             |
+|                     unsigned char_ b_ReferenceLevel  : Reference level.             |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -1152,10 +1152,10 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InitReference(struct comedi_device * dev,
-	BYTE b_ModulNbr, BYTE b_ReferenceLevel)
+int i_APCI1710_InitReference(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char b_ReferenceLevel)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -1239,27 +1239,27 @@ INT i_APCI1710_InitReference(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_	i_APCI1710_InitExternalStrobe                |
-|					(BYTE_ b_BoardHandle,                |
-|					 BYTE_ b_ModulNbr,                   |
-|					 BYTE_ b_ExternalStrobe,             |
-|					 BYTE_ b_ExternalStrobeLevel)        |
+|					(unsigned char_ b_BoardHandle,                |
+|					 unsigned char_ b_ModulNbr,                   |
+|					 unsigned char_ b_ExternalStrobe,             |
+|					 unsigned char_ b_ExternalStrobeLevel)        |
 +----------------------------------------------------------------------------+
 | Task              : Initialises the external strobe level corresponding to |
 |		      the selected module (b_ModulNbr).                      |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
-|		      BYTE_ b_ExternalStrobe  : External strobe selection    |
+|		      unsigned char_ b_ExternalStrobe  : External strobe selection    |
 |						0 : External strobe A        |
 |						1 : External strobe B        |
-|		      BYTE_ b_ExternalStrobeLevel : External strobe level    |
+|		      unsigned char_ b_ExternalStrobeLevel : External strobe level    |
 |						APCI1710_LOW :               |
 |						External latch occurs if "0" |
 |						APCI1710_HIGH :              |
@@ -1277,10 +1277,10 @@ INT i_APCI1710_InitReference(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev,
-	BYTE b_ModulNbr, BYTE b_ExternalStrobe, BYTE b_ExternalStrobeLevel)
+int i_APCI1710_InitExternalStrobe(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char b_ExternalStrobe, unsigned char b_ExternalStrobeLevel)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -1335,7 +1335,7 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev,
 					DPRINTK("External strobe level parameter is wrong\n");
 					i_ReturnValue = -5;
 				}
-			}	// if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1)
+			}	/*  if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) */
 			else {
 		 /**************************************/
 				/* External strobe selection is wrong */
@@ -1343,7 +1343,7 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev,
 
 				DPRINTK("External strobe selection is wrong\n");
 				i_ReturnValue = -4;
-			}	// if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1)
+			}	/*  if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) */
 		} else {
 	      /****************************************/
 			/* Counter not initialised see function */
@@ -1362,24 +1362,24 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 	/*
 	   +----------------------------------------------------------------------------+
 	   | Function Name     : _INT_ i_APCI1710_InitCompareLogic                      |
-	   |                               (BYTE_   b_BoardHandle,                      |
-	   |                                BYTE_   b_ModulNbr,                         |
-	   |                                UINT_  ui_CompareValue)                     |
+	   |                               (unsigned char_   b_BoardHandle,                      |
+	   |                                unsigned char_   b_ModulNbr,                         |
+	   |                                unsigned int_  ui_CompareValue)                     |
 	   +----------------------------------------------------------------------------+
 	   | Task              : Set the 32-Bit compare value. At that moment that the  |
 	   |                     incremental counter arrive to the compare value        |
 	   |                     (ui_CompareValue) a interrupt is generated.            |
 	   +----------------------------------------------------------------------------+
-	   | Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    |
-	   |                     BYTE_  b_ModulNbr       : Module number to configure   |
+	   | Input Parameters  : unsigned char_  b_BoardHandle    : Handle of board APCI-1710    |
+	   |                     unsigned char_  b_ModulNbr       : Module number to configure   |
 	   |                                               (0 to 3)                     |
-	   |                     UINT_ ui_CompareValue   : 32-Bit compare value         |
+	   |                     unsigned int_ ui_CompareValue   : 32-Bit compare value         |
 	   +----------------------------------------------------------------------------+
 	   | Output Parameters : -
 	   +----------------------------------------------------------------------------+
@@ -1391,10 +1391,10 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev,
 	   +----------------------------------------------------------------------------+
 	 */
 
-INT i_APCI1710_InitCompareLogic(struct comedi_device * dev,
-	BYTE b_ModulNbr, UINT ui_CompareValue)
+int i_APCI1710_InitCompareLogic(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned int ui_CompareValue)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -1434,16 +1434,16 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_InitFrequencyMeasurement              |
-|				(BYTE_		 b_BoardHandle,              |
-|				 BYTE_		 b_ModulNbr,                 |
-|				 BYTE_		 b_PCIInputClock,            |
-|				 BYTE_		 b_TimingUnity,              |
+|				(unsigned char_		 b_BoardHandle,              |
+|				 unsigned char_		 b_ModulNbr,                 |
+|				 unsigned char_		 b_PCIInputClock,            |
+|				 unsigned char_		 b_TimingUnity,              |
 |				 ULONG_ 	ul_TimingInterval,           |
 |				 PULONG_       pul_RealTimingInterval)       |
 +----------------------------------------------------------------------------+
@@ -1456,10 +1456,10 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev,
 |		      you call up any other function which gives access to   |
 |		      the frequency measurement.                             |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    |
-|		      BYTE_  b_ModulNbr	      :	Number of the module to be   |
+| Input Parameters  : unsigned char_  b_BoardHandle    : Handle of board APCI-1710    |
+|		      unsigned char_  b_ModulNbr	      :	Number of the module to be   |
 |						configured (0 to 3)          |
-|		      BYTE_  b_PCIInputClock  :	Selection of the PCI bus     |
+|		      unsigned char_  b_PCIInputClock  :	Selection of the PCI bus     |
 |						clock                        |
 |						- APCI1710_30MHZ :           |
 |						  The PC has a PCI bus clock |
@@ -1467,7 +1467,7 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev,
 |						- APCI1710_33MHZ :           |
 |						  The PC has a PCI bus clock |
 |						  of 33 MHz                  |
-|		      BYTE_  b_TimingUnity    : Base time unit (0 to 2)      |
+|		      unsigned char_  b_TimingUnity    : Base time unit (0 to 2)      |
 |						  0 : ns                     |
 |						  1 : æs                     |
 |						  2 : ms                     |
@@ -1487,16 +1487,16 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev,
-	BYTE b_ModulNbr,
-	BYTE b_PCIInputClock,
-	BYTE b_TimingUnity,
-	ULONG ul_TimingInterval, PULONG pul_RealTimingInterval)
+int i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev,
+	unsigned char b_ModulNbr,
+	unsigned char b_PCIInputClock,
+	unsigned char b_TimingUnity,
+	unsigned int ul_TimingInterval, unsigned int *pul_RealTimingInterval)
 {
-	INT i_ReturnValue = 0;
-	ULONG ul_TimerValue = 0;
+	int i_ReturnValue = 0;
+	unsigned int ul_TimerValue = 0;
 	double d_RealTimingInterval;
-	DWORD dw_Status = 0;
+	unsigned int dw_Status = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -1637,7 +1637,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev,
 								i_ReturnValue =
 									-7;
 							}
-						}	// if (b_PCIInputClock == APCI1710_40MHZ)
+						}	/*  if (b_PCIInputClock == APCI1710_40MHZ) */
 
 		       /***************************/
 						/* Test if not error occur */
@@ -1676,7 +1676,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev,
 										b_ModeRegister4
 										|
 										APCI1710_ENABLE_40MHZ_FREQUENCY;
-								}	// if (b_PCIInputClock == APCI1710_40MHZ)
+								}	/*  if (b_PCIInputClock == APCI1710_40MHZ) */
 								else {
 				   /**********************************/
 									/* Disable the 40MHz quarz (DQ30) */
@@ -1700,7 +1700,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev,
 										&
 										APCI1710_DISABLE_40MHZ_FREQUENCY;
 
-								}	// if (b_PCIInputClock == APCI1710_40MHZ)
+								}	/*  if (b_PCIInputClock == APCI1710_40MHZ) */
 
 			     /********************************/
 								/* Calculate the division fator */
@@ -1720,7 +1720,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev,
 
 									ul_TimerValue
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_TimingInterval
 										*
 										(0.00025 * b_PCIInputClock));
@@ -1743,7 +1743,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev,
 
 									*pul_RealTimingInterval
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_TimerValue
 										/
 										(0.00025 * (double)b_PCIInputClock));
@@ -1790,7 +1790,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev,
 
 									ul_TimerValue
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_TimingInterval
 										*
 										(0.25 * b_PCIInputClock));
@@ -1813,7 +1813,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev,
 
 									*pul_RealTimingInterval
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_TimerValue
 										/
 										(0.25 * (double)b_PCIInputClock));
@@ -1886,7 +1886,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev,
 
 									*pul_RealTimingInterval
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_TimerValue
 										/
 										(250.0 * (double)b_PCIInputClock));
@@ -1949,7 +1949,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev,
 								i_ReturnValue =
 									-3;
 							}
-						}	// if (i_ReturnValue == 0)
+						}	/*  if (i_ReturnValue == 0) */
 					} else {
 		       /**********************************/
 						/* Base timing selection is wrong */
@@ -1992,12 +1992,12 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*########################################################################### */
 
-							//INSN BITS
+							/* INSN BITS */
 /*########################################################################### */
 
 /*
@@ -2015,18 +2015,18 @@ struct comedi_insn *insn,unsigned int *data)                   |
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_BitsType;
-	INT i_ReturnValue = 0;
+	unsigned int ui_BitsType;
+	int i_ReturnValue = 0;
 	ui_BitsType = CR_CHAN(insn->chanspec);
-	devpriv->tsk_Current = current;	// Save the current process task structure
+	devpriv->tsk_Current = current;	/*  Save the current process task structure */
 
 	switch (ui_BitsType) {
 	case APCI1710_INCCPT_CLEARCOUNTERVALUE:
 		i_ReturnValue = i_APCI1710_ClearCounterValue(dev,
-			(BYTE) CR_AREF(insn->chanspec));
+			(unsigned char) CR_AREF(insn->chanspec));
 		break;
 
 	case APCI1710_INCCPT_CLEARALLCOUNTERVALUE:
@@ -2035,28 +2035,28 @@ INT i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevic
 
 	case APCI1710_INCCPT_SETINPUTFILTER:
 		i_ReturnValue = i_APCI1710_SetInputFilter(dev,
-			(BYTE) CR_AREF(insn->chanspec),
-			(BYTE) data[0], (BYTE) data[1]);
+			(unsigned char) CR_AREF(insn->chanspec),
+			(unsigned char) data[0], (unsigned char) data[1]);
 		break;
 
 	case APCI1710_INCCPT_LATCHCOUNTER:
 		i_ReturnValue = i_APCI1710_LatchCounter(dev,
-			(BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
 		break;
 
 	case APCI1710_INCCPT_SETINDEXANDREFERENCESOURCE:
 		i_ReturnValue = i_APCI1710_SetIndexAndReferenceSource(dev,
-			(BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
 		break;
 
 	case APCI1710_INCCPT_SETDIGITALCHLON:
 		i_ReturnValue = i_APCI1710_SetDigitalChlOn(dev,
-			(BYTE) CR_AREF(insn->chanspec));
+			(unsigned char) CR_AREF(insn->chanspec));
 		break;
 
 	case APCI1710_INCCPT_SETDIGITALCHLOFF:
 		i_ReturnValue = i_APCI1710_SetDigitalChlOff(dev,
-			(BYTE) CR_AREF(insn->chanspec));
+			(unsigned char) CR_AREF(insn->chanspec));
 		break;
 
 	default:
@@ -2065,20 +2065,20 @@ INT i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevic
 
 	if (i_ReturnValue >= 0)
 		i_ReturnValue = insn->n;
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ClearCounterValue                     |
-|                               (BYTE_      b_BoardHandle,                   |
-|                                BYTE_       b_ModulNbr)                     |
+|                               (unsigned char_      b_BoardHandle,                   |
+|                                unsigned char_       b_ModulNbr)                     |
 +----------------------------------------------------------------------------+
 | Task              : Clear the counter value from selected module           |
 |                     (b_ModulNbr).                                          |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle : Handle of board APCI-1710        |
-|                     BYTE_ b_ModulNbr    : Module number to configure       |
+| Input Parameters  : unsigned char_ b_BoardHandle : Handle of board APCI-1710        |
+|                     unsigned char_ b_ModulNbr    : Module number to configure       |
 |                                           (0 to 3)                         |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -2091,9 +2091,9 @@ INT i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevic
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_ClearCounterValue(struct comedi_device * dev, BYTE b_ModulNbr)
+int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -2131,17 +2131,17 @@ INT i_APCI1710_ClearCounterValue(struct comedi_device * dev, BYTE b_ModulNbr)
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ClearAllCounterValue                  |
-|                               (BYTE_      b_BoardHandle)                   |
+|                               (unsigned char_      b_BoardHandle)                   |
 +----------------------------------------------------------------------------+
 | Task              : Clear all counter value.                               |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle : Handle of board APCI-1710        |
+| Input Parameters  : unsigned char_ b_BoardHandle : Handle of board APCI-1710        |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -2151,10 +2151,10 @@ INT i_APCI1710_ClearCounterValue(struct comedi_device * dev, BYTE b_ModulNbr)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev)
+int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev)
 {
-	BYTE b_ModulCpt = 0;
-	INT i_ReturnValue = 0;
+	unsigned char b_ModulCpt = 0;
+	int i_ReturnValue = 0;
 
 	/********************************/
 	/* Test if counter module found */
@@ -2198,24 +2198,24 @@ INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev)
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_SetInputFilter                        |
-|					(BYTE_ b_BoardHandle,                |
-|					 BYTE_ b_Module,                     |
-|					 BYTE_ b_PCIInputClock,              |
-|					 BYTE_ b_Filter)     		     |
+|					(unsigned char_ b_BoardHandle,                |
+|					 unsigned char_ b_Module,                     |
+|					 unsigned char_ b_PCIInputClock,              |
+|					 unsigned char_ b_Filter)     		     |
 +----------------------------------------------------------------------------+
 | Task              : Disable or enable the software filter from selected    |
 |		      module (b_ModulNbr). b_Filter determine the filter time|
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    |
-|		      BYTE_  b_ModulNbr	      :	Number of the module to be   |
+| Input Parameters  : unsigned char_  b_BoardHandle    : Handle of board APCI-1710    |
+|		      unsigned char_  b_ModulNbr	      :	Number of the module to be   |
 |						configured (0 to 3)          |
-|		      BYTE_  b_PCIInputClock  :	Selection of the PCI bus     |
+|		      unsigned char_  b_PCIInputClock  :	Selection of the PCI bus     |
 |						clock                        |
 |						- APCI1710_30MHZ :           |
 |						  The PC has a PCI bus clock |
@@ -2226,7 +2226,7 @@ INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev)
 |						- APCI1710_40MHZ :           |
 |						  The APCI1710 has a 40MHz    |
 |						  quartz		     |
-|		      BYTE_  b_Filter	      : Filter selection             |
+|		      unsigned char_  b_Filter	      : Filter selection             |
 |                                                                            |
 |				30 MHz                                       |
 |				------                                       |
@@ -2297,11 +2297,11 @@ INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_SetInputFilter(struct comedi_device * dev,
-	BYTE b_ModulNbr, BYTE b_PCIInputClock, BYTE b_Filter)
+int i_APCI1710_SetInputFilter(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char b_PCIInputClock, unsigned char b_Filter)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_Status = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_Status = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -2365,7 +2365,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev,
 								i_ReturnValue =
 									-6;
 							}
-						}	// if (b_PCIInputClock == APCI1710_40MHZ)
+						}	/*  if (b_PCIInputClock == APCI1710_40MHZ) */
 
 		       /***************************/
 						/* Test if error not occur */
@@ -2401,7 +2401,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev,
 									|
 									APCI1710_ENABLE_40MHZ_FILTER;
 
-							}	// if (b_PCIInputClock == APCI1710_40MHZ)
+							}	/*  if (b_PCIInputClock == APCI1710_40MHZ) */
 							else {
 			     /**********************************/
 								/* Disable the 40MHz quarz (DQ31) */
@@ -2425,7 +2425,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev,
 									&
 									APCI1710_DISABLE_40MHZ_FILTER;
 
-							}	// if (b_PCIInputClock == APCI1710_40MHZ)
+							}	/*  if (b_PCIInputClock == APCI1710_40MHZ) */
 
 			  /************************/
 							/* Set the filter value */
@@ -2486,8 +2486,8 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev,
 								ui_Address +
 								20 +
 								(64 * b_ModulNbr));
-						}	// if (i_ReturnValue == 0)
-					}	// if (b_Filter < 16)
+						}	/*  if (i_ReturnValue == 0) */
+					}	/*  if (b_Filter < 16) */
 					else {
 		       /**************************************/
 						/* The selected filter value is wrong */
@@ -2495,8 +2495,8 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev,
 
 						DPRINTK("The selected filter value is wrong\n");
 						i_ReturnValue = -5;
-					}	// if (b_Filter < 16)
-				}	// if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ))
+					}	/*  if (b_Filter < 16) */
+				}	/*  if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ)) */
 				else {
 		    /*****************************************/
 					/* The selected PCI input clock is wrong */
@@ -2504,7 +2504,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev,
 
 					DPRINTK("The selected PCI input clock is wrong\n");
 					i_ReturnValue = 4;
-				}	// if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ))
+				}	/*  if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ)) */
 			} else {
 		 /**************************************/
 				/* The module is not a counter module */
@@ -2530,23 +2530,23 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : _INT_ i_APCI1710_LatchCounter (BYTE_ b_BoardHandle,    |
-|                                                    BYTE_ b_ModulNbr,       |
-|                                                    BYTE_ b_LatchReg)       |
+| Function Name     : _INT_ i_APCI1710_LatchCounter (unsigned char_ b_BoardHandle,    |
+|                                                    unsigned char_ b_ModulNbr,       |
+|                                                    unsigned char_ b_LatchReg)       |
 +----------------------------------------------------------------------------+
 | Task              : Latch the courant value from selected module           |
 |                     (b_ModulNbr) in to the selected latch register         |
 |                     (b_LatchReg).                                          |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle : Handle of board APCI-1710        |
-|                     BYTE_ b_ModulNbr    : Module number to configure       |
+| Input Parameters  : unsigned char_ b_BoardHandle : Handle of board APCI-1710        |
+|                     unsigned char_ b_ModulNbr    : Module number to configure       |
 |                                           (0 to 3)                         |
-|                     BYTE_ b_LatchReg    : Selected latch register          |
+|                     unsigned char_ b_LatchReg    : Selected latch register          |
 |                               0 : for the first latch register             |
 |                               1 : for the second latch register            |
 +----------------------------------------------------------------------------+
@@ -2561,10 +2561,10 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_LatchCounter(struct comedi_device * dev,
-	BYTE b_ModulNbr, BYTE b_LatchReg)
+int i_APCI1710_LatchCounter(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char b_LatchReg)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -2616,25 +2616,25 @@ INT i_APCI1710_LatchCounter(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_	i_APCI1710_SetIndexAndReferenceSource        |
-|					(BYTE_ b_BoardHandle,                |
-|					 BYTE_ b_ModulNbr,                   |
-|					 BYTE_ b_SourceSelection)            |
+|					(unsigned char_ b_BoardHandle,                |
+|					 unsigned char_ b_ModulNbr,                   |
+|					 unsigned char_ b_SourceSelection)            |
 +----------------------------------------------------------------------------+
 | Task              : Determine the hardware source for the index and the    |
 |		      reference logic. Per default the index logic is        |
 |		      connected to the difference input C and the reference  |
 |		      logic is connected to the 24V input E                  |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
-|		      BYTE_ b_SourceSelection : APCI1710_SOURCE_0 :          |
+|		      unsigned char_ b_SourceSelection : APCI1710_SOURCE_0 :          |
 |						The index logic is connected |
 |						to the difference input C and|
 |						the reference logic is       |
@@ -2658,10 +2658,10 @@ INT i_APCI1710_LatchCounter(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev,
-	BYTE b_ModulNbr, BYTE b_SourceSelection)
+int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char b_SourceSelection)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -2735,7 +2735,7 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev,
 							b_ModeRegister4 &
 							APCI1710_DEFAULT_INDEX_RFERENCE;
 					}
-				}	// if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1)
+				}	/*  if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1) */
 				else {
 		    /*********************************/
 					/* The source selection is wrong */
@@ -2743,7 +2743,7 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev,
 
 					DPRINTK("The source selection is wrong\n");
 					i_ReturnValue = -4;
-				}	// if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1)
+				}	/*  if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1) */
 			} else {
 		 /**************************************/
 				/* The module is not a counter module */
@@ -2769,20 +2769,20 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_	i_APCI1710_SetDigitalChlOn                   |
-|				   (BYTE_  b_BoardHandle,                    |
-|				    BYTE_  b_ModulNbr)                       |
+|				   (unsigned char_  b_BoardHandle,                    |
+|				    unsigned char_  b_ModulNbr)                       |
 +----------------------------------------------------------------------------+
 | Task              : Sets the digital output H Setting an output means      |
 |		      setting an ouput high.                                 |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    |
-|		      BYTE_  b_ModulNbr	      :	Number of the module to be   |
+| Input Parameters  : unsigned char_  b_BoardHandle    : Handle of board APCI-1710    |
+|		      unsigned char_  b_ModulNbr	      :	Number of the module to be   |
 |						configured (0 to 3)          |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -2795,9 +2795,9 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_SetDigitalChlOn(struct comedi_device * dev, BYTE b_ModulNbr)
+int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulNbr)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -2849,20 +2849,20 @@ INT i_APCI1710_SetDigitalChlOn(struct comedi_device * dev, BYTE b_ModulNbr)
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_	i_APCI1710_SetDigitalChlOff                  |
-|				   (BYTE_  b_BoardHandle,                    |
-|				    BYTE_  b_ModulNbr)                       |
+|				   (unsigned char_  b_BoardHandle,                    |
+|				    unsigned char_  b_ModulNbr)                       |
 +----------------------------------------------------------------------------+
 | Task              : Resets the digital output H. Resetting an output means |
 |		      setting an ouput low.                                  |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    |
-|		      BYTE_  b_ModulNbr	      :	Number of the module to be   |
+| Input Parameters  : unsigned char_  b_BoardHandle    : Handle of board APCI-1710    |
+|		      unsigned char_  b_ModulNbr	      :	Number of the module to be   |
 |						configured (0 to 3)          |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -2875,9 +2875,9 @@ INT i_APCI1710_SetDigitalChlOn(struct comedi_device * dev, BYTE b_ModulNbr)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_SetDigitalChlOff(struct comedi_device * dev, BYTE b_ModulNbr)
+int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_ModulNbr)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -2929,12 +2929,12 @@ INT i_APCI1710_SetDigitalChlOff(struct comedi_device * dev, BYTE b_ModulNbr)
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*########################################################################### */
 
-							// INSN WRITE
+							/*  INSN WRITE */
 /*########################################################################### */
 
 /*
@@ -2951,65 +2951,65 @@ struct comedi_insn *insn,unsigned int *data)                   |
 | Return Value      :
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1710_InsnWriteINCCPT(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_WriteType;
-	INT i_ReturnValue = 0;
+	unsigned int ui_WriteType;
+	int i_ReturnValue = 0;
 
 	ui_WriteType = CR_CHAN(insn->chanspec);
-	devpriv->tsk_Current = current;	// Save the current process task structure
+	devpriv->tsk_Current = current;	/*  Save the current process task structure */
 
 	switch (ui_WriteType) {
 	case APCI1710_INCCPT_ENABLELATCHINTERRUPT:
 		i_ReturnValue = i_APCI1710_EnableLatchInterrupt(dev,
-			(BYTE) CR_AREF(insn->chanspec));
+			(unsigned char) CR_AREF(insn->chanspec));
 		break;
 
 	case APCI1710_INCCPT_DISABLELATCHINTERRUPT:
 		i_ReturnValue = i_APCI1710_DisableLatchInterrupt(dev,
-			(BYTE) CR_AREF(insn->chanspec));
+			(unsigned char) CR_AREF(insn->chanspec));
 		break;
 
 	case APCI1710_INCCPT_WRITE16BITCOUNTERVALUE:
 		i_ReturnValue = i_APCI1710_Write16BitCounterValue(dev,
-			(BYTE) CR_AREF(insn->chanspec),
-			(BYTE) data[0], (UINT) data[1]);
+			(unsigned char) CR_AREF(insn->chanspec),
+			(unsigned char) data[0], (unsigned int) data[1]);
 		break;
 
 	case APCI1710_INCCPT_WRITE32BITCOUNTERVALUE:
 		i_ReturnValue = i_APCI1710_Write32BitCounterValue(dev,
-			(BYTE) CR_AREF(insn->chanspec), (ULONG) data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned int) data[0]);
 
 		break;
 
 	case APCI1710_INCCPT_ENABLEINDEX:
-		i_APCI1710_EnableIndex(dev, (BYTE) CR_AREF(insn->chanspec));
+		i_APCI1710_EnableIndex(dev, (unsigned char) CR_AREF(insn->chanspec));
 		break;
 
 	case APCI1710_INCCPT_DISABLEINDEX:
 		i_ReturnValue = i_APCI1710_DisableIndex(dev,
-			(BYTE) CR_AREF(insn->chanspec));
+			(unsigned char) CR_AREF(insn->chanspec));
 		break;
 
 	case APCI1710_INCCPT_ENABLECOMPARELOGIC:
 		i_ReturnValue = i_APCI1710_EnableCompareLogic(dev,
-			(BYTE) CR_AREF(insn->chanspec));
+			(unsigned char) CR_AREF(insn->chanspec));
 		break;
 
 	case APCI1710_INCCPT_DISABLECOMPARELOGIC:
 		i_ReturnValue = i_APCI1710_DisableCompareLogic(dev,
-			(BYTE) CR_AREF(insn->chanspec));
+			(unsigned char) CR_AREF(insn->chanspec));
 		break;
 
 	case APCI1710_INCCPT_ENABLEFREQUENCYMEASUREMENT:
 		i_ReturnValue = i_APCI1710_EnableFrequencyMeasurement(dev,
-			(BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
 		break;
 
 	case APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT:
 		i_ReturnValue = i_APCI1710_DisableFrequencyMeasurement(dev,
-			(BYTE) CR_AREF(insn->chanspec));
+			(unsigned char) CR_AREF(insn->chanspec));
 		break;
 
 	default:
@@ -3018,21 +3018,21 @@ INT i_APCI1710_InsnWriteINCCPT(struct comedi_device * dev, struct comedi_subdevi
 
 	if (i_ReturnValue >= 0)
 		i_ReturnValue = insn->n;
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_EnableLatchInterrupt                  |
-|                               (BYTE_ b_BoardHandle,                        |
-|                                BYTE_ b_ModulNbr)                           |
+|                               (unsigned char_ b_BoardHandle,                        |
+|                                unsigned char_ b_ModulNbr)                           |
 +----------------------------------------------------------------------------+
 | Task              : Enable the latch interrupt from selected module        |
 |                     (b_ModulNbr). Each software or hardware latch occur a  |
 |                     interrupt.                                             |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle : Handle of board APCI-1710        |
-|                     BYTE_ b_ModulNbr    : Module number to configure       |
+| Input Parameters  : unsigned char_ b_BoardHandle : Handle of board APCI-1710        |
+|                     unsigned char_ b_ModulNbr    : Module number to configure       |
 |                                           (0 to 3)                         |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -3047,9 +3047,9 @@ INT i_APCI1710_InsnWriteINCCPT(struct comedi_device * dev, struct comedi_subdevi
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_EnableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr)
+int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -3105,20 +3105,20 @@ INT i_APCI1710_EnableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr)
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_DisableLatchInterrupt                 |
-|                               (BYTE_ b_BoardHandle,                        |
-|                                BYTE_ b_ModulNbr)                           |
+|                               (unsigned char_ b_BoardHandle,                        |
+|                                unsigned char_ b_ModulNbr)                           |
 +----------------------------------------------------------------------------+
 | Task              : Disable the latch interrupt from selected module       |
 |                     (b_ModulNbr).                                          |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle : Handle of board APCI-1710        |
-|                     BYTE_ b_ModulNbr    : Module number to configure       |
+| Input Parameters  : unsigned char_ b_BoardHandle : Handle of board APCI-1710        |
+|                     unsigned char_ b_ModulNbr    : Module number to configure       |
 |                                           (0 to 3)                         |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -3133,9 +3133,9 @@ INT i_APCI1710_EnableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_DisableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr)
+int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -3198,27 +3198,27 @@ INT i_APCI1710_DisableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_Write16BitCounterValue                |
-|                                               (BYTE_  b_BoardHandle        |
-|                                                BYTE_  b_ModulNbr,          |
-|                                                BYTE_  b_SelectedCounter,   |
-|                                                UINT_ ui_WriteValue)        |
+|                                               (unsigned char_  b_BoardHandle        |
+|                                                unsigned char_  b_ModulNbr,          |
+|                                                unsigned char_  b_SelectedCounter,   |
+|                                                unsigned int_ ui_WriteValue)        |
 +----------------------------------------------------------------------------+
 | Task              : Write a 16-Bit value (ui_WriteValue) in to the selected|
 |                     16-Bit counter (b_SelectedCounter) from selected module|
 |                     (b_ModulNbr).                                          |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                              (0 to 3)                      |
-|                     BYTE_ b_SelectedCounter : Selected 16-Bit counter      |
+|                     unsigned char_ b_SelectedCounter : Selected 16-Bit counter      |
 |                                               (0 or 1)                     |
-|                     UINT_ ui_WriteValue     : 16-Bit write value           |
+|                     unsigned int_ ui_WriteValue     : 16-Bit write value           |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -3231,10 +3231,10 @@ INT i_APCI1710_DisableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev,
-	BYTE b_ModulNbr, BYTE b_SelectedCounter, UINT ui_WriteValue)
+int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int ui_WriteValue)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -3257,7 +3257,7 @@ INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev,
 				/* Write the value */
 		 /*******************/
 
-				outl((ULONG) ((ULONG) (ui_WriteValue) << (16 *
+				outl((unsigned int) ((unsigned int) (ui_WriteValue) << (16 *
 							b_SelectedCounter)),
 					devpriv->s_BoardInfos.ui_Address + 8 +
 					(b_SelectedCounter * 4) +
@@ -3288,21 +3288,21 @@ INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_Write32BitCounterValue                |
-|                                               (BYTE_   b_BoardHandle       |
-|                                                BYTE_   b_ModulNbr,         |
+|                                               (unsigned char_   b_BoardHandle       |
+|                                                unsigned char_   b_ModulNbr,         |
 |                                                ULONG_ ul_WriteValue)       |
 +----------------------------------------------------------------------------+
 | Task              : Write a 32-Bit value (ui_WriteValue) in to the selected|
 |                     module (b_ModulNbr).                                   |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                              (0 to 3)                      |
 |                     ULONG_ ul_WriteValue    : 32-Bit write value           |
 +----------------------------------------------------------------------------+
@@ -3316,10 +3316,10 @@ INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_Write32BitCounterValue(struct comedi_device * dev,
-	BYTE b_ModulNbr, ULONG ul_WriteValue)
+int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned int ul_WriteValue)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -3357,18 +3357,18 @@ INT i_APCI1710_Write32BitCounterValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : _INT_ i_APCI1710_EnableIndex (BYTE_  b_BoardHandle,    |
-|                                                   BYTE_  b_ModulNbr)       |
+| Function Name     : _INT_ i_APCI1710_EnableIndex (unsigned char_  b_BoardHandle,    |
+|                                                   unsigned char_  b_ModulNbr)       |
 +----------------------------------------------------------------------------+
 | Task              : Enable the INDEX actions                               |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -3383,10 +3383,10 @@ INT i_APCI1710_Write32BitCounterValue(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_EnableIndex(struct comedi_device * dev, BYTE b_ModulNbr)
+int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr)
 {
-	INT i_ReturnValue = 0;
-	ULONG ul_InterruptLatchReg;
+	int i_ReturnValue = 0;
+	unsigned int ul_InterruptLatchReg;
 
 	/**************************/
 	/* Test the module number */
@@ -3455,18 +3455,18 @@ INT i_APCI1710_EnableIndex(struct comedi_device * dev, BYTE b_ModulNbr)
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : _INT_ i_APCI1710_DisableIndex (BYTE_  b_BoardHandle,   |
-|                                                    BYTE_  b_ModulNbr)      |
+| Function Name     : _INT_ i_APCI1710_DisableIndex (unsigned char_  b_BoardHandle,   |
+|                                                    unsigned char_  b_ModulNbr)      |
 +----------------------------------------------------------------------------+
 | Task              : Disable the INDEX actions                              |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -3481,9 +3481,9 @@ INT i_APCI1710_EnableIndex(struct comedi_device * dev, BYTE b_ModulNbr)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_DisableIndex(struct comedi_device * dev, BYTE b_ModulNbr)
+int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -3549,21 +3549,21 @@ INT i_APCI1710_DisableIndex(struct comedi_device * dev, BYTE b_ModulNbr)
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_EnableCompareLogic                    |
-|                               (BYTE_   b_BoardHandle,                      |
-|                                BYTE_   b_ModulNbr)                         |
+|                               (unsigned char_   b_BoardHandle,                      |
+|                                unsigned char_   b_ModulNbr)                         |
 +----------------------------------------------------------------------------+
 | Task              : Enable the 32-Bit compare logic. At that moment that   |
 |                     the incremental counter arrive to the compare value a  |
 |                     interrupt is generated.                                |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    |
-|                     BYTE_  b_ModulNbr       : Module number to configure   |
+| Input Parameters  : unsigned char_  b_BoardHandle    : Handle of board APCI-1710    |
+|                     unsigned char_  b_ModulNbr       : Module number to configure   |
 |                                               (0 to 3)                     |
 +----------------------------------------------------------------------------+
 | Output Parameters : -
@@ -3580,9 +3580,9 @@ INT i_APCI1710_DisableIndex(struct comedi_device * dev, BYTE b_ModulNbr)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_EnableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr)
+int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -3653,19 +3653,19 @@ INT i_APCI1710_EnableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr)
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_DisableCompareLogic                   |
-|                               (BYTE_   b_BoardHandle,                      |
-|                                BYTE_   b_ModulNbr)                         |
+|                               (unsigned char_   b_BoardHandle,                      |
+|                                unsigned char_   b_ModulNbr)                         |
 +----------------------------------------------------------------------------+
 | Task              : Disable the 32-Bit compare logic.
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    |
-|                     BYTE_  b_ModulNbr       : Module number to configure   |
+| Input Parameters  : unsigned char_  b_BoardHandle    : Handle of board APCI-1710    |
+|                     unsigned char_  b_ModulNbr       : Module number to configure   |
 |                                               (0 to 3)                     |
 +----------------------------------------------------------------------------+
 | Output Parameters : -
@@ -3680,9 +3680,9 @@ INT i_APCI1710_EnableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_DisableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr)
+int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -3753,22 +3753,22 @@ INT i_APCI1710_DisableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr)
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 	/*
 	   +----------------------------------------------------------------------------+
 	   | Function Name     : _INT_ i_APCI1710_EnableFrequencyMeasurement            |
-	   |                            (BYTE_   b_BoardHandle,                      |
-	   |                             BYTE_   b_ModulNbr,                         |
-	   |                             BYTE_   b_InterruptEnable)                  |
+	   |                            (unsigned char_   b_BoardHandle,                      |
+	   |                             unsigned char_   b_ModulNbr,                         |
+	   |                             unsigned char_   b_InterruptEnable)                  |
 	   +----------------------------------------------------------------------------+
 	   | Task              : Enables the frequency measurement function             |
 	   +----------------------------------------------------------------------------+
-	   | Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    |
-	   |                  BYTE_  b_ModulNbr       : Number of the module to be   |
+	   | Input Parameters  : unsigned char_  b_BoardHandle    : Handle of board APCI-1710    |
+	   |                  unsigned char_  b_ModulNbr       : Number of the module to be   |
 	   |                                            configured (0 to 3)          |
-	   |                  BYTE_  b_InterruptEnable: Enable or disable the        |
+	   |                  unsigned char_  b_InterruptEnable: Enable or disable the        |
 	   |                                            interrupt.                   |
 	   |                                            APCI1710_ENABLE:             |
 	   |                                            Enable the interrupt         |
@@ -3789,10 +3789,10 @@ INT i_APCI1710_DisableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr)
 	   +----------------------------------------------------------------------------+
 	 */
 
-INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device * dev,
-	BYTE b_ModulNbr, BYTE b_InterruptEnable)
+int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char b_InterruptEnable)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -3909,19 +3909,19 @@ INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 	/*
 	   +----------------------------------------------------------------------------+
 	   | Function Name     : _INT_ i_APCI1710_DisableFrequencyMeasurement           |
-	   |                            (BYTE_   b_BoardHandle,                      |
-	   |                             BYTE_   b_ModulNbr)                         |
+	   |                            (unsigned char_   b_BoardHandle,                      |
+	   |                             unsigned char_   b_ModulNbr)                         |
 	   +----------------------------------------------------------------------------+
 	   | Task              : Disables the frequency measurement function             |
 	   +----------------------------------------------------------------------------+
-	   | Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    |
-	   |                  BYTE_  b_ModulNbr       : Number of the module to be   |
+	   | Input Parameters  : unsigned char_  b_BoardHandle    : Handle of board APCI-1710    |
+	   |                  unsigned char_  b_ModulNbr       : Number of the module to be   |
 	   |                                            configured (0 to 3)          |
 	   +----------------------------------------------------------------------------+
 	   | Output Parameters : -                                                      |
@@ -3936,9 +3936,9 @@ INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device * dev,
 	   +----------------------------------------------------------------------------+
 	 */
 
-INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device * dev, BYTE b_ModulNbr)
+int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, unsigned char b_ModulNbr)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -3976,9 +3976,9 @@ INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device * dev, BYTE b_Mo
 					s_ByteModeRegister.
 					b_ModeRegister3 &
 					APCI1710_DISABLE_FREQUENCY
-					// Begin CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared
+					/*  Begin CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared */
 					& APCI1710_DISABLE_FREQUENCY_INT;
-				// End CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared
+				/*  End CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared */
 
 		 /***************************/
 				/* Write the configuration */
@@ -4026,12 +4026,12 @@ INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device * dev, BYTE b_Mo
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*########################################################################### */
 
-							// INSN READ
+							/*  INSN READ */
 
 /*########################################################################### */
 
@@ -4049,82 +4049,82 @@ struct comedi_insn *insn,unsigned int *data)                   |
 | Return Value      :
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1710_InsnReadINCCPT(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnReadINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_ReadType;
-	INT i_ReturnValue = 0;
+	unsigned int ui_ReadType;
+	int i_ReturnValue = 0;
 
 	ui_ReadType = CR_CHAN(insn->chanspec);
 
-	devpriv->tsk_Current = current;	// Save the current process task structure
+	devpriv->tsk_Current = current;	/*  Save the current process task structure */
 	switch (ui_ReadType) {
 	case APCI1710_INCCPT_READLATCHREGISTERSTATUS:
 		i_ReturnValue = i_APCI1710_ReadLatchRegisterStatus(dev,
-			(BYTE) CR_AREF(insn->chanspec),
-			(BYTE) CR_RANGE(insn->chanspec), (PBYTE) & data[0]);
+			(unsigned char) CR_AREF(insn->chanspec),
+			(unsigned char) CR_RANGE(insn->chanspec), (unsigned char *) &data[0]);
 		break;
 
 	case APCI1710_INCCPT_READLATCHREGISTERVALUE:
 		i_ReturnValue = i_APCI1710_ReadLatchRegisterValue(dev,
-			(BYTE) CR_AREF(insn->chanspec),
-			(BYTE) CR_RANGE(insn->chanspec), (PULONG) & data[0]);
+			(unsigned char) CR_AREF(insn->chanspec),
+			(unsigned char) CR_RANGE(insn->chanspec), (unsigned int *) &data[0]);
 		printk("Latch Register Value %d\n", data[0]);
 		break;
 
 	case APCI1710_INCCPT_READ16BITCOUNTERVALUE:
 		i_ReturnValue = i_APCI1710_Read16BitCounterValue(dev,
-			(BYTE) CR_AREF(insn->chanspec),
-			(BYTE) CR_RANGE(insn->chanspec), (PUINT) & data[0]);
+			(unsigned char) CR_AREF(insn->chanspec),
+			(unsigned char) CR_RANGE(insn->chanspec), (unsigned int *) &data[0]);
 		break;
 
 	case APCI1710_INCCPT_READ32BITCOUNTERVALUE:
 		i_ReturnValue = i_APCI1710_Read32BitCounterValue(dev,
-			(BYTE) CR_AREF(insn->chanspec), (PULONG) & data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned int *) &data[0]);
 		break;
 
 	case APCI1710_INCCPT_GETINDEXSTATUS:
 		i_ReturnValue = i_APCI1710_GetIndexStatus(dev,
-			(BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
 		break;
 
 	case APCI1710_INCCPT_GETREFERENCESTATUS:
 		i_ReturnValue = i_APCI1710_GetReferenceStatus(dev,
-			(BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
 		break;
 
 	case APCI1710_INCCPT_GETUASSTATUS:
 		i_ReturnValue = i_APCI1710_GetUASStatus(dev,
-			(BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
 		break;
 
 	case APCI1710_INCCPT_GETCBSTATUS:
 		i_ReturnValue = i_APCI1710_GetCBStatus(dev,
-			(BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
 		break;
 
 	case APCI1710_INCCPT_GET16BITCBSTATUS:
 		i_ReturnValue = i_APCI1710_Get16BitCBStatus(dev,
-			(BYTE) CR_AREF(insn->chanspec),
-			(PBYTE) & data[0], (PBYTE) & data[1]);
+			(unsigned char) CR_AREF(insn->chanspec),
+			(unsigned char *) &data[0], (unsigned char *) &data[1]);
 		break;
 
 	case APCI1710_INCCPT_GETUDSTATUS:
 		i_ReturnValue = i_APCI1710_GetUDStatus(dev,
-			(BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
 
 		break;
 
 	case APCI1710_INCCPT_GETINTERRUPTUDLATCHEDSTATUS:
 		i_ReturnValue = i_APCI1710_GetInterruptUDLatchedStatus(dev,
-			(BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned char *) &data[0]);
 		break;
 
 	case APCI1710_INCCPT_READFREQUENCYMEASUREMENT:
 		i_ReturnValue = i_APCI1710_ReadFrequencyMeasurement(dev,
-			(BYTE) CR_AREF(insn->chanspec),
-			(PBYTE) & data[0],
-			(PBYTE) & data[1], (PULONG) & data[2]);
+			(unsigned char) CR_AREF(insn->chanspec),
+			(unsigned char *) &data[0],
+			(unsigned char *) &data[1], (unsigned int *) &data[2]);
 		break;
 
 	case APCI1710_INCCPT_READINTERRUPT:
@@ -4155,29 +4155,29 @@ INT i_APCI1710_InsnReadINCCPT(struct comedi_device * dev, struct comedi_subdevic
 
 	if (i_ReturnValue >= 0)
 		i_ReturnValue = insn->n;
-	return (i_ReturnValue);
+	return i_ReturnValue;
 
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ReadLatchRegisterStatus               |
-|                                                   (BYTE_   b_BoardHandle,  |
-|                                                    BYTE_   b_ModulNbr,     |
-|                                                    BYTE_   b_LatchReg,     |
-|                                                    PBYTE_ pb_LatchStatus)  |
+|                                                   (unsigned char_   b_BoardHandle,  |
+|                                                    unsigned char_   b_ModulNbr,     |
+|                                                    unsigned char_   b_LatchReg,     |
+|                                                    unsigned char *_ pb_LatchStatus)  |
 +----------------------------------------------------------------------------+
 | Task              : Read the latch register status from selected module    |
 |                     (b_ModulNbr) and selected latch register (b_LatchReg). |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle : Handle of board APCI-1710        |
-|                     BYTE_ b_ModulNbr    : Module number to configure       |
+| Input Parameters  : unsigned char_ b_BoardHandle : Handle of board APCI-1710        |
+|                     unsigned char_ b_ModulNbr    : Module number to configure       |
 |                                           (0 to 3)                         |
-|                     BYTE_ b_LatchReg    : Selected latch register          |
+|                     unsigned char_ b_LatchReg    : Selected latch register          |
 |                               0 : for the first latch register             |
 |                               1 : for the second latch register            |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_LatchStatus :   Latch register status.       |
+| Output Parameters : unsigned char *_ pb_LatchStatus :   Latch register status.       |
 |                                               0 : No latch occur           |
 |                                               1 : A software latch occur   |
 |                                               2 : A hardware latch occur   |
@@ -4193,11 +4193,11 @@ INT i_APCI1710_InsnReadINCCPT(struct comedi_device * dev, struct comedi_subdevic
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev,
-	BYTE b_ModulNbr, BYTE b_LatchReg, PBYTE pb_LatchStatus)
+int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned char *pb_LatchStatus)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_LatchReg;
+	int i_ReturnValue = 0;
+	unsigned int dw_LatchReg;
 
 	/**************************/
 	/* Test the module number */
@@ -4220,7 +4220,7 @@ INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev,
 					ui_Address + (64 * b_ModulNbr));
 
 				*pb_LatchStatus =
-					(BYTE) ((dw_LatchReg >> (b_LatchReg *
+					(unsigned char) ((dw_LatchReg >> (b_LatchReg *
 							4)) & 0x3);
 			} else {
 		 /**************************************************/
@@ -4248,24 +4248,24 @@ INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ReadLatchRegisterValue                |
-|                                                   (BYTE_     b_BoardHandle,|
-|                                                    BYTE_     b_ModulNbr,   |
-|                                                    BYTE_     b_LatchReg,   |
+|                                                   (unsigned char_     b_BoardHandle,|
+|                                                    unsigned char_     b_ModulNbr,   |
+|                                                    unsigned char_     b_LatchReg,   |
 |                                                    PULONG_ pul_LatchValue) |
 +----------------------------------------------------------------------------+
 | Task              : Read the latch register value from selected module     |
 |                     (b_ModulNbr) and selected latch register (b_LatchReg). |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle : Handle of board APCI-1710        |
-|                     BYTE_ b_ModulNbr    : Module number to configure       |
+| Input Parameters  : unsigned char_ b_BoardHandle : Handle of board APCI-1710        |
+|                     unsigned char_ b_ModulNbr    : Module number to configure       |
 |                                           (0 to 3)                         |
-|                     BYTE_ b_LatchReg    : Selected latch register          |
+|                     unsigned char_ b_LatchReg    : Selected latch register          |
 |                               0 : for the first latch register             |
 |                               1 : for the second latch register            |
 +----------------------------------------------------------------------------+
@@ -4280,10 +4280,10 @@ INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_ReadLatchRegisterValue(struct comedi_device * dev,
-	BYTE b_ModulNbr, BYTE b_LatchReg, PULONG pul_LatchValue)
+int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned int *pul_LatchValue)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -4332,28 +4332,28 @@ INT i_APCI1710_ReadLatchRegisterValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_Read16BitCounterValue                 |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
-|                                        BYTE_     b_SelectedCounter,        |
-|                                        PUINT_   pui_CounterValue)          |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
+|                                        unsigned char_     b_SelectedCounter,        |
+|                                        unsigned int *_   pui_CounterValue)          |
 +----------------------------------------------------------------------------+
 | Task              : Latch the selected 16-Bit counter (b_SelectedCounter)  |
 |                     from selected module (b_ModulNbr) in to the first      |
 |                     latch register and return the latched value.           |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                              (0 to 3)                      |
-|                     BYTE_ b_SelectedCounter : Selected 16-Bit counter      |
+|                     unsigned char_ b_SelectedCounter : Selected 16-Bit counter      |
 |                                               (0 or 1)                     |
 +----------------------------------------------------------------------------+
-| Output Parameters : PUINT_ pui_CounterValue : 16-Bit counter value         |
+| Output Parameters : unsigned int *_ pui_CounterValue : 16-Bit counter value         |
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
 |                     -1: The handle parameter of the board is wrong         |
@@ -4364,11 +4364,11 @@ INT i_APCI1710_ReadLatchRegisterValue(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev,
-	BYTE b_ModulNbr, BYTE b_SelectedCounter, PUINT pui_CounterValue)
+int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int *pui_CounterValue)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_LathchValue = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_LathchValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -4402,7 +4402,7 @@ INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev,
 					ui_Address + 4 + (64 * b_ModulNbr));
 
 				*pui_CounterValue =
-					(UINT) ((dw_LathchValue >> (16 *
+					(unsigned int) ((dw_LathchValue >> (16 *
 							b_SelectedCounter)) &
 					0xFFFFU);
 			} else {
@@ -4431,22 +4431,22 @@ INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_Read32BitCounterValue                 |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
 |                                        PULONG_ pul_CounterValue)           |
 +----------------------------------------------------------------------------+
 | Task              : Latch the 32-Bit counter from selected module          |
 |                     (b_ModulNbr) in to the first latch register and return |
 |                     the latched value.                                     |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                              (0 to 3)                      |
 +----------------------------------------------------------------------------+
 | Output Parameters : PULONG_  pul_CounterValue : 32-Bit counter value       |
@@ -4459,10 +4459,10 @@ INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_Read32BitCounterValue(struct comedi_device * dev,
-	BYTE b_ModulNbr, PULONG pul_CounterValue)
+int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned int *pul_CounterValue)
 {
-	INT i_ReturnValue = 0;
+	int i_ReturnValue = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -4507,22 +4507,22 @@ INT i_APCI1710_Read32BitCounterValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : _INT_ i_APCI1710_GetIndexStatus (BYTE_   b_BoardHandle,|
-|                                                      BYTE_   b_ModulNbr,   |
-|                                                      PBYTE_ pb_IndexStatus)|
+| Function Name     : _INT_ i_APCI1710_GetIndexStatus (unsigned char_   b_BoardHandle,|
+|                                                      unsigned char_   b_ModulNbr,   |
+|                                                      unsigned char *_ pb_IndexStatus)|
 +----------------------------------------------------------------------------+
 | Task              : Return the index status                                |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_IndexStatus   : 0 : No INDEX occur           |
+| Output Parameters : unsigned char *_ pb_IndexStatus   : 0 : No INDEX occur           |
 |                                               1 : A INDEX occur            |
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
@@ -4535,11 +4535,11 @@ INT i_APCI1710_Read32BitCounterValue(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_GetIndexStatus(struct comedi_device * dev,
-	BYTE b_ModulNbr, PBYTE pb_IndexStatus)
+int i_APCI1710_GetIndexStatus(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char *pb_IndexStatus)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -4563,7 +4563,7 @@ INT i_APCI1710_GetIndexStatus(struct comedi_device * dev,
 				dw_StatusReg = inl(devpriv->s_BoardInfos.
 					ui_Address + 12 + (64 * b_ModulNbr));
 
-				*pb_IndexStatus = (BYTE) (dw_StatusReg & 1);
+				*pb_IndexStatus = (unsigned char) (dw_StatusReg & 1);
 			} else {
 		 /*************************************************************/
 				/* Index not initialised see function "i_APCI1710_InitIndex" */
@@ -4590,23 +4590,23 @@ INT i_APCI1710_GetIndexStatus(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_GetReferenceStatus                    |
-|                                                (BYTE_   b_BoardHandle,     |
-|                                                 BYTE_   b_ModulNbr,        |
-|                                                 PBYTE_ pb_ReferenceStatus) |
+|                                                (unsigned char_   b_BoardHandle,     |
+|                                                 unsigned char_   b_ModulNbr,        |
+|                                                 unsigned char *_ pb_ReferenceStatus) |
 +----------------------------------------------------------------------------+
 | Task              : Return the reference status                            |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_ReferenceStatus   : 0 : No REFERENCE occur   |
+| Output Parameters : unsigned char *_ pb_ReferenceStatus   : 0 : No REFERENCE occur   |
 |                                                   1 : A REFERENCE occur    |
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
@@ -4619,11 +4619,11 @@ INT i_APCI1710_GetIndexStatus(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev,
-	BYTE b_ModulNbr, PBYTE pb_ReferenceStatus)
+int i_APCI1710_GetReferenceStatus(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char *pb_ReferenceStatus)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -4649,7 +4649,7 @@ INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev,
 					ui_Address + 24 + (64 * b_ModulNbr));
 
 				*pb_ReferenceStatus =
-					(BYTE) (~dw_StatusReg & 1);
+					(unsigned char) (~dw_StatusReg & 1);
 			} else {
 		 /*********************************************************************/
 				/* Reference not initialised see function "i_APCI1710_InitReference" */
@@ -4676,23 +4676,23 @@ INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_GetUASStatus                          |
-|                               (BYTE_   b_BoardHandle,                      |
-|                                BYTE_   b_ModulNbr,                         |
-|                                PBYTE_ pb_UASStatus)                        |
+|                               (unsigned char_   b_BoardHandle,                      |
+|                                unsigned char_   b_ModulNbr,                         |
+|                                unsigned char *_ pb_UASStatus)                        |
 +----------------------------------------------------------------------------+
 | Task              : Return the error signal (UAS) status                   |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_UASStatus      : 0 : UAS is low "0"          |
+| Output Parameters : unsigned char *_ pb_UASStatus      : 0 : UAS is low "0"          |
 |                                                1 : UAS is high "1"         |
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
@@ -4703,11 +4703,11 @@ INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_GetUASStatus(struct comedi_device * dev,
-	BYTE b_ModulNbr, PBYTE pb_UASStatus)
+int i_APCI1710_GetUASStatus(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char *pb_UASStatus)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -4724,7 +4724,7 @@ INT i_APCI1710_GetUASStatus(struct comedi_device * dev,
 			dw_StatusReg = inl(devpriv->s_BoardInfos.
 				ui_Address + 24 + (64 * b_ModulNbr));
 
-			*pb_UASStatus = (BYTE) ((dw_StatusReg >> 1) & 1);
+			*pb_UASStatus = (unsigned char) ((dw_StatusReg >> 1) & 1);
 		} else {
 	      /****************************************/
 			/* Counter not initialised see function */
@@ -4744,23 +4744,23 @@ INT i_APCI1710_GetUASStatus(struct comedi_device * dev,
 
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_GetCBStatus                           |
-|                               (BYTE_   b_BoardHandle,                      |
-|                                BYTE_   b_ModulNbr,                         |
-|                                PBYTE_ pb_CBStatus)                         |
+|                               (unsigned char_   b_BoardHandle,                      |
+|                                unsigned char_   b_ModulNbr,                         |
+|                                unsigned char *_ pb_CBStatus)                         |
 +----------------------------------------------------------------------------+
 | Task              : Return the counter overflow status                     |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_CBStatus      : 0 : Counter no overflow      |
+| Output Parameters : unsigned char *_ pb_CBStatus      : 0 : Counter no overflow      |
 |                                               1 : Counter overflow         |
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
@@ -4771,11 +4771,11 @@ INT i_APCI1710_GetUASStatus(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_GetCBStatus(struct comedi_device * dev,
-	BYTE b_ModulNbr, PBYTE pb_CBStatus)
+int i_APCI1710_GetCBStatus(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char *pb_CBStatus)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -4792,7 +4792,7 @@ INT i_APCI1710_GetCBStatus(struct comedi_device * dev,
 			dw_StatusReg = inl(devpriv->s_BoardInfos.
 				ui_Address + 16 + (64 * b_ModulNbr));
 
-			*pb_CBStatus = (BYTE) (dw_StatusReg & 1);
+			*pb_CBStatus = (unsigned char) (dw_StatusReg & 1);
 
 		} else {
 	      /****************************************/
@@ -4812,31 +4812,31 @@ INT i_APCI1710_GetCBStatus(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_Get16BitCBStatus                      |
-|					(BYTE_     b_BoardHandle,            |
-|					 BYTE_     b_ModulNbr,               |
-|					 PBYTE_ pb_CBStatusCounter0,         |
-|					 PBYTE_ pb_CBStatusCounter1)         |
+|					(unsigned char_     b_BoardHandle,            |
+|					 unsigned char_     b_ModulNbr,               |
+|					 unsigned char *_ pb_CBStatusCounter0,         |
+|					 unsigned char *_ pb_CBStatusCounter1)         |
 +----------------------------------------------------------------------------+
 | Task              : Returns the counter overflow (counter initialised to   |
 |		      2*16-bit) status from selected incremental counter     |
 |		      module                                                 |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_CBStatusCounter0 : 0 : No overflow occur for |
+| Output Parameters : unsigned char *_ pb_CBStatusCounter0 : 0 : No overflow occur for |
 |						       the first 16-bit      |
 |						       counter               |
 |						   1 : Overflow occur for the|
 |						       first 16-bit counter  |
-|		      PBYTE_ pb_CBStatusCounter1 : 0 : No overflow occur for |
+|		      unsigned char *_ pb_CBStatusCounter1 : 0 : No overflow occur for |
 |						       the second 16-bit     |
 |						       counter               |
 |						   1 : Overflow occur for the|
@@ -4853,11 +4853,11 @@ INT i_APCI1710_GetCBStatus(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev,
-	BYTE b_ModulNbr, PBYTE pb_CBStatusCounter0, PBYTE pb_CBStatusCounter1)
+int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char *pb_CBStatusCounter0, unsigned char *pb_CBStatusCounter1)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -4894,20 +4894,20 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev,
 						(64 * b_ModulNbr));
 
 					*pb_CBStatusCounter1 =
-						(BYTE) ((dw_StatusReg >> 0) &
+						(unsigned char) ((dw_StatusReg >> 0) &
 						1);
 					*pb_CBStatusCounter0 =
-						(BYTE) ((dw_StatusReg >> 1) &
+						(unsigned char) ((dw_StatusReg >> 1) &
 						1);
-				}	// if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136)
+				}	/*  if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136) */
 				else {
 		    /****************************/
 					/* Firmware revision error  */
 		    /****************************/
 
 					i_ReturnValue = -5;
-				}	// if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136)
-			}	// if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_ModeRegister.s_ByteModeRegister.b_ModeRegister1 & 0x10) == 0x10)
+				}	/*  if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136) */
+			}	/*  if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_ModeRegister.s_ByteModeRegister.b_ModeRegister1 & 0x10) == 0x10) */
 			else {
 		 /********************************************/
 				/* Counter not initialised to 2*16-bit mode */
@@ -4916,8 +4916,8 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev,
 
 				DPRINTK("Counter not initialised\n");
 				i_ReturnValue = -4;
-			}	// if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_ModeRegister.s_ByteModeRegister.b_ModeRegister1 & 0x10) == 0x10)
-		}		// if (ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1)
+			}	/*  if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_ModeRegister.s_ByteModeRegister.b_ModeRegister1 & 0x10) == 0x10) */
+		}		/*  if (ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) */
 		else {
 	      /****************************************/
 			/* Counter not initialised see function */
@@ -4926,8 +4926,8 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev,
 
 			DPRINTK("Counter not initialised\n");
 			i_ReturnValue = -3;
-		}		// if (ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1)
-	}			// if (b_ModulNbr < 4)
+		}		/*  if (ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) */
+	}			/*  if (b_ModulNbr < 4) */
 	else {
 	   /*************************************************/
 		/* The selected module number parameter is wrong */
@@ -4935,25 +4935,25 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev,
 
 		DPRINTK("The selected module number parameter is wrong\n");
 		i_ReturnValue = -2;
-	}			// if (b_ModulNbr < 4)
+	}			/*  if (b_ModulNbr < 4) */
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_GetUDStatus                           |
-|                               (BYTE_   b_BoardHandle,                      |
-|                                BYTE_   b_ModulNbr,                         |
-|                                PBYTE_ pb_UDStatus)                         |
+|                               (unsigned char_   b_BoardHandle,                      |
+|                                unsigned char_   b_ModulNbr,                         |
+|                                unsigned char *_ pb_UDStatus)                         |
 +----------------------------------------------------------------------------+
 | Task              : Return the counter progress status                     |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_UDStatus      : 0 : Counter progress in the  |
+| Output Parameters : unsigned char *_ pb_UDStatus      : 0 : Counter progress in the  |
 |                                                   selected mode down       |
 |                                               1 : Counter progress in the  |
 |                                                   selected mode up         |
@@ -4966,11 +4966,11 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_GetUDStatus(struct comedi_device * dev,
-	BYTE b_ModulNbr, PBYTE pb_UDStatus)
+int i_APCI1710_GetUDStatus(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char *pb_UDStatus)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -4987,7 +4987,7 @@ INT i_APCI1710_GetUDStatus(struct comedi_device * dev,
 			dw_StatusReg = inl(devpriv->s_BoardInfos.
 				ui_Address + 24 + (64 * b_ModulNbr));
 
-			*pb_UDStatus = (BYTE) ((dw_StatusReg >> 2) & 1);
+			*pb_UDStatus = (unsigned char) ((dw_StatusReg >> 2) & 1);
 
 		} else {
 	      /****************************************/
@@ -5007,24 +5007,24 @@ INT i_APCI1710_GetUDStatus(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_GetInterruptUDLatchedStatus           |
-|                               (BYTE_   b_BoardHandle,                      |
-|                                BYTE_   b_ModulNbr,                         |
-|                                PBYTE_ pb_UDStatus)                         |
+|                               (unsigned char_   b_BoardHandle,                      |
+|                                unsigned char_   b_ModulNbr,                         |
+|                                unsigned char *_ pb_UDStatus)                         |
 +----------------------------------------------------------------------------+
 | Task              : Return the counter progress latched status after a     |
 |                     index interrupt occur.                                 |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Module number to configure   |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Module number to configure   |
 |                                               (0 to 3)                     |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_UDStatus      : 0 : Counter progress in the  |
+| Output Parameters : unsigned char *_ pb_UDStatus      : 0 : Counter progress in the  |
 |                                                   selected mode down       |
 |                                               1 : Counter progress in the  |
 |                                                   selected mode up         |
@@ -5040,11 +5040,11 @@ INT i_APCI1710_GetUDStatus(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev,
-	BYTE b_ModulNbr, PBYTE pb_UDStatus)
+int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev,
+	unsigned char b_ModulNbr, unsigned char *pb_UDStatus)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg = 0;
 
 	/**************************/
 	/* Test the module number */
@@ -5074,7 +5074,7 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev,
 				dw_StatusReg = inl(devpriv->s_BoardInfos.
 					ui_Address + 12 + (64 * b_ModulNbr));
 
-				*pb_UDStatus = (BYTE) ((dw_StatusReg >> 1) & 1);
+				*pb_UDStatus = (unsigned char) ((dw_StatusReg >> 1) & 1);
 			} else {
 		    /****************************/
 				/* No index interrupt occur */
@@ -5100,26 +5100,26 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 	/*
 	   +----------------------------------------------------------------------------+
 	   | Function Name     : _INT_ i_APCI1710_ReadFrequencyMeasurement              |
-	   |                            (BYTE_            b_BoardHandle,             |
-	   |                             BYTE_            b_ModulNbr,                |
-	   |                             PBYTE_          pb_Status,                  |
+	   |                            (unsigned char_            b_BoardHandle,             |
+	   |                             unsigned char_            b_ModulNbr,                |
+	   |                             unsigned char *_          pb_Status,                  |
 	   |                             PULONG_        pul_ReadValue)               |
 	   +----------------------------------------------------------------------------+
 	   | Task              : Returns the status (pb_Status) and the number of       |
 	   |                  increments in the set time.                            |
 	   |                  See function " i_APCI1710_InitFrequencyMeasurement "   |
 	   +----------------------------------------------------------------------------+
-	   | Input Parameters  : BYTE_  b_BoardHandle    : Handle of board APCI-1710    |
-	   |                  BYTE_  b_ModulNbr       : Number of the module to be   |
+	   | Input Parameters  : unsigned char_  b_BoardHandle    : Handle of board APCI-1710    |
+	   |                  unsigned char_  b_ModulNbr       : Number of the module to be   |
 	   |                                            configured (0 to 3)          |
 	   +----------------------------------------------------------------------------+
-	   | Output Parameters : PBYTE_ pb_Status     : Returns the frequency        |
+	   | Output Parameters : unsigned char *_ pb_Status     : Returns the frequency        |
 	   |                                            measurement status           |
 	   |                                            0 : Counting cycle not       |
 	   |                                                started.                 |
@@ -5127,7 +5127,7 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev,
 	   |                                            2 : Counting cycle stopped.  |
 	   |                                                The measurement cycle is |
 	   |                                                completed.               |
-	   |                  PBYTE_ pb_UDStatus      : 0 : Counter progress in the  |
+	   |                  unsigned char *_ pb_UDStatus      : 0 : Counter progress in the  |
 	   |                                                   selected mode down       |
 	   |                                               1 : Counter progress in the  |
 	   |                                                   selected mode up         |
@@ -5145,13 +5145,13 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev,
 	   +----------------------------------------------------------------------------+
 	 */
 
-INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev,
-	BYTE b_ModulNbr,
-	PBYTE pb_Status, PBYTE pb_UDStatus, PULONG pul_ReadValue)
+int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev,
+	unsigned char b_ModulNbr,
+	unsigned char *pb_Status, unsigned char *pb_UDStatus, unsigned int *pul_ReadValue)
 {
-	INT i_ReturnValue = 0;
-	UINT ui_16BitValue;
-	DWORD dw_StatusReg;
+	int i_ReturnValue = 0;
+	unsigned int ui_16BitValue;
+	unsigned int dw_StatusReg;
 
 	/**************************/
 	/* Test the module number */
@@ -5198,7 +5198,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev,
 					if (dw_StatusReg & 1) {
 						*pb_Status = 2;
 						*pb_UDStatus =
-							(BYTE) ((dw_StatusReg >>
+							(unsigned char) ((dw_StatusReg >>
 								1) & 3);
 
 		       /******************/
@@ -5224,7 +5224,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev,
 								if ((*pul_ReadValue & 0xFFFFU) != 0) {
 									ui_16BitValue
 										=
-										(UINT)
+										(unsigned int)
 										*
 										pul_ReadValue
 										&
@@ -5247,7 +5247,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev,
 								if ((*pul_ReadValue & 0xFFFF0000UL) != 0) {
 									ui_16BitValue
 										=
-										(UINT)
+										(unsigned int)
 										(
 										(*pul_ReadValue
 											>>
@@ -5281,7 +5281,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev,
 								if ((*pul_ReadValue & 0xFFFF0000UL) != 0) {
 									ui_16BitValue
 										=
-										(UINT)
+										(unsigned int)
 										(
 										(*pul_ReadValue
 											>>
@@ -5307,7 +5307,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev,
 									if ((*pul_ReadValue & 0xFFFFU) != 0) {
 										ui_16BitValue
 											=
-											(UINT)
+											(unsigned int)
 											*
 											pul_ReadValue
 											&
@@ -5359,5 +5359,5 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }

+ 94 - 94
drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.h

@@ -132,140 +132,140 @@
 #define APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT		409
 
 /************ Main Functions *************/
-INT i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevice *s,
 				struct comedi_insn *insn, unsigned int * data);
 
-INT i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice * s,
+int i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice * s,
 			      struct comedi_insn *insn, unsigned int * data);
 
-INT i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev, struct comedi_subdevice * s,
+int i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev, struct comedi_subdevice * s,
 			       struct comedi_insn *insn, unsigned int * data);
 
-INT i_APCI1710_InsnReadINCCPT(struct comedi_device *dev, struct comedi_subdevice * s,
+int i_APCI1710_InsnReadINCCPT(struct comedi_device *dev, struct comedi_subdevice * s,
 			      struct comedi_insn *insn, unsigned int * data);
 
 /*********** Supplementary Functions********/
 
 /* INSN CONFIG */
-INT i_APCI1710_InitCounter(struct comedi_device *dev,
-			   BYTE b_ModulNbr,
-			   BYTE b_CounterRange,
-			   BYTE b_FirstCounterModus,
-			   BYTE b_FirstCounterOption,
-			   BYTE b_SecondCounterModus,
-			   BYTE b_SecondCounterOption);
-
-INT i_APCI1710_CounterAutoTest(struct comedi_device *dev, PBYTE pb_TestStatus);
-
-INT i_APCI1710_InitIndex(struct comedi_device *dev,
-			 BYTE b_ModulNbr,
-			 BYTE b_ReferenceAction,
-			 BYTE b_IndexOperation, BYTE b_AutoMode,
-			 BYTE b_InterruptEnable);
-
-INT i_APCI1710_InitReference(struct comedi_device *dev,
-			     BYTE b_ModulNbr, BYTE b_ReferenceLevel);
-
-INT i_APCI1710_InitExternalStrobe(struct comedi_device *dev,
-				  BYTE b_ModulNbr, BYTE b_ExternalStrobe,
-				  BYTE b_ExternalStrobeLevel);
-
-INT i_APCI1710_InitCompareLogic(struct comedi_device *dev,
-				BYTE b_ModulNbr, UINT ui_CompareValue);
-
-INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev,
-					BYTE b_ModulNbr,
-					BYTE b_PCIInputClock,
-					BYTE b_TimingUnity,
-					ULONG ul_TimingInterval,
-					PULONG pul_RealTimingInterval);
+int i_APCI1710_InitCounter(struct comedi_device *dev,
+			   unsigned char b_ModulNbr,
+			   unsigned char b_CounterRange,
+			   unsigned char b_FirstCounterModus,
+			   unsigned char b_FirstCounterOption,
+			   unsigned char b_SecondCounterModus,
+			   unsigned char b_SecondCounterOption);
+
+int i_APCI1710_CounterAutoTest(struct comedi_device *dev, unsigned char * pb_TestStatus);
+
+int i_APCI1710_InitIndex(struct comedi_device *dev,
+			 unsigned char b_ModulNbr,
+			 unsigned char b_ReferenceAction,
+			 unsigned char b_IndexOperation, unsigned char b_AutoMode,
+			 unsigned char b_InterruptEnable);
+
+int i_APCI1710_InitReference(struct comedi_device *dev,
+			     unsigned char b_ModulNbr, unsigned char b_ReferenceLevel);
+
+int i_APCI1710_InitExternalStrobe(struct comedi_device *dev,
+				  unsigned char b_ModulNbr, unsigned char b_ExternalStrobe,
+				  unsigned char b_ExternalStrobeLevel);
+
+int i_APCI1710_InitCompareLogic(struct comedi_device *dev,
+				unsigned char b_ModulNbr, unsigned int ui_CompareValue);
+
+int i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev,
+					unsigned char b_ModulNbr,
+					unsigned char b_PCIInputClock,
+					unsigned char b_TimingUnity,
+					unsigned int ul_TimingInterval,
+					unsigned int *pul_RealTimingInterval);
 
 /* INSN BITS */
-INT i_APCI1710_ClearCounterValue(struct comedi_device *dev, BYTE b_ModulNbr);
+int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr);
 
-INT i_APCI1710_ClearAllCounterValue(struct comedi_device *dev);
+int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev);
 
-INT i_APCI1710_SetInputFilter(struct comedi_device *dev,
-			      BYTE b_ModulNbr, BYTE b_PCIInputClock,
-			      BYTE b_Filter);
+int i_APCI1710_SetInputFilter(struct comedi_device *dev,
+			      unsigned char b_ModulNbr, unsigned char b_PCIInputClock,
+			      unsigned char b_Filter);
 
-INT i_APCI1710_LatchCounter(struct comedi_device *dev,
-			    BYTE b_ModulNbr, BYTE b_LatchReg);
+int i_APCI1710_LatchCounter(struct comedi_device *dev,
+			    unsigned char b_ModulNbr, unsigned char b_LatchReg);
 
-INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev,
-					  BYTE b_ModulNbr,
-					  BYTE b_SourceSelection);
+int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev,
+					  unsigned char b_ModulNbr,
+					  unsigned char b_SourceSelection);
 
-INT i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, BYTE b_ModulNbr);
+int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulNbr);
 
-INT i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, BYTE b_ModulNbr);
+int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_ModulNbr);
 
 /* INSN WRITE */
-INT i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, BYTE b_ModulNbr);
+int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr);
 
-INT i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, BYTE b_ModulNbr);
+int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr);
 
-INT i_APCI1710_Write16BitCounterValue(struct comedi_device *dev,
-				      BYTE b_ModulNbr, BYTE b_SelectedCounter,
-				      UINT ui_WriteValue);
+int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev,
+				      unsigned char b_ModulNbr, unsigned char b_SelectedCounter,
+				      unsigned int ui_WriteValue);
 
-INT i_APCI1710_Write32BitCounterValue(struct comedi_device *dev,
-				      BYTE b_ModulNbr, ULONG ul_WriteValue);
+int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev,
+				      unsigned char b_ModulNbr, unsigned int ul_WriteValue);
 
-INT i_APCI1710_EnableIndex(struct comedi_device *dev, BYTE b_ModulNbr);
+int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr);
 
-INT i_APCI1710_DisableIndex(struct comedi_device *dev, BYTE b_ModulNbr);
+int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr);
 
-INT i_APCI1710_EnableCompareLogic(struct comedi_device *dev, BYTE b_ModulNbr);
+int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr);
 
-INT i_APCI1710_DisableCompareLogic(struct comedi_device *dev, BYTE b_ModulNbr);
+int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr);
 
-INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev,
-					  BYTE b_ModulNbr,
-					  BYTE b_InterruptEnable);
+int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev,
+					  unsigned char b_ModulNbr,
+					  unsigned char b_InterruptEnable);
 
-INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev,
-					   BYTE b_ModulNbr);
+int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev,
+					   unsigned char b_ModulNbr);
 
 /* INSN READ */
-INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev,
-				       BYTE b_ModulNbr, BYTE b_LatchReg,
-				       PBYTE pb_LatchStatus);
+int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev,
+				       unsigned char b_ModulNbr, unsigned char b_LatchReg,
+				       unsigned char *pb_LatchStatus);
 
-INT i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev,
-				      BYTE b_ModulNbr, BYTE b_LatchReg,
-				      PULONG pul_LatchValue);
+int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev,
+				      unsigned char b_ModulNbr, unsigned char b_LatchReg,
+				      unsigned int *pul_LatchValue);
 
-INT i_APCI1710_Read16BitCounterValue(struct comedi_device *dev,
-				     BYTE b_ModulNbr, BYTE b_SelectedCounter,
-				     PUINT pui_CounterValue);
+int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev,
+				     unsigned char b_ModulNbr, unsigned char b_SelectedCounter,
+				     unsigned int *pui_CounterValue);
 
-INT i_APCI1710_Read32BitCounterValue(struct comedi_device *dev,
-				     BYTE b_ModulNbr, PULONG pul_CounterValue);
+int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev,
+				     unsigned char b_ModulNbr, unsigned int *pul_CounterValue);
 
-INT i_APCI1710_GetIndexStatus(struct comedi_device *dev,
-			      BYTE b_ModulNbr, PBYTE pb_IndexStatus);
+int i_APCI1710_GetIndexStatus(struct comedi_device *dev,
+			      unsigned char b_ModulNbr, unsigned char *pb_IndexStatus);
 
-INT i_APCI1710_GetReferenceStatus(struct comedi_device *dev,
-				  BYTE b_ModulNbr, PBYTE pb_ReferenceStatus);
+int i_APCI1710_GetReferenceStatus(struct comedi_device *dev,
+				  unsigned char b_ModulNbr, unsigned char *pb_ReferenceStatus);
 
-INT i_APCI1710_GetUASStatus(struct comedi_device *dev,
-			    BYTE b_ModulNbr, PBYTE pb_UASStatus);
+int i_APCI1710_GetUASStatus(struct comedi_device *dev,
+			    unsigned char b_ModulNbr, unsigned char *pb_UASStatus);
 
-INT i_APCI1710_GetCBStatus(struct comedi_device *dev,
-			   BYTE b_ModulNbr, PBYTE pb_CBStatus);
+int i_APCI1710_GetCBStatus(struct comedi_device *dev,
+			   unsigned char b_ModulNbr, unsigned char *pb_CBStatus);
 
-INT i_APCI1710_Get16BitCBStatus(struct comedi_device *dev,
-				BYTE b_ModulNbr, PBYTE pb_CBStatusCounter0,
-				PBYTE pb_CBStatusCounter1);
+int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev,
+				unsigned char b_ModulNbr, unsigned char *pb_CBStatusCounter0,
+				unsigned char *pb_CBStatusCounter1);
 
-INT i_APCI1710_GetUDStatus(struct comedi_device *dev,
-			   BYTE b_ModulNbr, PBYTE pb_UDStatus);
+int i_APCI1710_GetUDStatus(struct comedi_device *dev,
+			   unsigned char b_ModulNbr, unsigned char *pb_UDStatus);
 
-INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev,
-					   BYTE b_ModulNbr, PBYTE pb_UDStatus);
+int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev,
+					   unsigned char b_ModulNbr, unsigned char *pb_UDStatus);
 
-INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev,
-					BYTE b_ModulNbr,
-					PBYTE pb_Status, PBYTE pb_UDStatus,
-					PULONG pul_ReadValue);
+int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev,
+					unsigned char b_ModulNbr,
+					unsigned char *pb_Status, unsigned char *pb_UDStatus,
+					unsigned int *pul_ReadValue);

+ 102 - 102
drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.c

@@ -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.
 
@@ -60,11 +60,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_InitPulseEncoder                      |
-|                               (BYTE_          b_BoardHandle,               |
-|                                BYTE_          b_ModulNbr,                  |
-|                                BYTE_          b_PulseEncoderNbr,           |
-|                                BYTE_          b_InputLevelSelection,       |
-|                                BYTE_          b_TriggerOutputAction,       |
+|                               (unsigned char_          b_BoardHandle,               |
+|                                unsigned char_          b_ModulNbr,                  |
+|                                unsigned char_          b_PulseEncoderNbr,           |
+|                                unsigned char_          b_InputLevelSelection,       |
+|                                unsigned char_          b_TriggerOutputAction,       |
 |                                ULONG_        ul_StartValue)                |
 +----------------------------------------------------------------------------+
 | Task              : Configure the pulse encoder operating mode selected via|
@@ -74,12 +74,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                     You must calling this function be for you call any     |
 |                     other function witch access of pulse encoders.         |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle         : Handle of board APCI-1710|
-|                     BYTE_ b_ModulNbr            : Module number to         |
+| Input Parameters  : unsigned char_ b_BoardHandle         : Handle of board APCI-1710|
+|                     unsigned char_ b_ModulNbr            : Module number to         |
 |                                                   configure (0 to 3)       |
-|                     BYTE_ b_PulseEncoderNbr     : Pulse encoder selection  |
+|                     unsigned char_ b_PulseEncoderNbr     : Pulse encoder selection  |
 |                                                   (0 to 3)                 |
-|                     BYTE_ b_InputLevelSelection : Input level selection    |
+|                     unsigned char_ b_InputLevelSelection : Input level selection    |
 |                                                   (0 or 1)                 |
 |                                                       0 : Set pulse encoder|
 |                                                           count the the low|
@@ -87,7 +87,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                                                       1 : Set pulse encoder|
 |                                                           count the the    |
 |                                                           high level pulse.|
-|                     BYTE_ b_TriggerOutputAction : Digital TRIGGER output   |
+|                     unsigned char_ b_TriggerOutputAction : Digital TRIGGER output   |
 |                                                   action                   |
 |                                                       0 : No action        |
 |                                                       1 : Set the trigger  |
@@ -104,11 +104,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                                                           encoder          |
 |                     ULONG_ ul_StartValue        : Pulse encoder start value|
 |                                                   (1 to 4294967295)
-	b_ModulNbr				=(BYTE) CR_AREF(insn->chanspec);
-	b_PulseEncoderNbr		=(BYTE) data[0];
-	b_InputLevelSelection	=(BYTE) data[1];
-	b_TriggerOutputAction	=(BYTE) data[2];
-	ul_StartValue			=(ULONG) data[3];
+	b_ModulNbr				=(unsigned char) CR_AREF(insn->chanspec);
+	b_PulseEncoderNbr		=(unsigned char) data[0];
+	b_InputLevelSelection	=(unsigned char) data[1];
+	b_TriggerOutputAction	=(unsigned char) data[2];
+	ul_StartValue			=(unsigned int) data[3];
        |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -123,23 +123,23 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_IntRegister;
+	int i_ReturnValue = 0;
+	unsigned int dw_IntRegister;
 
-	BYTE b_ModulNbr;
-	BYTE b_PulseEncoderNbr;
-	BYTE b_InputLevelSelection;
-	BYTE b_TriggerOutputAction;
-	ULONG ul_StartValue;
+	unsigned char b_ModulNbr;
+	unsigned char b_PulseEncoderNbr;
+	unsigned char b_InputLevelSelection;
+	unsigned char b_TriggerOutputAction;
+	unsigned int ul_StartValue;
 
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_PulseEncoderNbr = (BYTE) data[0];
-	b_InputLevelSelection = (BYTE) data[1];
-	b_TriggerOutputAction = (BYTE) data[2];
-	ul_StartValue = (ULONG) data[3];
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_PulseEncoderNbr = (unsigned char) data[0];
+	b_InputLevelSelection = (unsigned char) data[1];
+	b_TriggerOutputAction = (unsigned char) data[2];
+	ul_StartValue = (unsigned int) data[3];
 
 	i_ReturnValue = insn->n;
 
@@ -346,17 +346,17 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_EnablePulseEncoder                    |
-|                                       (BYTE_  b_BoardHandle,               |
-|                                        BYTE_  b_ModulNbr,                  |
-|                                        BYTE_  b_PulseEncoderNbr,           |
-|                                        BYTE_  b_CycleSelection,            |
-|                                        BYTE_  b_InterruptHandling)         |
+|                                       (unsigned char_  b_BoardHandle,               |
+|                                        unsigned char_  b_ModulNbr,                  |
+|                                        unsigned char_  b_PulseEncoderNbr,           |
+|                                        unsigned char_  b_CycleSelection,            |
+|                                        unsigned char_  b_InterruptHandling)         |
 +----------------------------------------------------------------------------+
 | Task              : Enableor disable  the selected pulse encoder (b_PulseEncoderNbr)  |
 |                     from selected module (b_ModulNbr). Each input pulse    |
@@ -365,12 +365,12 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 |                     interrupt is generated when the pulse encoder has run  |
 |                     down.                                                  |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_   b_BoardHandle       : Handle of board APCI-1710|
-|                     BYTE_   b_ModulNbr          : Module number to         |
+| Input Parameters  : unsigned char_   b_BoardHandle       : Handle of board APCI-1710|
+|                     unsigned char_   b_ModulNbr          : Module number to         |
 |                                                   configure (0 to 3)       |
-|                     BYTE_   b_PulseEncoderNbr   : Pulse encoder selection  |
+|                     unsigned char_   b_PulseEncoderNbr   : Pulse encoder selection  |
 |                                                   (0 to 3)                 |
-|                     BYTE_   b_CycleSelection    : APCI1710_CONTINUOUS:     |
+|                     unsigned char_   b_CycleSelection    : APCI1710_CONTINUOUS:     |
 |                                                       Each time the        |
 |                                                       counting value is set|
 |                                                       on "0", the pulse    |
@@ -381,7 +381,7 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 |                                                       If the counter is set|
 |                                                       on "0", the pulse    |
 |                                                       encoder is stopped.  |
-|                     BYTE_   b_InterruptHandling : Interrupts can be        |
+|                     unsigned char_   b_InterruptHandling : Interrupts can be        |
 |                                                   generated, when the pulse|
 |                                                   encoder has run down.    |
 |                                                   With this parameter the  |
@@ -393,11 +393,11 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 |                                                     APCI1710_DISABLE:      |
 |                                                     Interrupts are disabled
 
-  	b_ModulNbr			=(BYTE) CR_AREF(insn->chanspec);
-	b_Action			=(BYTE) data[0];
-	b_PulseEncoderNbr	=(BYTE) data[1];
-	b_CycleSelection	=(BYTE) data[2];
-	b_InterruptHandling	=(BYTE) data[3];|
+	b_ModulNbr			=(unsigned char) CR_AREF(insn->chanspec);
+	b_Action			=(unsigned char) data[0];
+	b_PulseEncoderNbr	=(unsigned char) data[1];
+	b_CycleSelection	=(unsigned char) data[2];
+	b_InterruptHandling	=(unsigned char) data[3];|
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -414,22 +414,22 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	BYTE b_ModulNbr;
-	BYTE b_PulseEncoderNbr;
-	BYTE b_CycleSelection;
-	BYTE b_InterruptHandling;
-	BYTE b_Action;
+	int i_ReturnValue = 0;
+	unsigned char b_ModulNbr;
+	unsigned char b_PulseEncoderNbr;
+	unsigned char b_CycleSelection;
+	unsigned char b_InterruptHandling;
+	unsigned char b_Action;
 
 	i_ReturnValue = insn->n;
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_Action = (BYTE) data[0];
-	b_PulseEncoderNbr = (BYTE) data[1];
-	b_CycleSelection = (BYTE) data[2];
-	b_InterruptHandling = (BYTE) data[3];
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_Action = (unsigned char) data[0];
+	b_PulseEncoderNbr = (unsigned char) data[1];
+	b_CycleSelection = (unsigned char) data[2];
+	b_InterruptHandling = (unsigned char) data[3];
 
 	/***********************************/
 	/* Test the selected module number */
@@ -515,7 +515,7 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
 									| (1UL
 									<<
 									b_PulseEncoderNbr);
-								devpriv->tsk_Current = current;	// Save the current process task structure
+								devpriv->tsk_Current = current;	/*  Save the current process task structure */
 
 							}
 
@@ -629,7 +629,7 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
 						(64 * b_ModulNbr));
 
 					break;
-				}	// switch End
+				}	/*  switch End */
 
 			} else {
 		 /*********************************/
@@ -656,39 +656,39 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ReadPulseEncoderStatus                |
-|                                       (BYTE_  b_BoardHandle,               |
-|                                        BYTE_  b_ModulNbr,                  |
-|                                        BYTE_  b_PulseEncoderNbr,           |
-|                                        PBYTE_ pb_Status)                   |
+|                                       (unsigned char_  b_BoardHandle,               |
+|                                        unsigned char_  b_ModulNbr,                  |
+|                                        unsigned char_  b_PulseEncoderNbr,           |
+|                                        unsigned char *_ pb_Status)                   |
 +----------------------------------------------------------------------------+
 | Task    APCI1710_PULSEENCODER_READ          : Reads the pulse encoder status
 											and valuefrom selected pulse     |
 |                     encoder (b_PulseEncoderNbr) from selected module       |
 |                     (b_ModulNbr).                                          |
 +----------------------------------------------------------------------------+
-	BYTE   b_Type; data[0]
+	unsigned char   b_Type; data[0]
    APCI1710_PULSEENCODER_WRITE
  Writes a 32-bit value (ul_WriteValue) into the selected|
 |                     pulse encoder (b_PulseEncoderNbr) from selected module |
 |                     (b_ModulNbr). This operation set the new start pulse   |
 |                     encoder value.
  APCI1710_PULSEENCODER_READ
-| Input Parameters  : BYTE_   b_BoardHandle       : Handle of board APCI-1710|
-|            CRAREF()         BYTE_   b_ModulNbr          : Module number to         |
+| Input Parameters  : unsigned char_   b_BoardHandle       : Handle of board APCI-1710|
+|            CRAREF()         unsigned char_   b_ModulNbr          : Module number to         |
 |                                                   configure (0 to 3)       |
-|              data[1]       BYTE_   b_PulseEncoderNbr   : Pulse encoder selection  |
+|              data[1]       unsigned char_   b_PulseEncoderNbr   : Pulse encoder selection  |
 |                                                   (0 to 3)
    APCI1710_PULSEENCODER_WRITE
 				data[2]		ULONG_ ul_WriteValue        : 32-bit value to be       |
 |                                                   written             |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_Status            : Pulse encoder status.    |
+| Output Parameters : unsigned char *_ pb_Status            : Pulse encoder status.    |
 |                                                       0 : No overflow occur|
 |                                                       1 : Overflow occur
 						PULONG_ pul_ReadValue       : Pulse encoder value      |  |
@@ -702,30 +702,30 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-/*_INT_   i_APCI1710_ReadPulseEncoderStatus       (BYTE_   b_BoardHandle,
-						 BYTE_   b_ModulNbr,
-						 BYTE_   b_PulseEncoderNbr,
+/*_INT_   i_APCI1710_ReadPulseEncoderStatus       (unsigned char_   b_BoardHandle,
+						 unsigned char_   b_ModulNbr,
+						 unsigned char_   b_PulseEncoderNbr,
 
-   						 PBYTE_ pb_Status)
+						 unsigned char *_ pb_Status)
 						 */
-INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusRegister;
-	BYTE b_ModulNbr;
-	BYTE b_PulseEncoderNbr;
-	PBYTE pb_Status;
-	BYTE b_Type;
-	PULONG pul_ReadValue;
-	ULONG ul_WriteValue;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusRegister;
+	unsigned char b_ModulNbr;
+	unsigned char b_PulseEncoderNbr;
+	unsigned char *pb_Status;
+	unsigned char b_Type;
+	unsigned int *pul_ReadValue;
+	unsigned int ul_WriteValue;
 
 	i_ReturnValue = insn->n;
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_Type = (BYTE) data[0];
-	b_PulseEncoderNbr = (BYTE) data[1];
-	pb_Status = (PBYTE) & data[0];
-	pul_ReadValue = (PULONG) & data[1];
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_Type = (unsigned char) data[0];
+	b_PulseEncoderNbr = (unsigned char) data[1];
+	pb_Status = (unsigned char *) &data[0];
+	pul_ReadValue = (unsigned int *) &data[1];
 
 	/***********************************/
 	/* Test the selected module number */
@@ -766,7 +766,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
 						dw_StatusRegister;
 
 					*pb_Status =
-						(BYTE) (devpriv->
+						(unsigned char) (devpriv->
 						s_ModuleInfo[b_ModulNbr].
 						s_PulseEncoderModuleInfo.
 						dw_StatusRegister >> (1 +
@@ -794,7 +794,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
 					break;
 
 				case APCI1710_PULSEENCODER_WRITE:
-					ul_WriteValue = (ULONG) data[2];
+					ul_WriteValue = (unsigned int) data[2];
 			/*******************/
 					/* Write the value */
 			/*******************/
@@ -805,7 +805,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
 						(4 * b_PulseEncoderNbr) +
 						(64 * b_ModulNbr));
 
-				}	//end of switch
+				}	/* end of switch */
 			} else {
 		 /*********************************/
 				/* Pulse encoder not initialised */
@@ -831,11 +831,11 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
-INT i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 
 	data[0] = devpriv->s_InterruptParameters.

+ 4 - 4
drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.h

@@ -21,11 +21,11 @@
 #define APCI1710_PULSEENCODER_READ	0
 #define APCI1710_PULSEENCODER_WRITE	1
 
-INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device *dev,
+int i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device *dev,
 					  struct comedi_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev,
+int i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev,
 						  struct comedi_subdevice *s,
 						  struct comedi_insn *insn,
 						  unsigned int *data);
@@ -33,7 +33,7 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev,
 /*
  * READ PULSE ENCODER FUNCTIONS
  */
-INT i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev,
+int i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev,
 					     struct comedi_subdevice *s,
 					     struct comedi_insn *insn,
 					     unsigned int *data);
@@ -41,7 +41,7 @@ INT i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev,
 /*
  * WRITE PULSE ENCODER FUNCTIONS
  */
-INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device *dev,
+int i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device *dev,
 					     struct comedi_subdevice *s,
 					     struct comedi_insn *insn,
 					     unsigned int *data);

+ 657 - 657
drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.c

@@ -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.
 
@@ -70,38 +70,38 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnConfigPWM(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	BYTE b_ConfigType;
-	INT i_ReturnValue = 0;
+	unsigned char b_ConfigType;
+	int i_ReturnValue = 0;
 	b_ConfigType = CR_CHAN(insn->chanspec);
 
 	switch (b_ConfigType) {
 	case APCI1710_PWM_INIT:
-		i_ReturnValue = i_APCI1710_InitPWM(dev, (BYTE) CR_AREF(insn->chanspec),	//  b_ModulNbr
-			(BYTE) data[0],	//b_PWM
-			(BYTE) data[1],	// b_ClockSelection
-			(BYTE) data[2],	// b_TimingUnit
-			(ULONG) data[3],	//ul_LowTiming
-			(ULONG) data[4],	//ul_HighTiming
-			(PULONG) & data[0],	//pul_RealLowTiming
-			(PULONG) & data[1]	//pul_RealHighTiming
+		i_ReturnValue = i_APCI1710_InitPWM(dev, (unsigned char) CR_AREF(insn->chanspec),	/*   b_ModulNbr */
+			(unsigned char) data[0],	/* b_PWM */
+			(unsigned char) data[1],	/*  b_ClockSelection */
+			(unsigned char) data[2],	/*  b_TimingUnit */
+			(unsigned int) data[3],	/* ul_LowTiming */
+			(unsigned int) data[4],	/* ul_HighTiming */
+			(unsigned int *) &data[0],	/* pul_RealLowTiming */
+			(unsigned int *) &data[1]	/* pul_RealHighTiming */
 			);
 		break;
 
 	case APCI1710_PWM_GETINITDATA:
-		i_ReturnValue = i_APCI1710_GetPWMInitialisation(dev, (BYTE) CR_AREF(insn->chanspec),	// b_ModulNbr
-			(BYTE) data[0],	//b_PWM
-			(PBYTE) & data[0],	//pb_TimingUnit
-			(PULONG) & data[1],	//pul_LowTiming
-			(PULONG) & data[2],	//pul_HighTiming
-			(PBYTE) & data[3],	// pb_StartLevel
-			(PBYTE) & data[4],	// pb_StopMode
-			(PBYTE) & data[5],	// pb_StopLevel
-			(PBYTE) & data[6],	// pb_ExternGate
-			(PBYTE) & data[7],	// pb_InterruptEnable
-			(PBYTE) & data[8]	// pb_Enable
+		i_ReturnValue = i_APCI1710_GetPWMInitialisation(dev, (unsigned char) CR_AREF(insn->chanspec),	/*  b_ModulNbr */
+			(unsigned char) data[0],	/* b_PWM */
+			(unsigned char *) &data[0],	/* pb_TimingUnit */
+			(unsigned int *) &data[1],	/* pul_LowTiming */
+			(unsigned int *) &data[2],	/* pul_HighTiming */
+			(unsigned char *) &data[3],	/*  pb_StartLevel */
+			(unsigned char *) &data[4],	/*  pb_StopMode */
+			(unsigned char *) &data[5],	/*  pb_StopLevel */
+			(unsigned char *) &data[6],	/*  pb_ExternGate */
+			(unsigned char *) &data[7],	/*  pb_InterruptEnable */
+			(unsigned char *) &data[8]	/*  pb_Enable */
 			);
 		break;
 
@@ -111,17 +111,17 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice
 
 	if (i_ReturnValue >= 0)
 		i_ReturnValue = insn->n;
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_InitPWM                               |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
-|                                        BYTE_     b_PWM,                    |
-|                                        BYTE_     b_ClockSelection,         |
-|                                        BYTE_     b_TimingUnit,             |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
+|                                        unsigned char_     b_PWM,                    |
+|                                        unsigned char_     b_ClockSelection,         |
+|                                        unsigned char_     b_TimingUnit,             |
 |                                        ULONG_   ul_LowTiming,              |
 |                                        ULONG_   ul_HighTiming,             |
 |                                        PULONG_ pul_RealLowTiming,          |
@@ -135,11 +135,11 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice
 |                     You must calling this function be for you call any     |
 |                     other function witch access of the PWM.                |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_     b_BoardHandle    : Handle of board APCI-1710 |
-|                     BYTE_     b_ModulNbr       : Module number to configure|
+| Input Parameters  : unsigned char_     b_BoardHandle    : Handle of board APCI-1710 |
+|                     unsigned char_     b_ModulNbr       : Module number to configure|
 |                                                  (0 to 3)                  |
-|                     BYTE_     b_PWM            : Selected PWM (0 or 1).    |
-|                     BYTE_     b_ClockSelection : Selection from PCI bus    |
+|                     unsigned char_     b_PWM            : Selected PWM (0 or 1).    |
+|                     unsigned char_     b_ClockSelection : Selection from PCI bus    |
 |                                                  clock                     |
 |                                                   - APCI1710_30MHZ :       |
 |                                                     The PC have a 30 MHz   |
@@ -151,7 +151,7 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice
 |                                                     The APCI-1710 have a   |
 |                                                     integrated 40Mhz       |
 |                                                     quartz.                |
-|                     BYTE_     b_TimingUnit     : Base timing Unit (0 to 4) |
+|                     unsigned char_     b_TimingUnit     : Base timing Unit (0 to 4) |
 |                                                       0 : ns               |
 |                                                       1 : æs               |
 |                                                       2 : ms               |
@@ -179,19 +179,19 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InitPWM(struct comedi_device * dev,
-	BYTE b_ModulNbr,
-	BYTE b_PWM,
-	BYTE b_ClockSelection,
-	BYTE b_TimingUnit,
-	ULONG ul_LowTiming,
-	ULONG ul_HighTiming,
-	PULONG pul_RealLowTiming, PULONG pul_RealHighTiming)
+int i_APCI1710_InitPWM(struct comedi_device *dev,
+	unsigned char b_ModulNbr,
+	unsigned char b_PWM,
+	unsigned char b_ClockSelection,
+	unsigned char b_TimingUnit,
+	unsigned int ul_LowTiming,
+	unsigned int ul_HighTiming,
+	unsigned int *pul_RealLowTiming, unsigned int *pul_RealHighTiming)
 {
-	INT i_ReturnValue = 0;
-	ULONG ul_LowTimerValue = 0;
-	ULONG ul_HighTimerValue = 0;
-	DWORD dw_Command;
+	int i_ReturnValue = 0;
+	unsigned int ul_LowTimerValue = 0;
+	unsigned int ul_HighTimerValue = 0;
+	unsigned int dw_Command;
 	double d_RealLowTiming = 0;
 	double d_RealHighTiming = 0;
 
@@ -200,33 +200,33 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 	/**************************/
 
 	if (b_ModulNbr < 4) {
-	   /***************/
+		/***************/
 		/* Test if PWM */
-	   /***************/
+		/***************/
 
 		if ((devpriv->s_BoardInfos.
 				dw_MolduleConfiguration[b_ModulNbr] &
 				0xFFFF0000UL) == APCI1710_PWM) {
-	      /**************************/
+			/**************************/
 			/* Test the PWM selection */
-	      /**************************/
+			/**************************/
 
 			if (b_PWM <= 1) {
-		 /******************/
+				/******************/
 				/* Test the clock */
-		 /******************/
+				/******************/
 
 				if ((b_ClockSelection == APCI1710_30MHZ) ||
 					(b_ClockSelection == APCI1710_33MHZ) ||
 					(b_ClockSelection == APCI1710_40MHZ)) {
-		    /************************/
+					/************************/
 					/* Test the timing unit */
-		    /************************/
+					/************************/
 
 					if (b_TimingUnit <= 4) {
-		       /*********************************/
+						/*********************************/
 						/* Test the low timing selection */
-		       /*********************************/
+						/*********************************/
 
 						if (((b_ClockSelection ==
 									APCI1710_30MHZ)
@@ -361,45 +361,45 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 								&& (ul_LowTiming
 									<=
 									7UL))) {
-			  /**********************************/
+							/**********************************/
 							/* Test the High timing selection */
-			  /**********************************/
+							/**********************************/
 
 							if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) {
-			     /**************************/
+								/**************************/
 								/* Test the board version */
-			     /**************************/
+								/**************************/
 
 								if (((b_ClockSelection == APCI1710_40MHZ) && (devpriv->s_BoardInfos.b_BoardVersion > 0)) || (b_ClockSelection != APCI1710_40MHZ)) {
 
-				/************************************/
+									/************************************/
 									/* Calculate the low division fator */
-				/************************************/
+									/************************************/
 
 									fpu_begin
 										();
 
 									switch (b_TimingUnit) {
-				   /******/
+										/******/
 										/* ns */
-				   /******/
+										/******/
 
 									case 0:
 
-					   /******************/
+										/******************/
 										/* Timer 0 factor */
-					   /******************/
+										/******************/
 
 										ul_LowTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_LowTiming
 											*
 											(0.00025 * b_ClockSelection));
 
-					   /*******************/
+										/*******************/
 										/* Round the value */
-					   /*******************/
+										/*******************/
 
 										if ((double)((double)ul_LowTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
 											ul_LowTimerValue
@@ -409,13 +409,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												1;
 										}
 
-					   /*****************************/
+										/*****************************/
 										/* Calculate the real timing */
-					   /*****************************/
+										/*****************************/
 
 										*pul_RealLowTiming
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_LowTimerValue
 											/
 											(0.00025 * (double)b_ClockSelection));
@@ -451,7 +451,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										if (b_ClockSelection != APCI1710_40MHZ) {
 											ul_LowTimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_LowTimerValue)
@@ -461,26 +461,26 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 
 										break;
 
-				   /******/
+										/******/
 										/* æs */
-				   /******/
+										/******/
 
 									case 1:
 
-					   /******************/
+										/******************/
 										/* Timer 0 factor */
-					   /******************/
+										/******************/
 
 										ul_LowTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_LowTiming
 											*
 											(0.25 * b_ClockSelection));
 
-					   /*******************/
+										/*******************/
 										/* Round the value */
-					   /*******************/
+										/*******************/
 
 										if ((double)((double)ul_LowTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
 											ul_LowTimerValue
@@ -490,13 +490,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												1;
 										}
 
-					   /*****************************/
+										/*****************************/
 										/* Calculate the real timing */
-					   /*****************************/
+										/*****************************/
 
 										*pul_RealLowTiming
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_LowTimerValue
 											/
 											(0.25 * (double)b_ClockSelection));
@@ -534,7 +534,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										if (b_ClockSelection != APCI1710_40MHZ) {
 											ul_LowTimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_LowTimerValue)
@@ -544,15 +544,15 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 
 										break;
 
-				   /******/
+										/******/
 										/* ms */
-				   /******/
+										/******/
 
 									case 2:
 
-					   /******************/
+										/******************/
 										/* Timer 0 factor */
-					   /******************/
+										/******************/
 
 										ul_LowTimerValue
 											=
@@ -562,9 +562,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 											*
 											b_ClockSelection);
 
-					   /*******************/
+										/*******************/
 										/* Round the value */
-					   /*******************/
+										/*******************/
 
 										if ((double)((double)ul_LowTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
 											ul_LowTimerValue
@@ -574,13 +574,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												1;
 										}
 
-					   /*****************************/
+										/*****************************/
 										/* Calculate the real timing */
-					   /*****************************/
+										/*****************************/
 
 										*pul_RealLowTiming
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_LowTimerValue
 											/
 											(250.0 * (double)b_ClockSelection));
@@ -616,7 +616,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										if (b_ClockSelection != APCI1710_40MHZ) {
 											ul_LowTimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_LowTimerValue)
@@ -626,27 +626,27 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 
 										break;
 
-				   /*****/
+										/*****/
 										/* s */
-				   /*****/
+										/*****/
 
 									case 3:
-					   /******************/
+										/******************/
 										/* Timer 0 factor */
-					   /******************/
+										/******************/
 
 										ul_LowTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_LowTiming
 											*
 											(250000.0
 												*
 												b_ClockSelection));
 
-					   /*******************/
+										/*******************/
 										/* Round the value */
-					   /*******************/
+										/*******************/
 
 										if ((double)((double)ul_LowTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
 											ul_LowTimerValue
@@ -656,13 +656,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												1;
 										}
 
-					   /*****************************/
+										/*****************************/
 										/* Calculate the real timing */
-					   /*****************************/
+										/*****************************/
 
 										*pul_RealLowTiming
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_LowTimerValue
 											/
 											(250000.0
@@ -701,7 +701,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										if (b_ClockSelection != APCI1710_40MHZ) {
 											ul_LowTimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_LowTimerValue)
@@ -711,19 +711,19 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 
 										break;
 
-				   /******/
+										/******/
 										/* mn */
-				   /******/
+										/******/
 
 									case 4:
 
-					   /******************/
+										/******************/
 										/* Timer 0 factor */
-					   /******************/
+										/******************/
 
 										ul_LowTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(ul_LowTiming
 												*
@@ -733,9 +733,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												*
 												b_ClockSelection));
 
-					   /*******************/
+										/*******************/
 										/* Round the value */
-					   /*******************/
+										/*******************/
 
 										if ((double)((double)(ul_LowTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
 											ul_LowTimerValue
@@ -745,13 +745,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												1;
 										}
 
-					   /*****************************/
+										/*****************************/
 										/* Calculate the real timing */
-					   /*****************************/
+										/*****************************/
 
 										*pul_RealLowTiming
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_LowTimerValue
 											/
 											(250000.0
@@ -795,7 +795,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										if (b_ClockSelection != APCI1710_40MHZ) {
 											ul_LowTimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_LowTimerValue)
@@ -806,31 +806,31 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										break;
 									}
 
-				/*************************************/
+									/*************************************/
 									/* Calculate the high division fator */
-				/*************************************/
+									/*************************************/
 
 									switch (b_TimingUnit) {
-				   /******/
+										/******/
 										/* ns */
-				   /******/
+										/******/
 
 									case 0:
 
-					   /******************/
+										/******************/
 										/* Timer 0 factor */
-					   /******************/
+										/******************/
 
 										ul_HighTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_HighTiming
 											*
 											(0.00025 * b_ClockSelection));
 
-					   /*******************/
+										/*******************/
 										/* Round the value */
-					   /*******************/
+										/*******************/
 
 										if ((double)((double)ul_HighTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
 											ul_HighTimerValue
@@ -840,13 +840,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												1;
 										}
 
-					   /*****************************/
+										/*****************************/
 										/* Calculate the real timing */
-					   /*****************************/
+										/*****************************/
 
 										*pul_RealHighTiming
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_HighTimerValue
 											/
 											(0.00025 * (double)b_ClockSelection));
@@ -882,7 +882,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										if (b_ClockSelection != APCI1710_40MHZ) {
 											ul_HighTimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_HighTimerValue)
@@ -892,26 +892,26 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 
 										break;
 
-				   /******/
+										/******/
 										/* æs */
-				   /******/
+										/******/
 
 									case 1:
 
-					   /******************/
+										/******************/
 										/* Timer 0 factor */
-					   /******************/
+										/******************/
 
 										ul_HighTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_HighTiming
 											*
 											(0.25 * b_ClockSelection));
 
-					   /*******************/
+										/*******************/
 										/* Round the value */
-					   /*******************/
+										/*******************/
 
 										if ((double)((double)ul_HighTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
 											ul_HighTimerValue
@@ -921,13 +921,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												1;
 										}
 
-					   /*****************************/
+										/*****************************/
 										/* Calculate the real timing */
-					   /*****************************/
+										/*****************************/
 
 										*pul_RealHighTiming
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_HighTimerValue
 											/
 											(0.25 * (double)b_ClockSelection));
@@ -965,7 +965,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										if (b_ClockSelection != APCI1710_40MHZ) {
 											ul_HighTimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_HighTimerValue)
@@ -975,15 +975,15 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 
 										break;
 
-				   /******/
+										/******/
 										/* ms */
-				   /******/
+										/******/
 
 									case 2:
 
-					   /******************/
+										/******************/
 										/* Timer 0 factor */
-					   /******************/
+										/******************/
 
 										ul_HighTimerValue
 											=
@@ -993,9 +993,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 											*
 											b_ClockSelection);
 
-					   /*******************/
+										/*******************/
 										/* Round the value */
-					   /*******************/
+										/*******************/
 
 										if ((double)((double)ul_HighTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
 											ul_HighTimerValue
@@ -1005,13 +1005,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												1;
 										}
 
-					   /*****************************/
+										/*****************************/
 										/* Calculate the real timing */
-					   /*****************************/
+										/*****************************/
 
 										*pul_RealHighTiming
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_HighTimerValue
 											/
 											(250.0 * (double)b_ClockSelection));
@@ -1047,7 +1047,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										if (b_ClockSelection != APCI1710_40MHZ) {
 											ul_HighTimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_HighTimerValue)
@@ -1057,28 +1057,28 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 
 										break;
 
-				   /*****/
+										/*****/
 										/* s */
-				   /*****/
+										/*****/
 
 									case 3:
 
-					   /******************/
+										/******************/
 										/* Timer 0 factor */
-					   /******************/
+										/******************/
 
 										ul_HighTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_HighTiming
 											*
 											(250000.0
 												*
 												b_ClockSelection));
 
-					   /*******************/
+										/*******************/
 										/* Round the value */
-					   /*******************/
+										/*******************/
 
 										if ((double)((double)ul_HighTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
 											ul_HighTimerValue
@@ -1088,13 +1088,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												1;
 										}
 
-					   /*****************************/
+										/*****************************/
 										/* Calculate the real timing */
-					   /*****************************/
+										/*****************************/
 
 										*pul_RealHighTiming
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_HighTimerValue
 											/
 											(250000.0
@@ -1133,7 +1133,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										if (b_ClockSelection != APCI1710_40MHZ) {
 											ul_HighTimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_HighTimerValue)
@@ -1143,19 +1143,19 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 
 										break;
 
-				   /******/
+										/******/
 										/* mn */
-				   /******/
+										/******/
 
 									case 4:
 
-					   /******************/
+										/******************/
 										/* Timer 0 factor */
-					   /******************/
+										/******************/
 
 										ul_HighTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(ul_HighTiming
 												*
@@ -1165,9 +1165,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												*
 												b_ClockSelection));
 
-					   /*******************/
+										/*******************/
 										/* Round the value */
-					   /*******************/
+										/*******************/
 
 										if ((double)((double)(ul_HighTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
 											ul_HighTimerValue
@@ -1177,13 +1177,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 												1;
 										}
 
-					   /*****************************/
+										/*****************************/
 										/* Calculate the real timing */
-					   /*****************************/
+										/*****************************/
 
 										*pul_RealHighTiming
 											=
-											(ULONG)
+											(unsigned int)
 											(ul_HighTimerValue
 											/
 											(250000.0
@@ -1227,7 +1227,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										if (b_ClockSelection != APCI1710_40MHZ) {
 											ul_HighTimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(double)
 												(ul_HighTimerValue)
@@ -1239,9 +1239,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 									}
 
 									fpu_end();
-				/****************************/
+									/****************************/
 									/* Save the clock selection */
-				/****************************/
+									/****************************/
 
 									devpriv->
 										s_ModuleInfo
@@ -1251,9 +1251,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										=
 										b_ClockSelection;
 
-				/************************/
+									/************************/
 									/* Save the timing unit */
-				/************************/
+									/************************/
 
 									devpriv->
 										s_ModuleInfo
@@ -1265,9 +1265,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										=
 										b_TimingUnit;
 
-				/****************************/
+									/****************************/
 									/* Save the low base timing */
-				/****************************/
+									/****************************/
 
 									devpriv->
 										s_ModuleInfo
@@ -1289,9 +1289,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										=
 										*pul_RealLowTiming;
 
-				/****************************/
+									/****************************/
 									/* Save the high base timing */
-				/****************************/
+									/****************************/
 
 									devpriv->
 										s_ModuleInfo
@@ -1313,21 +1313,21 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										=
 										*pul_RealHighTiming;
 
-				/************************/
+									/************************/
 									/* Write the low timing */
-				/************************/
+									/************************/
 
 									outl(ul_LowTimerValue, devpriv->s_BoardInfos.ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr));
 
-				/*************************/
+									/*************************/
 									/* Write the high timing */
-				/*************************/
+									/*************************/
 
 									outl(ul_HighTimerValue, devpriv->s_BoardInfos.ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr));
 
-				/***************************/
+									/***************************/
 									/* Set the clock selection */
-				/***************************/
+									/***************************/
 
 									dw_Command
 										=
@@ -1354,15 +1354,15 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 											0x80;
 									}
 
-				/***************************/
+									/***************************/
 									/* Set the clock selection */
-				/***************************/
+									/***************************/
 
 									outl(dw_Command, devpriv->s_BoardInfos.ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr));
 
-				/*************/
+									/*************/
 									/* PWM init. */
-				/*************/
+									/*************/
 									devpriv->
 										s_ModuleInfo
 										[b_ModulNbr].
@@ -1373,98 +1373,98 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 										=
 										1;
 								} else {
-				/***************************************************/
+									/***************************************************/
 									/* You can not used the 40MHz clock selection with */
 									/* this board                                      */
-				/***************************************************/
+									/***************************************************/
 									DPRINTK("You can not used the 40MHz clock selection with this board\n");
 									i_ReturnValue
 										=
 										-9;
 								}
 							} else {
-			     /***************************************/
+								/***************************************/
 								/* High base timing selection is wrong */
-			     /***************************************/
+								/***************************************/
 								DPRINTK("High base timing selection is wrong\n");
 								i_ReturnValue =
 									-8;
 							}
 						} else {
-			  /**************************************/
+							/**************************************/
 							/* Low base timing selection is wrong */
-			  /**************************************/
+							/**************************************/
 							DPRINTK("Low base timing selection is wrong\n");
 							i_ReturnValue = -7;
 						}
-					}	// if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4))
+					}	/*  if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
 					else {
-		       /**********************************/
+						/**********************************/
 						/* Timing unit selection is wrong */
-		       /**********************************/
+						/**********************************/
 						DPRINTK("Timing unit selection is wrong\n");
 						i_ReturnValue = -6;
-					}	// if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4))
-				}	// if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ))
+					}	/*  if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
+				}	/*  if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) */
 				else {
-		    /*******************************/
+					/*******************************/
 					/* The selected clock is wrong */
-		    /*******************************/
+					/*******************************/
 					DPRINTK("The selected clock is wrong\n");
 					i_ReturnValue = -5;
-				}	// if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ))
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+				}	/*  if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) */
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 			else {
-		 /******************************/
+				/******************************/
 				/* Tor PWM selection is wrong */
-		 /******************************/
+				/******************************/
 				DPRINTK("Tor PWM selection is wrong\n");
 				i_ReturnValue = -4;
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 		} else {
-	      /**********************************/
+			/**********************************/
 			/* The module is not a PWM module */
-	      /**********************************/
+			/**********************************/
 			DPRINTK("The module is not a PWM module\n");
 			i_ReturnValue = -3;
 		}
 	} else {
-	   /***********************/
+		/***********************/
 		/* Module number error */
-	   /***********************/
+		/***********************/
 		DPRINTK("Module number error\n");
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_GetPWMInitialisation                  |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
-|                                        BYTE_     b_PWM,                    |
-|                                        PBYTE_   pb_TimingUnit,             |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
+|                                        unsigned char_     b_PWM,                    |
+|                                        unsigned char *_   pb_TimingUnit,             |
 |                                        PULONG_ pul_LowTiming,              |
 |                                        PULONG_ pul_HighTiming,             |
-|                                        PBYTE_   pb_StartLevel,             |
-|                                        PBYTE_   pb_StopMode,               |
-|                                        PBYTE_   pb_StopLevel,              |
-|                                        PBYTE_   pb_ExternGate,             |
-|                                        PBYTE_   pb_InterruptEnable,        |
-|                                        PBYTE_   pb_Enable)                 |
+|                                        unsigned char *_   pb_StartLevel,             |
+|                                        unsigned char *_   pb_StopMode,               |
+|                                        unsigned char *_   pb_StopLevel,              |
+|                                        unsigned char *_   pb_ExternGate,             |
+|                                        unsigned char *_   pb_InterruptEnable,        |
+|                                        unsigned char *_   pb_Enable)                 |
 +----------------------------------------------------------------------------+
 | Task              : Return the PWM (b_PWM) initialisation from selected    |
 |                     module (b_ModulNbr). You must calling the              |
 |                     "i_APCI1710_InitPWM" function be for you call this     |
 |                     function.                                              |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle : Handle of board APCI-1710        |
-|                     BYTE_ b_ModulNbr    : Selected module number (0 to 3)  |
-|                     BYTE_ b_PWM         : Selected PWM (0 or 1)            |
+| Input Parameters  : unsigned char_ b_BoardHandle : Handle of board APCI-1710        |
+|                     unsigned char_ b_ModulNbr    : Selected module number (0 to 3)  |
+|                     unsigned char_ b_PWM         : Selected PWM (0 or 1)            |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_  pb_TimingUnit      : Base timing Unit (0 to 4) |
+| Output Parameters : unsigned char *_  pb_TimingUnit      : Base timing Unit (0 to 4) |
 |                                                       0 : ns               |
 |                                                       1 : æs               |
 |                                                       2 : ms               |
@@ -1472,13 +1472,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 |                                                       4 : mn               |
 |                     PULONG_ pul_LowTiming      : Low base timing value.    |
 |                     PULONG_ pul_HighTiming     : High base timing value.   |
-|                     PBYTE_  pb_StartLevel      : Start period level        |
+|                     unsigned char *_  pb_StartLevel      : Start period level        |
 |                                                  selection                 |
 |                                                       0 : The period start |
 |                                                           with a low level |
 |                                                       1 : The period start |
 |                                                           with a high level|
-|                     PBYTE_  pb_StopMode        : Stop mode selection       |
+|                     unsigned char *_  pb_StopMode        : Stop mode selection       |
 |                                                  0 : The PWM is stopped    |
 |                                                      directly after the    |
 |                                                     "i_APCI1710_DisablePWM"|
@@ -1489,7 +1489,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 |                                                      function the PWM is   |
 |                                                      stopped at the end    |
 |                                                      from last period cycle|
-|                     PBYTE_  pb_StopLevel        : Stop PWM level selection |
+|                     unsigned char *_  pb_StopLevel        : Stop PWM level selection |
 |                                                    0 : The output signal   |
 |                                                        keep the level after|
 |                                                        the                 |
@@ -1504,13 +1504,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 |                                                        the                 |
 |                                                     "i_APCI1710_DisablePWM"|
 |                                                        function            |
-|                     PBYTE_  pb_ExternGate      : Extern gate action        |
+|                     unsigned char *_  pb_ExternGate      : Extern gate action        |
 |                                                  selection                 |
 |                                                   0 : Extern gate signal   |
 |                                                       not used.            |
 |                                                   1 : Extern gate signal   |
 |                                                       used.                |
-|                     PBYTE_  pb_InterruptEnable : Enable or disable the PWM |
+|                     unsigned char *_  pb_InterruptEnable : Enable or disable the PWM |
 |                                                  interrupt.                |
 |                                                  - APCI1710_ENABLE :       |
 |                                                    Enable the PWM interrupt|
@@ -1519,7 +1519,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 |                                                  - APCI1710_DISABLE :      |
 |                                                    Disable the PWM         |
 |                                                    interrupt               |
-|                     PBYTE_  pb_Enable          : Indicate if the PWM is    |
+|                     unsigned char *_  pb_Enable          : Indicate if the PWM is    |
 |                                                  enabled or no             |
 |                                                       0 : PWM not enabled  |
 |                                                       1 : PWM enabled      |
@@ -1534,138 +1534,138 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_GetPWMInitialisation(struct comedi_device * dev,
-	BYTE b_ModulNbr,
-	BYTE b_PWM,
-	PBYTE pb_TimingUnit,
-	PULONG pul_LowTiming,
-	PULONG pul_HighTiming,
-	PBYTE pb_StartLevel,
-	PBYTE pb_StopMode,
-	PBYTE pb_StopLevel,
-	PBYTE pb_ExternGate, PBYTE pb_InterruptEnable, PBYTE pb_Enable)
+int i_APCI1710_GetPWMInitialisation(struct comedi_device *dev,
+	unsigned char b_ModulNbr,
+	unsigned char b_PWM,
+	unsigned char *pb_TimingUnit,
+	unsigned int *pul_LowTiming,
+	unsigned int *pul_HighTiming,
+	unsigned char *pb_StartLevel,
+	unsigned char *pb_StopMode,
+	unsigned char *pb_StopLevel,
+	unsigned char *pb_ExternGate, unsigned char *pb_InterruptEnable, unsigned char *pb_Enable)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_Status;
-	DWORD dw_Command;
+	int i_ReturnValue = 0;
+	unsigned int dw_Status;
+	unsigned int dw_Command;
 
 	/**************************/
 	/* Test the module number */
 	/**************************/
 
 	if (b_ModulNbr < 4) {
-	   /***************/
+		/***************/
 		/* Test if PWM */
-	   /***************/
+		/***************/
 
 		if ((devpriv->s_BoardInfos.
 				dw_MolduleConfiguration[b_ModulNbr] &
 				0xFFFF0000UL) == APCI1710_PWM) {
-	      /**************************/
+			/**************************/
 			/* Test the PWM selection */
-	      /**************************/
+			/**************************/
 
 			if (b_PWM <= 1) {
-		 /***************************/
+				/***************************/
 				/* Test if PWM initialised */
-		 /***************************/
+				/***************************/
 
 				dw_Status = inl(devpriv->s_BoardInfos.
 					ui_Address + 12 + (20 * b_PWM) +
 					(64 * b_ModulNbr));
 
 				if (dw_Status & 0x10) {
-		    /***********************/
+					/***********************/
 					/* Read the low timing */
-		    /***********************/
+					/***********************/
 
 					*pul_LowTiming =
 						inl(devpriv->s_BoardInfos.
 						ui_Address + 0 + (20 * b_PWM) +
 						(64 * b_ModulNbr));
 
-		    /************************/
+					/************************/
 					/* Read the high timing */
-		    /************************/
+					/************************/
 
 					*pul_HighTiming =
 						inl(devpriv->s_BoardInfos.
 						ui_Address + 4 + (20 * b_PWM) +
 						(64 * b_ModulNbr));
 
-		    /********************/
+					/********************/
 					/* Read the command */
-		    /********************/
+					/********************/
 
 					dw_Command = inl(devpriv->s_BoardInfos.
 						ui_Address + 8 + (20 * b_PWM) +
 						(64 * b_ModulNbr));
 
 					*pb_StartLevel =
-						(BYTE) ((dw_Command >> 5) & 1);
+						(unsigned char) ((dw_Command >> 5) & 1);
 					*pb_StopMode =
-						(BYTE) ((dw_Command >> 0) & 1);
+						(unsigned char) ((dw_Command >> 0) & 1);
 					*pb_StopLevel =
-						(BYTE) ((dw_Command >> 1) & 1);
+						(unsigned char) ((dw_Command >> 1) & 1);
 					*pb_ExternGate =
-						(BYTE) ((dw_Command >> 4) & 1);
+						(unsigned char) ((dw_Command >> 4) & 1);
 					*pb_InterruptEnable =
-						(BYTE) ((dw_Command >> 3) & 1);
+						(unsigned char) ((dw_Command >> 3) & 1);
 
 					if (*pb_StopLevel) {
 						*pb_StopLevel =
 							*pb_StopLevel +
-							(BYTE) ((dw_Command >>
+							(unsigned char) ((dw_Command >>
 								2) & 1);
 					}
 
-		    /********************/
+					/********************/
 					/* Read the command */
-		    /********************/
+					/********************/
 
 					dw_Command = inl(devpriv->s_BoardInfos.
 						ui_Address + 8 + (20 * b_PWM) +
 						(64 * b_ModulNbr));
 
 					*pb_Enable =
-						(BYTE) ((dw_Command >> 0) & 1);
+						(unsigned char) ((dw_Command >> 0) & 1);
 
 					*pb_TimingUnit = devpriv->
 						s_ModuleInfo[b_ModulNbr].
 						s_PWMModuleInfo.
 						s_PWMInfo[b_PWM].b_TimingUnit;
-				}	// if (dw_Status & 0x10)
+				}	/*  if (dw_Status & 0x10) */
 				else {
-		    /***********************/
+					/***********************/
 					/* PWM not initialised */
-		    /***********************/
+					/***********************/
 					DPRINTK("PWM not initialised\n");
 					i_ReturnValue = -5;
-				}	// if (dw_Status & 0x10)
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+				}	/*  if (dw_Status & 0x10) */
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 			else {
-		 /******************************/
+				/******************************/
 				/* Tor PWM selection is wrong */
-		 /******************************/
+				/******************************/
 				DPRINTK("Tor PWM selection is wrong\n");
 				i_ReturnValue = -4;
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 		} else {
-	      /**********************************/
+			/**********************************/
 			/* The module is not a PWM module */
-	      /**********************************/
+			/**********************************/
 			DPRINTK("The module is not a PWM module\n");
 			i_ReturnValue = -3;
 		}
 	} else {
-	   /***********************/
+		/***********************/
 		/* Module number error */
-	   /***********************/
+		/***********************/
 		DPRINTK("Module number error\n");
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -1683,33 +1683,33 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnWritePWM(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	BYTE b_WriteType;
-	INT i_ReturnValue = 0;
+	unsigned char b_WriteType;
+	int i_ReturnValue = 0;
 	b_WriteType = CR_CHAN(insn->chanspec);
 
 	switch (b_WriteType) {
 	case APCI1710_PWM_ENABLE:
 		i_ReturnValue = i_APCI1710_EnablePWM(dev,
-			(BYTE) CR_AREF(insn->chanspec),
-			(BYTE) data[0],
-			(BYTE) data[1],
-			(BYTE) data[2],
-			(BYTE) data[3], (BYTE) data[4], (BYTE) data[5]);
+			(unsigned char) CR_AREF(insn->chanspec),
+			(unsigned char) data[0],
+			(unsigned char) data[1],
+			(unsigned char) data[2],
+			(unsigned char) data[3], (unsigned char) data[4], (unsigned char) data[5]);
 		break;
 
 	case APCI1710_PWM_DISABLE:
 		i_ReturnValue = i_APCI1710_DisablePWM(dev,
-			(BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]);
+			(unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]);
 		break;
 
 	case APCI1710_PWM_NEWTIMING:
 		i_ReturnValue = i_APCI1710_SetNewPWMTiming(dev,
-			(BYTE) CR_AREF(insn->chanspec),
-			(BYTE) data[0],
-			(BYTE) data[1], (ULONG) data[2], (ULONG) data[3]);
+			(unsigned char) CR_AREF(insn->chanspec),
+			(unsigned char) data[0],
+			(unsigned char) data[1], (unsigned int) data[2], (unsigned int) data[3]);
 		break;
 
 	default:
@@ -1718,20 +1718,20 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice
 
 	if (i_ReturnValue >= 0)
 		i_ReturnValue = insn->n;
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_     i_APCI1710_EnablePWM                         |
-|                                       (BYTE_  b_BoardHandle,               |
-|                                        BYTE_  b_ModulNbr,                  |
-|                                        BYTE_  b_PWM,                       |
-|                                        BYTE_  b_StartLevel,                |
-|                                        BYTE_  b_StopMode,                  |
-|                                        BYTE_  b_StopLevel,                 |
-|                                        BYTE_  b_ExternGate,                |
-|                                        BYTE_  b_InterruptEnable)           |
+|                                       (unsigned char_  b_BoardHandle,               |
+|                                        unsigned char_  b_ModulNbr,                  |
+|                                        unsigned char_  b_PWM,                       |
+|                                        unsigned char_  b_StartLevel,                |
+|                                        unsigned char_  b_StopMode,                  |
+|                                        unsigned char_  b_StopLevel,                 |
+|                                        unsigned char_  b_ExternGate,                |
+|                                        unsigned char_  b_InterruptEnable)           |
 +----------------------------------------------------------------------------+
 | Task              : Enable the selected PWM (b_PWM) from selected module   |
 |                     (b_ModulNbr). You must calling the "i_APCI1710_InitPWM"|
@@ -1741,16 +1741,16 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice
 |                     See function "i_APCI1710_SetBoardIntRoutineX" and the  |
 |                     Interrupt mask description chapter.                    |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle     : Handle of board APCI-1710    |
-|                     BYTE_ b_ModulNbr        : Selected module number       |
+| Input Parameters  : unsigned char_ b_BoardHandle     : Handle of board APCI-1710    |
+|                     unsigned char_ b_ModulNbr        : Selected module number       |
 |                                               (0 to 3)                     |
-|                     BYTE_ b_PWM             : Selected PWM (0 or 1)        |
-|                     BYTE_ b_StartLevel      : Start period level selection |
+|                     unsigned char_ b_PWM             : Selected PWM (0 or 1)        |
+|                     unsigned char_ b_StartLevel      : Start period level selection |
 |                                                0 : The period start with a |
 |                                                    low level               |
 |                                                1 : The period start with a |
 |                                                    high level              |
-|                     BYTE_ b_StopMode        : Stop mode selection          |
+|                     unsigned char_ b_StopMode        : Stop mode selection          |
 |                                                0 : The PWM is stopped      |
 |                                                    directly after the      |
 |                                                    "i_APCI1710_DisablePWM" |
@@ -1761,7 +1761,7 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice
 |                                                     function the PWM is    |
 |                                                     stopped at the end from|
 |                                                     last period cycle.     |
-|                     BYTE_ b_StopLevel       : Stop PWM level selection     |
+|                     unsigned char_ b_StopLevel       : Stop PWM level selection     |
 |                                                0 : The output signal keep  |
 |                                                    the level after the     |
 |                                                    "i_APCI1710_DisablePWM" |
@@ -1774,11 +1774,11 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice
 |                                                    to high after the       |
 |                                                    "i_APCI1710_DisablePWM" |
 |                                                    function                |
-|                     BYTE_ b_ExternGate      : Extern gate action selection |
+|                     unsigned char_ b_ExternGate      : Extern gate action selection |
 |                                                0 : Extern gate signal not  |
 |                                                    used.                   |
 |                                                1 : Extern gate signal used.|
-|                     BYTE_ b_InterruptEnable : Enable or disable the PWM    |
+|                     unsigned char_ b_InterruptEnable : Enable or disable the PWM    |
 |                                               interrupt.                   |
 |                                               - APCI1710_ENABLE :          |
 |                                                 Enable the PWM interrupt   |
@@ -1806,77 +1806,77 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_EnablePWM(struct comedi_device * dev,
-	BYTE b_ModulNbr,
-	BYTE b_PWM,
-	BYTE b_StartLevel,
-	BYTE b_StopMode,
-	BYTE b_StopLevel, BYTE b_ExternGate, BYTE b_InterruptEnable)
+int i_APCI1710_EnablePWM(struct comedi_device *dev,
+	unsigned char b_ModulNbr,
+	unsigned char b_PWM,
+	unsigned char b_StartLevel,
+	unsigned char b_StopMode,
+	unsigned char b_StopLevel, unsigned char b_ExternGate, unsigned char b_InterruptEnable)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_Status;
-	DWORD dw_Command;
+	int i_ReturnValue = 0;
+	unsigned int dw_Status;
+	unsigned int dw_Command;
 
-	devpriv->tsk_Current = current;	// Save the current process task structure
+	devpriv->tsk_Current = current;	/*  Save the current process task structure */
 	/**************************/
 	/* Test the module number */
 	/**************************/
 
 	if (b_ModulNbr < 4) {
-	   /***************/
+		/***************/
 		/* Test if PWM */
-	   /***************/
+		/***************/
 
 		if ((devpriv->s_BoardInfos.
 				dw_MolduleConfiguration[b_ModulNbr] &
 				0xFFFF0000UL) == APCI1710_PWM) {
-	      /**************************/
+			/**************************/
 			/* Test the PWM selection */
-	      /**************************/
+			/**************************/
 
 			if (b_PWM <= 1) {
-		 /***************************/
+				/***************************/
 				/* Test if PWM initialised */
-		 /***************************/
+				/***************************/
 
 				dw_Status = inl(devpriv->s_BoardInfos.
 					ui_Address + 12 + (20 * b_PWM) +
 					(64 * b_ModulNbr));
 
 				if (dw_Status & 0x10) {
-		    /**********************************/
+					/**********************************/
 					/* Test the start level selection */
-		    /**********************************/
+					/**********************************/
 
 					if (b_StartLevel <= 1) {
-		       /**********************/
+						/**********************/
 						/* Test the stop mode */
-		       /**********************/
+						/**********************/
 
 						if (b_StopMode <= 1) {
-			  /***********************/
+							/***********************/
 							/* Test the stop level */
-			  /***********************/
+							/***********************/
 
 							if (b_StopLevel <= 2) {
-			     /*****************************/
+								/*****************************/
 								/* Test the extern gate mode */
-			     /*****************************/
+								/*****************************/
 
 								if (b_ExternGate
 									<= 1) {
-				/*****************************/
+									/*****************************/
 									/* Test the interrupt action */
-				/*****************************/
+									/*****************************/
 
 									if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) {
-				   /******************************************/
+										/******************************************/
 										/* Test if interrupt function initialised */
-				   /******************************************/
+										/******************************************/
 
-				      /********************/
+										/********************/
 										/* Read the command */
-				      /********************/
+										/********************/
 
 										dw_Command
 											=
@@ -1895,9 +1895,9 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev,
 											&
 											0x80;
 
-				      /********************/
+										/********************/
 										/* Make the command */
-				      /********************/
+										/********************/
 
 										dw_Command
 											=
@@ -1943,100 +1943,100 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev,
 											=
 											b_InterruptEnable;
 
-				      /*******************/
+										/*******************/
 										/* Set the command */
-				      /*******************/
+										/*******************/
 
 										outl(dw_Command, devpriv->s_BoardInfos.ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr));
 
-				      /******************/
+										/******************/
 										/* Enable the PWM */
-				      /******************/
+										/******************/
 										outl(1, devpriv->s_BoardInfos.ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr));
-									}	// if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE)
+									}	/*  if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) */
 									else {
-				   /********************************/
+										/********************************/
 										/* Interrupt parameter is wrong */
-				   /********************************/
+										/********************************/
 										DPRINTK("Interrupt parameter is wrong\n");
 										i_ReturnValue
 											=
 											-10;
-									}	// if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE)
-								}	// if (b_ExternGate >= 0 && b_ExternGate <= 1)
+									}	/*  if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) */
+								}	/*  if (b_ExternGate >= 0 && b_ExternGate <= 1) */
 								else {
-				/*****************************************/
+									/*****************************************/
 									/* Extern gate signal selection is wrong */
-				/*****************************************/
+									/*****************************************/
 									DPRINTK("Extern gate signal selection is wrong\n");
 									i_ReturnValue
 										=
 										-9;
-								}	// if (b_ExternGate >= 0 && b_ExternGate <= 1)
-							}	// if (b_StopLevel >= 0 && b_StopLevel <= 2)
+								}	/*  if (b_ExternGate >= 0 && b_ExternGate <= 1) */
+							}	/*  if (b_StopLevel >= 0 && b_StopLevel <= 2) */
 							else {
-			     /*************************************/
+								/*************************************/
 								/* PWM stop level selection is wrong */
-			     /*************************************/
+								/*************************************/
 								DPRINTK("PWM stop level selection is wrong\n");
 								i_ReturnValue =
 									-8;
-							}	// if (b_StopLevel >= 0 && b_StopLevel <= 2)
-						}	// if (b_StopMode >= 0 && b_StopMode <= 1)
+							}	/*  if (b_StopLevel >= 0 && b_StopLevel <= 2) */
+						}	/*  if (b_StopMode >= 0 && b_StopMode <= 1) */
 						else {
-			  /************************************/
+							/************************************/
 							/* PWM stop mode selection is wrong */
-			  /************************************/
+							/************************************/
 							DPRINTK("PWM stop mode selection is wrong\n");
 							i_ReturnValue = -7;
-						}	// if (b_StopMode >= 0 && b_StopMode <= 1)
-					}	// if (b_StartLevel >= 0 && b_StartLevel <= 1)
+						}	/*  if (b_StopMode >= 0 && b_StopMode <= 1) */
+					}	/*  if (b_StartLevel >= 0 && b_StartLevel <= 1) */
 					else {
-		       /**************************************/
+						/**************************************/
 						/* PWM start level selection is wrong */
-		       /**************************************/
+						/**************************************/
 						DPRINTK("PWM start level selection is wrong\n");
 						i_ReturnValue = -6;
-					}	// if (b_StartLevel >= 0 && b_StartLevel <= 1)
-				}	// if (dw_Status & 0x10)
+					}	/*  if (b_StartLevel >= 0 && b_StartLevel <= 1) */
+				}	/*  if (dw_Status & 0x10) */
 				else {
-		    /***********************/
+					/***********************/
 					/* PWM not initialised */
-		    /***********************/
+					/***********************/
 					DPRINTK("PWM not initialised\n");
 					i_ReturnValue = -5;
-				}	// if (dw_Status & 0x10)
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+				}	/*  if (dw_Status & 0x10) */
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 			else {
-		 /******************************/
+				/******************************/
 				/* Tor PWM selection is wrong */
-		 /******************************/
+				/******************************/
 				DPRINTK("Tor PWM selection is wrong\n");
 				i_ReturnValue = -4;
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 		} else {
-	      /**********************************/
+			/**********************************/
 			/* The module is not a PWM module */
-	      /**********************************/
+			/**********************************/
 			DPRINTK("The module is not a PWM module\n");
 			i_ReturnValue = -3;
 		}
 	} else {
-	   /***********************/
+		/***********************/
 		/* Module number error */
-	   /***********************/
+		/***********************/
 		DPRINTK("Module number error\n");
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : _INT_ i_APCI1710_DisablePWM (BYTE_  b_BoardHandle,     |
-|                                                  BYTE_  b_ModulNbr,        |
-|                                                  BYTE_  b_PWM)             |
+| Function Name     : _INT_ i_APCI1710_DisablePWM (unsigned char_  b_BoardHandle,     |
+|                                                  unsigned char_  b_ModulNbr,        |
+|                                                  unsigned char_  b_PWM)             |
 +----------------------------------------------------------------------------+
 | Task              : Disable the selected PWM (b_PWM) from selected module  |
 |                     (b_ModulNbr). The output signal level depend of the    |
@@ -2045,8 +2045,8 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev,
 |                     parameters from this function.                         |
 +----------------------------------------------------------------------------+
 | Input Parameters  :BYTE_ b_BoardHandle : Handle of board APCI-1710         |
-|                    BYTE_ b_ModulNbr    : Selected module number (0 to 3)   |
-|                    BYTE_ b_PWM         : Selected PWM (0 or 1)             |
+|                    unsigned char_ b_ModulNbr    : Selected module number (0 to 3)   |
+|                    unsigned char_ b_PWM         : Selected PWM (0 or 1)             |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -2062,99 +2062,99 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_DisablePWM(struct comedi_device * dev, BYTE b_ModulNbr, BYTE b_PWM)
+int i_APCI1710_DisablePWM(struct comedi_device *dev, unsigned char b_ModulNbr, unsigned char b_PWM)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_Status;
+	int i_ReturnValue = 0;
+	unsigned int dw_Status;
 
 	/**************************/
 	/* Test the module number */
 	/**************************/
 
 	if (b_ModulNbr < 4) {
-	   /***************/
+		/***************/
 		/* Test if PWM */
-	   /***************/
+		/***************/
 
 		if ((devpriv->s_BoardInfos.
 				dw_MolduleConfiguration[b_ModulNbr] &
 				0xFFFF0000UL) == APCI1710_PWM) {
-	      /**************************/
+			/**************************/
 			/* Test the PWM selection */
-	      /**************************/
+			/**************************/
 
 			if (b_PWM <= 1) {
-		 /***************************/
+				/***************************/
 				/* Test if PWM initialised */
-		 /***************************/
+				/***************************/
 
 				dw_Status = inl(devpriv->s_BoardInfos.
 					ui_Address + 12 + (20 * b_PWM) +
 					(64 * b_ModulNbr));
 
 				if (dw_Status & 0x10) {
-		    /***********************/
+					/***********************/
 					/* Test if PWM enabled */
-		    /***********************/
+					/***********************/
 
 					if (dw_Status & 0x1) {
-		       /*******************/
+						/*******************/
 						/* Disable the PWM */
-		       /*******************/
+						/*******************/
 						outl(0, devpriv->s_BoardInfos.
 							ui_Address + 12 +
 							(20 * b_PWM) +
 							(64 * b_ModulNbr));
-					}	// if (dw_Status & 0x1)
+					}	/*  if (dw_Status & 0x1) */
 					else {
-		       /*******************/
+						/*******************/
 						/* PWM not enabled */
-		       /*******************/
+						/*******************/
 						DPRINTK("PWM not enabled\n");
 						i_ReturnValue = -6;
-					}	// if (dw_Status & 0x1)
-				}	// if (dw_Status & 0x10)
+					}	/*  if (dw_Status & 0x1) */
+				}	/*  if (dw_Status & 0x10) */
 				else {
-		    /***********************/
+					/***********************/
 					/* PWM not initialised */
-		    /***********************/
+					/***********************/
 					DPRINTK(" PWM not initialised\n");
 					i_ReturnValue = -5;
-				}	// if (dw_Status & 0x10)
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+				}	/*  if (dw_Status & 0x10) */
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 			else {
-		 /******************************/
+				/******************************/
 				/* Tor PWM selection is wrong */
-		 /******************************/
+				/******************************/
 				DPRINTK("Tor PWM selection is wrong\n");
 				i_ReturnValue = -4;
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 		} else {
-	      /**********************************/
+			/**********************************/
 			/* The module is not a PWM module */
-	      /**********************************/
+			/**********************************/
 			DPRINTK("The module is not a PWM module\n");
 			i_ReturnValue = -3;
 		}
 	} else {
-	   /***********************/
+		/***********************/
 		/* Module number error */
-	   /***********************/
+		/***********************/
 		DPRINTK("Module number error\n");
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_SetNewPWMTiming                       |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
-|                                        BYTE_     b_PWM,                    |
-|                                        BYTE_     b_ClockSelection,         |
-|                                        BYTE_     b_TimingUnit,             |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
+|                                        unsigned char_     b_PWM,                    |
+|                                        unsigned char_     b_ClockSelection,         |
+|                                        unsigned char_     b_TimingUnit,             |
 |                                        ULONG_   ul_LowTiming,              |
 |                                        ULONG_   ul_HighTiming)             |
 +----------------------------------------------------------------------------+
@@ -2162,11 +2162,11 @@ INT i_APCI1710_DisablePWM(struct comedi_device * dev, BYTE b_ModulNbr, BYTE b_PW
 |                     ul_TimingUnit determine the low/high timing base for   |
 |                     the period.                                            |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_     b_BoardHandle    : Handle of board APCI-1710 |
-|                     BYTE_     b_ModulNbr       : Module number to configure|
+| Input Parameters  : unsigned char_     b_BoardHandle    : Handle of board APCI-1710 |
+|                     unsigned char_     b_ModulNbr       : Module number to configure|
 |                                                  (0 to 3)                  |
-|                     BYTE_     b_PWM            : Selected PWM (0 or 1).    |
-|                     BYTE_     b_TimingUnit     : Base timing Unit (0 to 4) |
+|                     unsigned char_     b_PWM            : Selected PWM (0 or 1).    |
+|                     unsigned char_     b_TimingUnit     : Base timing Unit (0 to 4) |
 |                                                       0 : ns               |
 |                                                       1 : æs               |
 |                                                       2 : ms               |
@@ -2189,18 +2189,18 @@ INT i_APCI1710_DisablePWM(struct comedi_device * dev, BYTE b_ModulNbr, BYTE b_PW
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
-	BYTE b_ModulNbr,
-	BYTE b_PWM, BYTE b_TimingUnit, ULONG ul_LowTiming, ULONG ul_HighTiming)
+int i_APCI1710_SetNewPWMTiming(struct comedi_device *dev,
+	unsigned char b_ModulNbr,
+	unsigned char b_PWM, unsigned char b_TimingUnit, unsigned int ul_LowTiming, unsigned int ul_HighTiming)
 {
-	BYTE b_ClockSelection;
-	INT i_ReturnValue = 0;
-	ULONG ul_LowTimerValue = 0;
-	ULONG ul_HighTimerValue = 0;
-	ULONG ul_RealLowTiming = 0;
-	ULONG ul_RealHighTiming = 0;
-	DWORD dw_Status;
-	DWORD dw_Command;
+	unsigned char b_ClockSelection;
+	int i_ReturnValue = 0;
+	unsigned int ul_LowTimerValue = 0;
+	unsigned int ul_HighTimerValue = 0;
+	unsigned int ul_RealLowTiming = 0;
+	unsigned int ul_RealHighTiming = 0;
+	unsigned int dw_Status;
+	unsigned int dw_Command;
 	double d_RealLowTiming = 0;
 	double d_RealHighTiming = 0;
 
@@ -2209,21 +2209,21 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 	/**************************/
 
 	if (b_ModulNbr < 4) {
-	   /***************/
+		/***************/
 		/* Test if PWM */
-	   /***************/
+		/***************/
 
 		if ((devpriv->s_BoardInfos.
 				dw_MolduleConfiguration[b_ModulNbr] &
 				0xFFFF0000UL) == APCI1710_PWM) {
-	      /**************************/
+			/**************************/
 			/* Test the PWM selection */
-	      /**************************/
+			/**************************/
 
 			if (b_PWM <= 1) {
-		 /***************************/
+				/***************************/
 				/* Test if PWM initialised */
-		 /***************************/
+				/***************************/
 
 				dw_Status = inl(devpriv->s_BoardInfos.
 					ui_Address + 12 + (20 * b_PWM) +
@@ -2235,14 +2235,14 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 						s_PWMModuleInfo.
 						b_ClockSelection;
 
-		    /************************/
+					/************************/
 					/* Test the timing unit */
-		    /************************/
+					/************************/
 
 					if (b_TimingUnit <= 4) {
-		       /*********************************/
+						/*********************************/
 						/* Test the low timing selection */
-		       /*********************************/
+						/*********************************/
 
 						if (((b_ClockSelection ==
 									APCI1710_30MHZ)
@@ -2377,37 +2377,37 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 								&& (ul_LowTiming
 									<=
 									7UL))) {
-			  /**********************************/
+							/**********************************/
 							/* Test the High timing selection */
-			  /**********************************/
+							/**********************************/
 
 							if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) {
-			     /************************************/
+								/************************************/
 								/* Calculate the low division fator */
-			     /************************************/
+								/************************************/
 
 								fpu_begin();
 								switch (b_TimingUnit) {
-				/******/
+									/******/
 									/* ns */
-				/******/
+									/******/
 
 								case 0:
 
-					/******************/
+									/******************/
 									/* Timer 0 factor */
-					/******************/
+									/******************/
 
 									ul_LowTimerValue
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_LowTiming
 										*
 										(0.00025 * b_ClockSelection));
 
-					/*******************/
+									/*******************/
 									/* Round the value */
-					/*******************/
+									/*******************/
 
 									if ((double)((double)ul_LowTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
 										ul_LowTimerValue
@@ -2417,13 +2417,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											1;
 									}
 
-					/*****************************/
+									/*****************************/
 									/* Calculate the real timing */
-					/*****************************/
+									/*****************************/
 
 									ul_RealLowTiming
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_LowTimerValue
 										/
 										(0.00025 * (double)b_ClockSelection));
@@ -2459,7 +2459,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									if (b_ClockSelection != APCI1710_40MHZ) {
 										ul_LowTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(double)
 											(ul_LowTimerValue)
@@ -2469,26 +2469,26 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 
 									break;
 
-				/******/
+									/******/
 									/* æs */
-				/******/
+									/******/
 
 								case 1:
 
-					/******************/
+									/******************/
 									/* Timer 0 factor */
-					/******************/
+									/******************/
 
 									ul_LowTimerValue
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_LowTiming
 										*
 										(0.25 * b_ClockSelection));
 
-					/*******************/
+									/*******************/
 									/* Round the value */
-					/*******************/
+									/*******************/
 
 									if ((double)((double)ul_LowTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
 										ul_LowTimerValue
@@ -2498,13 +2498,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											1;
 									}
 
-					/*****************************/
+									/*****************************/
 									/* Calculate the real timing */
-					/*****************************/
+									/*****************************/
 
 									ul_RealLowTiming
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_LowTimerValue
 										/
 										(0.25 * (double)b_ClockSelection));
@@ -2542,7 +2542,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									if (b_ClockSelection != APCI1710_40MHZ) {
 										ul_LowTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(double)
 											(ul_LowTimerValue)
@@ -2552,15 +2552,15 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 
 									break;
 
-				/******/
+									/******/
 									/* ms */
-				/******/
+									/******/
 
 								case 2:
 
-					/******************/
+									/******************/
 									/* Timer 0 factor */
-					/******************/
+									/******************/
 
 									ul_LowTimerValue
 										=
@@ -2570,9 +2570,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 										*
 										b_ClockSelection);
 
-					/*******************/
+									/*******************/
 									/* Round the value */
-					/*******************/
+									/*******************/
 
 									if ((double)((double)ul_LowTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
 										ul_LowTimerValue
@@ -2582,13 +2582,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											1;
 									}
 
-					/*****************************/
+									/*****************************/
 									/* Calculate the real timing */
-					/*****************************/
+									/*****************************/
 
 									ul_RealLowTiming
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_LowTimerValue
 										/
 										(250.0 * (double)b_ClockSelection));
@@ -2624,7 +2624,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									if (b_ClockSelection != APCI1710_40MHZ) {
 										ul_LowTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(double)
 											(ul_LowTimerValue)
@@ -2634,28 +2634,28 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 
 									break;
 
-				/*****/
+									/*****/
 									/* s */
-				/*****/
+									/*****/
 
 								case 3:
 
-					/******************/
+									/******************/
 									/* Timer 0 factor */
-					/******************/
+									/******************/
 
 									ul_LowTimerValue
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_LowTiming
 										*
 										(250000.0
 											*
 											b_ClockSelection));
 
-					/*******************/
+									/*******************/
 									/* Round the value */
-					/*******************/
+									/*******************/
 
 									if ((double)((double)ul_LowTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
 										ul_LowTimerValue
@@ -2665,13 +2665,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											1;
 									}
 
-					/*****************************/
+									/*****************************/
 									/* Calculate the real timing */
-					/*****************************/
+									/*****************************/
 
 									ul_RealLowTiming
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_LowTimerValue
 										/
 										(250000.0
@@ -2710,7 +2710,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									if (b_ClockSelection != APCI1710_40MHZ) {
 										ul_LowTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(double)
 											(ul_LowTimerValue)
@@ -2720,19 +2720,19 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 
 									break;
 
-				/******/
+									/******/
 									/* mn */
-				/******/
+									/******/
 
 								case 4:
 
-					/******************/
+									/******************/
 									/* Timer 0 factor */
-					/******************/
+									/******************/
 
 									ul_LowTimerValue
 										=
-										(ULONG)
+										(unsigned int)
 										(
 										(ul_LowTiming
 											*
@@ -2742,9 +2742,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											*
 											b_ClockSelection));
 
-					/*******************/
+									/*******************/
 									/* Round the value */
-					/*******************/
+									/*******************/
 
 									if ((double)((double)(ul_LowTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) {
 										ul_LowTimerValue
@@ -2754,13 +2754,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											1;
 									}
 
-					/*****************************/
+									/*****************************/
 									/* Calculate the real timing */
-					/*****************************/
+									/*****************************/
 
 									ul_RealLowTiming
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_LowTimerValue
 										/
 										(250000.0
@@ -2804,7 +2804,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									if (b_ClockSelection != APCI1710_40MHZ) {
 										ul_LowTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(double)
 											(ul_LowTimerValue)
@@ -2815,31 +2815,31 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									break;
 								}
 
-			     /*************************************/
+								/*************************************/
 								/* Calculate the high division fator */
-			     /*************************************/
+								/*************************************/
 
 								switch (b_TimingUnit) {
-				/******/
+									/******/
 									/* ns */
-				/******/
+									/******/
 
 								case 0:
 
-					/******************/
+									/******************/
 									/* Timer 0 factor */
-					/******************/
+									/******************/
 
 									ul_HighTimerValue
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_HighTiming
 										*
 										(0.00025 * b_ClockSelection));
 
-					/*******************/
+									/*******************/
 									/* Round the value */
-					/*******************/
+									/*******************/
 
 									if ((double)((double)ul_HighTiming * (0.00025 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
 										ul_HighTimerValue
@@ -2849,13 +2849,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											1;
 									}
 
-					/*****************************/
+									/*****************************/
 									/* Calculate the real timing */
-					/*****************************/
+									/*****************************/
 
 									ul_RealHighTiming
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_HighTimerValue
 										/
 										(0.00025 * (double)b_ClockSelection));
@@ -2891,7 +2891,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									if (b_ClockSelection != APCI1710_40MHZ) {
 										ul_HighTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(double)
 											(ul_HighTimerValue)
@@ -2901,26 +2901,26 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 
 									break;
 
-				/******/
+									/******/
 									/* æs */
-				/******/
+									/******/
 
 								case 1:
 
-					/******************/
+									/******************/
 									/* Timer 0 factor */
-					/******************/
+									/******************/
 
 									ul_HighTimerValue
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_HighTiming
 										*
 										(0.25 * b_ClockSelection));
 
-					/*******************/
+									/*******************/
 									/* Round the value */
-					/*******************/
+									/*******************/
 
 									if ((double)((double)ul_HighTiming * (0.25 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
 										ul_HighTimerValue
@@ -2930,13 +2930,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											1;
 									}
 
-					/*****************************/
+									/*****************************/
 									/* Calculate the real timing */
-					/*****************************/
+									/*****************************/
 
 									ul_RealHighTiming
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_HighTimerValue
 										/
 										(0.25 * (double)b_ClockSelection));
@@ -2974,7 +2974,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									if (b_ClockSelection != APCI1710_40MHZ) {
 										ul_HighTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(double)
 											(ul_HighTimerValue)
@@ -2984,15 +2984,15 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 
 									break;
 
-				/******/
+									/******/
 									/* ms */
-				/******/
+									/******/
 
 								case 2:
 
-					/******************/
+									/******************/
 									/* Timer 0 factor */
-					/******************/
+									/******************/
 
 									ul_HighTimerValue
 										=
@@ -3002,9 +3002,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 										*
 										b_ClockSelection);
 
-					/*******************/
+									/*******************/
 									/* Round the value */
-					/*******************/
+									/*******************/
 
 									if ((double)((double)ul_HighTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
 										ul_HighTimerValue
@@ -3014,13 +3014,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											1;
 									}
 
-					/*****************************/
+									/*****************************/
 									/* Calculate the real timing */
-					/*****************************/
+									/*****************************/
 
 									ul_RealHighTiming
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_HighTimerValue
 										/
 										(250.0 * (double)b_ClockSelection));
@@ -3056,7 +3056,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									if (b_ClockSelection != APCI1710_40MHZ) {
 										ul_HighTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(double)
 											(ul_HighTimerValue)
@@ -3066,28 +3066,28 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 
 									break;
 
-				/*****/
+									/*****/
 									/* s */
-				/*****/
+									/*****/
 
 								case 3:
 
-					/******************/
+									/******************/
 									/* Timer 0 factor */
-					/******************/
+									/******************/
 
 									ul_HighTimerValue
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_HighTiming
 										*
 										(250000.0
 											*
 											b_ClockSelection));
 
-					/*******************/
+									/*******************/
 									/* Round the value */
-					/*******************/
+									/*******************/
 
 									if ((double)((double)ul_HighTiming * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
 										ul_HighTimerValue
@@ -3097,13 +3097,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											1;
 									}
 
-					/*****************************/
+									/*****************************/
 									/* Calculate the real timing */
-					/*****************************/
+									/*****************************/
 
 									ul_RealHighTiming
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_HighTimerValue
 										/
 										(250000.0
@@ -3142,7 +3142,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									if (b_ClockSelection != APCI1710_40MHZ) {
 										ul_HighTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(double)
 											(ul_HighTimerValue)
@@ -3152,19 +3152,19 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 
 									break;
 
-				/******/
+									/******/
 									/* mn */
-				/******/
+									/******/
 
 								case 4:
 
-					/******************/
+									/******************/
 									/* Timer 0 factor */
-					/******************/
+									/******************/
 
 									ul_HighTimerValue
 										=
-										(ULONG)
+										(unsigned int)
 										(
 										(ul_HighTiming
 											*
@@ -3174,9 +3174,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											*
 											b_ClockSelection));
 
-					/*******************/
+									/*******************/
 									/* Round the value */
-					/*******************/
+									/*******************/
 
 									if ((double)((double)(ul_HighTiming * 60.0) * (250000.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) {
 										ul_HighTimerValue
@@ -3186,13 +3186,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 											1;
 									}
 
-					/*****************************/
+									/*****************************/
 									/* Calculate the real timing */
-					/*****************************/
+									/*****************************/
 
 									ul_RealHighTiming
 										=
-										(ULONG)
+										(unsigned int)
 										(ul_HighTimerValue
 										/
 										(250000.0
@@ -3236,7 +3236,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									if (b_ClockSelection != APCI1710_40MHZ) {
 										ul_HighTimerValue
 											=
-											(ULONG)
+											(unsigned int)
 											(
 											(double)
 											(ul_HighTimerValue)
@@ -3249,9 +3249,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 
 								fpu_end();
 
-			     /************************/
+								/************************/
 								/* Save the timing unit */
-			     /************************/
+								/************************/
 
 								devpriv->
 									s_ModuleInfo
@@ -3263,9 +3263,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									=
 									b_TimingUnit;
 
-			     /****************************/
+								/****************************/
 								/* Save the low base timing */
-			     /****************************/
+								/****************************/
 
 								devpriv->
 									s_ModuleInfo
@@ -3287,9 +3287,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									=
 									ul_RealLowTiming;
 
-			     /****************************/
+								/****************************/
 								/* Save the high base timing */
-			     /****************************/
+								/****************************/
 
 								devpriv->
 									s_ModuleInfo
@@ -3311,21 +3311,21 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									=
 									ul_RealHighTiming;
 
-			     /************************/
+								/************************/
 								/* Write the low timing */
-			     /************************/
+								/************************/
 
 								outl(ul_LowTimerValue, devpriv->s_BoardInfos.ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr));
 
-			     /*************************/
+								/*************************/
 								/* Write the high timing */
-			     /*************************/
+								/*************************/
 
 								outl(ul_HighTimerValue, devpriv->s_BoardInfos.ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr));
 
-			     /***************************/
+								/***************************/
 								/* Set the clock selection */
-			     /***************************/
+								/***************************/
 
 								dw_Command =
 									inl
@@ -3347,9 +3347,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 										0x80;
 								}
 
-			     /***************************/
+								/***************************/
 								/* Set the clock selection */
-			     /***************************/
+								/***************************/
 
 								outl(dw_Command,
 									devpriv->
@@ -3358,96 +3358,96 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 									+ 8 +
 									(20 * b_PWM) + (64 * b_ModulNbr));
 							} else {
-			     /***************************************/
+								/***************************************/
 								/* High base timing selection is wrong */
-			     /***************************************/
+								/***************************************/
 								DPRINTK("High base timing selection is wrong\n");
 								i_ReturnValue =
 									-8;
 							}
 						} else {
-			  /**************************************/
+							/**************************************/
 							/* Low base timing selection is wrong */
-			  /**************************************/
+							/**************************************/
 							DPRINTK("Low base timing selection is wrong\n");
 							i_ReturnValue = -7;
 						}
-					}	// if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4))
+					}	/*  if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
 					else {
-		       /**********************************/
+						/**********************************/
 						/* Timing unit selection is wrong */
-		       /**********************************/
+						/**********************************/
 						DPRINTK("Timing unit selection is wrong\n");
 						i_ReturnValue = -6;
-					}	// if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4))
-				}	// if (dw_Status & 0x10)
+					}	/*  if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
+				}	/*  if (dw_Status & 0x10) */
 				else {
-		    /***********************/
+					/***********************/
 					/* PWM not initialised */
-		    /***********************/
+					/***********************/
 					DPRINTK("PWM not initialised\n");
 					i_ReturnValue = -5;
-				}	// if (dw_Status & 0x10)
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+				}	/*  if (dw_Status & 0x10) */
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 			else {
-		 /******************************/
+				/******************************/
 				/* Tor PWM selection is wrong */
-		 /******************************/
+				/******************************/
 				DPRINTK("Tor PWM selection is wrong\n");
 				i_ReturnValue = -4;
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 		} else {
-	      /**********************************/
+			/**********************************/
 			/* The module is not a PWM module */
-	      /**********************************/
+			/**********************************/
 			DPRINTK("The module is not a PWM module\n");
 			i_ReturnValue = -3;
 		}
 	} else {
-	   /***********************/
+		/***********************/
 		/* Module number error */
-	   /***********************/
+		/***********************/
 		DPRINTK("Module number error\n");
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_GetPWMStatus                          |
-|                               (BYTE_    b_BoardHandle,                     |
-|                                BYTE_    b_ModulNbr,                        |
-|                                BYTE_    b_PWM,                             |
-|                                PBYTE_  pb_PWMOutputStatus,                 |
-|                                PBYTE_  pb_ExternGateStatus)                |
+|                               (unsigned char_    b_BoardHandle,                     |
+|                                unsigned char_    b_ModulNbr,                        |
+|                                unsigned char_    b_PWM,                             |
+|                                unsigned char *_  pb_PWMOutputStatus,                 |
+|                                unsigned char *_  pb_ExternGateStatus)                |
 +----------------------------------------------------------------------------+
 | Task              : Return the status from selected PWM (b_PWM) from       |
 |                     selected module (b_ModulNbr).                          |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_  b_BoardHandle : Handle of board APCI-1710       |
-|                     BYTE_  b_PWM         : Selected PWM (0 or 1)           |
-|                     BYTE_  b_ModulNbr    : Selected module number (0 to 3)
-	b_ModulNbr			=(BYTE)  CR_AREF(insn->chanspec);
-	b_PWM				=(BYTE)  data[0];
+| Input Parameters  : unsigned char_  b_BoardHandle : Handle of board APCI-1710       |
+|                     unsigned char_  b_PWM         : Selected PWM (0 or 1)           |
+|                     unsigned char_  b_ModulNbr    : Selected module number (0 to 3)
+	b_ModulNbr			=(unsigned char)  CR_AREF(insn->chanspec);
+	b_PWM				=(unsigned char)  data[0];
 
  |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_  pb_PWMOutputStatus  : Return the PWM output    |
+| Output Parameters : unsigned char *_  pb_PWMOutputStatus  : Return the PWM output    |
 |                                                   level status.            |
 |                                                    0 : The PWM output level|
 |                                                        is low.             |
 |                                                    1 : The PWM output level|
 |                                                        is high.            |
-|                     PBYTE_  pb_ExternGateStatus : Return the extern gate   |
+|                     unsigned char *_  pb_ExternGateStatus : Return the extern gate   |
 |                                                   level status.            |
 |                                                    0 : The extern gate is  |
 |                                                        low.                |
 |                                                    1 : The extern gate is  |
 |                                                        high.
-    pb_PWMOutputStatus	=(PBYTE) data[0];
-	pb_ExternGateStatus =(PBYTE) data[1];             |
+    pb_PWMOutputStatus	=(unsigned char *) data[0];
+	pb_ExternGateStatus =(unsigned char *) data[1];             |
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
 |                     -1: The handle parameter of the board is wrong         |
@@ -3460,109 +3460,109 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnReadGetPWMStatus(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_Status;
+	int i_ReturnValue = 0;
+	unsigned int dw_Status;
 
-	BYTE b_ModulNbr;
-	BYTE b_PWM;
-	PBYTE pb_PWMOutputStatus;
-	PBYTE pb_ExternGateStatus;
+	unsigned char b_ModulNbr;
+	unsigned char b_PWM;
+	unsigned char *pb_PWMOutputStatus;
+	unsigned char *pb_ExternGateStatus;
 
 	i_ReturnValue = insn->n;
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_PWM = (BYTE) CR_CHAN(insn->chanspec);
-	pb_PWMOutputStatus = (PBYTE) & data[0];
-	pb_ExternGateStatus = (PBYTE) & data[1];
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_PWM = (unsigned char) CR_CHAN(insn->chanspec);
+	pb_PWMOutputStatus = (unsigned char *) &data[0];
+	pb_ExternGateStatus = (unsigned char *) &data[1];
 
 	/**************************/
 	/* Test the module number */
 	/**************************/
 
 	if (b_ModulNbr < 4) {
-	   /***************/
+		/***************/
 		/* Test if PWM */
-	   /***************/
+		/***************/
 
 		if ((devpriv->s_BoardInfos.
 				dw_MolduleConfiguration[b_ModulNbr] &
 				0xFFFF0000UL) == APCI1710_PWM) {
-	      /**************************/
+			/**************************/
 			/* Test the PWM selection */
-	      /**************************/
+			/**************************/
 
 			if (b_PWM <= 1) {
-		 /***************************/
+				/***************************/
 				/* Test if PWM initialised */
-		 /***************************/
+				/***************************/
 
 				dw_Status = inl(devpriv->s_BoardInfos.
 					ui_Address + 12 + (20 * b_PWM) +
 					(64 * b_ModulNbr));
 
 				if (dw_Status & 0x10) {
-		    /***********************/
+					/***********************/
 					/* Test if PWM enabled */
-		    /***********************/
+					/***********************/
 
 					if (dw_Status & 0x1) {
 						*pb_PWMOutputStatus =
-							(BYTE) ((dw_Status >> 7)
+							(unsigned char) ((dw_Status >> 7)
 							& 1);
 						*pb_ExternGateStatus =
-							(BYTE) ((dw_Status >> 6)
+							(unsigned char) ((dw_Status >> 6)
 							& 1);
-					}	// if (dw_Status & 0x1)
+					}	/*  if (dw_Status & 0x1) */
 					else {
-		       /*******************/
+						/*******************/
 						/* PWM not enabled */
-		       /*******************/
+						/*******************/
 
 						DPRINTK("PWM not enabled \n");
 						i_ReturnValue = -6;
-					}	// if (dw_Status & 0x1)
-				}	// if (dw_Status & 0x10)
+					}	/*  if (dw_Status & 0x1) */
+				}	/*  if (dw_Status & 0x10) */
 				else {
-		    /***********************/
+					/***********************/
 					/* PWM not initialised */
-		    /***********************/
+					/***********************/
 
 					DPRINTK("PWM not initialised\n");
 					i_ReturnValue = -5;
-				}	// if (dw_Status & 0x10)
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+				}	/*  if (dw_Status & 0x10) */
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 			else {
-		 /******************************/
+				/******************************/
 				/* Tor PWM selection is wrong */
-		 /******************************/
+				/******************************/
 
 				DPRINTK("Tor PWM selection is wrong\n");
 				i_ReturnValue = -4;
-			}	// if (b_PWM >= 0 && b_PWM <= 1)
+			}	/*  if (b_PWM >= 0 && b_PWM <= 1) */
 		} else {
-	      /**********************************/
+			/**********************************/
 			/* The module is not a PWM module */
-	      /**********************************/
+			/**********************************/
 
 			DPRINTK("The module is not a PWM module\n");
 			i_ReturnValue = -3;
 		}
 	} else {
-	   /***********************/
+		/***********************/
 		/* Module number error */
-	   /***********************/
+		/***********************/
 
 		DPRINTK("Module number error\n");
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
-INT i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 	data[0] = devpriv->s_InterruptParameters.
 		s_FIFOInterruptParameters[devpriv->
@@ -3574,9 +3574,9 @@ INT i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device * dev,
 		s_FIFOInterruptParameters[devpriv->
 		s_InterruptParameters.ui_Read].ul_OldCounterLatchValue;
 
-			     /**************************/
+	/**************************/
 	/* Increment the read FIFO */
-			     /***************************/
+	/***************************/
 
 	devpriv->
 		s_InterruptParameters.

+ 35 - 35
drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.h

@@ -26,51 +26,51 @@
 #define APCI1710_PWM_ENABLE		1
 #define APCI1710_PWM_NEWTIMING		2
 
-INT i_APCI1710_InsnConfigPWM(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnConfigPWM(struct comedi_device *dev, struct comedi_subdevice *s,
 			     struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_InitPWM(struct comedi_device *dev,
-		       BYTE b_ModulNbr,
-		       BYTE b_PWM,
-		       BYTE b_ClockSelection,
-		       BYTE b_TimingUnit,
-		       ULONG ul_LowTiming,
-		       ULONG ul_HighTiming,
-		       PULONG pul_RealLowTiming, PULONG pul_RealHighTiming);
+int i_APCI1710_InitPWM(struct comedi_device *dev,
+		       unsigned char b_ModulNbr,
+		       unsigned char b_PWM,
+		       unsigned char b_ClockSelection,
+		       unsigned char b_TimingUnit,
+		       unsigned int ul_LowTiming,
+		       unsigned int ul_HighTiming,
+		       unsigned int *pul_RealLowTiming, unsigned int *pul_RealHighTiming);
 
-INT i_APCI1710_GetPWMInitialisation(struct comedi_device *dev,
-				    BYTE b_ModulNbr,
-				    BYTE b_PWM,
-				    PBYTE pb_TimingUnit,
-				    PULONG pul_LowTiming,
-				    PULONG pul_HighTiming,
-				    PBYTE pb_StartLevel,
-				    PBYTE pb_StopMode,
-				    PBYTE pb_StopLevel,
-				    PBYTE pb_ExternGate,
-				    PBYTE pb_InterruptEnable, PBYTE pb_Enable);
+int i_APCI1710_GetPWMInitialisation(struct comedi_device *dev,
+				    unsigned char b_ModulNbr,
+				    unsigned char b_PWM,
+				    unsigned char *pb_TimingUnit,
+				    unsigned int *pul_LowTiming,
+				    unsigned int *pul_HighTiming,
+				    unsigned char *pb_StartLevel,
+				    unsigned char *pb_StopMode,
+				    unsigned char *pb_StopLevel,
+				    unsigned char *pb_ExternGate,
+				    unsigned char *pb_InterruptEnable, unsigned char *pb_Enable);
 
-INT i_APCI1710_InsnWritePWM(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnWritePWM(struct comedi_device *dev, struct comedi_subdevice *s,
 			    struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_EnablePWM(struct comedi_device *dev,
-			 BYTE b_ModulNbr,
-			 BYTE b_PWM,
-			 BYTE b_StartLevel,
-			 BYTE b_StopMode,
-			 BYTE b_StopLevel, BYTE b_ExternGate,
-			 BYTE b_InterruptEnable);
+int i_APCI1710_EnablePWM(struct comedi_device *dev,
+			 unsigned char b_ModulNbr,
+			 unsigned char b_PWM,
+			 unsigned char b_StartLevel,
+			 unsigned char b_StopMode,
+			 unsigned char b_StopLevel, unsigned char b_ExternGate,
+			 unsigned char b_InterruptEnable);
 
-INT i_APCI1710_SetNewPWMTiming(struct comedi_device *dev,
-			       BYTE b_ModulNbr,
-			       BYTE b_PWM, BYTE b_TimingUnit,
-			       ULONG ul_LowTiming, ULONG ul_HighTiming);
+int i_APCI1710_SetNewPWMTiming(struct comedi_device *dev,
+			       unsigned char b_ModulNbr,
+			       unsigned char b_PWM, unsigned char b_TimingUnit,
+			       unsigned int ul_LowTiming, unsigned int ul_HighTiming);
 
-INT i_APCI1710_DisablePWM(struct comedi_device *dev, BYTE b_ModulNbr, BYTE b_PWM);
+int i_APCI1710_DisablePWM(struct comedi_device *dev, unsigned char b_ModulNbr, unsigned char b_PWM);
 
-INT i_APCI1710_InsnReadGetPWMStatus(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device *dev, struct comedi_subdevice *s,
 				    struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device *dev,
+int i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device *dev,
 					struct comedi_subdevice *s,
 					struct comedi_insn *insn, unsigned int *data);

+ 114 - 116
drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.c

@@ -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.
 
@@ -65,31 +65,31 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_InitSSI                               |
-|                               (BYTE_    b_BoardHandle,                     |
-|                                BYTE_    b_ModulNbr,                        |
-|                                BYTE_    b_SSIProfile,                      |
-|                                BYTE_    b_PositionTurnLength,              |
-|                                BYTE_    b_TurnCptLength,                   |
-|                                BYTE_    b_PCIInputClock,                   |
+|                               (unsigned char_    b_BoardHandle,                     |
+|                                unsigned char_    b_ModulNbr,                        |
+|                                unsigned char_    b_SSIProfile,                      |
+|                                unsigned char_    b_PositionTurnLength,              |
+|                                unsigned char_    b_TurnCptLength,                   |
+|                                unsigned char_    b_PCIInputClock,                   |
 |                                ULONG_  ul_SSIOutputClock,                  |
-|                                BYTE_    b_SSICountingMode)                 |
+|                                unsigned char_    b_SSICountingMode)                 |
 +----------------------------------------------------------------------------+
 | Task              : Configure the SSI operating mode from selected module  |
 |                     (b_ModulNbr). You must calling this function be for you|
 |                     call any other function witch access of SSI.           |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle         : Handle of board APCI-1710|
-|                     BYTE_ b_ModulNbr            : Module number to         |
+| Input Parameters  : unsigned char_ b_BoardHandle         : Handle of board APCI-1710|
+|                     unsigned char_ b_ModulNbr            : Module number to         |
 |                                                   configure (0 to 3)       |
-|                     BYTE_  b_SSIProfile         : Selection from SSI       |
+|                     unsigned char_  b_SSIProfile         : Selection from SSI       |
 |                                                   profile length (2 to 32).|
-|                     BYTE_  b_PositionTurnLength : Selection from SSI       |
+|                     unsigned char_  b_PositionTurnLength : Selection from SSI       |
 |                                                   position data length     |
 |                                                   (1 to 31).               |
-|                     BYTE_  b_TurnCptLength      : Selection from SSI turn  |
+|                     unsigned char_  b_TurnCptLength      : Selection from SSI turn  |
 |                                                   counter data length      |
 |                                                   (1 to 31).               |
-|                     BYTE   b_PCIInputClock      : Selection from PCI bus   |
+|                     unsigned char   b_PCIInputClock      : Selection from PCI bus   |
 |                                                   clock                    |
 |                                                 - APCI1710_30MHZ :         |
 |                                                   The PC have a PCI bus    |
@@ -103,7 +103,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                                                   for 30 MHz selection.    |
 |                                                   From  252 to 5 000 000 Hz|
 |                                                   for 33 MHz selection.    |
-|                     BYTE   b_SSICountingMode    : SSI counting mode        |
+|                     unsigned char   b_SSICountingMode    : SSI counting mode        |
 |                                                   selection                |
 |                                                 - APCI1710_BINARY_MODE :   |
 |                                                    Binary counting mode.   |
@@ -111,12 +111,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                                                    Gray counting mode.
 
 	b_ModulNbr			= CR_AREF(insn->chanspec);
-	b_SSIProfile		= (BYTE) data[0];
-	b_PositionTurnLength= (BYTE) data[1];
-	b_TurnCptLength		= (BYTE) data[2];
-	b_PCIInputClock		= (BYTE) data[3];
-	ul_SSIOutputClock	= (ULONG) data[4];
-	b_SSICountingMode	= (BYTE)  data[5];     |
+	b_SSIProfile		= (unsigned char) data[0];
+	b_PositionTurnLength= (unsigned char) data[1];
+	b_TurnCptLength		= (unsigned char) data[2];
+	b_PCIInputClock		= (unsigned char) data[3];
+	ul_SSIOutputClock	= (unsigned int) data[4];
+	b_SSICountingMode	= (unsigned char)  data[5];     |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -133,22 +133,22 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnConfigInitSSI(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	UINT ui_TimerValue;
-	BYTE b_ModulNbr, b_SSIProfile, b_PositionTurnLength, b_TurnCptLength,
+	int i_ReturnValue = 0;
+	unsigned int ui_TimerValue;
+	unsigned char b_ModulNbr, b_SSIProfile, b_PositionTurnLength, b_TurnCptLength,
 		b_PCIInputClock, b_SSICountingMode;
-	ULONG ul_SSIOutputClock;
+	unsigned int ul_SSIOutputClock;
 
 	b_ModulNbr = CR_AREF(insn->chanspec);
-	b_SSIProfile = (BYTE) data[0];
-	b_PositionTurnLength = (BYTE) data[1];
-	b_TurnCptLength = (BYTE) data[2];
-	b_PCIInputClock = (BYTE) data[3];
-	ul_SSIOutputClock = (ULONG) data[4];
-	b_SSICountingMode = (BYTE) data[5];
+	b_SSIProfile = (unsigned char) data[0];
+	b_PositionTurnLength = (unsigned char) data[1];
+	b_TurnCptLength = (unsigned char) data[2];
+	b_PCIInputClock = (unsigned char) data[3];
+	ul_SSIOutputClock = (unsigned int) data[4];
+	b_SSICountingMode = (unsigned char) data[5];
 
 	i_ReturnValue = insn->n;
 	/**************************/
@@ -167,7 +167,7 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde
 			/* Test the SSI profile length */
 	      /*******************************/
 
-			// CG 22/03/00 b_SSIProfile >= 2 anstatt b_SSIProfile > 2
+			/*  CG 22/03/00 b_SSIProfile >= 2 anstatt b_SSIProfile > 2 */
 			if (b_SSIProfile >= 2 && b_SSIProfile < 33) {
 		 /*************************************/
 				/* Test the SSI position data length */
@@ -250,9 +250,9 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde
 
 										ui_TimerValue
 											=
-											(UINT)
+											(unsigned int)
 											(
-											((ULONG) (b_PCIInputClock) * 500000UL) / ul_SSIOutputClock);
+											((unsigned int) (b_PCIInputClock) * 500000UL) / ul_SSIOutputClock);
 
 				   /************************/
 										/* Initialise the timer */
@@ -351,18 +351,18 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_  i_APCI1710_Read1SSIValue                        |
-|                               (BYTE_     b_BoardHandle,                    |
-|                                BYTE_     b_ModulNbr,                       |
-|                                BYTE_     b_SelectedSSI,                    |
+|                               (unsigned char_     b_BoardHandle,                    |
+|                                unsigned char_     b_ModulNbr,                       |
+|                                unsigned char_     b_SelectedSSI,                    |
 |                                PULONG_ pul_Position,                       |
 |                                PULONG_ pul_TurnCpt)
- INT i_APCI1710_ReadSSIValue(struct comedi_device *dev,struct comedi_subdevice *s,
+ int i_APCI1710_ReadSSIValue(struct comedi_device *dev,struct comedi_subdevice *s,
 	struct comedi_insn *insn,unsigned int *data)                       |
 +----------------------------------------------------------------------------+
 | Task              :
@@ -373,22 +373,22 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde
 						or Read all SSI counter (b_SelectedSSI) from              |
 |                     selected module (b_ModulNbr).                            |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle         : Handle of board APCI-1710|
-|                     BYTE_ b_ModulNbr            : Module number to         |
+| Input Parameters  : unsigned char_ b_BoardHandle         : Handle of board APCI-1710|
+|                     unsigned char_ b_ModulNbr            : Module number to         |
 |                                                   configure (0 to 3)       |
-|                     BYTE_ b_SelectedSSI         : Selection from SSI       |
+|                     unsigned char_ b_SelectedSSI         : Selection from SSI       |
 |                                                   counter (0 to 2)
 
-    b_ModulNbr		=   (BYTE) CR_AREF(insn->chanspec);
-	b_SelectedSSI	=	(BYTE) CR_CHAN(insn->chanspec); (in case of single ssi)
-	b_ReadType		=	(BYTE) CR_RANGE(insn->chanspec);
+    b_ModulNbr		=   (unsigned char) CR_AREF(insn->chanspec);
+	b_SelectedSSI	=	(unsigned char) CR_CHAN(insn->chanspec); (in case of single ssi)
+	b_ReadType		=	(unsigned char) CR_RANGE(insn->chanspec);
 |
 +----------------------------------------------------------------------------+
 | Output Parameters : PULONG_  pul_Position       : SSI position in the turn |
 |                     PULONG_  pul_TurnCpt        : Number of turns
 
-pul_Position	=	(PULONG) &data[0];
-	pul_TurnCpt		=	(PULONG) &data[1];         |
+pul_Position	=	(unsigned int *) &data[0];
+	pul_TurnCpt		=	(unsigned int *) &data[1];         |
 +----------------------------------------------------------------------------+
 | Return Value      : 0: No error                                            |
 |                    -1: The handle parameter of the board is wrong          |
@@ -400,37 +400,37 @@ pul_Position	=	(PULONG) &data[0];
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnReadSSIValue(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	BYTE b_Cpt;
-	BYTE b_Length;
-	BYTE b_Schift;
-	BYTE b_SSICpt;
-	DWORD dw_And;
-	DWORD dw_And1;
-	DWORD dw_And2;
-	DWORD dw_StatusReg;
-	DWORD dw_CounterValue;
-	BYTE b_ModulNbr;
-	BYTE b_SelectedSSI;
-	BYTE b_ReadType;
-	PULONG pul_Position;
-	PULONG pul_TurnCpt;
-	PULONG pul_Position1;
-	PULONG pul_TurnCpt1;
+	int i_ReturnValue = 0;
+	unsigned char b_Cpt;
+	unsigned char b_Length;
+	unsigned char b_Schift;
+	unsigned char b_SSICpt;
+	unsigned int dw_And;
+	unsigned int dw_And1;
+	unsigned int dw_And2;
+	unsigned int dw_StatusReg;
+	unsigned int dw_CounterValue;
+	unsigned char b_ModulNbr;
+	unsigned char b_SelectedSSI;
+	unsigned char b_ReadType;
+	unsigned int *pul_Position;
+	unsigned int *pul_TurnCpt;
+	unsigned int *pul_Position1;
+	unsigned int *pul_TurnCpt1;
 
 	i_ReturnValue = insn->n;
-	pul_Position1 = (PULONG) & data[0];
-// For Read1
-	pul_TurnCpt1 = (PULONG) & data[1];
-// For Read all
-	pul_Position = (PULONG) & data[0];	//0-2
-	pul_TurnCpt = (PULONG) & data[3];	//3-5
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_SelectedSSI = (BYTE) CR_CHAN(insn->chanspec);
-	b_ReadType = (BYTE) CR_RANGE(insn->chanspec);
+	pul_Position1 = (unsigned int *) &data[0];
+/* For Read1 */
+	pul_TurnCpt1 = (unsigned int *) &data[1];
+/* For Read all */
+	pul_Position = (unsigned int *) &data[0];	/* 0-2 */
+	pul_TurnCpt = (unsigned int *) &data[3];	/* 3-5 */
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_SelectedSSI = (unsigned char) CR_CHAN(insn->chanspec);
+	b_ReadType = (unsigned char) CR_RANGE(insn->chanspec);
 
 	/**************************/
 	/* Test the module number */
@@ -477,9 +477,8 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev
 								s_BoardInfos.
 								ui_Address +
 								(64 * b_ModulNbr));
-						}
-						while ((dw_StatusReg & 0x1) !=
-							0);
+						} while ((dw_StatusReg & 0x1)
+							 != 0);
 
 		    /******************************/
 						/* Read the SSI counter value */
@@ -608,8 +607,7 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev
 							s_BoardInfos.
 							ui_Address +
 							(64 * b_ModulNbr));
-					}
-					while ((dw_StatusReg & 0x1) != 0);
+					} while ((dw_StatusReg & 0x1) != 0);
 
 					for (b_SSICpt = 0; b_SSICpt < 3;
 						b_SSICpt++) {
@@ -667,7 +665,7 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev
 				default:
 					printk("Read Type Inputs Wrong\n");
 
-				}	// switch  ending
+				}	/*  switch  ending */
 
 			} else {
 		 /***********************/
@@ -695,16 +693,16 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_   i_APCI1710_ReadSSI1DigitalInput                |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
-|                                        BYTE_     b_InputChannel,           |
-|                                        PBYTE_   pb_ChannelStatus)          |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
+|                                        unsigned char_     b_InputChannel,           |
+|                                        unsigned char *_   pb_ChannelStatus)          |
 +----------------------------------------------------------------------------+
 | Task              :
 					(0) Set the digital output from selected SSI moule         |
@@ -716,13 +714,13 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev
                     (3)Read the status from all SSI digital inputs from       |
 |                     selected SSI module (b_ModulNbr)                   |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle         : Handle of board APCI-1710|
-|                     BYTE_ b_ModulNbr    CR_AREF        : Module number to         |
+| Input Parameters  : unsigned char_ b_BoardHandle         : Handle of board APCI-1710|
+|                     unsigned char_ b_ModulNbr    CR_AREF        : Module number to         |
 |                                                   configure (0 to 3)       |
-|                     BYTE_ b_InputChannel CR_CHAN       : Selection from digital   |
+|                     unsigned char_ b_InputChannel CR_CHAN       : Selection from digital   |
 |                        data[0] which IOTYPE                           input ( 0 to 2)          |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_  pb_ChannelStatus    : Digital input channel    |
+| Output Parameters : unsigned char *_  pb_ChannelStatus    : Digital input channel    |
 |                                 data[0]                  status                   |
 |                                                   0 : Channle is not active|
 |                                                   1 : Channle is active    |
@@ -735,19 +733,19 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg;
-	BYTE b_ModulNbr;
-	BYTE b_InputChannel;
-	PBYTE pb_ChannelStatus;
-	PBYTE pb_InputStatus;
-	BYTE b_IOType;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg;
+	unsigned char b_ModulNbr;
+	unsigned char b_InputChannel;
+	unsigned char *pb_ChannelStatus;
+	unsigned char *pb_InputStatus;
+	unsigned char b_IOType;
 	i_ReturnValue = insn->n;
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_IOType = (BYTE) data[0];
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_IOType = (unsigned char) data[0];
 
 	/**************************/
 	/* Test the module number */
@@ -785,8 +783,8 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su
 				/* Test the digital imnput channel number */
 				   /******************************************/
 
-				b_InputChannel = (BYTE) CR_CHAN(insn->chanspec);
-				pb_ChannelStatus = (PBYTE) & data[0];
+				b_InputChannel = (unsigned char) CR_CHAN(insn->chanspec);
+				pb_ChannelStatus = (unsigned char *) &data[0];
 
 				if (b_InputChannel <= 2) {
 					/**************************/
@@ -797,7 +795,7 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su
 						inl(devpriv->s_BoardInfos.
 						ui_Address + (64 * b_ModulNbr));
 					*pb_ChannelStatus =
-						(BYTE) (((~dw_StatusReg) >> (4 +
+						(unsigned char) (((~dw_StatusReg) >> (4 +
 								b_InputChannel))
 						& 1);
 				} else {
@@ -814,19 +812,19 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su
 					/**************************/
 				/* Read all digital input */
 					/**************************/
-				pb_InputStatus = (PBYTE) & data[0];
+				pb_InputStatus = (unsigned char *) &data[0];
 
 				dw_StatusReg =
 					inl(devpriv->s_BoardInfos.ui_Address +
 					(64 * b_ModulNbr));
 				*pb_InputStatus =
-					(BYTE) (((~dw_StatusReg) >> 4) & 7);
+					(unsigned char) (((~dw_StatusReg) >> 4) & 7);
 				break;
 
 			default:
 				printk("IO type wrong\n");
 
-			}	//switch end
+			}	/* switch end */
 		} else {
 	      /**********************************/
 			/* The module is not a SSI module */
@@ -844,5 +842,5 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }

+ 3 - 3
drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.h

@@ -33,11 +33,11 @@
 /*
  * SSI INISIALISATION FUNCTION
  */
-INT i_APCI1710_InsnConfigInitSSI(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnConfigInitSSI(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_InsnReadSSIValue(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnReadSSIValue(struct comedi_device *dev, struct comedi_subdevice *s,
 				struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s,
 				    struct comedi_insn *insn, unsigned int *data);

+ 216 - 216
drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c

@@ -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.
 
@@ -63,11 +63,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_     i_APCI1710_InitTorCounter                    |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
-|                                        BYTE_     b_TorCounter,             |
-|                                        BYTE_     b_PCIInputClock,          |
-|                                        BYTE_     b_TimingUnit,             |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
+|                                        unsigned char_     b_TorCounter,             |
+|                                        unsigned char_     b_PCIInputClock,          |
+|                                        unsigned char_     b_TimingUnit,             |
 |                                        ULONG_   ul_TimingInterval,         |
 |                                        PULONG_ pul_RealTimingInterval)     |
 +----------------------------------------------------------------------------+
@@ -82,11 +82,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 | Input Parameters  :    |
 |
-		CR_AREF	BYTE_   b_ModulNbr       : Module number to configure  |
+		CR_AREF	unsigned char_   b_ModulNbr       : Module number to configure  |
 |                                                (0 to 3)                    |
-|           data[0] BYTE_   b_TorCounter     : Tor counter selection       |
+|           data[0] unsigned char_   b_TorCounter     : Tor counter selection       |
 |                                                (0 or 1).                   |
-|           data[1] BYTE_   b_PCIInputClock  : Selection from PCI bus clock|
+|           data[1] unsigned char_   b_PCIInputClock  : Selection from PCI bus clock|
 |                                                - APCI1710_30MHZ :          |
 |                                                  The PC have a PCI bus     |
 |                                                  clock from 30 MHz         |
@@ -104,7 +104,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |						   than it is not possibl to |
 |						   used the gate input for   |
 |						   enabled the acquisition   |
-|           data[2] BYTE_   b_TimingUnit    : Base timing unit (0 to 4)    |
+|           data[2] unsigned char_   b_TimingUnit    : Base timing unit (0 to 4)    |
 |                                                 0 : ns                     |
 |                                                 1 : µs                     |
 |                                                 2 : ms                     |
@@ -130,27 +130,27 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	ULONG ul_TimerValue = 0;
-	DWORD dw_Command;
+	int i_ReturnValue = 0;
+	unsigned int ul_TimerValue = 0;
+	unsigned int dw_Command;
 	double d_RealTimingInterval = 0;
-	BYTE b_ModulNbr;
-	BYTE b_TorCounter;
-	BYTE b_PCIInputClock;
-	BYTE b_TimingUnit;
-	ULONG ul_TimingInterval;
-	ULONG ul_RealTimingInterval = 0;
+	unsigned char b_ModulNbr;
+	unsigned char b_TorCounter;
+	unsigned char b_PCIInputClock;
+	unsigned char b_TimingUnit;
+	unsigned int ul_TimingInterval;
+	unsigned int ul_RealTimingInterval = 0;
 
 	i_ReturnValue = insn->n;
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
 
-	b_TorCounter = (BYTE) data[0];
-	b_PCIInputClock = (BYTE) data[1];
-	b_TimingUnit = (BYTE) data[2];
-	ul_TimingInterval = (ULONG) data[3];
+	b_TorCounter = (unsigned char) data[0];
+	b_PCIInputClock = (unsigned char) data[1];
+	b_TimingUnit = (unsigned char) data[2];
+	ul_TimingInterval = (unsigned int) data[3];
 	printk("INPUT clock %d\n", b_PCIInputClock);
 
 		/**************************/
@@ -225,7 +225,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 											ul_TimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimingInterval
 												*
 												(0.00025 * b_PCIInputClock));
@@ -248,7 +248,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 											ul_RealTimingInterval
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimerValue
 												/
 												(0.00025 * (double)b_PCIInputClock));
@@ -284,7 +284,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 												ul_TimerValue
 													=
-													(ULONG)
+													(unsigned int)
 													(
 													(double)
 													(ul_TimerValue)
@@ -306,7 +306,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 											ul_TimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimingInterval
 												*
 												(0.25 * b_PCIInputClock));
@@ -329,7 +329,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 											ul_RealTimingInterval
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimerValue
 												/
 												(0.25 * (double)b_PCIInputClock));
@@ -367,7 +367,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 												ul_TimerValue
 													=
-													(ULONG)
+													(unsigned int)
 													(
 													(double)
 													(ul_TimerValue)
@@ -413,7 +413,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 											ul_RealTimingInterval
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimerValue
 												/
 												(250.0 * (double)b_PCIInputClock));
@@ -449,7 +449,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 												ul_TimerValue
 													=
-													(ULONG)
+													(unsigned int)
 													(
 													(double)
 													(ul_TimerValue)
@@ -471,7 +471,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 											ul_TimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimingInterval
 												*
 												(250000.0
@@ -496,7 +496,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 											ul_RealTimingInterval
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimerValue
 												/
 												(250000.0
@@ -535,7 +535,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 												ul_TimerValue
 													=
-													(ULONG)
+													(unsigned int)
 													(
 													(double)
 													(ul_TimerValue)
@@ -557,7 +557,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 											ul_TimerValue
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(ul_TimingInterval
 													*
@@ -585,7 +585,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 											ul_RealTimingInterval
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimerValue
 												/
 												(250000.0
@@ -629,7 +629,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 												ul_TimerValue
 													=
-													(ULONG)
+													(unsigned int)
 													(
 													(double)
 													(ul_TimerValue)
@@ -641,7 +641,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 										}
 
 										fpu_end();
-									}	// if (b_PCIInputClock != APCI1710_GATE_INPUT)
+									}	/*  if (b_PCIInputClock != APCI1710_GATE_INPUT) */
 									else {
 				   /*************************************************************/
 										/* 2 Clock used for the overflow and the reload from counter */
@@ -652,7 +652,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 											ul_TimingInterval
 											-
 											2;
-									}	// if (b_PCIInputClock != APCI1710_GATE_INPUT)
+									}	/*  if (b_PCIInputClock != APCI1710_GATE_INPUT) */
 
 				/****************************/
 									/* Save the PCI input clock */
@@ -814,7 +814,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 							DPRINTK("Base timing selection is wrong\n");
 							i_ReturnValue = -7;
 						}
-					}	// if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4))
+					}	/*  if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
 					else {
 		       /**********************************/
 						/* Timing unit selection is wrong */
@@ -822,8 +822,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 						DPRINTK("Timing unit selection is wrong\n");
 						i_ReturnValue = -6;
-					}	// if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4))
-				}	// if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ))
+					}	/*  if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
+				}	/*  if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */
 				else {
 		    /*****************************************/
 					/* The selected PCI input clock is wrong */
@@ -831,8 +831,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 					DPRINTK("The selected PCI input clock is wrong\n");
 					i_ReturnValue = -5;
-				}	// if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ))
-			}	// if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7)
+				}	/*  if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */
+			}	/*  if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) */
 			else {
 		 /**********************************/
 				/* Tor Counter selection is wrong */
@@ -840,7 +840,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 				DPRINTK("Tor Counter selection is wrong\n");
 				i_ReturnValue = -4;
-			}	// if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7)
+			}	/*  if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) */
 		} else {
 	      /******************************************/
 			/* The module is not a tor counter module */
@@ -857,20 +857,20 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 		DPRINTK("Module number error\n");
 		i_ReturnValue = -2;
 	}
-	data[0] = (UINT) ul_RealTimingInterval;
-	return (i_ReturnValue);
+	data[0] = (unsigned int) ul_RealTimingInterval;
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_EnableTorCounter                      |
-|                                               (BYTE_ b_BoardHandle,        |
-|                                                BYTE_ b_ModulNbr,           |
-|						 BYTE_ b_TorCounter,         |
-|						 BYTE_ b_InputMode,          |
-|						 BYTE_ b_ExternGate,         |
-|                                                BYTE_ b_CycleMode,          |
-|                                                BYTE_ b_InterruptEnable)    |
+|                                               (unsigned char_ b_BoardHandle,        |
+|                                                unsigned char_ b_ModulNbr,           |
+|						 unsigned char_ b_TorCounter,         |
+|						 unsigned char_ b_InputMode,          |
+|						 unsigned char_ b_ExternGate,         |
+|                                                unsigned char_ b_CycleMode,          |
+|                                                unsigned char_ b_InterruptEnable)    |
 +----------------------------------------------------------------------------+
 | Task              : Enable the tor counter (b_TorCounter) from selected    |
 |		      module (b_ModulNbr). You must calling the              |
@@ -883,13 +883,13 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 |                     The b_CycleMode parameter determine if you will        |
 |                     measured a single or more cycle.                       |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle  : Handle of board APCI-1710       |
-|                     BYTE_ b_ModulNbr     : Selected module number (0 to 3) |
-|                     BYTE_ b_TorCounter   : Tor counter selection (0 or 1). |
-|		      BYTE_ b_InputMode    : Input signal level selection    |
+| Input Parameters  : unsigned char_ b_BoardHandle  : Handle of board APCI-1710       |
+|                     unsigned char_ b_ModulNbr     : Selected module number (0 to 3) |
+|                     unsigned char_ b_TorCounter   : Tor counter selection (0 or 1). |
+|		      unsigned char_ b_InputMode    : Input signal level selection    |
 |						0 : Tor count each low level |
 |						1 : Tor count each high level|
-|		      BYTE_ b_ExternGate   : Extern gate action selection    |
+|		      unsigned char_ b_ExternGate   : Extern gate action selection    |
 |						0 : Extern gate signal not   |
 |						    used                     |
 |						1 : Extern gate signal used. |
@@ -928,9 +928,9 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 |					      The gate input is used for the |
 |					      signal B                       |
 |									     |
-|                     BYTE_ b_CycleMode    : Selected the tor counter        |
+|                     unsigned char_ b_CycleMode    : Selected the tor counter        |
 |                                            acquisition mode                |
-|                     BYTE_ b_InterruptEnable : Enable or disable the        |
+|                     unsigned char_ b_InterruptEnable : Enable or disable the        |
 |                                               tor counter interrupt.       |
 |                                               APCI1710_ENABLE:             |
 |                                               Enable the tor counter       |
@@ -959,9 +959,9 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_DisableTorCounter                     |
-|                                               (BYTE_  b_BoardHandle,       |
-|                                                BYTE_  b_ModulNbr,          |
-|						 BYTE_  b_TorCounter)        |
+|                                               (unsigned char_  b_BoardHandle,       |
+|                                                unsigned char_  b_ModulNbr,          |
+|						 unsigned char_  b_TorCounter)        |
 +----------------------------------------------------------------------------+
 | Task              : Disable the tor counter (b_TorCounter) from selected   |
 |		      module (b_ModulNbr). If you disable the tor counter    |
@@ -969,9 +969,9 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 |		      counter witch the " i_APCI1710_EnableTorCounter"       |
 |		      function, the status register is cleared               |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle  : Handle of board APCI-1710       |
-|                     BYTE_ b_ModulNbr     : Selected module number (0 to 3) |
-|                     BYTE_ b_TorCounter   : Tor counter selection (0 or 1). |
+| Input Parameters  : unsigned char_ b_BoardHandle  : Handle of board APCI-1710       |
+|                     unsigned char_ b_ModulNbr     : Selected module number (0 to 3) |
+|                     unsigned char_ b_TorCounter   : Tor counter selection (0 or 1). |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -987,29 +987,29 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_Status;
-	DWORD dw_DummyRead;
-	DWORD dw_ConfigReg;
-	BYTE b_ModulNbr, b_Action;
-	BYTE b_TorCounter;
-	BYTE b_InputMode;
-	BYTE b_ExternGate;
-	BYTE b_CycleMode;
-	BYTE b_InterruptEnable;
-
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_Action = (BYTE) data[0];	// enable or disable
-	b_TorCounter = (BYTE) data[1];
-	b_InputMode = (BYTE) data[2];
-	b_ExternGate = (BYTE) data[3];
-	b_CycleMode = (BYTE) data[4];
-	b_InterruptEnable = (BYTE) data[5];
+	int i_ReturnValue = 0;
+	unsigned int dw_Status;
+	unsigned int dw_DummyRead;
+	unsigned int dw_ConfigReg;
+	unsigned char b_ModulNbr, b_Action;
+	unsigned char b_TorCounter;
+	unsigned char b_InputMode;
+	unsigned char b_ExternGate;
+	unsigned char b_CycleMode;
+	unsigned char b_InterruptEnable;
+
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_Action = (unsigned char) data[0];	/*  enable or disable */
+	b_TorCounter = (unsigned char) data[1];
+	b_InputMode = (unsigned char) data[2];
+	b_ExternGate = (unsigned char) data[3];
+	b_CycleMode = (unsigned char) data[4];
+	b_InterruptEnable = (unsigned char) data[5];
 	i_ReturnValue = insn->n;;
-	devpriv->tsk_Current = current;	// Save the current process task structure
+	devpriv->tsk_Current = current;	/*  Save the current process task structure */
 	/**************************/
 	/* Test the module number */
 	/**************************/
@@ -1027,7 +1027,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 	      /**********************************/
 
 			if (b_TorCounter <= 1) {
-				switch (b_Action)	// Enable or Disable
+				switch (b_Action)	/*  Enable or Disable */
 				{
 				case APCI1710_ENABLE:
 		 /***********************************/
@@ -1149,7 +1149,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 													|
 													0x780;
 
-											}	// if (b_InputMode == APCI1710_TOR_SIMPLE_MODE)
+											}	/*  if (b_InputMode == APCI1710_TOR_SIMPLE_MODE) */
 
 				      /***********************/
 											/* Test if double mode */
@@ -1166,12 +1166,12 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 													|
 													0x180;
 
-											}	// if (b_InputMode == APCI1710_TOR_DOUBLE_MODE)
+											}	/*  if (b_InputMode == APCI1710_TOR_DOUBLE_MODE) */
 
 											b_InputMode
 												=
 												0;
-										}	// if (b_InputMode > 1)
+										}	/*  if (b_InputMode > 1) */
 
 				   /*******************/
 										/* Set the command */
@@ -1237,7 +1237,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 
 										outl(1, devpriv->s_BoardInfos.ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr));
 
-									}	// if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE))
+									}	/*  if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */
 									else {
 				/********************************/
 										/* Interrupt parameter is wrong */
@@ -1247,8 +1247,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 										i_ReturnValue
 											=
 											-9;
-									}	// if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE))
-								}	// if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS))
+									}	/*  if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */
+								}	/*  if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */
 								else {
 			     /***********************************************/
 									/* Tor counter acquisition mode cycle is wrong */
@@ -1258,8 +1258,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 									i_ReturnValue
 										=
 										-8;
-								}	// if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS))
-							}	// if (b_ExternGate >= 0 && b_ExternGate <= 1)
+								}	/*  if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */
+							}	/*  if (b_ExternGate >= 0 && b_ExternGate <= 1) */
 							else {
 			  /***********************************/
 								/* Extern gate input mode is wrong */
@@ -1268,8 +1268,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 								DPRINTK("Extern gate input mode is wrong\n");
 								i_ReturnValue =
 									-7;
-							}	// if (b_ExternGate >= 0 && b_ExternGate <= 1)
-						}	// if (b_InputMode >= 0 && b_InputMode <= 1)
+							}	/*  if (b_ExternGate >= 0 && b_ExternGate <= 1) */
+						}	/*  if (b_InputMode >= 0 && b_InputMode <= 1) */
 						else {
 		       /***************************************/
 							/* Tor input signal selection is wrong */
@@ -1329,7 +1329,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 								s_BoardInfos.
 								ui_Address + 8 +
 								(16 * b_TorCounter) + (64 * b_ModulNbr));
-						}	// if (dw_Status & 0x1)
+						}	/*  if (dw_Status & 0x1) */
 						else {
 		       /***************************/
 							/* Tor counter not enabled */
@@ -1337,8 +1337,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 
 							DPRINTK("Tor counter not enabled \n");
 							i_ReturnValue = -6;
-						}	// if (dw_Status & 0x1)
-					}	// if (dw_Status & 0x10)
+						}	/*  if (dw_Status & 0x1) */
+					}	/*  if (dw_Status & 0x10) */
 					else {
 		    /*******************************/
 						/* Tor counter not initialised */
@@ -1346,10 +1346,10 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 
 						DPRINTK("Tor counter not initialised\n");
 						i_ReturnValue = -5;
-					}	// // if (dw_Status & 0x10)
+					}	/*  // if (dw_Status & 0x10) */
 
-				}	// switch
-			}	// if (b_TorCounter <= 1)
+				}	/*  switch */
+			}	/*  if (b_TorCounter <= 1) */
 			else {
 		 /**********************************/
 				/* Tor counter selection is wrong */
@@ -1357,7 +1357,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 
 				DPRINTK("Tor counter selection is wrong\n");
 				i_ReturnValue = -4;
-			}	// if (b_TorCounter <= 1)
+			}	/*  if (b_TorCounter <= 1) */
 		} else {
 	      /******************************************/
 			/* The module is not a tor counter module */
@@ -1375,22 +1375,22 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_GetTorCounterInitialisation           |
-|                                               (BYTE_     b_BoardHandle,    |
-|                                                BYTE_     b_ModulNbr,       |
-|						 BYTE_     b_TorCounter,     |
-|                                        	 PBYTE_   pb_TimingUnit,     |
+|                                               (unsigned char_     b_BoardHandle,    |
+|                                                unsigned char_     b_ModulNbr,       |
+|						 unsigned char_     b_TorCounter,     |
+|                                        	 unsigned char *_   pb_TimingUnit,     |
 |                                        	 PULONG_ pul_TimingInterval, |
-|						 PBYTE_   pb_InputMode,      |
-|						 PBYTE_   pb_ExternGate,     |
-|                                                PBYTE_   pb_CycleMode,      |
-|						 PBYTE_   pb_Enable,         |
-|                                                PBYTE_   pb_InterruptEnable)|
+|						 unsigned char *_   pb_InputMode,      |
+|						 unsigned char *_   pb_ExternGate,     |
+|                                                unsigned char *_   pb_CycleMode,      |
+|						 unsigned char *_   pb_Enable,         |
+|                                                unsigned char *_   pb_InterruptEnable)|
 +----------------------------------------------------------------------------+
 | Task              : Enable the tor counter (b_TorCounter) from selected    |
 |		      module (b_ModulNbr). You must calling the              |
@@ -1403,37 +1403,37 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 |                     The b_CycleMode parameter determine if you will        |
 |                     measured a single or more cycle.                       |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle  : Handle of board APCI-1710       |
-|                     BYTE_ b_ModulNbr     : Selected module number (0 to 3) |
-|                     BYTE_ b_TorCounter   : Tor counter selection (0 or 1)
+| Input Parameters  : unsigned char_ b_BoardHandle  : Handle of board APCI-1710       |
+|                     unsigned char_ b_ModulNbr     : Selected module number (0 to 3) |
+|                     unsigned char_ b_TorCounter   : Tor counter selection (0 or 1)
 
 	b_ModulNbr			=	CR_AREF(insn->chanspec);
 	b_TorCounter		=	CR_CHAN(insn->chanspec);
 . |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_  pb_TimingUnit    : Base timing unit (0 to 4)   |
+| Output Parameters : unsigned char *_  pb_TimingUnit    : Base timing unit (0 to 4)   |
 |                                                 0 : ns                     |
 |                                                 1 : µs                     |
 |                                                 2 : ms                     |
 |                                                 3 : s                      |
 |                                                 4 : mn                     |
 |                     PULONG_ pul_TimingInterval : Base timing value.        |
-|		      PBYTE_ pb_InputMode        : Input signal level        |
+|		      unsigned char *_ pb_InputMode        : Input signal level        |
 |						   selection  		     |
 |						0 : Tor count each low level |
 |						1 : Tor count each high level|
-|		      PBYTE_ pb_ExternGate	: Extern gate action         |
+|		      unsigned char *_ pb_ExternGate	: Extern gate action         |
 |						  selection                  |
 |						  0 : Extern gate signal not |
 |						      used                   |
 |						  1 : Extern gate signal used|
-|                     PBYTE_ pb_CycleMode       : Tor counter acquisition    |
+|                     unsigned char *_ pb_CycleMode       : Tor counter acquisition    |
 |						  mode           	     |
-|		      PBYTE_ pb_Enable		: Indicate if the tor counter|
+|		      unsigned char *_ pb_Enable		: Indicate if the tor counter|
 |						  is enabled or no           |
 |						  0 : Tor counter disabled   |
 |						  1 : Tor counter enabled    |
-|                     PBYTE_ pb_InterruptEnable : Enable or disable the      |
+|                     unsigned char *_ pb_InterruptEnable : Enable or disable the      |
 |                                                 tor counter interrupt.     |
 |                                                 APCI1710_ENABLE:           |
 |                                                 Enable the tor counter     |
@@ -1441,13 +1441,13 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 |                                                 APCI1710_DISABLE:          |
 |                                                 Disable the tor counter    |
 |                                                 interrupt
-	pb_TimingUnit		=	(PBYTE) &data[0];
-	pul_TimingInterval	=  (PULONG) &data[1];
-	pb_InputMode		=	(PBYTE) &data[2];
-	pb_ExternGate		=	(PBYTE) &data[3];
-	pb_CycleMode		=	(PBYTE) &data[4];
-	pb_Enable			=	(PBYTE) &data[5];
-	pb_InterruptEnable	=	(PBYTE) &data[6];
+	pb_TimingUnit		=	(unsigned char *) &data[0];
+	pul_TimingInterval	=  (unsigned int *) &data[1];
+	pb_InputMode		=	(unsigned char *) &data[2];
+	pb_ExternGate		=	(unsigned char *) &data[3];
+	pb_CycleMode		=	(unsigned char *) &data[4];
+	pb_Enable			=	(unsigned char *) &data[5];
+	pb_InterruptEnable	=	(unsigned char *) &data[6];
                  |
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
@@ -1460,32 +1460,32 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_Status;
-	BYTE b_ModulNbr;
-	BYTE b_TorCounter;
-	PBYTE pb_TimingUnit;
-	PULONG pul_TimingInterval;
-	PBYTE pb_InputMode;
-	PBYTE pb_ExternGate;
-	PBYTE pb_CycleMode;
-	PBYTE pb_Enable;
-	PBYTE pb_InterruptEnable;
+	int i_ReturnValue = 0;
+	unsigned int dw_Status;
+	unsigned char b_ModulNbr;
+	unsigned char b_TorCounter;
+	unsigned char *pb_TimingUnit;
+	unsigned int *pul_TimingInterval;
+	unsigned char *pb_InputMode;
+	unsigned char *pb_ExternGate;
+	unsigned char *pb_CycleMode;
+	unsigned char *pb_Enable;
+	unsigned char *pb_InterruptEnable;
 
 	i_ReturnValue = insn->n;
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_TorCounter = CR_CHAN(insn->chanspec);
 
-	pb_TimingUnit = (PBYTE) & data[0];
-	pul_TimingInterval = (PULONG) & data[1];
-	pb_InputMode = (PBYTE) & data[2];
-	pb_ExternGate = (PBYTE) & data[3];
-	pb_CycleMode = (PBYTE) & data[4];
-	pb_Enable = (PBYTE) & data[5];
-	pb_InterruptEnable = (PBYTE) & data[6];
+	pb_TimingUnit = (unsigned char *) &data[0];
+	pul_TimingInterval = (unsigned int *) &data[1];
+	pb_InputMode = (unsigned char *) &data[2];
+	pb_ExternGate = (unsigned char *) &data[3];
+	pb_CycleMode = (unsigned char *) &data[4];
+	pb_Enable = (unsigned char *) &data[5];
+	pb_InterruptEnable = (unsigned char *) &data[6];
 
 	/**************************/
 	/* Test the module number */
@@ -1526,9 +1526,9 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 						(64 * b_ModulNbr));
 
 					*pb_CycleMode =
-						(BYTE) ((dw_Status >> 4) & 1);
+						(unsigned char) ((dw_Status >> 4) & 1);
 					*pb_InterruptEnable =
-						(BYTE) ((dw_Status >> 5) & 1);
+						(unsigned char) ((dw_Status >> 5) & 1);
 
 		    /******************************************************/
 					/* Test if extern gate used for clock or for signal B */
@@ -1569,25 +1569,25 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 								*pb_InputMode =
 									APCI1710_TOR_QUADRUPLE_MODE;
 							}
-						}	// if (dw_Status & 0x400)
+						}	/*  if (dw_Status & 0x400) */
 						else {
 							*pb_InputMode = 1;
-						}	// // if (dw_Status & 0x400)
+						}	/*  // if (dw_Status & 0x400) */
 
 		       /************************/
 						/* Extern gate not used */
 		       /************************/
 
 						*pb_ExternGate = 0;
-					}	// if (dw_Status & 0x600)
+					}	/*  if (dw_Status & 0x600) */
 					else {
 						*pb_InputMode =
-							(BYTE) ((dw_Status >> 6)
+							(unsigned char) ((dw_Status >> 6)
 							& 1);
 						*pb_ExternGate =
-							(BYTE) ((dw_Status >> 7)
+							(unsigned char) ((dw_Status >> 7)
 							& 1);
-					}	// if (dw_Status & 0x600)
+					}	/*  if (dw_Status & 0x600) */
 
 					*pb_TimingUnit =
 						devpriv->
@@ -1611,7 +1611,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 					i_ReturnValue = -5;
 				}
 
-			}	// if (b_TorCounter <= 1)
+			}	/*  if (b_TorCounter <= 1) */
 			else {
 		 /**********************************/
 				/* Tor counter selection is wrong */
@@ -1619,7 +1619,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 
 				DPRINTK("Tor counter selection is wrong \n");
 				i_ReturnValue = -4;
-			}	// if (b_TorCounter <= 1)
+			}	/*  if (b_TorCounter <= 1) */
 		} else {
 	      /******************************************/
 			/* The module is not a tor counter module */
@@ -1637,17 +1637,17 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ReadTorCounterValue                   |
-|                               (BYTE_     b_BoardHandle,                    |
-|                                BYTE_     b_ModulNbr,                       |
-|				 BYTE_     b_TorCounter,                     |
-|                                UINT_    ui_TimeOut,                        |
-|                                PBYTE_   pb_TorCounterStatus,               |
+|                               (unsigned char_     b_BoardHandle,                    |
+|                                unsigned char_     b_ModulNbr,                       |
+|				 unsigned char_     b_TorCounter,                     |
+|                                unsigned int_    ui_TimeOut,                        |
+|                                unsigned char *_   pb_TorCounterStatus,               |
 |                                PULONG_ pul_TorCounterValue)                |
 +----------------------------------------------------------------------------+
 | Task        	case APCI1710_TOR_GETPROGRESSSTATUS: Return the tor counter
@@ -1660,15 +1660,15 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 |		      (pul_TorCounterValue) after a conting cycle stop       |
 |                     from selected tor counter module (b_ModulNbr).         |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle  : Handle of board APCI-1710       |
-|                     BYTE_ b_ModulNbr     : Selected module number (0 to 3) |
-|                     BYTE_ b_TorCounter   : Tor counter selection (0 or 1).
+| Input Parameters  : unsigned char_ b_BoardHandle  : Handle of board APCI-1710       |
+|                     unsigned char_ b_ModulNbr     : Selected module number (0 to 3) |
+|                     unsigned char_ b_TorCounter   : Tor counter selection (0 or 1).
 	b_ModulNbr    = CR_AREF(insn->chanspec);
-	b_ReadType    = (BYTE) data[0];
-	b_TorCounter  =	(BYTE) data[1];
-	ui_TimeOut	  = (UINT) data[2]; |
+	b_ReadType    = (unsigned char) data[0];
+	b_TorCounter  =	(unsigned char) data[1];
+	ui_TimeOut	  = (unsigned int) data[2]; |
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_  pb_TorCounterStatus : Return the tor counter   |
+| Output Parameters : unsigned char *_  pb_TorCounterStatus : Return the tor counter   |
 |                                                    status.                 |
 |                                               0 : Conting cycle not started|
 |                                                   Software gate not set.   |
@@ -1683,9 +1683,9 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 |                                                   function                 |
 |                                                 "i_APCI1710_InitTorCounter"|
 |						4 : Timeeout occur           |
-|                     PULONG  pul_TorCounterValue  : Tor counter value.
-	pb_TorCounterStatus=(PBYTE) &data[0];
-	pul_TorCounterValue=(PULONG) &data[1];    |
+|                     unsigned int *  pul_TorCounterValue  : Tor counter value.
+	pb_TorCounterStatus=(unsigned char *) &data[0];
+	pul_TorCounterValue=(unsigned int *) &data[1];    |
 +----------------------------------------------------------------------------+
 | Return Value      :  0: No error                                           |
 |                     -1: The handle parameter of the board is wrong         |
@@ -1700,27 +1700,27 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_Status;
-	DWORD dw_TimeOut = 0;
+	int i_ReturnValue = 0;
+	unsigned int dw_Status;
+	unsigned int dw_TimeOut = 0;
 
-	BYTE b_ModulNbr;
-	BYTE b_TorCounter;
-	BYTE b_ReadType;
-	UINT ui_TimeOut;
-	PBYTE pb_TorCounterStatus;
-	PULONG pul_TorCounterValue;
+	unsigned char b_ModulNbr;
+	unsigned char b_TorCounter;
+	unsigned char b_ReadType;
+	unsigned int ui_TimeOut;
+	unsigned char *pb_TorCounterStatus;
+	unsigned int *pul_TorCounterValue;
 
 	i_ReturnValue = insn->n;
 	b_ModulNbr = CR_AREF(insn->chanspec);
-	b_ReadType = (BYTE) data[0];
-	b_TorCounter = (BYTE) data[1];
-	ui_TimeOut = (UINT) data[2];
-	pb_TorCounterStatus = (PBYTE) & data[0];
-	pul_TorCounterValue = (PULONG) & data[1];
+	b_ReadType = (unsigned char) data[0];
+	b_TorCounter = (unsigned char) data[1];
+	ui_TimeOut = (unsigned int) data[2];
+	pb_TorCounterStatus = (unsigned char *) &data[0];
+	pul_TorCounterValue = (unsigned int *) &data[1];
 
 	/**************************/
 	/* Test the module number */
@@ -1896,7 +1896,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 											+
 											(16 * b_TorCounter) + (64 * b_ModulNbr));
 										break;
-									}	// if ((dw_Status & 4) == 4)
+									}	/*  if ((dw_Status & 4) == 4) */
 									else {
 				/*******************************/
 										/* Test if measurement stopped */
@@ -1927,7 +1927,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 												(16 * b_TorCounter) + (64 * b_ModulNbr));
 
 											break;
-										}	// if ((dw_Status & 2) == 2)
+										}	/*  if ((dw_Status & 2) == 2) */
 										else {
 				   /*******************************/
 											/* Test if measurement started */
@@ -1941,7 +1941,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 												*pb_TorCounterStatus
 													=
 													1;
-											}	// if ((dw_Status & 1) == 1)
+											}	/*  if ((dw_Status & 1) == 1) */
 											else {
 				      /***************************/
 												/* Measurement not started */
@@ -1950,9 +1950,9 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 												*pb_TorCounterStatus
 													=
 													0;
-											}	// if ((dw_Status & 1) == 1)
-										}	// if ((dw_Status & 2) == 2)
-									}	// if ((dw_Status & 8) == 8)
+											}	/*  if ((dw_Status & 1) == 1) */
+										}	/*  if ((dw_Status & 2) == 2) */
+									}	/*  if ((dw_Status & 8) == 8) */
 
 									if (dw_TimeOut == ui_TimeOut) {
 				/*****************/
@@ -1973,7 +1973,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 
 										mdelay(1000);
 									}
-								}	// for (;;)
+								}	/*  for (;;) */
 
 			  /*************************/
 								/* Test if timeout occur */
@@ -2001,8 +2001,8 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 
 						default:
 							printk("Inputs wrong\n");
-						}	// switch end
-					}	// if (dw_Status & 0x1)
+						}	/*  switch end */
+					}	/*  if (dw_Status & 0x1) */
 					else {
 		       /***************************/
 						/* Tor counter not enabled */
@@ -2010,7 +2010,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 
 						DPRINTK("Tor counter not enabled\n");
 						i_ReturnValue = -6;
-					}	// if (dw_Status & 0x1)
+					}	/*  if (dw_Status & 0x1) */
 				} else {
 		    /*******************************/
 					/* Tor counter not initialised */
@@ -2019,7 +2019,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 					DPRINTK("Tor counter not initialised\n");
 					i_ReturnValue = -5;
 				}
-			}	// if (b_TorCounter <= 1)
+			}	/*  if (b_TorCounter <= 1) */
 			else {
 		 /**********************************/
 				/* Tor counter selection is wrong */
@@ -2027,7 +2027,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 
 				DPRINTK("Tor counter selection is wrong\n");
 				i_ReturnValue = -4;
-			}	// if (b_TorCounter <= 1)
+			}	/*  if (b_TorCounter <= 1) */
 		} else {
 	      /******************************************/
 			/* The module is not a tor counter module */
@@ -2045,5 +2045,5 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }

+ 4 - 4
drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.h

@@ -35,23 +35,23 @@
 /*
  * TOR_COUNTER INISIALISATION FUNCTION
  */
-INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev,
+int i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev,
 					struct comedi_subdevice *s,
 					struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev,
+int i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev,
 						struct comedi_subdevice *s,
 						struct comedi_insn *insn,
 						unsigned int *data);
 
-INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev,
+int i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev,
 						   struct comedi_subdevice *s,
 						   struct comedi_insn *insn,
 						   unsigned int *data);
 /*
  * TOR_COUNTER READ FUNCTION
  */
-INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *dev,
+int i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *dev,
 							   struct comedi_subdevice *s,
 							   struct comedi_insn *insn,
 							   unsigned int *data);

+ 99 - 99
drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.c

@@ -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.
 
@@ -63,12 +63,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_InitTTLIODirection                    |
-|                               (BYTE_    b_BoardHandle,                     |
-|				 BYTE_    b_ModulNbr,                        |
-|				 BYTE_    b_PortAMode,                       |
-|				 BYTE_    b_PortBMode,                       |
-|				 BYTE_    b_PortCMode,                       |
-|				 BYTE_    b_PortDMode)                       |
+|                               (unsigned char_    b_BoardHandle,                     |
+|				 unsigned char_    b_ModulNbr,                        |
+|				 unsigned char_    b_PortAMode,                       |
+|				 unsigned char_    b_PortBMode,                       |
+|				 unsigned char_    b_PortCMode,                       |
+|				 unsigned char_    b_PortDMode)                       |
 +----------------------------------------------------------------------------+
 | Task           APCI1710_TTL_INIT (using defaults)   : Configure the TTL I/O operating mode from selected     |
 |                     module  (b_ModulNbr). You must calling this function be|
@@ -76,15 +76,15 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 				 APCI1710_TTL_INITDIRECTION(user inputs for direction)
 
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle         : Handle of board APCI-1710|
-|                     BYTE_ b_ModulNbr            : Module number to         |
+| Input Parameters  : unsigned char_ b_BoardHandle         : Handle of board APCI-1710|
+|                     unsigned char_ b_ModulNbr            : Module number to         |
 |                                                   configure (0 to 3)
-		b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-		b_InitType = (BYTE) data[0];
-		b_PortAMode	= (BYTE) data[1];
-		b_PortBMode = (BYTE) data[2];
-		b_PortCMode = (BYTE) data[3];
-		b_PortDMode	= (BYTE) data[4];|
+		b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+		b_InitType = (unsigned char) data[0];
+		b_PortAMode	= (unsigned char) data[1];
+		b_PortBMode = (unsigned char) data[2];
+		b_PortCMode = (unsigned char) data[3];
+		b_PortDMode	= (unsigned char) data[4];|
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -100,19 +100,19 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnConfigInitTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	BYTE b_ModulNbr;
-	BYTE b_InitType;
-	BYTE b_PortAMode;
-	BYTE b_PortBMode;
-	BYTE b_PortCMode;
-	BYTE b_PortDMode;
-
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
-	b_InitType = (BYTE) data[0];
+	int i_ReturnValue = 0;
+	unsigned char b_ModulNbr;
+	unsigned char b_InitType;
+	unsigned char b_PortAMode;
+	unsigned char b_PortBMode;
+	unsigned char b_PortCMode;
+	unsigned char b_PortDMode;
+
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
+	b_InitType = (unsigned char) data[0];
 	i_ReturnValue = insn->n;
 
 	/**************************/
@@ -172,10 +172,10 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub
 
 			case APCI1710_TTL_INITDIRECTION:
 
-				b_PortAMode = (BYTE) data[1];
-				b_PortBMode = (BYTE) data[2];
-				b_PortCMode = (BYTE) data[3];
-				b_PortDMode = (BYTE) data[4];
+				b_PortAMode = (unsigned char) data[1];
+				b_PortBMode = (unsigned char) data[2];
+				b_PortCMode = (unsigned char) data[3];
+				b_PortDMode = (unsigned char) data[4];
 
 	      /********************/
 				/* Test the version */
@@ -322,7 +322,7 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub
 				DPRINTK("\n");
 			default:
 				printk("Bad Config Type\n");
-			}	// switch end
+			}	/*  switch end */
 		} else {
 	      /**********************************/
 			/* The module is not a TTL module */
@@ -340,7 +340,7 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -352,11 +352,11 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_   i_APCI1710_ReadTTLIOChannelValue               |
-|                                       (BYTE_     b_BoardHandle,            |
-|                                        BYTE_     b_ModulNbr,               |
-|                                        BYTE_     b_SelectedPort,           |
-|                                        BYTE_     b_InputChannel,           |
-|                                        PBYTE_   pb_ChannelStatus)          |
+|                                       (unsigned char_     b_BoardHandle,            |
+|                                        unsigned char_     b_ModulNbr,               |
+|                                        unsigned char_     b_SelectedPort,           |
+|                                        unsigned char_     b_InputChannel,           |
+|                                        unsigned char *_   pb_ChannelStatus)          |
 +----------------------------------------------------------------------------+
 | Task              : Read the status from selected TTL digital input        |
 |                     (b_InputChannel)
@@ -366,32 +366,32 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub
 +----------------------------------------------------------------------------+
 
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle         : Handle of board APCI-1710|
-|                     BYTE_ b_ModulNbr            : Module number to         |
+| Input Parameters  : unsigned char_ b_BoardHandle         : Handle of board APCI-1710|
+|                     unsigned char_ b_ModulNbr            : Module number to         |
 |                                                   configure (0 to 7)       |
-|                     BYTE_ b_SelectedPort,       : Selection from TTL I/O   |
+|                     unsigned char_ b_SelectedPort,       : Selection from TTL I/O   |
 |                                                   port (0 to 2)            |
 |                                                      0 : Port A selection  |
 |                                                      1 : Port B selection  |
 |                                                      2 : Port C selection  |
 |                                                      3 : Port D selection  |
-|                     BYTE_ b_InputChannel        : Selection from digital   |
+|                     unsigned char_ b_InputChannel        : Selection from digital   |
 |                                                   input ( 0 to 2)
 APCI1710_TTL_READCHANNEL
 	b_ModulNbr	  = CR_AREF(insn->chanspec);
 	b_SelectedPort= CR_RANGE(insn->chanspec);
 	b_InputChannel= CR_CHAN(insn->chanspec);
-	b_ReadType	  = (BYTE) data[0];
+	b_ReadType	  = (unsigned char) data[0];
 
  APCI1710_TTL_READPORT|
 	b_ModulNbr	  = CR_AREF(insn->chanspec);
 	b_SelectedPort= CR_RANGE(insn->chanspec);
-	b_ReadType	  = (BYTE) data[0];
+	b_ReadType	  = (unsigned char) data[0];
 
 +----------------------------------------------------------------------------+
 | Output Parameters : data[0]
 
-	PBYTE_  pb_ChannelStatus    : Digital input channel    |
+	unsigned char *_  pb_ChannelStatus    : Digital input channel    |
 |                                                   status                   |
 |                                                   0 : Channle is not active|
 |                                                   1 : Channle is active    |
@@ -406,20 +406,20 @@ APCI1710_TTL_READCHANNEL
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg;
-	BYTE b_ModulNbr;
-	BYTE b_SelectedPort;
-	BYTE b_InputChannel;
-	BYTE b_ReadType;
-	PBYTE pb_ChannelStatus;
-	PBYTE pb_PortValue;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg;
+	unsigned char b_ModulNbr;
+	unsigned char b_SelectedPort;
+	unsigned char b_InputChannel;
+	unsigned char b_ReadType;
+	unsigned char *pb_ChannelStatus;
+	unsigned char *pb_PortValue;
 
 	i_ReturnValue = insn->n;
-	b_ReadType = (BYTE) data[0];
+	b_ReadType = (unsigned char) data[0];
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_SelectedPort = CR_RANGE(insn->chanspec);
 	b_InputChannel = CR_CHAN(insn->chanspec);
@@ -439,7 +439,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde
 			switch (b_ReadType) {
 
 			case APCI1710_TTL_READCHANNEL:
-				pb_ChannelStatus = (PBYTE) & data[0];
+				pb_ChannelStatus = (unsigned char *) &data[0];
 	      /********************************/
 				/* Test the TTL I/O port number */
 	      /********************************/
@@ -493,7 +493,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde
 
 								*pb_ChannelStatus
 									=
-									(BYTE) (
+									(unsigned char) (
 									(dw_StatusReg
 										>>
 										(8 * b_SelectedPort)) >> b_InputChannel) & 1;
@@ -533,7 +533,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde
 				break;
 
 			case APCI1710_TTL_READPORT:
-				pb_PortValue = (PBYTE) & data[0];
+				pb_PortValue = (unsigned char *) &data[0];
 			  /********************************/
 				/* Test the TTL I/O port number */
 			  /********************************/
@@ -578,7 +578,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde
 								(64 * b_ModulNbr));
 
 							*pb_PortValue =
-								(BYTE) (
+								(unsigned char) (
 								(dw_StatusReg >>
 									(8 * b_SelectedPort)) & 0xFF);
 						} else {
@@ -610,7 +610,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde
 			default:
 				printk("Bad ReadType\n");
 
-			}	//End Switch
+			}	/* End Switch */
 		} else {
 	      /**********************************/
 			/* The module is not a TTL module */
@@ -628,20 +628,20 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device
+| Function Name     : int i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device
 *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)              |
 +----------------------------------------------------------------------------+
 | Task              : Read the status from all digital input ports           |
 |                     (port A, port B and port C) from selected TTL          |
 |		      module (b_ModulNbr) 				     |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle         : Handle of board APCI-1710|
-|                     BYTE_ b_ModulNbr            : Module number to         |
+| Input Parameters  : unsigned char_ b_BoardHandle         : Handle of board APCI-1710|
+|                     unsigned char_ b_ModulNbr            : Module number to         |
 |                                                   configure (0 to 3)       |
 +----------------------------------------------------------------------------+
 | Output Parameters : PULONG_  pul_PortValue      : Digital TTL inputs port  |
@@ -655,17 +655,17 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg;
-	BYTE b_ModulNbr;
-	PULONG pul_PortValue;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg;
+	unsigned char b_ModulNbr;
+	unsigned int *pul_PortValue;
 
-	b_ModulNbr = (BYTE) CR_AREF(insn->chanspec);
+	b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec);
 	i_ReturnValue = insn->n;
-	pul_PortValue = (PULONG) & data[0];
+	pul_PortValue = (unsigned int *) &data[0];
 
 	/**************************/
 	/* Test the module number */
@@ -777,7 +777,7 @@ INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -789,19 +789,19 @@ INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 /*
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_SetTTLIOChlOn                         |
-|                               (BYTE_           b_BoardHandle,              |
-|                                BYTE_           b_ModulNbr,                 |
-|                                BYTE_           b_OutputChannel)
-INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi_subdevice *s,
+|                               (unsigned char_           b_BoardHandle,              |
+|                                unsigned char_           b_ModulNbr,                 |
+|                                unsigned char_           b_OutputChannel)
+int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi_subdevice *s,
 	struct comedi_insn *insn,unsigned int *data)           |
 +----------------------------------------------------------------------------+
 | Task              : Sets or resets  the output witch has been passed with the         |
 |                     parameter b_Channel. Setting an output means setting   |
 |                     an ouput high.                                         |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE_ b_BoardHandle   : Handle of board APCI-1710      |
-|                     BYTE_ b_ModulNbr      : Selected module number (0 to 3)|
-|                     BYTE_ b_OutputChannel : Selection from digital output  |
+| Input Parameters  : unsigned char_ b_BoardHandle   : Handle of board APCI-1710      |
+|                     unsigned char_ b_ModulNbr      : Selected module number (0 to 3)|
+|                     unsigned char_ b_OutputChannel : Selection from digital output  |
 |                                             channel (0 or 1)               |
 |                                                0      : PD0                |
 |                                                1      : PD1                |
@@ -811,7 +811,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi
 
   b_ModulNbr	   = CR_AREF(insn->chanspec);
 	b_OutputChannel= CR_CHAN(insn->chanspec);
-	ui_State	   = data[0]; // ON or OFF
+	ui_State	   = data[0]; /*  ON or OFF */
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -825,19 +825,19 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = 0;
-	DWORD dw_StatusReg = 0;
-	BYTE b_ModulNbr;
-	BYTE b_OutputChannel;
-	UINT ui_State;
+	int i_ReturnValue = 0;
+	unsigned int dw_StatusReg = 0;
+	unsigned char b_ModulNbr;
+	unsigned char b_OutputChannel;
+	unsigned int ui_State;
 
 	i_ReturnValue = insn->n;
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_OutputChannel = CR_CHAN(insn->chanspec);
-	ui_State = data[0];	// ON or OFF
+	ui_State = data[0];	/*  ON or OFF */
 
 	/**************************/
 	/* Test the module number */
@@ -953,7 +953,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev,
 									ui_Address
 									+
 									(64 * b_ModulNbr));
-								if (ui_State)	// ON
+								if (ui_State)	/*  ON */
 								{
 									dw_StatusReg
 										=
@@ -969,7 +969,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev,
 										(b_OutputChannel
 											%
 											8));
-								} else	// Off
+								} else	/*  Off */
 								{
 									dw_StatusReg
 										=
@@ -1034,5 +1034,5 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev,
 		i_ReturnValue = -2;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }

+ 4 - 4
drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.h

@@ -24,21 +24,21 @@
 /*
  * TTL INISIALISATION FUNCTION
  */
-INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnConfigInitTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 
 /*
  * TTL INPUT FUNCTION
  */
-INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1710_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
-INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
+int i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
 					 struct comedi_subdevice *s,
 					 struct comedi_insn *insn, unsigned int *data);
 
 /*
  * TTL OUTPUT FUNCTIONS
  */
-INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,
+int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,
 					 struct comedi_subdevice *s,
 					 struct comedi_insn *insn, unsigned int *data);

+ 56 - 63
drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c

@@ -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.
 
@@ -49,37 +49,37 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 #include "addi_amcc_S5920.h"
 
 /*+----------------------------------------------------------------------------+*/
-/*| Function   Name   : INT i_AddiHeaderRW_ReadEeprom                          |*/
-/*|                               (INT    i_NbOfWordsToRead,                   |*/
-/*|                                DWORD dw_PCIBoardEepromAddress,             |*/
-/*|                                WORD   w_EepromStartAddress,                |*/
-/*|                                PWORD pw_DataRead)                          |*/
+/*| Function   Name   : int i_AddiHeaderRW_ReadEeprom                          |*/
+/*|                               (int    i_NbOfWordsToRead,                   |*/
+/*|                                unsigned int dw_PCIBoardEepromAddress,             |*/
+/*|                                unsigned short   w_EepromStartAddress,                |*/
+/*|                                unsigned short * pw_DataRead)                          |*/
 /*+----------------------------------------------------------------------------+*/
 /*| Task              : Read word from the 5920 eeprom.                        |*/
 /*+----------------------------------------------------------------------------+*/
-/*| Input Parameters  : INT    i_NbOfWordsToRead : Nbr. of word to read        |*/
-/*|                     DWORD dw_PCIBoardEepromAddress : Address of the eeprom |*/
-/*|                     WORD   w_EepromStartAddress : Eeprom strat address     |*/
+/*| Input Parameters  : int    i_NbOfWordsToRead : Nbr. of word to read        |*/
+/*|                     unsigned int dw_PCIBoardEepromAddress : Address of the eeprom |*/
+/*|                     unsigned short   w_EepromStartAddress : Eeprom strat address     |*/
 /*+----------------------------------------------------------------------------+*/
-/*| Output Parameters : PWORD pw_DataRead : Read data                          |*/
+/*| Output Parameters : unsigned short * pw_DataRead : Read data                          |*/
 /*+----------------------------------------------------------------------------+*/
 /*| Return Value      : -                                                      |*/
 /*+----------------------------------------------------------------------------+*/
 
-INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead,
-	DWORD dw_PCIBoardEepromAddress,
-	WORD w_EepromStartAddress, PWORD pw_DataRead)
+int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
+	unsigned int dw_PCIBoardEepromAddress,
+	unsigned short w_EepromStartAddress, unsigned short *pw_DataRead)
 {
-	DWORD dw_eeprom_busy = 0;
-	INT i_Counter = 0;
-	INT i_WordCounter;
-	INT i;
-	BYTE pb_ReadByte[1];
-	BYTE b_ReadLowByte = 0;
-	BYTE b_ReadHighByte = 0;
-	BYTE b_SelectedAddressLow = 0;
-	BYTE b_SelectedAddressHigh = 0;
-	WORD w_ReadWord = 0;
+	unsigned int dw_eeprom_busy = 0;
+	int i_Counter = 0;
+	int i_WordCounter;
+	int i;
+	unsigned char pb_ReadByte[1];
+	unsigned char b_ReadLowByte = 0;
+	unsigned char b_ReadHighByte = 0;
+	unsigned char b_SelectedAddressLow = 0;
+	unsigned char b_SelectedAddressHigh = 0;
+	unsigned short w_ReadWord = 0;
 
 	for (i_WordCounter = 0; i_WordCounter < i_NbOfWordsToRead;
 		i_WordCounter++) {
@@ -88,106 +88,99 @@ 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
-			b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256;	//Read the high 8 bit part
+			b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256;	/* Read the low 8 bit part */
+			b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256;	/* Read the high 8 bit part */
 
-			//Select the load low address mode
+			/* Select the load low address mode */
 			outb(NVCMD_LOAD_LOW,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				3);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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
+			/* Load the low address */
 			outb(b_SelectedAddressLow,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				2);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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
+			/* Select the load high address mode */
 			outb(NVCMD_LOAD_HIGH,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				3);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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
+			/* Load the high address */
 			outb(b_SelectedAddressHigh,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				2);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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
+			/* Select the READ mode */
 			outb(NVCMD_BEGIN_READ,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				3);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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
+			/* Read data into the EEPROM */
 			*pb_ReadByte =
 				inb(dw_PCIBoardEepromAddress +
 				AMCC_OP_REG_MCSR + 2);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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
+			/* Select the upper address part */
 			if (i_Counter == 0) {
 				b_ReadLowByte = pb_ReadByte[0];
 			} else {
 				b_ReadHighByte = pb_ReadByte[0];
 			}
 
-			//Sleep
-			for (i = 0; i < 10000; i++) ;
+			/* Sleep */
+			msleep(1);
 
 		}
 		w_ReadWord =
@@ -196,8 +189,8 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead,
 
 		pw_DataRead[i_WordCounter] = w_ReadWord;
 
-		w_EepromStartAddress += 2;	// to read the next word
+		w_EepromStartAddress += 2;	/*  to read the next word */
 
-	}			// for (...) i_NbOfWordsToRead
-	return (0);
+	}			/*  for (...) i_NbOfWordsToRead */
+	return 0;
 }

+ 3 - 3
drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.h

@@ -22,6 +22,6 @@
 #define NVCMD_BEGIN_READ	(0x7 << 5)	/* nvRam begin read command */
 #define NVCMD_BEGIN_WRITE	(0x6 << 5)	/* EEPROM begin write command */
 
-INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead,
-			      DWORD dw_PCIBoardEepromAddress,
-			      WORD w_EepromStartAddress, PWORD pw_DataRead);
+int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
+			      unsigned int dw_PCIBoardEepromAddress,
+			      unsigned short w_EepromStartAddress, unsigned short *pw_DataRead);

+ 6 - 6
drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h

@@ -85,7 +85,7 @@
 #define AMCC_OP_REG_MRTC		0x30
 #define AMCC_OP_REG_MBEF		0x34
 #define AMCC_OP_REG_INTCSR		0x38
-/* INT source */
+/* int source */
 #define  AMCC_OP_REG_INTCSR_SRC		(AMCC_OP_REG_INTCSR + 2)
 /* FIFO ctrl */
 #define  AMCC_OP_REG_INTCSR_FEC		(AMCC_OP_REG_INTCSR + 3)
@@ -343,7 +343,7 @@ int i_find_free_pci_card_by_position(unsigned short vendor_id,
 				*card = amcc;
 				return 0;	/* ok, card is found */
 			} else {
-				rt_printk(" - \nCard on requested position is used b:s %d:%d!\n",
+				printk(" - \nCard on requested position is used b:s %d:%d!\n",
 					  pci_bus, pci_slot);
 				return 2;	/* card exist but is used */
 			}
@@ -447,7 +447,7 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
 		/* use autodetection */
 		card = ptr_find_free_pci_card_by_device(vendor_id, device_id);
 		if (card == NULL) {
-			rt_printk(" - Unused card not found in system!\n");
+			printk(" - Unused card not found in system!\n");
 			return NULL;
 		}
 	} else {
@@ -455,18 +455,18 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
 							 pci_bus, pci_slot,
 							 &card)) {
 		case 1:
-			rt_printk(" - Card not found on requested position b:s %d:%d!\n",
+			printk(" - Card not found on requested position b:s %d:%d!\n",
 				  pci_bus, pci_slot);
 			return NULL;
 		case 2:
-			rt_printk(" - Card on requested position is used b:s %d:%d!\n",
+			printk(" - Card on requested position is used b:s %d:%d!\n",
 				  pci_bus, pci_slot);
 			return NULL;
 		}
 	}
 
 	if (pci_card_alloc(card, i_Master) != 0) {
-		rt_printk(" - Can't allocate card!\n");
+		printk(" - Can't allocate card!\n");
 		return NULL;
 
 	}

+ 93 - 98
drivers/staging/comedi/drivers/addi-data/addi_common.c

@@ -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.
 
@@ -68,25 +68,25 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 #include "addi_common.h"
 #include "addi_amcc_s5933.h"
 
-//Update-0.7.57->0.7.68MODULE_AUTHOR("ADDI-DATA GmbH <info@addi-data.com>");
-//Update-0.7.57->0.7.68MODULE_DESCRIPTION("Comedi ADDI-DATA module");
-//Update-0.7.57->0.7.68MODULE_LICENSE("GPL");
+/* Update-0.7.57->0.7.68MODULE_AUTHOR("ADDI-DATA GmbH <info@addi-data.com>"); */
+/* Update-0.7.57->0.7.68MODULE_DESCRIPTION("Comedi ADDI-DATA module"); */
+/* Update-0.7.57->0.7.68MODULE_LICENSE("GPL"); */
 
-#define devpriv ((addi_private *)dev->private)
-#define this_board ((boardtype *)dev->board_ptr)
+#define devpriv ((struct addi_private *)dev->private)
+#define this_board ((struct addi_board *)dev->board_ptr)
 
 #if defined(CONFIG_APCI_1710) || defined(CONFIG_APCI_3200) || defined(CONFIG_APCI_3300)
-//BYTE b_SaveFPUReg [94];
+/* BYTE b_SaveFPUReg [94]; */
 
 void fpu_begin(void)
 {
-	//asm ("fstenv b_SaveFPUReg");
+	/* asm ("fstenv b_SaveFPUReg"); */
 	kernel_fpu_begin();
 }
 
 void fpu_end(void)
 {
-	// asm ("frstor b_SaveFPUReg");
+	/*  asm ("frstor b_SaveFPUReg"); */
 	kernel_fpu_end();
 }
 #endif
@@ -219,7 +219,7 @@ static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = {
 
 MODULE_DEVICE_TABLE(pci, addi_apci_tbl);
 
-static const boardtype boardtypes[] = {
+static const struct addi_board boardtypes[] = {
 #ifdef CONFIG_APCI_3120
 	{"apci3120",
 			APCI3120_BOARD_VENDOR_ID,
@@ -901,7 +901,7 @@ static const boardtype boardtypes[] = {
 		NULL},
 #endif
 #ifdef CONFIG_APCI_3300
-	//Begin JK 20.10.2004: APCI-3300 integration
+	/* Begin JK	.20.10.2004 = APCI-3300 integration */
 	{"apci3300",
 			APCI3200_BOARD_VENDOR_ID,
 			0x3007,
@@ -2525,16 +2525,16 @@ static const boardtype boardtypes[] = {
 #endif
 };
 
-#define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype))
+#define n_boardtypes (sizeof(boardtypes)/sizeof(struct addi_board))
 
 struct comedi_driver driver_addi = {
-      driver_name:"addi_common",
-      module:THIS_MODULE,
-      attach:i_ADDI_Attach,
-      detach:i_ADDI_Detach,
-      num_names:n_boardtypes,
-      board_name:&boardtypes[0].pc_DriverName,
-      offset:sizeof(boardtype),
+	.driver_name = "addi_common",
+	.module = THIS_MODULE,
+	.attach = i_ADDI_Attach,
+	.detach = i_ADDI_Detach,
+	.num_names = n_boardtypes,
+	.board_name = &boardtypes[0].pc_DriverName,
+	.offset = sizeof(struct addi_board),
 };
 
 COMEDI_PCI_INITCLEANUP(driver_addi, addi_apci_tbl);
@@ -2559,11 +2559,11 @@ COMEDI_PCI_INITCLEANUP(driver_addi, addi_apci_tbl);
 +----------------------------------------------------------------------------+
 */
 
-static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct comedi_subdevice *s;
 	int ret, pages, i, n_subdevices;
-	DWORD dw_Dummy;
+	unsigned int dw_Dummy;
 	resource_size_t io_addr[5];
 	unsigned int irq;
 	resource_size_t iobase_a, iobase_main, iobase_addon, iobase_reserved;
@@ -2575,26 +2575,28 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 	sprintf(c_Identifier, "Addi-Data GmbH Comedi %s",
 		this_board->pc_DriverName);
 
-	if ((ret = alloc_private(dev, sizeof(addi_private))) < 0) {
-	  	return -ENOMEM;
-	}
+	ret = alloc_private(dev, sizeof(struct addi_private));
+	if (ret < 0)
+		return -ENOMEM;
 
 	if (!pci_list_builded) {
-		v_pci_card_list_init(this_board->i_VendorId, 1);	//1 for displaying the list..
+		v_pci_card_list_init(this_board->i_VendorId, 1);	/* 1 for displaying the list.. */
 		pci_list_builded = 1;
 	}
-	//rt_printk("comedi%d: addi_common: board=%s",dev->minor,this_board->pc_DriverName);
+	/* printk("comedi%d: addi_common: board=%s",dev->minor,this_board->pc_DriverName); */
 
 	if ((this_board->i_Dma) && (it->options[2] == 0)) {
 		i_Dma = 1;
 	}
 
-	if ((card = ptr_select_and_alloc_pci_card(this_board->i_VendorId,
-				this_board->i_DeviceId,
-				it->options[0],
-				it->options[1], i_Dma)) == NULL) {
+	card = ptr_select_and_alloc_pci_card(this_board->i_VendorId,
+					     this_board->i_DeviceId,
+					     it->options[0],
+					     it->options[1], i_Dma);
+
+	if (card == NULL)
 		return -EIO;
-	}
+
 	devpriv->allocated = 1;
 
 	if ((i_pci_card_data(card, &pci_bus, &pci_slot, &pci_func, &io_addr[0],
@@ -2617,63 +2619,63 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 	   /************************************/
 
 		if (this_board->i_IorangeBase1 != 0) {
-			dev->iobase = (unsigned long)iobase_main;	// DAQ base address...
+			dev->iobase = (unsigned long)iobase_main;	/*  DAQ base address... */
 		} else {
-			dev->iobase = (unsigned long)iobase_a;	// DAQ base address...
+			dev->iobase = (unsigned long)iobase_a;	/*  DAQ base address... */
 		}
 
 		dev->board_name = this_board->pc_DriverName;
 		devpriv->amcc = card;
-		devpriv->iobase = (INT) dev->iobase;
-		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->iobase = (int) dev->iobase;
+		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->iobase = (int) io_addr[2];
 		devpriv->ps_BoardInfo = this_board;
-		devpriv->i_IobaseReserved = (INT) io_addr[3];
+		devpriv->i_IobaseReserved = (int) io_addr[3];
 		printk("\nioremap begin");
 		devpriv->dw_AiBase =
-			(ULONG_PTR) ioremap(io_addr[3],
+			(unsigned long) ioremap(io_addr[3],
 			this_board->i_IorangeBase3);
 		printk("\nioremap end");
 	}
 
-	//##
+	/* ## */
 
 	if (irq > 0) {
-		if (comedi_request_irq(irq, v_ADDI_Interrupt, IRQF_SHARED,
+		if (request_irq(irq, v_ADDI_Interrupt, IRQF_SHARED,
 				c_Identifier, dev) < 0) {
 			printk(", unable to allocate IRQ %u, DISABLING IT",
 				irq);
 			irq = 0;	/* Can't use IRQ */
 		} else {
-			rt_printk("\nirq=%u", irq);
+			printk("\nirq=%u", irq);
 		}
 	} else {
-		rt_printk(", IRQ disabled");
+		printk(", IRQ disabled");
 	}
 
 	printk("\nOption %d %d %d\n", it->options[0], it->options[1],
 		it->options[2]);
 	dev->irq = irq;
 
-	// Read eepeom and fill boardtype Structure
+	/*  Read eepeom and fill addi_board Structure */
 
 	if (this_board->i_PCIEeprom) {
 		printk("\nPCI Eeprom used");
 		if (!(strcmp(this_board->pc_EepromChip, "S5920"))) {
-			// Set 3 wait stait
+			/*  Set 3 wait stait */
 			if (!(strcmp(this_board->pc_DriverName, "apci035"))) {
 				outl(0x80808082, devpriv->i_IobaseAmcc + 0x60);
 			} else {
 				outl(0x83838383, devpriv->i_IobaseAmcc + 0x60);
 			}
-			// Enable the interrupt for the controler
+			/*  Enable the interrupt for the controler */
 			dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38);
 			outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38);
 			printk("\nEnable the interrupt for the controler");
@@ -2694,16 +2696,15 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 	if (this_board->i_Dma) {
 		printk("\nDMA used");
 		if (devpriv->us_UseDma == ADDI_ENABLE) {
-			// alloc DMA buffers
+			/*  alloc DMA buffers */
 			devpriv->b_DmaDoubleBuffer = 0;
 			for (i = 0; i < 2; i++) {
 				for (pages = 4; pages >= 0; pages--) {
-					if ((devpriv->ul_DmaBufferVirtual[i] =
-							(void *)
-							__get_free_pages
-							(GFP_KERNEL, pages))) {
+					devpriv->ul_DmaBufferVirtual[i] =
+						(void *) __get_free_pages(GFP_KERNEL, pages);
+
+					if (devpriv->ul_DmaBufferVirtual[i])
 						break;
-					}
 				}
 				if (devpriv->ul_DmaBufferVirtual[i]) {
 					devpriv->ui_DmaBufferPages[i] = pages;
@@ -2718,7 +2719,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 				}
 			}
 			if (!devpriv->ul_DmaBufferVirtual[0]) {
-				rt_printk
+				printk
 					(", Can't allocate DMA buffer, DMA disabled!");
 				devpriv->us_UseDma = ADDI_DISABLE;
 			}
@@ -2729,7 +2730,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 		}
 
 		if ((devpriv->us_UseDma == ADDI_ENABLE)) {
-			rt_printk("\nDMA ENABLED\n");
+			printk("\nDMA ENABLED\n");
 		} else {
 			printk("\nDMA DISABLED\n");
 		}
@@ -2739,23 +2740,24 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 #ifdef CONFIG_APCI_1710
 		i_ADDI_AttachPCI1710(dev);
 
-		// save base address
+		/*  save base address */
 		devpriv->s_BoardInfos.ui_Address = io_addr[2];
 #endif
 	} else {
-		//Update-0.7.57->0.7.68dev->n_subdevices = 7;
+		/* Update-0.7.57->0.7.68dev->n_subdevices = 7; */
 		n_subdevices = 7;
-		if ((ret = alloc_subdevices(dev, n_subdevices)) < 0)
+		ret = alloc_subdevices(dev, n_subdevices);
+		if (ret < 0)
 			return ret;
 
-		// Allocate and Initialise AI Subdevice Structures
+		/*  Allocate and Initialise AI Subdevice Structures */
 		s = dev->subdevices + 0;
 		if ((this_board->i_NbrAiChannel)
 			|| (this_board->i_NbrAiChannelDiff)) {
 			dev->read_subdev = s;
 			s->type = COMEDI_SUBD_AI;
 			s->subdev_flags =
-				SDF_READABLE | SDF_RT | SDF_COMMON | SDF_GROUND
+				SDF_READABLE | SDF_COMMON | SDF_GROUND
 				| SDF_DIFF;
 			if (this_board->i_NbrAiChannel) {
 				s->n_chan = this_board->i_NbrAiChannel;
@@ -2786,13 +2788,11 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 			s->type = COMEDI_SUBD_UNUSED;
 		}
 
-		// Allocate and Initialise AO Subdevice Structures
+		/*  Allocate and Initialise AO Subdevice Structures */
 		s = dev->subdevices + 1;
 		if (this_board->i_NbrAoChannel) {
 			s->type = COMEDI_SUBD_AO;
-			s->subdev_flags =
-				SDF_WRITEABLE | SDF_GROUND | SDF_COMMON |
-				SDF_RT;
+			s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
 			s->n_chan = this_board->i_NbrAoChannel;
 			s->maxdata = this_board->i_AoMaxdata;
 			s->len_chanlist = this_board->i_NbrAoChannel;
@@ -2804,12 +2804,11 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 		} else {
 			s->type = COMEDI_SUBD_UNUSED;
 		}
-		// Allocate and Initialise DI Subdevice Structures
+		/*  Allocate and Initialise DI Subdevice Structures */
 		s = dev->subdevices + 2;
 		if (this_board->i_NbrDiChannel) {
 			s->type = COMEDI_SUBD_DI;
-			s->subdev_flags =
-				SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON;
+			s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON;
 			s->n_chan = this_board->i_NbrDiChannel;
 			s->maxdata = 1;
 			s->len_chanlist = this_board->i_NbrDiChannel;
@@ -2824,20 +2823,19 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 		} else {
 			s->type = COMEDI_SUBD_UNUSED;
 		}
-		// Allocate and Initialise DO Subdevice Structures
+		/*  Allocate and Initialise DO Subdevice Structures */
 		s = dev->subdevices + 3;
 		if (this_board->i_NbrDoChannel) {
 			s->type = COMEDI_SUBD_DO;
 			s->subdev_flags =
-				SDF_READABLE | SDF_WRITEABLE | SDF_RT |
-				SDF_GROUND | SDF_COMMON;
+				SDF_READABLE | SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
 			s->n_chan = this_board->i_NbrDoChannel;
 			s->maxdata = this_board->i_DoMaxdata;
 			s->len_chanlist = this_board->i_NbrDoChannel;
 			s->range_table = &range_digital;
 			s->io_bits = 0xf;	/* all bits output */
 
-			s->insn_config = this_board->i_hwdrv_InsnConfigDigitalOutput;	//for digital output memory..
+			s->insn_config = this_board->i_hwdrv_InsnConfigDigitalOutput;	/* for digital output memory.. */
 			s->insn_write =
 				this_board->i_hwdrv_InsnWriteDigitalOutput;
 			s->insn_bits =
@@ -2848,13 +2846,11 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 			s->type = COMEDI_SUBD_UNUSED;
 		}
 
-		// Allocate and Initialise Timer Subdevice Structures
+		/*  Allocate and Initialise Timer Subdevice Structures */
 		s = dev->subdevices + 4;
 		if (this_board->i_Timer) {
 			s->type = COMEDI_SUBD_TIMER;
-			s->subdev_flags =
-				SDF_WRITEABLE | SDF_RT | SDF_GROUND |
-				SDF_COMMON;
+			s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
 			s->n_chan = 1;
 			s->maxdata = 0;
 			s->len_chanlist = 1;
@@ -2868,13 +2864,12 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 			s->type = COMEDI_SUBD_UNUSED;
 		}
 
-		// Allocate and Initialise TTL
+		/*  Allocate and Initialise TTL */
 		s = dev->subdevices + 5;
 		if (this_board->i_NbrTTLChannel) {
 			s->type = COMEDI_SUBD_TTLIO;
 			s->subdev_flags =
-				SDF_WRITEABLE | SDF_READABLE | SDF_RT |
-				SDF_GROUND | SDF_COMMON;
+				SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON;
 			s->n_chan = this_board->i_NbrTTLChannel;
 			s->maxdata = 1;
 			s->io_bits = 0;	/* all bits input */
@@ -2926,7 +2921,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i
 +----------------------------------------------------------------------------+
 */
 
-static int i_ADDI_Detach(struct comedi_device * dev)
+static int i_ADDI_Detach(struct comedi_device *dev)
 {
 
 	if (dev->private) {
@@ -2935,7 +2930,7 @@ static int i_ADDI_Detach(struct comedi_device * dev)
 		}
 
 		if (dev->irq) {
-			comedi_free_irq(dev->irq, dev);
+			free_irq(dev->irq, dev);
 		}
 
 		if ((devpriv->ps_BoardInfo->pc_EepromChip == NULL)
@@ -2965,7 +2960,7 @@ static int i_ADDI_Detach(struct comedi_device * dev)
 		}
 
 		if (pci_list_builded) {
-			//v_pci_card_list_cleanup(PCI_VENDOR_ID_AMCC);
+			/* v_pci_card_list_cleanup(PCI_VENDOR_ID_AMCC); */
 			v_pci_card_list_cleanup(this_board->i_VendorId);
 			pci_list_builded = 0;
 		}
@@ -2992,18 +2987,18 @@ static int i_ADDI_Detach(struct comedi_device * dev)
 +----------------------------------------------------------------------------+
 */
 
-static int i_ADDI_Reset(struct comedi_device * dev)
+static int i_ADDI_Reset(struct comedi_device *dev)
 {
 
 	this_board->i_hwdrv_Reset(dev);
 	return 0;
 }
 
-// Interrupt function
+/* Interrupt function */
 /*
 +----------------------------------------------------------------------------+
 | Function name     :                                                        |
-|static void v_ADDI_Interrupt(int irq, void *d  PT_REGS_ARG)                 |
+|static void v_ADDI_Interrupt(int irq, void *d)                 |
 |                                        									 |
 +----------------------------------------------------------------------------+
 | Task              : Registerd interrupt routine						     |
@@ -3018,14 +3013,14 @@ static int i_ADDI_Reset(struct comedi_device * dev)
 +----------------------------------------------------------------------------+
 */
 
-static irqreturn_t v_ADDI_Interrupt(int irq, void *d PT_REGS_ARG)
+static irqreturn_t v_ADDI_Interrupt(int irq, void *d)
 {
 	struct comedi_device *dev = d;
 	this_board->v_hwdrv_Interrupt(irq, d);
 	return IRQ_RETVAL(1);
 }
 
-// EEPROM Read Function
+/* EEPROM Read Function */
 /*
 +----------------------------------------------------------------------------+
 | Function name     :                                                        |
@@ -3046,17 +3041,17 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d PT_REGS_ARG)
 +----------------------------------------------------------------------------+
 */
 
-static int i_ADDIDATA_InsnReadEeprom(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	WORD w_Data;
-	WORD w_Address;
-	w_Address = CR_CHAN(insn->chanspec);	// address to be read as 0,1,2,3...255
+	unsigned short w_Data;
+	unsigned short w_Address;
+	w_Address = CR_CHAN(insn->chanspec);	/*  address to be read as 0,1,2,3...255 */
 
 	w_Data = w_EepromReadWord(devpriv->i_IobaseAmcc,
 		this_board->pc_EepromChip, 0x100 + (2 * w_Address));
 	data[0] = w_Data;
-	//multiplied by 2 bcozinput will be like 0,1,2...255
+	/* multiplied by 2 bcozinput will be like 0,1,2...255 */
 	return insn->n;
 
 }

+ 171 - 185
drivers/staging/comedi/drivers/addi-data/addi_common.h

@@ -36,26 +36,12 @@
 #define ERROR	-1
 #define SUCCESS	1
 
-/* variable type definition */
-typedef unsigned char BYTE, *PBYTE;
-typedef short SHORT, *PSHORT;
-typedef unsigned short USHORT, *PUSHORT;
-typedef unsigned short WORD, *PWORD;
-typedef int INT, *PINT;;
-typedef unsigned int UINT, *PUINT;
-typedef int LONG, *PLONG;		/* 32-bit */
-typedef unsigned int ULONG, *PULONG;	/* 32-bit */
-typedef unsigned int DWORD, *PDWORD;	/* 32-bit */
-typedef unsigned long ULONG_PTR;
-
-typedef const struct comedi_lrange *PCRANGE;
-
-#define LOBYTE(W)	(BYTE)((W) & 0xFF)
-#define HIBYTE(W)	(BYTE)(((W) >> 8) & 0xFF)
-#define MAKEWORD(H, L)	(USHORT)((L) | ((H) << 8))
-#define LOWORD(W)	(USHORT)((W) & 0xFFFF)
-#define HIWORD(W)	(USHORT)(((W) >> 16) & 0xFFFF)
-#define MAKEDWORD(H, L)	(UINT)((L) | ((H) << 16))
+#define LOBYTE(W)	(unsigned char)((W) & 0xFF)
+#define HIBYTE(W)	(unsigned char)(((W) >> 8) & 0xFF)
+#define MAKEWORD(H, L)	(unsigned short)((L) | ((H) << 8))
+#define LOWORD(W)	(unsigned short)((W) & 0xFFFF)
+#define HIWORD(W)	(unsigned short)(((W) >> 16) & 0xFFFF)
+#define MAKEDWORD(H, L)	(unsigned int)((L) | ((H) << 16))
 
 #define ADDI_ENABLE		1
 #define ADDI_DISABLE		0
@@ -75,37 +61,37 @@ typedef const struct comedi_lrange *PCRANGE;
 /* Structures */
 
 /* structure for the boardtype */
-typedef struct {
-	const char *pc_DriverName;	// driver name
-	INT i_VendorId;		//PCI vendor a device ID of card
-	INT i_DeviceId;
-	INT i_IorangeBase0;
-	INT i_IorangeBase1;
-	INT i_IorangeBase2;	//  base 2 range
-	INT i_IorangeBase3;	//  base 3 range
-	INT i_PCIEeprom;	// eeprom present or not
-	char *pc_EepromChip;	// type of chip
-	INT i_NbrAiChannel;	// num of A/D chans
-	INT i_NbrAiChannelDiff;	// num of A/D chans in diff mode
-	INT i_AiChannelList;	// len of chanlist
-	INT i_NbrAoChannel;	// num of D/A chans
-	INT i_AiMaxdata;	// resolution of A/D
-	INT i_AoMaxdata;	// resolution of D/A
-	PCRANGE pr_AiRangelist;	// rangelist for A/D
-	PCRANGE pr_AoRangelist;	// rangelist for D/A
-
-	INT i_NbrDiChannel;	// Number of DI channels
-	INT i_NbrDoChannel;	// Number of DO channels
-	INT i_DoMaxdata;	// data to set all chanels high
-
-	INT i_NbrTTLChannel;	// Number of TTL channels
-	PCRANGE pr_TTLRangelist;	// rangelist for TTL
-
-	INT i_Dma;		// dma present or not
-	INT i_Timer;		//   timer subdevice present or not
-	BYTE b_AvailableConvertUnit;
-	UINT ui_MinAcquisitiontimeNs;	// Minimum Acquisition in Nano secs
-	UINT ui_MinDelaytimeNs;	// Minimum Delay in Nano secs
+struct addi_board {
+	const char *pc_DriverName;	/*  driver name */
+	int i_VendorId;		/* PCI vendor a device ID of card */
+	int i_DeviceId;
+	int i_IorangeBase0;
+	int i_IorangeBase1;
+	int i_IorangeBase2;	/*   base 2 range */
+	int i_IorangeBase3;	/*   base 3 range */
+	int i_PCIEeprom;	/*  eeprom present or not */
+	char *pc_EepromChip;	/*  type of chip */
+	int i_NbrAiChannel;	/*  num of A/D chans */
+	int i_NbrAiChannelDiff;	/*  num of A/D chans in diff mode */
+	int i_AiChannelList;	/*  len of chanlist */
+	int i_NbrAoChannel;	/*  num of D/A chans */
+	int i_AiMaxdata;	/*  resolution of A/D */
+	int i_AoMaxdata;	/*  resolution of D/A */
+        const struct comedi_lrange *pr_AiRangelist;	/* rangelist for A/D */
+        const struct comedi_lrange *pr_AoRangelist;	/* rangelist for D/A */
+
+	int i_NbrDiChannel;	/*  Number of DI channels */
+	int i_NbrDoChannel;	/*  Number of DO channels */
+	int i_DoMaxdata;	/*  data to set all chanels high */
+
+	int i_NbrTTLChannel;	/*  Number of TTL channels */
+	const struct comedi_lrange *pr_TTLRangelist;	/* rangelist for TTL */
+
+	int i_Dma;		/*  dma present or not */
+	int i_Timer;		/*    timer subdevice present or not */
+	unsigned char b_AvailableConvertUnit;
+	unsigned int ui_MinAcquisitiontimeNs;	/*  Minimum Acquisition in Nano secs */
+	unsigned int ui_MinDelaytimeNs;	/*  Minimum Delay in Nano secs */
 
 	/* interrupt and reset */
 	void (*v_hwdrv_Interrupt)(int irq, void *d);
@@ -213,21 +199,21 @@ typedef struct {
 	int (*i_hwdr_WriteTTLIOChlOnOff)(struct comedi_device *dev,
 					 struct comedi_subdevice *s,
 					 struct comedi_insn *insn, unsigned int *data);
-} boardtype;
+};
 
-//MODULE INFO STRUCTURE
+/* MODULE INFO STRUCTURE */
 
-typedef union {
+union str_ModuleInfo {
 	/* Incremental counter infos */
 	struct {
 		union {
 			struct {
-				BYTE b_ModeRegister1;
-				BYTE b_ModeRegister2;
-				BYTE b_ModeRegister3;
-				BYTE b_ModeRegister4;
+				unsigned char b_ModeRegister1;
+				unsigned char b_ModeRegister2;
+				unsigned char b_ModeRegister3;
+				unsigned char b_ModeRegister4;
 			} s_ByteModeRegister;
-			DWORD dw_ModeRegister1_2_3_4;
+			unsigned int dw_ModeRegister1_2_3_4;
 		} s_ModeRegister;
 
 		struct {
@@ -244,25 +230,25 @@ typedef union {
 
 	/* SSI infos */
 	struct {
-		BYTE b_SSIProfile;
-		BYTE b_PositionTurnLength;
-		BYTE b_TurnCptLength;
-		BYTE b_SSIInit;
+		unsigned char b_SSIProfile;
+		unsigned char b_PositionTurnLength;
+		unsigned char b_TurnCptLength;
+		unsigned char b_SSIInit;
 	} s_SSICounterInfo;
 
 	/* TTL I/O infos */
 	struct {
-		BYTE b_TTLInit;
-		BYTE b_PortConfiguration[4];
+		unsigned char b_TTLInit;
+		unsigned char b_PortConfiguration[4];
 	} s_TTLIOInfo;
 
 	/* Digital I/O infos */
 	struct {
-		BYTE b_DigitalInit;
-		BYTE b_ChannelAMode;
-		BYTE b_ChannelBMode;
-		BYTE b_OutputMemoryEnabled;
-		DWORD dw_OutputMemory;
+		unsigned char b_DigitalInit;
+		unsigned char b_ChannelAMode;
+		unsigned char b_ChannelBMode;
+		unsigned char b_OutputMemoryEnabled;
+		unsigned int dw_OutputMemory;
 	} s_DigitalIOInfo;
 
       /*********************/
@@ -271,14 +257,14 @@ typedef union {
 
 	struct {
 		struct {
-			BYTE b_82X54Init;
-			BYTE b_InputClockSelection;
-			BYTE b_InputClockLevel;
-			BYTE b_OutputLevel;
-			BYTE b_HardwareGateLevel;
-			DWORD dw_ConfigurationWord;
+			unsigned char b_82X54Init;
+			unsigned char b_InputClockSelection;
+			unsigned char b_InputClockLevel;
+			unsigned char b_OutputLevel;
+			unsigned char b_HardwareGateLevel;
+			unsigned int dw_ConfigurationWord;
 		} s_82X54TimerInfo[3];
-		BYTE b_InterruptMask;
+		unsigned char b_InterruptMask;
 	} s_82X54ModuleInfo;
 
       /*********************/
@@ -286,13 +272,13 @@ typedef union {
       /*********************/
 
 	struct {
-		BYTE b_ChronoInit;
-		BYTE b_InterruptMask;
-		BYTE b_PCIInputClock;
-		BYTE b_TimingUnit;
-		BYTE b_CycleMode;
+		unsigned char b_ChronoInit;
+		unsigned char b_InterruptMask;
+		unsigned char b_PCIInputClock;
+		unsigned char b_TimingUnit;
+		unsigned char b_CycleMode;
 		double d_TimingInterval;
-		DWORD dw_ConfigReg;
+		unsigned int dw_ConfigReg;
 	} s_ChronoModuleInfo;
 
       /***********************/
@@ -301,154 +287,154 @@ typedef union {
 
 	struct {
 		struct {
-			BYTE b_PulseEncoderInit;
+			unsigned char b_PulseEncoderInit;
 		} s_PulseEncoderInfo[4];
-		DWORD dw_SetRegister;
-		DWORD dw_ControlRegister;
-		DWORD dw_StatusRegister;
+		unsigned int dw_SetRegister;
+		unsigned int dw_ControlRegister;
+		unsigned int dw_StatusRegister;
 	} s_PulseEncoderModuleInfo;
 
 	/* Tor conter infos */
 	struct {
 		struct {
-			BYTE b_TorCounterInit;
-			BYTE b_TimingUnit;
-			BYTE b_InterruptEnable;
+			unsigned char b_TorCounterInit;
+			unsigned char b_TimingUnit;
+			unsigned char b_InterruptEnable;
 			double d_TimingInterval;
-			ULONG ul_RealTimingInterval;
+			unsigned int ul_RealTimingInterval;
 		} s_TorCounterInfo[2];
-		BYTE b_PCIInputClock;
+		unsigned char b_PCIInputClock;
 	} s_TorCounterModuleInfo;
 
 	/* PWM infos */
 	struct {
 		struct {
-			BYTE b_PWMInit;
-			BYTE b_TimingUnit;
-			BYTE b_InterruptEnable;
+			unsigned char b_PWMInit;
+			unsigned char b_TimingUnit;
+			unsigned char b_InterruptEnable;
 			double d_LowTiming;
 			double d_HighTiming;
-			ULONG ul_RealLowTiming;
-			ULONG ul_RealHighTiming;
+			unsigned int ul_RealLowTiming;
+			unsigned int ul_RealHighTiming;
 		} s_PWMInfo[2];
-		BYTE b_ClockSelection;
+		unsigned char b_ClockSelection;
 	} s_PWMModuleInfo;
 
 	/* ETM infos */
 	struct {
 		struct {
-			BYTE b_ETMEnable;
-			BYTE b_ETMInterrupt;
+			unsigned char b_ETMEnable;
+			unsigned char b_ETMInterrupt;
 		} s_ETMInfo[2];
-		BYTE b_ETMInit;
-		BYTE b_TimingUnit;
-		BYTE b_ClockSelection;
+		unsigned char b_ETMInit;
+		unsigned char b_TimingUnit;
+		unsigned char b_ClockSelection;
 		double d_TimingInterval;
-		ULONG ul_Timing;
+		unsigned int ul_Timing;
 	} s_ETMModuleInfo;
 
 	/* CDA infos */
 	struct {
-		BYTE b_CDAEnable;
-		BYTE b_CDAInterrupt;
-		BYTE b_CDAInit;
-		BYTE b_FctSelection;
-		BYTE b_CDAReadFIFOOverflow;
+		unsigned char b_CDAEnable;
+		unsigned char b_CDAInterrupt;
+		unsigned char b_CDAInit;
+		unsigned char b_FctSelection;
+		unsigned char b_CDAReadFIFOOverflow;
 	} s_CDAModuleInfo;
 
-} str_ModuleInfo;
+};
 
 /* Private structure for the addi_apci3120 driver */
-typedef struct {
-
-	INT iobase;
-	INT i_IobaseAmcc;	// base+size for AMCC chip
-	INT i_IobaseAddon;	//addon base address
-	INT i_IobaseReserved;
-	ULONG_PTR dw_AiBase;
-	struct pcilst_struct *amcc;	// ptr too AMCC data
-	BYTE allocated;		// we have blocked card
-	BYTE b_ValidDriver;	// driver is ok
-	BYTE b_AiContinuous;	// we do unlimited AI
-	BYTE b_AiInitialisation;
-	UINT ui_AiActualScan;	//how many scans we finished
-	UINT ui_AiBufferPtr;	// data buffer ptr in samples
-	UINT ui_AiNbrofChannels;	// how many channels is measured
-	UINT ui_AiScanLength;	// Length of actual scanlist
-	UINT ui_AiActualScanPosition;	// position in actual scan
-	PUINT pui_AiChannelList;	// actual chanlist
-	UINT ui_AiChannelList[32];	// actual chanlist
-	BYTE b_AiChannelConfiguration[32];	// actual chanlist
-	UINT ui_AiReadData[32];
-	DWORD dw_AiInitialised;
-	UINT ui_AiTimer0;	//Timer Constant for Timer0
-	UINT ui_AiTimer1;	//Timer constant for Timer1
-	UINT ui_AiFlags;
-	UINT ui_AiDataLength;
-	short *AiData;	// Pointer to sample data
-	UINT ui_AiNbrofScans;	// number of scans to do
-	USHORT us_UseDma;	// To use Dma or not
-	BYTE b_DmaDoubleBuffer;	// we can use double buffering
-	UINT ui_DmaActualBuffer;	// which buffer is used now
-	//*UPDATE-0.7.57->0.7.68
-	//ULONG               ul_DmaBufferVirtual[2];// pointers to begin of DMA buffer
-	short *ul_DmaBufferVirtual[2];	// pointers to begin of DMA buffer
-	ULONG ul_DmaBufferHw[2];	// hw address of DMA buff
-	UINT ui_DmaBufferSize[2];	// size of dma buffer in bytes
-	UINT ui_DmaBufferUsesize[2];	// which size we may now used for transfer
-	UINT ui_DmaBufferSamples[2];	// size in samples
-	UINT ui_DmaBufferPages[2];	// number of pages in buffer
-	BYTE b_DigitalOutputRegister;	// Digital Output Register
-	BYTE b_OutputMemoryStatus;
-	BYTE b_AnalogInputChannelNbr;	// Analog input channel Nbr
-	BYTE b_AnalogOutputChannelNbr;	// Analog input Output  Nbr
-	BYTE b_TimerSelectMode;	// Contain data written at iobase + 0C
-	BYTE b_ModeSelectRegister;	// Contain data written at iobase + 0E
-	USHORT us_OutputRegister;	// Contain data written at iobase + 0
-	BYTE b_InterruptState;
-	BYTE b_TimerInit;	// Specify if InitTimerWatchdog was load
-	BYTE b_TimerStarted;	// Specify if timer 2 is running or not
-	BYTE b_Timer2Mode;	// Specify the timer 2 mode
-	BYTE b_Timer2Interrupt;	//Timer2  interrupt enable or disable
-	BYTE b_AiCyclicAcquisition;	// indicate cyclic acquisition
-	BYTE b_InterruptMode;	// eoc eos or dma
-	BYTE b_EocEosInterrupt;	// Enable disable eoc eos interrupt
-	UINT ui_EocEosConversionTime;
-	BYTE b_EocEosConversionTimeBase;
-	BYTE b_SingelDiff;
-	BYTE b_ExttrigEnable;	/* To enable or disable external trigger */
+struct addi_private {
+
+	int iobase;
+	int i_IobaseAmcc;	/*  base+size for AMCC chip */
+	int i_IobaseAddon;	/* addon base address */
+	int i_IobaseReserved;
+	unsigned long dw_AiBase;
+	struct pcilst_struct *amcc;	/*  ptr too AMCC data */
+	unsigned char allocated;		/*  we have blocked card */
+	unsigned char b_ValidDriver;	/*  driver is ok */
+	unsigned char b_AiContinuous;	/*  we do unlimited AI */
+	unsigned char b_AiInitialisation;
+	unsigned int ui_AiActualScan;	/* how many scans we finished */
+	unsigned int ui_AiBufferPtr;	/*  data buffer ptr in samples */
+	unsigned int ui_AiNbrofChannels;	/*  how many channels is measured */
+	unsigned int ui_AiScanLength;	/*  Length of actual scanlist */
+	unsigned int ui_AiActualScanPosition;	/*  position in actual scan */
+	unsigned int *pui_AiChannelList;	/*  actual chanlist */
+	unsigned int ui_AiChannelList[32];	/*  actual chanlist */
+	unsigned char b_AiChannelConfiguration[32];	/*  actual chanlist */
+	unsigned int ui_AiReadData[32];
+	unsigned int dw_AiInitialised;
+	unsigned int ui_AiTimer0;	/* Timer Constant for Timer0 */
+	unsigned int ui_AiTimer1;	/* Timer constant for Timer1 */
+	unsigned int ui_AiFlags;
+	unsigned int ui_AiDataLength;
+	short *AiData;	/*  Pointer to sample data */
+	unsigned int ui_AiNbrofScans;	/*  number of scans to do */
+	unsigned short us_UseDma;	/*  To use Dma or not */
+	unsigned char b_DmaDoubleBuffer;	/*  we can use double buffering */
+	unsigned int ui_DmaActualBuffer;	/*  which buffer is used now */
+	/* UPDATE-0.7.57->0.7.68 */
+	/* unsigned int               ul_DmaBufferVirtual[2]; pointers to begin of DMA buffer */
+	short *ul_DmaBufferVirtual[2];	/*  pointers to begin of DMA buffer */
+	unsigned int ul_DmaBufferHw[2];	/*  hw address of DMA buff */
+	unsigned int ui_DmaBufferSize[2];	/*  size of dma buffer in bytes */
+	unsigned int ui_DmaBufferUsesize[2];	/*  which size we may now used for transfer */
+	unsigned int ui_DmaBufferSamples[2];	/*  size in samples */
+	unsigned int ui_DmaBufferPages[2];	/*  number of pages in buffer */
+	unsigned char b_DigitalOutputRegister;	/*  Digital Output Register */
+	unsigned char b_OutputMemoryStatus;
+	unsigned char b_AnalogInputChannelNbr;	/*  Analog input channel Nbr */
+	unsigned char b_AnalogOutputChannelNbr;	/*  Analog input Output  Nbr */
+	unsigned char b_TimerSelectMode;	/*  Contain data written at iobase + 0C */
+	unsigned char b_ModeSelectRegister;	/*  Contain data written at iobase + 0E */
+	unsigned short us_OutputRegister;	/*  Contain data written at iobase + 0 */
+	unsigned char b_InterruptState;
+	unsigned char b_TimerInit;	/*  Specify if InitTimerWatchdog was load */
+	unsigned char b_TimerStarted;	/*  Specify if timer 2 is running or not */
+	unsigned char b_Timer2Mode;	/*  Specify the timer 2 mode */
+	unsigned char b_Timer2Interrupt;	/* Timer2  interrupt enable or disable */
+	unsigned char b_AiCyclicAcquisition;	/*  indicate cyclic acquisition */
+	unsigned char b_InterruptMode;	/*  eoc eos or dma */
+	unsigned char b_EocEosInterrupt;	/*  Enable disable eoc eos interrupt */
+	unsigned int ui_EocEosConversionTime;
+	unsigned char b_EocEosConversionTimeBase;
+	unsigned char b_SingelDiff;
+	unsigned char b_ExttrigEnable;	/* To enable or disable external trigger */
 
 	/* Pointer to the current process */
 	struct task_struct *tsk_Current;
-	boardtype *ps_BoardInfo;
+	struct addi_board *ps_BoardInfo;
 
 	/* Hardware board infos for 1710 */
 	struct {
-		UINT ui_Address;	/* Board address */
-		UINT ui_FlashAddress;
-		BYTE b_InterruptNbr;	/* Board interrupt number */
-		BYTE b_SlotNumber;	/* PCI slot number */
-		BYTE b_BoardVersion;
-		DWORD dw_MolduleConfiguration[4];	/* Module config */
+		unsigned int ui_Address;	/* Board address */
+		unsigned int ui_FlashAddress;
+		unsigned char b_InterruptNbr;	/* Board interrupt number */
+		unsigned char b_SlotNumber;	/* PCI slot number */
+		unsigned char b_BoardVersion;
+		unsigned int dw_MolduleConfiguration[4];	/* Module config */
 	} s_BoardInfos;
 
 	/* Interrupt infos */
 	struct {
-		ULONG ul_InterruptOccur;	/* 0   : No interrupt occur */
+		unsigned int ul_InterruptOccur;	/* 0   : No interrupt occur */
 						/* > 0 : Interrupt occur */
-		UINT ui_Read;	/* Read FIFO */
-		UINT ui_Write;	/* Write FIFO */
+		unsigned int ui_Read;	/* Read FIFO */
+		unsigned int ui_Write;	/* Write FIFO */
 		struct {
-			BYTE b_OldModuleMask;
-			ULONG ul_OldInterruptMask;	/* Interrupt mask */
-			ULONG ul_OldCounterLatchValue;	/* Interrupt counter value */
+			unsigned char b_OldModuleMask;
+			unsigned int ul_OldInterruptMask;	/* Interrupt mask */
+			unsigned int ul_OldCounterLatchValue;	/* Interrupt counter value */
 		} s_FIFOInterruptParameters[APCI1710_SAVE_INTERRUPT];
 	} s_InterruptParameters;
 
-	str_ModuleInfo s_ModuleInfo[4];
-	ULONG ul_TTLPortConfiguration[10];
+	union str_ModuleInfo s_ModuleInfo[4];
+	unsigned int ul_TTLPortConfiguration[10];
 
-} addi_private;
+};
 
 static unsigned short pci_list_builded;	/* set to 1 when list of card is known */
 
@@ -457,6 +443,6 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
 static int i_ADDI_Detach(struct comedi_device *dev);
 static int i_ADDI_Reset(struct comedi_device *dev);
 
-static irqreturn_t v_ADDI_Interrupt(int irq, void *d PT_REGS_ARG);
+static irqreturn_t v_ADDI_Interrupt(int irq, void *d);
 static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, struct comedi_subdevice *s,
 				     struct comedi_insn *insn, unsigned int *data);

+ 218 - 220
drivers/staging/comedi/drivers/addi-data/addi_eeprom.c

@@ -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.
 
@@ -45,19 +45,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
   +----------+-----------+------------------------------------------------+
 */
 
-#define NVCMD_BEGIN_READ 	(0x7 << 5 )	// nvRam begin read command
-#define NVCMD_LOAD_LOW   	(0x4 << 5 )	// nvRam load low command
-#define NVCMD_LOAD_HIGH  	(0x5 << 5 )	// nvRam load high command
-#define EE76_CMD_LEN    	13	// bits in instructions
-#define EE_READ         	0x0180	// 01 1000 0000 read instruction
-
-#define	WORD				unsigned short
-#define PWORD				unsigned short *
-#define PDWORD				unsigned int  *
-
-#ifndef DWORD
-#define	DWORD				unsigned int
-#endif
+#define NVCMD_BEGIN_READ 	(0x7 << 5)	/*  nvRam begin read command */
+#define NVCMD_LOAD_LOW   	(0x4 << 5)	/*  nvRam load low command */
+#define NVCMD_LOAD_HIGH  	(0x5 << 5)	/*  nvRam load high command */
+#define EE76_CMD_LEN    	13	/*  bits in instructions */
+#define EE_READ         	0x0180	/*  01 1000 0000 read instruction */
 
 #define EEPROM_DIGITALINPUT 			0
 #define EEPROM_DIGITALOUTPUT			1
@@ -68,107 +60,114 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 #define EEPROM_TIMER_WATCHDOG_COUNTER	10
 
 struct str_Functionality {
-	BYTE b_Type;
-	WORD w_Address;
+	unsigned char b_Type;
+	unsigned short w_Address;
 };
 
-typedef struct {
-	WORD w_HeaderSize;
-	BYTE b_Nfunctions;
+struct str_MainHeader {
+	unsigned short w_HeaderSize;
+	unsigned char b_Nfunctions;
 	struct str_Functionality s_Functions[7];
-} str_MainHeader;
+};
 
-typedef struct {
-	WORD w_Nchannel;
-	BYTE b_Interruptible;
-	WORD w_NinterruptLogic;
-} str_DigitalInputHeader;
+struct str_DigitalInputHeader {
+	unsigned short w_Nchannel;
+	unsigned char b_Interruptible;
+	unsigned short w_NinterruptLogic;
+};
 
-typedef struct {
-	WORD w_Nchannel;
-} str_DigitalOutputHeader;
+struct str_DigitalOutputHeader {
 
-// used for timer as well as watchdog
+	unsigned short w_Nchannel;
+};
 
-typedef struct {
-	WORD w_HeaderSize;
-	BYTE b_Resolution;
-	BYTE b_Mode;		// in case of Watchdog it is functionality
-	WORD w_MinTiming;
-	BYTE b_TimeBase;
-} str_TimerDetails;
-typedef struct {
 
-	WORD w_Ntimer;
-	str_TimerDetails s_TimerDetails[4];	//  supports 4 timers
-} str_TimerMainHeader;
+/* used for timer as well as watchdog */
+
+struct str_TimerDetails {
+
+	unsigned short w_HeaderSize;
+	unsigned char b_Resolution;
+	unsigned char b_Mode;		/*  in case of Watchdog it is functionality */
+	unsigned short w_MinTiming;
+	unsigned char b_TimeBase;
+};
+
+struct str_TimerMainHeader {
+
+
+	unsigned short w_Ntimer;
+	struct str_TimerDetails s_TimerDetails[4];	/*   supports 4 timers */
+};
+
 
 typedef struct {
-	WORD w_Nchannel;
-	BYTE b_Resolution;
+	unsigned short w_Nchannel;
+	unsigned char b_Resolution;
 } str_AnalogOutputHeader;
 
-typedef struct {
-	WORD w_Nchannel;
-	WORD w_MinConvertTiming;
-	WORD w_MinDelayTiming;
-	BYTE b_HasDma;
-	BYTE b_Resolution;
-} str_AnalogInputHeader;
+struct str_AnalogInputHeader {
+	unsigned short w_Nchannel;
+	unsigned short w_MinConvertTiming;
+	unsigned short w_MinDelayTiming;
+	unsigned char b_HasDma;
+	unsigned char b_Resolution;
+};
+
 
 		/*****************************************/
 		/*            Read Header Functions              */
 		/*****************************************/
 
-INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
+int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
 	char *pc_PCIChipInformation, struct comedi_device *dev);
 
-INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress,
-	char *pc_PCIChipInformation, WORD w_Address,
-	str_DigitalInputHeader * s_Header);
+int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress,
+	char *pc_PCIChipInformation, unsigned short w_Address,
+	struct str_DigitalInputHeader *s_Header);
 
-INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress,
-	char *pc_PCIChipInformation, WORD w_Address,
-	str_DigitalOutputHeader * s_Header);
+int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress,
+	char *pc_PCIChipInformation, unsigned short w_Address,
+	struct str_DigitalOutputHeader *s_Header);
 
-INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,
-	char *pc_PCIChipInformation, WORD w_Address,
-	str_TimerMainHeader * s_Header);
+int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress,
+	char *pc_PCIChipInformation, unsigned short w_Address,
+	struct str_TimerMainHeader *s_Header);
 
-INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress,
-	char *pc_PCIChipInformation, WORD w_Address,
-	str_AnalogOutputHeader * s_Header);
+int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress,
+	char *pc_PCIChipInformation, unsigned short w_Address,
+	str_AnalogOutputHeader *s_Header);
 
-INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress,
-	char *pc_PCIChipInformation, WORD w_Address,
-	str_AnalogInputHeader * s_Header);
+int i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress,
+	char *pc_PCIChipInformation, unsigned short w_Address,
+	struct str_AnalogInputHeader *s_Header);
 
 		/******************************************/
 		/*      Eeprom Specific Functions                         */
 		/******************************************/
-WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
-	WORD w_EepromStartAddress);
-void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress);
-void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue);
-void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress);
-void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand,
-	BYTE b_DataLengthInBits);
-void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value);
+unsigned short w_EepromReadWord(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
+	unsigned short w_EepromStartAddress);
+void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress);
+void v_EepromClock76(unsigned int dw_Address, unsigned int dw_RegisterValue);
+void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress);
+void v_EepromSendCommand76(unsigned int dw_Address, unsigned int dw_EepromCommand,
+	unsigned char b_DataLengthInBits);
+void v_EepromCs76Read(unsigned int dw_Address, unsigned short w_offset, unsigned short *pw_Value);
 
 /*
 +----------------------------------------------------------------------------+
-| Function   Name   : WORD w_EepromReadWord                                  |
-|				(WORD	w_PCIBoardEepromAddress,             		 |
+| Function   Name   : unsigned short w_EepromReadWord                                  |
+|				(unsigned short	w_PCIBoardEepromAddress,             		 |
 |				 char *	pc_PCIChipInformation,               		 |
-|				 WORD   w_EepromStartAddress)                		 |
+|				 unsigned short   w_EepromStartAddress)                		 |
 +----------------------------------------------------------------------------+
 | Task              : Read from eepromn a word                               |
 +----------------------------------------------------------------------------+
-| Input Parameters  : WORD w_PCIBoardEepromAddress : PCI eeprom address      |
+| Input Parameters  : unsigned short w_PCIBoardEepromAddress : PCI eeprom address      |
 |																	 |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
-|		      WORD w_EepromStartAddress    : Selected eeprom address |
+|		      unsigned short w_EepromStartAddress    : Selected eeprom address |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -176,23 +175,23 @@ void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value);
 +----------------------------------------------------------------------------+
 */
 
-WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
-	WORD w_EepromStartAddress)
+unsigned short w_EepromReadWord(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
+	unsigned short w_EepromStartAddress)
 {
 
-	BYTE b_Counter = 0;
+	unsigned char b_Counter = 0;
 
-	BYTE b_ReadByte = 0;
+	unsigned char b_ReadByte = 0;
 
-	BYTE b_ReadLowByte = 0;
+	unsigned char b_ReadLowByte = 0;
 
-	BYTE b_ReadHighByte = 0;
+	unsigned char b_ReadHighByte = 0;
 
-	BYTE b_SelectedAddressLow = 0;
+	unsigned char b_SelectedAddressLow = 0;
 
-	BYTE b_SelectedAddressHigh = 0;
+	unsigned char b_SelectedAddressHigh = 0;
 
-	WORD w_ReadWord = 0;
+	unsigned short w_ReadWord = 0;
 
 	/**************************/
 
@@ -207,9 +206,9 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
 		for (b_Counter = 0; b_Counter < 2; b_Counter++)
 		{
 
-			b_SelectedAddressLow = (w_EepromStartAddress + b_Counter) % 256;	//Read the low 8 bit part
+			b_SelectedAddressLow = (w_EepromStartAddress + b_Counter) % 256;	/* Read the low 8 bit part */
 
-			b_SelectedAddressHigh = (w_EepromStartAddress + b_Counter) / 256;	//Read the high 8 bit part
+			b_SelectedAddressHigh = (w_EepromStartAddress + b_Counter) / 256;	/* Read the high 8 bit part */
 
 	      /************************************/
 
@@ -320,20 +319,20 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
 
 				b_ReadLowByte = b_ReadByte;
 
-			}	// if(b_Counter==0)
+			}	/*  if(b_Counter==0) */
 
 			else
 			{
 
 				b_ReadHighByte = b_ReadByte;
 
-			}	// if(b_Counter==0)
+			}	/*  if(b_Counter==0) */
 
-		}		// for (b_Counter=0; b_Counter<2; b_Counter++)
+		}		/*  for (b_Counter=0; b_Counter<2; b_Counter++) */
 
-		w_ReadWord = (b_ReadLowByte | (((WORD) b_ReadHighByte) * 256));
+		w_ReadWord = (b_ReadLowByte | (((unsigned short) b_ReadHighByte) * 256));
 
-	}			// end of if ((!strcmp(pc_PCIChipInformation, "S5920")) || (!strcmp(pc_PCIChipInformation, "S5933")))
+	}			/*  end of if ((!strcmp(pc_PCIChipInformation, "S5920")) || (!strcmp(pc_PCIChipInformation, "S5933"))) */
 
 	if (!strcmp(pc_PCIChipInformation, "93C76"))
 	{
@@ -349,7 +348,7 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
 
 	}
 
-	return (w_ReadWord);
+	return w_ReadWord;
 
 }
 
@@ -359,7 +358,7 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
 
 | Function   Name   : void v_EepromWaitBusy                                  |
 
-|			(WORD	w_PCIBoardEepromAddress)                    	 |
+|			(unsigned short	w_PCIBoardEepromAddress)                    	 |
 
 +----------------------------------------------------------------------------+
 
@@ -367,7 +366,7 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
 
 +----------------------------------------------------------------------------+
 
-| Input Parameters  : WORD w_PCIBoardEepromAddress : PCI eeprom base address |
+| Input Parameters  : unsigned short w_PCIBoardEepromAddress : PCI eeprom base address |
 
 +----------------------------------------------------------------------------+
 
@@ -381,10 +380,10 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation,
 
 */
 
-void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress)
+void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress)
 {
 
-	BYTE b_EepromBusy = 0;
+	unsigned char b_EepromBusy = 0;
 
 	do
 	{
@@ -403,17 +402,16 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress)
 
 		/*      the operator register is AMCC_OP_REG_MCSR+3 */
 
-		/*      WORD read  EEPROM=0x8000 andAMCC_OP_REG_MCSR+2                  */
+		/*      unsigned short read  EEPROM=0x8000 andAMCC_OP_REG_MCSR+2                  */
 
-		/*      DWORD read  EEPROM=0x80000000 and AMCC_OP_REG_MCSR */
+		/*      unsigned int read  EEPROM=0x80000000 and AMCC_OP_REG_MCSR */
 
 	   /************************************************************************/
 
 		b_EepromBusy = inb(w_PCIBoardEepromAddress + 0x3F);
 		b_EepromBusy = b_EepromBusy & 0x80;
 
-	}
-	while (b_EepromBusy == 0x80);
+	} while (b_EepromBusy == 0x80);
 
 }
 
@@ -421,9 +419,9 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress)
 
 +---------------------------------------------------------------------------------+
 
-| Function   Name   : void v_EepromClock76(DWORD dw_Address,                      |
+| Function   Name   : void v_EepromClock76(unsigned int dw_Address,                      |
 
-|					   DWORD dw_RegisterValue)                 			  |
+|					   unsigned int dw_RegisterValue)                 			  |
 
 +---------------------------------------------------------------------------------+
 
@@ -431,9 +429,9 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress)
 
 +---------------------------------------------------------------------------------+
 
-| Input Parameters  : DWORD dw_Address : PCI eeprom base address                  |
+| Input Parameters  : unsigned int dw_Address : PCI eeprom base address                  |
 
-|		      DWORD dw_RegisterValue : PCI eeprom register value to write.|
+|		      unsigned int dw_RegisterValue : PCI eeprom register value to write.|
 
 +---------------------------------------------------------------------------------+
 
@@ -447,7 +445,7 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress)
 
 */
 
-void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue)
+void v_EepromClock76(unsigned int dw_Address, unsigned int dw_RegisterValue)
 {
 
    /************************/
@@ -488,11 +486,11 @@ void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue)
 
 +---------------------------------------------------------------------------------+
 
-| Function   Name   : void v_EepromSendCommand76(DWORD dw_Address,                |
+| Function   Name   : void v_EepromSendCommand76(unsigned int dw_Address,                |
 
-|					   DWORD   dw_EepromCommand,                		  |
+|					   unsigned int   dw_EepromCommand,                		  |
 
-|					   BYTE    b_DataLengthInBits)                        |
+|					   unsigned char    b_DataLengthInBits)                        |
 
 +---------------------------------------------------------------------------------+
 
@@ -500,11 +498,11 @@ void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue)
 
 +---------------------------------------------------------------------------------+
 
-| Input Parameters  : DWORD dw_Address : PCI eeprom base address                  |
+| Input Parameters  : unsigned int dw_Address : PCI eeprom base address                  |
 
-|		      DWORD dw_EepromCommand : PCI eeprom command to write.       |
+|		      unsigned int dw_EepromCommand : PCI eeprom command to write.       |
 
-|		      BYTE  b_DataLengthInBits : PCI eeprom command data length.  |
+|		      unsigned char  b_DataLengthInBits : PCI eeprom command data length.  |
 
 +---------------------------------------------------------------------------------+
 
@@ -518,13 +516,13 @@ void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue)
 
 */
 
-void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand,
-	BYTE b_DataLengthInBits)
+void v_EepromSendCommand76(unsigned int dw_Address, unsigned int dw_EepromCommand,
+	unsigned char b_DataLengthInBits)
 {
 
 	char c_BitPos = 0;
 
-	DWORD dw_RegisterValue = 0;
+	unsigned int dw_RegisterValue = 0;
 
    /*****************************/
 
@@ -623,11 +621,11 @@ void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand,
 
 +---------------------------------------------------------------------------------+
 
-| Function   Name   : void v_EepromCs76Read(DWORD dw_Address,                     |
+| Function   Name   : void v_EepromCs76Read(unsigned int dw_Address,                     |
 
-|					   WORD    w_offset,                      			  |
+|					   unsigned short    w_offset,                      			  |
 
-|					   PWORD   pw_Value)                      			  |
+|					   unsigned short *   pw_Value)                      			  |
 
 +---------------------------------------------------------------------------------+
 
@@ -635,11 +633,11 @@ void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand,
 
 +---------------------------------------------------------------------------------+
 
-| Input Parameters  : DWORD dw_Address : PCI eeprom base address                  |
+| Input Parameters  : unsigned int dw_Address : PCI eeprom base address                  |
 
-|		      WORD    w_offset : Offset of the adress to read             |
+|		      unsigned short    w_offset : Offset of the adress to read             |
 
-|		      PWORD   pw_Value : PCI eeprom 16 bit read value.            |
+|		      unsigned short *   pw_Value : PCI eeprom 16 bit read value.            |
 
 +---------------------------------------------------------------------------------+
 
@@ -653,14 +651,14 @@ void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand,
 
 */
 
-void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value)
+void v_EepromCs76Read(unsigned int dw_Address, unsigned short w_offset, unsigned short *pw_Value)
 {
 
         char c_BitPos = 0;
 
-	DWORD dw_RegisterValue = 0;
+	unsigned int dw_RegisterValue = 0;
 
-	DWORD dw_RegisterValueRead = 0;
+	unsigned int dw_RegisterValueRead = 0;
 
    /*************************************************/
 
@@ -786,12 +784,12 @@ void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value)
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name  : INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,  |
+| Function Name  : int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,  |
 |				char *	pc_PCIChipInformation,struct comedi_device *dev)    |
 +----------------------------------------------------------------------------+
 | Task              : Read from eeprom Main Header                           |
 +----------------------------------------------------------------------------+
-| Input Parameters  : WORD w_PCIBoardEepromAddress : PCI eeprom address      |
+| Input Parameters  : unsigned short w_PCIBoardEepromAddress : PCI eeprom address      |
 |																	 |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
@@ -804,43 +802,43 @@ void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value)
 +----------------------------------------------------------------------------+
 */
 
-INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
+int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
 	char *pc_PCIChipInformation, struct comedi_device *dev)
 {
-	WORD w_Temp, i, w_Count = 0;
-	UINT ui_Temp;
-	str_MainHeader s_MainHeader;
-	str_DigitalInputHeader s_DigitalInputHeader;
-	str_DigitalOutputHeader s_DigitalOutputHeader;
-	//str_TimerMainHeader     s_TimerMainHeader,s_WatchdogMainHeader;
+	unsigned short w_Temp, i, w_Count = 0;
+	unsigned int ui_Temp;
+	struct str_MainHeader s_MainHeader;
+	struct str_DigitalInputHeader s_DigitalInputHeader;
+	struct str_DigitalOutputHeader s_DigitalOutputHeader;
+	/* struct str_TimerMainHeader     s_TimerMainHeader,s_WatchdogMainHeader; */
 	str_AnalogOutputHeader s_AnalogOutputHeader;
-	str_AnalogInputHeader s_AnalogInputHeader;
+	struct str_AnalogInputHeader s_AnalogInputHeader;
 
-	// Read size
+	/* Read size */
 	s_MainHeader.w_HeaderSize =
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		0x100 + 8);
 
-	// Read nbr of functionality
+	/* Read nbr of functionality */
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + 10);
-	s_MainHeader.b_Nfunctions = (BYTE) w_Temp & 0x00FF;
+	s_MainHeader.b_Nfunctions = (unsigned char) w_Temp & 0x00FF;
 
-	// Read functionality details
+	/* Read functionality details */
 	for (i = 0; i < s_MainHeader.b_Nfunctions; i++) {
-		// Read Type
+		/* Read Type */
 		w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 			pc_PCIChipInformation, 0x100 + 12 + w_Count);
-		s_MainHeader.s_Functions[i].b_Type = (BYTE) w_Temp & 0x3F;
+		s_MainHeader.s_Functions[i].b_Type = (unsigned char) w_Temp & 0x3F;
 		w_Count = w_Count + 2;
-		//Read Address
+		/* Read Address */
 		s_MainHeader.s_Functions[i].w_Address =
 			w_EepromReadWord(w_PCIBoardEepromAddress,
 			pc_PCIChipInformation, 0x100 + 12 + w_Count);
 		w_Count = w_Count + 2;
 	}
 
-	// Display main header info
+	/* Display main header info */
 	for (i = 0; i < s_MainHeader.b_Nfunctions; i++) {
 
 		switch (s_MainHeader.s_Functions[i].b_Type) {
@@ -878,10 +876,10 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
 					s_AnalogInputHeader.w_Nchannel;
 			this_board->i_Dma = s_AnalogInputHeader.b_HasDma;
 			this_board->ui_MinAcquisitiontimeNs =
-				(UINT) s_AnalogInputHeader.w_MinConvertTiming *
+				(unsigned int) s_AnalogInputHeader.w_MinConvertTiming *
 				1000;
 			this_board->ui_MinDelaytimeNs =
-				(UINT) s_AnalogInputHeader.w_MinDelayTiming *
+				(unsigned int) s_AnalogInputHeader.w_MinDelayTiming *
 				1000;
 			ui_Temp = 0xffff;
 			this_board->i_AiMaxdata =
@@ -903,15 +901,15 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
 			break;
 
 		case EEPROM_TIMER:
-			this_board->i_Timer = 1;	//Timer subdevice present
+			this_board->i_Timer = 1;	/* Timer subdevice present */
 			break;
 
 		case EEPROM_WATCHDOG:
-			this_board->i_Timer = 1;	//Timer subdevice present
+			this_board->i_Timer = 1;	/* Timer subdevice present */
 			break;
 
 		case EEPROM_TIMER_WATCHDOG_COUNTER:
-			this_board->i_Timer = 1;	//Timer subdevice present
+			this_board->i_Timer = 1;	/* Timer subdevice present */
 		}
 	}
 
@@ -920,18 +918,18 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name  : INT i_EepromReadDigitalInputHeader(WORD 					 |
+| Function Name  : int i_EepromReadDigitalInputHeader(unsigned short 					 |
 |			w_PCIBoardEepromAddress,char *pc_PCIChipInformation,	 |
-|			WORD w_Address,str_DigitalInputHeader *s_Header)		 |
+|			unsigned short w_Address,struct str_DigitalInputHeader *s_Header)		 |
 |																	 |
 +----------------------------------------------------------------------------+
 | Task              : Read Digital Input Header                              |
 +----------------------------------------------------------------------------+
-| Input Parameters  : WORD w_PCIBoardEepromAddress : PCI eeprom address      |
+| Input Parameters  : unsigned short w_PCIBoardEepromAddress : PCI eeprom address      |
 |																	 |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
-|			 str_DigitalInputHeader *s_Header: Digita Input Header   |
+|			 struct str_DigitalInputHeader *s_Header: Digita Input Header   |
 |												   Pointer			 |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -939,23 +937,23 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
 | Return Value      : 0							                             |
 +----------------------------------------------------------------------------+
 */
-INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress,
-	char *pc_PCIChipInformation, WORD w_Address,
-	str_DigitalInputHeader * s_Header)
+int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress,
+	char *pc_PCIChipInformation, unsigned short w_Address,
+	struct str_DigitalInputHeader *s_Header)
 {
-	WORD w_Temp;
+	unsigned short w_Temp;
 
-	// read nbr of channels
+	/*  read nbr of channels */
 	s_Header->w_Nchannel =
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		0x100 + w_Address + 6);
 
-	// interruptible or not
+	/*  interruptible or not */
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + 8);
-	s_Header->b_Interruptible = (BYTE) (w_Temp >> 7) & 0x01;
+	s_Header->b_Interruptible = (unsigned char) (w_Temp >> 7) & 0x01;
 
-// How many interruptible logic
+/* How many interruptible logic */
 	s_Header->w_NinterruptLogic =
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		0x100 + w_Address + 10);
@@ -965,18 +963,18 @@ INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name  : INT i_EepromReadDigitalOutputHeader(WORD 				 |
+| Function Name  : int i_EepromReadDigitalOutputHeader(unsigned short 				 |
 |			w_PCIBoardEepromAddress,char *pc_PCIChipInformation,	 |
-|			WORD w_Address,str_DigitalOutputHeader *s_Header)	     |
+|			unsigned short w_Address,struct str_DigitalOutputHeader *s_Header)	     |
 |																	 |
 +----------------------------------------------------------------------------+
 | Task              : Read Digital Output Header                             |
 +----------------------------------------------------------------------------+
-| Input Parameters  : WORD w_PCIBoardEepromAddress : PCI eeprom address      |
+| Input Parameters  : unsigned short w_PCIBoardEepromAddress : PCI eeprom address      |
 |																	 |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
-|			 str_DigitalOutputHeader *s_Header: Digital Output Header|
+|			 struct str_DigitalOutputHeader *s_Header: Digital Output Header|
 |											   Pointer				 |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -984,11 +982,11 @@ INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress,
 | Return Value      : 0							                             |
 +----------------------------------------------------------------------------+
 */
-INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress,
-	char *pc_PCIChipInformation, WORD w_Address,
-	str_DigitalOutputHeader * s_Header)
+int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress,
+	char *pc_PCIChipInformation, unsigned short w_Address,
+	struct str_DigitalOutputHeader *s_Header)
 {
-// Read Nbr channels
+/* Read Nbr channels */
 	s_Header->w_Nchannel =
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		0x100 + w_Address + 6);
@@ -997,17 +995,17 @@ INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name  : INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, |
+| Function Name  : int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress, |
 |			char *pc_PCIChipInformation,WORD w_Address,				 |
-|			str_TimerMainHeader *s_Header)							 |
+|			struct str_TimerMainHeader *s_Header)							 |
 +----------------------------------------------------------------------------+
 | Task              : Read Timer or Watchdog Header                          |
 +----------------------------------------------------------------------------+
-| Input Parameters  : WORD w_PCIBoardEepromAddress : PCI eeprom address      |
+| Input Parameters  : unsigned short w_PCIBoardEepromAddress : PCI eeprom address      |
 |																	 |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
-|			 str_TimerMainHeader *s_Header: Timer Header			 |
+|			 struct str_TimerMainHeader *s_Header: Timer Header			 |
 |											   Pointer				 |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -1015,18 +1013,18 @@ INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress,
 | Return Value      : 0							                             |
 +----------------------------------------------------------------------------+
 */
-INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,
-	char *pc_PCIChipInformation, WORD w_Address,
-	str_TimerMainHeader * s_Header)
+int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress,
+	char *pc_PCIChipInformation, unsigned short w_Address,
+	struct str_TimerMainHeader *s_Header)
 {
 
-	WORD i, w_Size = 0, w_Temp;
+	unsigned short i, w_Size = 0, w_Temp;
 
-//Read No of Timer
+/* Read No of Timer */
 	s_Header->w_Ntimer =
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		0x100 + w_Address + 6);
-//Read header size
+/* Read header size */
 
 	for (i = 0; i < s_Header->w_Ntimer; i++) {
 		s_Header->s_TimerDetails[i].w_HeaderSize =
@@ -1037,23 +1035,23 @@ INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,
 			pc_PCIChipInformation,
 			0x100 + w_Address + 8 + w_Size + 2);
 
-		//Read Resolution
+		/* Read Resolution */
 		s_Header->s_TimerDetails[i].b_Resolution =
-			(BYTE) (w_Temp >> 10) & 0x3F;
+			(unsigned char) (w_Temp >> 10) & 0x3F;
 
-		//Read Mode
+		/* Read Mode */
 		s_Header->s_TimerDetails[i].b_Mode =
-			(BYTE) (w_Temp >> 4) & 0x3F;
+			(unsigned char) (w_Temp >> 4) & 0x3F;
 
 		w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 			pc_PCIChipInformation,
 			0x100 + w_Address + 8 + w_Size + 4);
 
-		//Read MinTiming
+		/* Read MinTiming */
 		s_Header->s_TimerDetails[i].w_MinTiming = (w_Temp >> 6) & 0x3FF;
 
-		//Read Timebase
-		s_Header->s_TimerDetails[i].b_TimeBase = (BYTE) (w_Temp) & 0x3F;
+		/* Read Timebase */
+		s_Header->s_TimerDetails[i].b_TimeBase = (unsigned char) (w_Temp) & 0x3F;
 		w_Size += s_Header->s_TimerDetails[i].w_HeaderSize;
 	}
 
@@ -1062,13 +1060,13 @@ INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name  : INT i_EepromReadAnlogOutputHeader(WORD 					 |
+| Function Name  : int i_EepromReadAnlogOutputHeader(unsigned short 					 |
 |			w_PCIBoardEepromAddress,char *pc_PCIChipInformation,	 |
-|			WORD w_Address,str_AnalogOutputHeader *s_Header)         |
+|			unsigned short w_Address,str_AnalogOutputHeader *s_Header)         |
 +----------------------------------------------------------------------------+
 | Task              : Read Nalog Output  Header                              |
 +----------------------------------------------------------------------------+
-| Input Parameters  : WORD w_PCIBoardEepromAddress : PCI eeprom address      |
+| Input Parameters  : unsigned short w_PCIBoardEepromAddress : PCI eeprom address      |
 |																	 |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
@@ -1081,35 +1079,35 @@ INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,
 +----------------------------------------------------------------------------+
 */
 
-INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress,
-	char *pc_PCIChipInformation, WORD w_Address,
-	str_AnalogOutputHeader * s_Header)
+int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress,
+	char *pc_PCIChipInformation, unsigned short w_Address,
+	str_AnalogOutputHeader *s_Header)
 {
-	WORD w_Temp;
-	// No of channels for 1st hard component
+	unsigned short w_Temp;
+	/*  No of channels for 1st hard component */
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + 10);
 	s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
-	// Resolution for 1st hard component
+	/*  Resolution for 1st hard component */
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + 16);
-	s_Header->b_Resolution = (BYTE) (w_Temp >> 8) & 0xFF;
+	s_Header->b_Resolution = (unsigned char) (w_Temp >> 8) & 0xFF;
 	return 0;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name  : INT i_EepromReadAnlogInputHeader(WORD 					 |
+| Function Name  : int i_EepromReadAnlogInputHeader(unsigned short 					 |
 |			w_PCIBoardEepromAddress,char *pc_PCIChipInformation,     |
-|			WORD w_Address,str_AnalogInputHeader *s_Header)          |
+|			unsigned short w_Address,struct str_AnalogInputHeader *s_Header)          |
 +----------------------------------------------------------------------------+
 | Task              : Read Nalog Output  Header                              |
 +----------------------------------------------------------------------------+
-| Input Parameters  : WORD w_PCIBoardEepromAddress : PCI eeprom address      |
+| Input Parameters  : unsigned short w_PCIBoardEepromAddress : PCI eeprom address      |
 |																	 |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
-|			 str_AnalogInputHeader *s_Header:Anlog Input Header      |
+|			 struct str_AnalogInputHeader *s_Header:Anlog Input Header      |
 |											   Pointer				 |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -1118,12 +1116,12 @@ INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress,
 +----------------------------------------------------------------------------+
 */
 
-// Reads only for ONE  hardware component
-INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress,
-	char *pc_PCIChipInformation, WORD w_Address,
-	str_AnalogInputHeader * s_Header)
+/* Reads only for ONE  hardware component */
+int i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress,
+	char *pc_PCIChipInformation, unsigned short w_Address,
+	struct str_AnalogInputHeader *s_Header)
 {
-	WORD w_Temp, w_Offset;
+	unsigned short w_Temp, w_Offset;
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + 10);
 	s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
@@ -1135,24 +1133,24 @@ INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress,
 		0x100 + w_Address + 30);
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + 20);
-	s_Header->b_HasDma = (w_Temp >> 13) & 0x01;	// whether dma present or not
+	s_Header->b_HasDma = (w_Temp >> 13) & 0x01;	/*  whether dma present or not */
 
-	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 72);	// reading Y
+	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 72);	/*  reading Y */
 	w_Temp = w_Temp & 0x00FF;
-	if (w_Temp)		//Y>0
+	if (w_Temp)		/* Y>0 */
 	{
-		w_Offset = 74 + (2 * w_Temp) + (10 * (1 + (w_Temp / 16)));	// offset of first analog input single header
-		w_Offset = w_Offset + 2;	// resolution
-	} else			//Y=0
+		w_Offset = 74 + (2 * w_Temp) + (10 * (1 + (w_Temp / 16)));	/*  offset of first analog input single header */
+		w_Offset = w_Offset + 2;	/*  resolution */
+	} else			/* Y=0 */
 	{
 		w_Offset = 74;
-		w_Offset = w_Offset + 2;	// resolution
+		w_Offset = w_Offset + 2;	/*  resolution */
 	}
 
-// read Resolution
+/* read Resolution */
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + w_Offset);
-	s_Header->b_Resolution = w_Temp & 0x001F;	// last 5 bits
+	s_Header->b_Resolution = w_Temp & 0x001F;	/*  last 5 bits */
 
 	return 0;
 }

+ 21 - 22
drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h

@@ -31,15 +31,15 @@
 
 *************************/
 
-#define FIFO_ADVANCE_ON_BYTE_2     0x20000000	// written on base0
+#define FIFO_ADVANCE_ON_BYTE_2     0x20000000	/*  written on base0 */
 
-#define AMWEN_ENABLE                     0x02	// added for step 6 dma written on base2
+#define AMWEN_ENABLE                     0x02	/*  added for step 6 dma written on base2 */
 #define A2P_FIFO_WRITE_ENABLE            0x01
 
-#define AGCSTS_TC_ENABLE		   0x10000000	// Added for transfer count enable bit
+#define AGCSTS_TC_ENABLE		   0x10000000	/*  Added for transfer count enable bit */
 
-//  ADDON RELATED ADDITIONS
-// Constant
+/* ADDON RELATED ADDITIONS */
+/* Constant */
 #define     APCI3120_ENABLE_TRANSFER_ADD_ON_LOW       0x00
 #define     APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH      0x1200
 #define     APCI3120_A2P_FIFO_MANAGEMENT              0x04000400L
@@ -52,7 +52,7 @@
 #define     APCI3120_DISABLE_BUS_MASTER_ADD_ON        0x0
 #define     APCI3120_DISABLE_BUS_MASTER_PCI           0x0
 
- // ADD_ON ::: this needed since apci supports 16 bit interface to add on
+ /*  ADD_ON ::: this needed since apci supports 16 bit interface to add on */
 #define     APCI3120_ADD_ON_AGCSTS_LOW       0x3C
 #define     APCI3120_ADD_ON_AGCSTS_HIGH      APCI3120_ADD_ON_AGCSTS_LOW + 2
 #define     APCI3120_ADD_ON_MWAR_LOW         0x24
@@ -60,7 +60,7 @@
 #define     APCI3120_ADD_ON_MWTC_LOW         0x058
 #define     APCI3120_ADD_ON_MWTC_HIGH        APCI3120_ADD_ON_MWTC_LOW + 2
 
-// AMCC
+/* AMCC */
 #define     APCI3120_AMCC_OP_MCSR            0x3C
 #define     APCI3120_AMCC_OP_REG_INTCSR      0x38
 
@@ -85,7 +85,7 @@
 #define AMCC_OP_REG_MRTC         0x30
 #define AMCC_OP_REG_MBEF         0x34
 #define AMCC_OP_REG_INTCSR       0x38
-#define  AMCC_OP_REG_INTCSR_SRC  (AMCC_OP_REG_INTCSR + 2)	/* INT source */
+#define  AMCC_OP_REG_INTCSR_SRC  (AMCC_OP_REG_INTCSR + 2)	/* int source */
 #define  AMCC_OP_REG_INTCSR_FEC  (AMCC_OP_REG_INTCSR + 3)	/* FIFO ctrl */
 #define AMCC_OP_REG_MCSR         0x3c
 #define  AMCC_OP_REG_MCSR_NVDATA (AMCC_OP_REG_MCSR + 2)	/* Data in byte 2 */
@@ -212,7 +212,7 @@ struct pcilst_struct {
 	unsigned int irq;
 };
 
-struct pcilst_struct *amcc_devices;	// ptr to root list of all amcc devices
+struct pcilst_struct *amcc_devices;	/*  ptr to root list of all amcc devices */
 
 /****************************************************************************/
 
@@ -267,7 +267,7 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display)
 			amcc->vendor = pcidev->vendor;
 			amcc->device = pcidev->device;
 #if 0
-			amcc->master = pcidev->master;	// how get this information under 2.4 kernels?
+			amcc->master = pcidev->master;	/*  how get this information under 2.4 kernels? */
 #endif
 			amcc->pci_bus = pcidev->bus->number;
 			amcc->pci_slot = PCI_SLOT(pcidev->devfn);
@@ -333,17 +333,17 @@ int i_find_free_pci_card_by_position(unsigned short vendor_id,
 		    && (amcc->pci_slot == pci_slot)) {
 			if (!(amcc->used)) {
 				*card = amcc;
-				return 0;	// ok, card is found
+				return 0;	/*  ok, card is found */
 			} else {
-				rt_printk
+				printk
 				    (" - \nCard on requested position is used b:s %d:%d!\n",
 				     pci_bus, pci_slot);
-				return 2;	// card exist but is used
+				return 2;	/*  card exist but is used */
 			}
 		}
 	}
 
-	return 1;		// no card found
+	return 1;		/*  no card found */
 }
 
 /****************************************************************************/
@@ -422,11 +422,10 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
 {
 	struct pcilst_struct *card;
 
-	if ((pci_bus < 1) & (pci_slot < 1)) {	// use autodetection
-		if ((card = ptr_find_free_pci_card_by_device(vendor_id,
-							     device_id)) ==
-		    NULL) {
-			rt_printk(" - Unused card not found in system!\n");
+	if ((pci_bus < 1) & (pci_slot < 1)) {	/*  use autodetection */
+		card = ptr_find_free_pci_card_by_device(vendor_id, device_id);
+		if (card == NULL) {
+			printk(" - Unused card not found in system!\n");
 			return NULL;
 		}
 	} else {
@@ -434,12 +433,12 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
 							 pci_bus, pci_slot,
 							 &card)) {
 		case 1:
-			rt_printk
+			printk
 			    (" - Card not found on requested position b:s %d:%d!\n",
 			     pci_bus, pci_slot);
 			return NULL;
 		case 2:
-			rt_printk
+			printk
 			    (" - Card on requested position is used b:s %d:%d!\n",
 			     pci_bus, pci_slot);
 			return NULL;
@@ -447,7 +446,7 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
 	}
 
 	if (i_pci_card_alloc(card) != 0) {
-		rt_printk(" - Can't allocate card!\n");
+		printk(" - Can't allocate card!\n");
 		return NULL;
 	}
 

+ 85 - 84
drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c

@@ -1,15 +1,15 @@
-/**
+//**
 @verbatim
 
 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.
 
@@ -56,21 +56,22 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 #include "APCI1710_Pwm.c"
 #include "APCI1710_INCCPT.c"
 
-void i_ADDI_AttachPCI1710(struct comedi_device * dev)
+void i_ADDI_AttachPCI1710(struct comedi_device *dev)
 {
 	struct comedi_subdevice *s;
 	int ret = 0;
 	int n_subdevices = 9;
 
-	//Update-0.7.57->0.7.68dev->n_subdevices = 9;
-	if ((ret = alloc_subdevices(dev, n_subdevices)) < 0)
+	/* Update-0.7.57->0.7.68dev->n_subdevices = 9; */
+	ret = alloc_subdevices(dev, n_subdevices);
+	if (ret < 0)
 		return;
 
-	// Allocate and Initialise Timer Subdevice Structures
+	/*  Allocate and Initialise Timer Subdevice Structures */
 	s = dev->subdevices + 0;
 
 	s->type = COMEDI_SUBD_TIMER;
-	s->subdev_flags = SDF_WRITEABLE | SDF_RT | SDF_GROUND | SDF_COMMON;
+	s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
 	s->n_chan = 3;
 	s->maxdata = 0;
 	s->len_chanlist = 3;
@@ -80,12 +81,12 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_config = i_APCI1710_InsnConfigInitTimer;
 	s->insn_bits = i_APCI1710_InsnBitsTimer;
 
-	// Allocate and Initialise DIO Subdevice Structures
+	/*  Allocate and Initialise DIO Subdevice Structures */
 	s = dev->subdevices + 1;
 
 	s->type = COMEDI_SUBD_DIO;
 	s->subdev_flags =
-		SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON;
+		SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON;
 	s->n_chan = 7;
 	s->maxdata = 1;
 	s->len_chanlist = 7;
@@ -95,11 +96,11 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_bits = i_APCI1710_InsnBitsDigitalIOPortOnOff;
 	s->insn_write = i_APCI1710_InsnWriteDigitalIOChlOnOff;
 
-	// Allocate and Initialise Chrono Subdevice Structures
+	/*  Allocate and Initialise Chrono Subdevice Structures */
 	s = dev->subdevices + 2;
 
 	s->type = COMEDI_SUBD_CHRONO;
-	s->subdev_flags = SDF_WRITEABLE | SDF_RT | SDF_GROUND | SDF_COMMON;
+	s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
 	s->n_chan = 4;
 	s->maxdata = 0;
 	s->len_chanlist = 4;
@@ -109,55 +110,55 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_config = i_APCI1710_InsnConfigInitChrono;
 	s->insn_bits = i_APCI1710_InsnBitsChronoDigitalIO;
 
-	// Allocate and Initialise PWM Subdevice Structures
+	/*  Allocate and Initialise PWM Subdevice Structures */
 	s = dev->subdevices + 3;
 	s->type = COMEDI_SUBD_PWM;
 	s->subdev_flags =
-		SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON;
+		SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON;
 	s->n_chan = 3;
 	s->maxdata = 1;
 	s->len_chanlist = 3;
 	s->range_table = &range_digital;
-	s->io_bits = 0;		//all bits input
+	s->io_bits = 0;		/* all bits input */
 	s->insn_config = i_APCI1710_InsnConfigPWM;
 	s->insn_read = i_APCI1710_InsnReadGetPWMStatus;
 	s->insn_write = i_APCI1710_InsnWritePWM;
 	s->insn_bits = i_APCI1710_InsnBitsReadPWMInterrupt;
 
-	// Allocate and Initialise TTLIO Subdevice Structures
+	/*  Allocate and Initialise TTLIO Subdevice Structures */
 	s = dev->subdevices + 4;
 	s->type = COMEDI_SUBD_TTLIO;
 	s->subdev_flags =
-		SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON;
+		SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON;
 	s->n_chan = 8;
 	s->maxdata = 1;
 	s->len_chanlist = 8;
-	s->range_table = &range_apci1710_ttl;	// to pass arguments in range
+	s->range_table = &range_apci1710_ttl;	/*  to pass arguments in range */
 	s->insn_config = i_APCI1710_InsnConfigInitTTLIO;
 	s->insn_bits = i_APCI1710_InsnBitsReadTTLIO;
 	s->insn_write = i_APCI1710_InsnWriteSetTTLIOChlOnOff;
 	s->insn_read = i_APCI1710_InsnReadTTLIOAllPortValue;
 
-	// Allocate and Initialise TOR Subdevice Structures
+	/*  Allocate and Initialise TOR Subdevice Structures */
 	s = dev->subdevices + 5;
 	s->type = COMEDI_SUBD_TOR;
 	s->subdev_flags =
-		SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON;
+		SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON;
 	s->n_chan = 8;
 	s->maxdata = 1;
 	s->len_chanlist = 8;
 	s->range_table = &range_digital;
-	s->io_bits = 0;		//all bits input
+	s->io_bits = 0;		/* all bits input */
 	s->insn_config = i_APCI1710_InsnConfigInitTorCounter;
 	s->insn_read = i_APCI1710_InsnReadGetTorCounterInitialisation;
 	s->insn_write = i_APCI1710_InsnWriteEnableDisableTorCounter;
 	s->insn_bits = i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue;
 
-	// Allocate and Initialise SSI Subdevice Structures
+	/*  Allocate and Initialise SSI Subdevice Structures */
 	s = dev->subdevices + 6;
 	s->type = COMEDI_SUBD_SSI;
 	s->subdev_flags =
-		SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON;
+		SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON;
 	s->n_chan = 4;
 	s->maxdata = 1;
 	s->len_chanlist = 4;
@@ -166,11 +167,11 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_read = i_APCI1710_InsnReadSSIValue;
 	s->insn_bits = i_APCI1710_InsnBitsSSIDigitalIO;
 
-	// Allocate and Initialise PULSEENCODER Subdevice Structures
+	/*  Allocate and Initialise PULSEENCODER Subdevice Structures */
 	s = dev->subdevices + 7;
 	s->type = COMEDI_SUBD_PULSEENCODER;
 	s->subdev_flags =
-		SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON;
+		SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON;
 	s->n_chan = 4;
 	s->maxdata = 1;
 	s->len_chanlist = 4;
@@ -180,11 +181,11 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_bits = i_APCI1710_InsnBitsReadWritePulseEncoder;
 	s->insn_read = i_APCI1710_InsnReadInterruptPulseEncoder;
 
-	// Allocate and Initialise INCREMENTALCOUNTER Subdevice Structures
+	/*  Allocate and Initialise INCREMENTALCOUNTER Subdevice Structures */
 	s = dev->subdevices + 8;
 	s->type = COMEDI_SUBD_INCREMENTALCOUNTER;
 	s->subdev_flags =
-		SDF_WRITEABLE | SDF_READABLE | SDF_RT | SDF_GROUND | SDF_COMMON;
+		SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON;
 	s->n_chan = 500;
 	s->maxdata = 1;
 	s->len_chanlist = 500;
@@ -195,14 +196,14 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_bits = i_APCI1710_InsnBitsINCCPT;
 }
 
-int i_APCI1710_Reset(struct comedi_device * dev);
+int i_APCI1710_Reset(struct comedi_device *dev);
 void v_APCI1710_Interrupt(int irq, void *d);
-//for 1710
+/* for 1710 */
 
-int i_APCI1710_Reset(struct comedi_device * dev)
+int i_APCI1710_Reset(struct comedi_device *dev)
 {
 	int ret;
-	DWORD dw_Dummy;
+	unsigned int dw_Dummy;
 
 	/*********************************/
 	/* Read all module configuration */
@@ -219,12 +220,12 @@ int i_APCI1710_Reset(struct comedi_device * dev)
 	ret = inl(devpriv->s_BoardInfos.ui_Address + 252);
 	devpriv->s_BoardInfos.dw_MolduleConfiguration[3] = ret;
 
-	// outl(0x80808082,devpriv->s_BoardInfos.ui_Address+0x60);
+	/*  outl(0x80808082,devpriv->s_BoardInfos.ui_Address+0x60); */
 	outl(0x83838383, devpriv->s_BoardInfos.ui_Address + 0x60);
 
 	devpriv->s_BoardInfos.b_BoardVersion = 1;
 
-	// Enable the interrupt for the controler
+	/*  Enable the interrupt for the controler */
 	dw_Dummy = inl(devpriv->s_BoardInfos.ui_Address + 0x38);
 	outl(dw_Dummy | 0x2000, devpriv->s_BoardInfos.ui_Address + 0x38);
 
@@ -234,11 +235,11 @@ int i_APCI1710_Reset(struct comedi_device * dev)
 /*
 +----------------------------------------------------------------------------+
 | Function's Name   : __void__ v_APCI1710_InterruptFunction                  |
-|				(BYTE b_Interrupt, __CPPARGS)                |
+|				(unsigned char b_Interrupt, __CPPARGS)                |
 +----------------------------------------------------------------------------+
 | Task              : APCI-1710 interrupt function                           |
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE b_Interrupt : Interrupt number                    |
+| Input Parameters  : unsigned char b_Interrupt : Interrupt number                    |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -250,18 +251,18 @@ int i_APCI1710_Reset(struct comedi_device * dev)
 void v_APCI1710_Interrupt(int irq, void *d)
 {
 	struct comedi_device *dev = d;
-	BYTE b_ModuleCpt = 0;
-	BYTE b_InterruptFlag = 0;
-	BYTE b_PWMCpt = 0;
-	BYTE b_TorCounterCpt = 0;
-	BYTE b_PulseIncoderCpt = 0;
-	UINT ui_16BitValue;
-	ULONG ul_InterruptLatchReg = 0;
-	ULONG ul_LatchRegisterValue = 0;
-	ULONG ul_82X54InterruptStatus;
-	ULONG ul_StatusRegister;
-
-	str_ModuleInfo *ps_ModuleInfo;
+	unsigned char b_ModuleCpt = 0;
+	unsigned char b_InterruptFlag = 0;
+	unsigned char b_PWMCpt = 0;
+	unsigned char b_TorCounterCpt = 0;
+	unsigned char b_PulseIncoderCpt = 0;
+	unsigned int ui_16BitValue;
+	unsigned int ul_InterruptLatchReg = 0;
+	unsigned int ul_LatchRegisterValue = 0;
+	unsigned int ul_82X54InterruptStatus;
+	unsigned int ul_StatusRegister;
+
+	union str_ModuleInfo *ps_ModuleInfo;
 
 	printk("APCI1710 Interrupt\n");
 	for (b_ModuleCpt = 0; b_ModuleCpt < 4; b_ModuleCpt++, ps_ModuleInfo++) {
@@ -279,7 +280,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				dw_MolduleConfiguration[b_ModuleCpt] &
 				0xFFFF0000UL) == APCI1710_82X54_TIMER) {
 
-			//printk("TIMER Interrupt Occurred\n");
+			/* printk("TIMER Interrupt Occurred\n"); */
 			ul_82X54InterruptStatus = inl(devpriv->s_BoardInfos.
 				ui_Address + 12 + (64 * b_ModuleCpt));
 
@@ -332,11 +333,11 @@ void v_APCI1710_Interrupt(int irq, void *d)
 			     /**********************/
 				/* Call user function */
 			     /**********************/
-				//Send a signal to from kernel to user space
+				/* Send a signal to from kernel to user space */
 				send_sig(SIGIO, devpriv->tsk_Current, 0);
 
-			}	// if ((ul_82X54InterruptStatus & 0x7) != 0)
-		}		// 82X54 timer
+			}	/*  if ((ul_82X54InterruptStatus & 0x7) != 0) */
+		}		/*  82X54 timer */
 
 		 /***************************/
 		/* Test if increm. counter */
@@ -412,7 +413,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				/**********************/
 					/* Call user function */
 				/**********************/
-					//Send a signal to from kernel to user space
+					/* Send a signal to from kernel to user space */
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 
@@ -473,7 +474,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 			    /**********************/
 					/* Call user function */
 				/**********************/
-					//Send a signal to from kernel to user space
+					/* Send a signal to from kernel to user space */
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 
@@ -562,7 +563,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				/**********************/
 					/* Call user function */
 				/**********************/
-					//Send a signal to from kernel to user space
+					/* Send a signal to from kernel to user space */
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 
@@ -628,7 +629,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				/**********************/
 					/* Call user function */
 				/**********************/
-					//Send a signal to from kernel to user space
+					/* Send a signal to from kernel to user space */
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 
@@ -675,7 +676,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 						if ((ul_LatchRegisterValue &
 								0xFFFFU) != 0) {
 							ui_16BitValue =
-								(UINT)
+								(unsigned int)
 								ul_LatchRegisterValue
 								& 0xFFFFU;
 							ul_LatchRegisterValue =
@@ -693,7 +694,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 								0xFFFF0000UL) !=
 							0) {
 							ui_16BitValue =
-								(UINT) (
+								(unsigned int) (
 								(ul_LatchRegisterValue
 									>> 16) &
 								0xFFFFU);
@@ -721,7 +722,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 					if ((ul_LatchRegisterValue &
 							0xFFFF0000UL) != 0) {
 						ui_16BitValue =
-							(UINT) (
+							(unsigned int) (
 							(ul_LatchRegisterValue
 								>> 16) &
 							0xFFFFU);
@@ -741,7 +742,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 					if ((ul_LatchRegisterValue & 0xFFFFU) !=
 						0) {
 						ui_16BitValue =
-							(UINT)
+							(unsigned int)
 							ul_LatchRegisterValue &
 							0xFFFFU;
 						ul_LatchRegisterValue =
@@ -795,11 +796,11 @@ void v_APCI1710_Interrupt(int irq, void *d)
 			     /**********************/
 				/* Call user function */
 			     /**********************/
-				//Send a signal to from kernel to user space
+				/* Send a signal to from kernel to user space */
 				send_sig(SIGIO, devpriv->tsk_Current, 0);
 
 			}
-		}		// Incremental counter
+		}		/*  Incremental counter */
 
 		 /***************/
 		/* Test if CDA */
@@ -870,14 +871,14 @@ void v_APCI1710_Interrupt(int irq, void *d)
 					/* Call user function */
 				/**********************/
 
-					//Send a signal to from kernel to user space
+					/* Send a signal to from kernel to user space */
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 
-				}	// if (ul_StatusRegister & 1)
+				}	/*  if (ul_StatusRegister & 1) */
 
 			}
-		}		// CDA
+		}		/*  CDA */
 
 		 /***********************/
 		/* Test if PWM counter */
@@ -950,15 +951,15 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				   /**********************/
 						/* Call user function */
 				   /**********************/
-						//Send a signal to from kernel to user space
+						/* Send a signal to from kernel to user space */
 						send_sig(SIGIO,
 							devpriv->tsk_Current,
 							0);
 
-					}	// if (ul_StatusRegister & 0x1)
-				}	// if (APCI1710_ENABLE)
-			}	// for (b_PWMCpt == 0; b_PWMCpt < 0; b_PWMCpt ++)
-		}		// PWM counter
+					}	/*  if (ul_StatusRegister & 0x1) */
+				}	/*  if (APCI1710_ENABLE) */
+			}	/*  for (b_PWMCpt == 0; b_PWMCpt < 0; b_PWMCpt ++) */
+		}		/*  PWM counter */
 
 		 /***********************/
 		/* Test if tor counter */
@@ -1054,14 +1055,14 @@ void v_APCI1710_Interrupt(int irq, void *d)
 						/* Call user function */
 				   /**********************/
 
-						//Send a signal to from kernel to user space
+						/* Send a signal to from kernel to user space */
 						send_sig(SIGIO,
 							devpriv->tsk_Current,
 							0);
-					}	// if (ul_StatusRegister & 0x1)
-				}	// if (APCI1710_ENABLE)
-			}	// for (b_TorCounterCpt == 0; b_TorCounterCpt < 0; b_TorCounterCpt ++)
-		}		// Tor counter
+					}	/*  if (ul_StatusRegister & 0x1) */
+				}	/*  if (APCI1710_ENABLE) */
+			}	/*  for (b_TorCounterCpt == 0; b_TorCounterCpt < 0; b_TorCounterCpt ++) */
+		}		/*  Tor counter */
 
 		 /***********************/
 		/* Test if chronometer */
@@ -1071,7 +1072,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				dw_MolduleConfiguration[b_ModuleCpt] &
 				0xFFFF0000UL) == APCI1710_CHRONOMETER) {
 
-			//printk("APCI1710 Chrono Interrupt\n");
+			/* printk("APCI1710 Chrono Interrupt\n"); */
 		    /*****************************/
 			/* Read the interrupt status */
 		    /*****************************/
@@ -1163,13 +1164,13 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				/**********************/
 					/* Call user function */
 				/**********************/
-					//Send a signal to from kernel to user space
+					/* Send a signal to from kernel to user space */
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 
 				}
 			}
-		}		// Chronometer
+		}		/*  Chronometer */
 
 		 /*************************/
 		/* Test if pulse encoder */
@@ -1249,7 +1250,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				   /**********************/
 						/* Call user function */
 				   /**********************/
-						//Send a signal to from kernel to user space
+						/* Send a signal to from kernel to user space */
 						send_sig(SIGIO,
 							devpriv->tsk_Current,
 							0);
@@ -1257,7 +1258,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 					}
 				}
 			}
-		}		//pulse encoder
+		}		/* pulse encoder */
 
 	}
 	return;

+ 1 - 1
drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.h

@@ -44,7 +44,7 @@
 #define APCI1710_SYNCHRONOUS_MODE	1
 #define APCI1710_ASYNCHRONOUS_MODE	0
 
-//MODULE INFO STRUCTURE
+/* MODULE INFO STRUCTURE */
 
 static const struct comedi_lrange range_apci1710_ttl = { 4, {
 						      BIP_RANGE(10),

+ 110 - 104
drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c

@@ -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.
 
@@ -52,9 +52,9 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 */
 #include "hwdrv_apci035.h"
-INT i_WatchdogNbr = 0;
-INT i_Temp = 0;
-INT i_Flag = 1;
+int i_WatchdogNbr = 0;
+int i_Temp = 0;
+int i_Flag = 1;
 /*
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI035_ConfigTimerWatchdog                      |
@@ -64,42 +64,42 @@ INT i_Flag = 1;
 | Task              : Configures The Timer , Counter or Watchdog             |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 |					  data[0]            : 0 Configure As Timer      |
 |										   1 Configure As Watchdog   |
-                              data[1]            : Watchdog number
+|                                         data[1]            : Watchdog number
 |					  data[2]            : Time base Unit            |
 |					  data[3]			 : Reload Value			     |
-                              data[4]            : External Trigger          |
-                                                   1:Enable
-                                                   0:Disable
-                              data[5]            :External Trigger Level
-                                                  00 Trigger Disabled
-                                                  01 Trigger Enabled (Low level)
-                                                  10 Trigger Enabled (High Level)
-                                                  11 Trigger Enabled (High/Low level)
-                              data[6]            : External Gate            |
-                                                   1:Enable
-                                                   0:Disable
-                              data[7]            : External Gate level
-                                                  00 Gate Disabled
-                                                  01 Gate Enabled (Low level)
-                                                  10 Gate Enabled (High Level)
-                              data[8]            :Warning Relay
-                                                  1: ENABLE
-                                                  0: DISABLE
-                              data[9]            :Warning Delay available
-                              data[10]           :Warning Relay Time unit
-                              data[11]           :Warning Relay Time Reload value
-                              data[12]           :Reset Relay
-                                                  1 : ENABLE
-                                                  0 : DISABLE
-                              data[13]           :Interrupt
-                                                  1 : ENABLE
-                                                  0 : DISABLE
-
+|                                         data[4]            : External Trigger          |
+|                                                              1:Enable
+|                                                           0:Disable
+|                              data[5]            :External Trigger Level
+|                                                  00 Trigger Disabled
+|                                                  01 Trigger Enabled (Low level)
+|                                                  10 Trigger Enabled (High Level)
+|                                                  11 Trigger Enabled (High/Low level)
+|                              data[6]            : External Gate            |
+|                                                   1:Enable
+|                                                   0:Disable
+|                              data[7]            : External Gate level
+|                                                  00 Gate Disabled
+|                                                  01 Gate Enabled (Low level)
+|                                                  10 Gate Enabled (High Level)
+|                              data[8]            :Warning Relay
+|                                                  1: ENABLE
+|                                                  0: DISABLE
+|                              data[9]            :Warning Delay available
+|                              data[10]           :Warning Relay Time unit
+|                              data[11]           :Warning Relay Time Reload value
+|                              data[12]           :Reset Relay
+|                                                  1 : ENABLE
+|                                                  0 : DISABLE
+|                              data[13]           :Interrupt
+|                                                  1 : ENABLE
+|                                                  0 : DISABLE
+|
 |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -109,12 +109,12 @@ INT i_Flag = 1;
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Status = 0;
-	UINT ui_Command = 0;
-	UINT ui_Mode = 0;
+	unsigned int ui_Status = 0;
+	unsigned int ui_Command = 0;
+	unsigned int ui_Mode = 0;
 	i_Temp = 0;
 	devpriv->tsk_Current = current;
 	devpriv->b_TimerSelectMode = data[0];
@@ -124,9 +124,9 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd
 	} else {
 		ui_Mode = 0;
 	}
-//ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12);
+/* ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); */
 	ui_Command = 0;
-//ui_Command = ui_Command & 0xFFFFF9FEUL;
+/* ui_Command = ui_Command & 0xFFFFF9FEUL; */
 	outl(ui_Command, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
 	ui_Command = 0;
 	ui_Command = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
@@ -153,7 +153,7 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd
 		ui_Command =
 			(ui_Command & 0xFFF719E2UL) | ui_Mode << 13UL | 0x10UL;
 
-	}			//if (data[0] == ADDIDATA_TIMER)
+	}			/* if (data[0] == ADDIDATA_TIMER) */
 	else {
 		if (data[0] == ADDIDATA_WATCHDOG) {
 
@@ -260,7 +260,7 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd
 | Task              : Start / Stop The Selected Timer , or Watchdog  |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |					                                                 |
 |					  data[0] : 0 - Stop Selected Timer/Watchdog     |
@@ -278,11 +278,11 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd
 |					                                                 |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Command = 0;
-	INT i_Count = 0;
+	unsigned int ui_Command = 0;
+	int i_Count = 0;
 	if (data[0] == 1) {
 		ui_Command =
 			inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
@@ -292,7 +292,7 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev,
 		ui_Command = (ui_Command & 0xFFFFF9FFUL) | 0x1UL;
 		outl(ui_Command,
 			devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
-	}			// if  (data[0]==1)
+	}			/*  if  (data[0]==1) */
 	if (data[0] == 2) {
 		ui_Command =
 			inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
@@ -304,16 +304,18 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev,
 			devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
 	}
 
-	if (data[0] == 0)	//Stop The Watchdog
+	if (data[0] == 0)	/* Stop The Watchdog */
 	{
-		//Stop The Watchdog
+		/* Stop The Watchdog */
 		ui_Command = 0;
-		//ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12);
-		//ui_Command = ui_Command & 0xFFFFF9FEUL;
+/*
+* ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12);
+* ui_Command = ui_Command & 0xFFFFF9FEUL;
+*/
 		outl(ui_Command,
 			devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
-	}			//  if (data[1]==0)
-	if (data[0] == 3)	//stop all Watchdogs
+	}			/*   if (data[1]==0) */
+	if (data[0] == 3)	/* stop all Watchdogs */
 	{
 		ui_Command = 0;
 		for (i_Count = 1; i_Count <= 4; i_Count++) {
@@ -329,7 +331,7 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev,
 		}
 
 	}
-	if (data[0] == 4)	//start all Watchdogs
+	if (data[0] == 4)	/* start all Watchdogs */
 	{
 		ui_Command = 0;
 		for (i_Count = 1; i_Count <= 4; i_Count++) {
@@ -344,7 +346,7 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev,
 				0);
 		}
 	}
-	if (data[0] == 5)	//trigger all Watchdogs
+	if (data[0] == 5)	/* trigger all Watchdogs */
 	{
 		ui_Command = 0;
 		for (i_Count = 1; i_Count <= 4; i_Count++) {
@@ -373,17 +375,17 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev,
 | Task              : Read The Selected Timer , Counter or Watchdog          |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 |     																	 |
 +----------------------------------------------------------------------------+
 | Output Parameters :	data[0]            : software trigger status
-              data[1]            : hardware trigger status
-|     				data[2]            : Software clear status
-                        data[3]            : Overflow status
-                     data[4]            : Timer actual value
-
+|                       data[1]            : hardware trigger status
+|     	  	        data[2]            : Software clear status
+|                       data[3]            : Overflow status
+|                       data[4]            : Timer actual value
+|
 
 +----------------------------------------------------------------------------+
 | Return Value      : TRUE  : No error occur                                 |
@@ -391,42 +393,46 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev,
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI035_ReadTimerWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Status = 0;	// Status register
+	unsigned int ui_Status = 0;	/*  Status register */
 	i_WatchdogNbr = insn->unused[0];
-	      /******************/
+
+	/******************/
 	/* Get the status */
-	      /******************/
+	/******************/
+
 	ui_Status = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 16);
-      /***********************************/
+
+	/***********************************/
 	/* Get the software trigger status */
-      /***********************************/
+	/***********************************/
+
 	data[0] = ((ui_Status >> 1) & 1);
-      /***********************************/
+	/***********************************/
 	/* Get the hardware trigger status */
-      /***********************************/
+	/***********************************/
 	data[1] = ((ui_Status >> 2) & 1);
-      /*********************************/
+	/*********************************/
 	/* Get the software clear status */
-      /*********************************/
+	/*********************************/
 	data[2] = ((ui_Status >> 3) & 1);
-      /***************************/
+	/***************************/
 	/* Get the overflow status */
-      /***************************/
+	/***************************/
 	data[3] = ((ui_Status >> 0) & 1);
 	if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
 		data[4] = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 0);
 
-	}			//  if  (devpriv->b_TimerSelectMode==ADDIDATA_TIMER)
+	}			/*   if  (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */
 
 	return insn->n;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function   Name   : INT i_APCI035_ConfigAnalogInput                        |
+| Function   Name   : int i_APCI035_ConfigAnalogInput                        |
 |			  (struct comedi_device *dev,struct comedi_subdevice *s,               |
 |                      struct comedi_insn *insn,unsigned int *data)                     |
 +----------------------------------------------------------------------------+
@@ -447,8 +453,8 @@ INT i_APCI035_ReadTimerWatchdog(struct comedi_device * dev, struct comedi_subdev
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI035_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	devpriv->tsk_Current = current;
 	outl(0x200 | 0, devpriv->iobase + 128 + 0x4);
@@ -472,8 +478,8 @@ INT i_APCI035_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdev
 | Task              : Read  value  of the selected channel			         |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To read       |
-|                     UINT *data              : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To read       |
+|                     unsigned int *data              : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 |			          data[0]  : Digital Value Of Input              |
@@ -484,10 +490,10 @@ INT i_APCI035_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdev
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI035_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_CommandRegister = 0;
+	unsigned int ui_CommandRegister = 0;
 /******************/
 /*  Set the start */
 /******************/
@@ -519,14 +525,14 @@ INT i_APCI035_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevic
 |			                                                                 |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI035_Reset(struct comedi_device * dev)
+int i_APCI035_Reset(struct comedi_device *dev)
 {
-	INT i_Count = 0;
+	int i_Count = 0;
 	for (i_Count = 1; i_Count <= 4; i_Count++) {
 		i_WatchdogNbr = i_Count;
-		outl(0x0, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 0);	//stop all timers
+		outl(0x0, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 0);	/* stop all timers */
 	}
-	outl(0x0, devpriv->iobase + 128 + 12);	//Disable the warning delay
+	outl(0x0, devpriv->iobase + 128 + 12);	/* Disable the warning delay */
 
 	return 0;
 }
@@ -551,11 +557,11 @@ INT i_APCI035_Reset(struct comedi_device * dev)
 static void v_APCI035_Interrupt(int irq, void *d)
 {
 	struct comedi_device *dev = d;
-	UINT ui_StatusRegister1 = 0;
-	UINT ui_StatusRegister2 = 0;
-	UINT ui_ReadCommand = 0;
-	UINT ui_ChannelNumber = 0;
-	UINT ui_DigitalTemperature = 0;
+	unsigned int ui_StatusRegister1 = 0;
+	unsigned int ui_StatusRegister2 = 0;
+	unsigned int ui_ReadCommand = 0;
+	unsigned int ui_ChannelNumber = 0;
+	unsigned int ui_DigitalTemperature = 0;
 	if (i_Temp == 1) {
 		i_WatchdogNbr = i_Flag;
 		i_Flag = i_Flag + 1;
@@ -571,7 +577,7 @@ static void v_APCI035_Interrupt(int irq, void *d)
 	ui_StatusRegister2 =
 		inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 20);
 
-	if ((((ui_StatusRegister1) & 0x8) == 0x8))	//Test if warning relay interrupt
+	if ((((ui_StatusRegister1) & 0x8) == 0x8))	/* Test if warning relay interrupt */
 	{
 	/**********************************/
 		/* Disable the temperature warning */
@@ -587,14 +593,14 @@ static void v_APCI035_Interrupt(int irq, void *d)
 		/* Read the digital temperature value */
 	/**************************************/
 		ui_DigitalTemperature = inl(devpriv->iobase + 128 + 60);
-		send_sig(SIGIO, devpriv->tsk_Current, 0);	// send signal to the sample
-	}			//if (((ui_StatusRegister1 & 0x8) == 0x8))
+		send_sig(SIGIO, devpriv->tsk_Current, 0);	/*  send signal to the sample */
+	}			/* if (((ui_StatusRegister1 & 0x8) == 0x8)) */
 
 	else {
 		if ((ui_StatusRegister2 & 0x1) == 0x1) {
-			send_sig(SIGIO, devpriv->tsk_Current, 0);	// send signal to the sample
+			send_sig(SIGIO, devpriv->tsk_Current, 0);	/*  send signal to the sample */
 		}
-	}			//else if (((ui_StatusRegister1 & 0x8) == 0x8))
+	}			/* else if (((ui_StatusRegister1 & 0x8) == 0x8)) */
 
 	return;
 }

+ 17 - 17
drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h

@@ -19,18 +19,18 @@
 #define APCI035_BOARD_VENDOR_ID		0x15B8
 #define APCI035_ADDRESS_RANGE		255
 
-INT i_TW_Number;
+int i_TW_Number;
 struct {
-	INT i_Gain;
-	INT i_Polarity;
-	INT i_OffsetRange;
-	INT i_Coupling;
-	INT i_SingleDiff;
-	INT i_AutoCalibration;
-	UINT ui_ReloadValue;
-	UINT ui_TimeUnitReloadVal;
-	INT i_Interrupt;
-	INT i_ModuleSelection;
+	int i_Gain;
+	int i_Polarity;
+	int i_OffsetRange;
+	int i_Coupling;
+	int i_SingleDiff;
+	int i_AutoCalibration;
+	unsigned int ui_ReloadValue;
+	unsigned int ui_TimeUnitReloadVal;
+	int i_Interrupt;
+	int i_ModuleSelection;
 } Config_Parameters_Main;
 
 /* ANALOG INPUT RANGE */
@@ -101,23 +101,23 @@ struct comedi_lrange range_apci035_ai = { 8, {
 
 /* TIMER */
 /* timer value is passed as u seconds */
-INT i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 				  struct comedi_insn *insn, unsigned int *data);
-INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev,
+int i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev,
 					  struct comedi_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);
-INT i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 				struct comedi_insn *insn, unsigned int *data);
 
 /* Temperature Related Defines (Analog Input Subdevice) */
 
-INT i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				struct comedi_insn *insn, unsigned int *data);
-INT i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
 			      struct comedi_insn *insn, unsigned int *data);
 
 /* Interrupt */
 static void v_APCI035_Interrupt(int irq, void *d);
 
 /* Reset functions */
-INT i_APCI035_Reset(struct comedi_device *dev);
+int i_APCI035_Reset(struct comedi_device *dev);

+ 54 - 52
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c

@@ -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.
 
@@ -53,8 +53,8 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 */
 #include "hwdrv_apci1032.h"
 #include <linux/delay.h>
-//Global variables
-UINT ui_InterruptStatus = 0;
+/* Global variables */
+unsigned int ui_InterruptStatus = 0;
 
 /*
 +----------------------------------------------------------------------------+
@@ -84,13 +84,13 @@ UINT ui_InterruptStatus = 0;
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_TmpValue;
+	unsigned int ui_TmpValue;
 
-	ULONG ul_Command1 = 0;
-	ULONG ul_Command2 = 0;
+	unsigned int ul_Command1 = 0;
+	unsigned int ul_Command2 = 0;
 	devpriv->tsk_Current = current;
 
   /*******************************/
@@ -107,11 +107,11 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd
 			outl(0x4, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
 			ui_TmpValue =
 				inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
-		}		//if (data[1] == ADDIDATA_OR)
+		}		/* if (data[1] == ADDIDATA_OR) */
 		else {
 			outl(0x6, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
-		}		//else if(data[1] == ADDIDATA_OR)
-	}			// if( data[0] == ADDIDATA_ENABLE)
+		}		/* else if(data[1] == ADDIDATA_OR) */
+	}			/*  if( data[0] == ADDIDATA_ENABLE) */
 	else {
 		ul_Command1 = ul_Command1 & 0xFFFF0000;
 		ul_Command2 = ul_Command2 & 0xFFFF0000;
@@ -120,7 +120,7 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd
 		outl(ul_Command2,
 			devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE2);
 		outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
-	}			//else if  ( data[0] == ADDIDATA_ENABLE)
+	}			/* else if  ( data[0] == ADDIDATA_ENABLE) */
 
 	return insn->n;
 }
@@ -134,7 +134,7 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd
 | Task              : Return the status of the digital input                 |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|		              UINT ui_Channel : Channel number to read       |
+|		              unsigned int ui_Channel : Channel number to read       |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -144,22 +144,24 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1032_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_TmpValue = 0;
-	UINT ui_Channel;
+	unsigned int ui_TmpValue = 0;
+	unsigned int ui_Channel;
 	ui_Channel = CR_CHAN(insn->chanspec);
 	if (ui_Channel >= 0 && ui_Channel <= 31) {
-		ui_TmpValue = (UINT) inl(devpriv->iobase + APCI1032_DIGITAL_IP);
-		//  since only 1 channel reqd  to bring it to last bit it is rotated
-		//  8 +(chan - 1) times then ANDed with 1 for last bit.
+		ui_TmpValue = (unsigned int) inl(devpriv->iobase + APCI1032_DIGITAL_IP);
+/*
+* since only 1 channel reqd to bring it to last bit it is rotated 8
+* +(chan - 1) times then ANDed with 1 for last bit.
+*/
 		*data = (ui_TmpValue >> ui_Channel) & 0x1;
-	}			//if(ui_Channel >= 0 && ui_Channel <=31)
+	}			/* if(ui_Channel >= 0 && ui_Channel <=31) */
 	else {
-		//comedi_error(dev," \n chan spec wrong\n");
-		return -EINVAL;	// "sorry channel spec wrong "
-	}			//else if(ui_Channel >= 0 && ui_Channel <=31)
+		/* comedi_error(dev," \n chan spec wrong\n"); */
+		return -EINVAL;	/*  "sorry channel spec wrong " */
+	}			/* else if(ui_Channel >= 0 && ui_Channel <=31) */
 	return insn->n;
 }
 
@@ -172,8 +174,8 @@ INT i_APCI1032_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde
 | Task              : Return the status of the Requested digital inputs      |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To be Read    |
-|                      UINT *data             : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To be Read    |
+|                      unsigned int *data             : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -183,16 +185,16 @@ INT i_APCI1032_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1032_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1032_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_PortValue = data[0];
-	UINT ui_Mask = 0;
-	UINT ui_NoOfChannels;
+	unsigned int ui_PortValue = data[0];
+	unsigned int ui_Mask = 0;
+	unsigned int ui_NoOfChannels;
 
 	ui_NoOfChannels = CR_CHAN(insn->chanspec);
 	if (data[1] == 0) {
-		*data = (UINT) inl(devpriv->iobase + APCI1032_DIGITAL_IP);
+		*data = (unsigned int) inl(devpriv->iobase + APCI1032_DIGITAL_IP);
 		switch (ui_NoOfChannels) {
 		case 2:
 			ui_Mask = 3;
@@ -213,16 +215,16 @@ INT i_APCI1032_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 		case 31:
 			break;
 		default:
-			//comedi_error(dev," \nchan spec wrong\n");
-			return -EINVAL;	// "sorry channel spec wrong "
+			/* comedi_error(dev," \nchan spec wrong\n"); */
+			return -EINVAL;	/*  "sorry channel spec wrong " */
 			break;
-		}		//switch(ui_NoOfChannels)
-	}			//if(data[1]==0)
+		}		/* switch(ui_NoOfChannels) */
+	}			/* if(data[1]==0) */
 	else {
 		if (data[1] == 1) {
 			*data = ui_InterruptStatus;
-		}		//if(data[1]==1)
-	}			//else if(data[1]==0)
+		}		/* if(data[1]==1) */
+	}			/* else if(data[1]==0) */
 	return insn->n;
 }
 
@@ -247,16 +249,16 @@ static void v_APCI1032_Interrupt(int irq, void *d)
 {
 	struct comedi_device *dev = d;
 
-	UINT ui_Temp;
-	//disable the interrupt
+	unsigned int ui_Temp;
+	/* disable the interrupt */
 	ui_Temp = inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
 	outl(ui_Temp & APCI1032_DIGITAL_IP_INTERRUPT_DISABLE,
 		devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
 	ui_InterruptStatus =
 		inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS);
 	ui_InterruptStatus = ui_InterruptStatus & 0X0000FFFF;
-	send_sig(SIGIO, devpriv->tsk_Current, 0);	// send signal to the sample
-	outl(ui_Temp, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);	//enable the interrupt
+	send_sig(SIGIO, devpriv->tsk_Current, 0);	/*  send signal to the sample */
+	outl(ui_Temp, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);	/* enable the interrupt */
 	return;
 }
 
@@ -275,11 +277,11 @@ static void v_APCI1032_Interrupt(int irq, void *d)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1032_Reset(struct comedi_device * dev)
+int i_APCI1032_Reset(struct comedi_device *dev)
 {
-	outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);	//disable the interrupts
-	inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS);	//Reset the interrupt status register
-	outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE1);	//Disable the and/or interrupt
+	outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);	/* disable the interrupts */
+	inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS);	/* Reset the interrupt status register */
+	outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE1);	/* Disable the and/or interrupt */
 	outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE2);
 	return 0;
 }

+ 15 - 14
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.h

@@ -19,45 +19,46 @@
 
 #define APCI1032_BOARD_VENDOR_ID 0x15B8
 #define APCI1032_ADDRESS_RANGE  20
-//DIGITAL INPUT DEFINE
+/* DIGITAL INPUT DEFINE */
 
 #define APCI1032_DIGITAL_IP                     0
 #define APCI1032_DIGITAL_IP_INTERRUPT_MODE1     4
 #define APCI1032_DIGITAL_IP_INTERRUPT_MODE2     8
 #define APCI1032_DIGITAL_IP_IRQ                 16
 
-//Digital Input IRQ Function Selection
+/* Digital Input IRQ Function Selection */
 #define ADDIDATA_OR                  0
 #define ADDIDATA_AND                 1
 
-//Digital Input Interrupt Status
+/* Digital Input Interrupt Status */
 #define APCI1032_DIGITAL_IP_INTERRUPT_STATUS    12
 
-//Digital Input Interrupt Enable Disable.
+/* Digital Input Interrupt Enable Disable. */
 #define APCI1032_DIGITAL_IP_INTERRUPT_ENABLE    0x4
 #define APCI1032_DIGITAL_IP_INTERRUPT_DISABLE   0xFFFFFFFB
 
-//ADDIDATA Enable Disable
+/* ADDIDATA Enable Disable */
 
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_DISABLE                           0
 
-// Hardware Layer  functions for Apci1032
+/* Hardware Layer  functions for Apci1032 */
 
-//DI
-// for di read
+/*
+* DI for di read
+*/
 
-INT i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				  struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 
-INT i_APCI1032_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1032_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				    struct comedi_insn *insn, unsigned int *data);
 
-// Interrupt functions.....
+/* Interrupt functions..... */
 
 static void v_APCI1032_Interrupt(int irq, void *d);
-//Reset
-INT i_APCI1032_Reset(struct comedi_device *dev);
+/* Reset */
+int i_APCI1032_Reset(struct comedi_device *dev);

+ 266 - 266
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c

@@ -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.
 
@@ -77,7 +77,7 @@ int i_TimerCounter1Enabled = 0, i_TimerCounter2Enabled =
 |			  data[0]            :Number of the input port on        |
 |                                         which the event will take place    |
 |                                         (1 or 2)
-                      data[1]            : The event logic for port 1 has    |
+|                      data[1]            : The event logic for port 1 has    |
 |                                            three possibilities             |
 |                                        :0  APCI1500_AND       :This logic  |
 |                                                                links       |
@@ -137,8 +137,8 @@ int i_TimerCounter1Enabled = 0, i_TimerCounter2Enabled =
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 	int i_PatternPolarity = 0, i_PatternTransition = 0, i_PatternMask = 0;
 	int i_MaxChannel = 0, i_Count = 0, i_EventMask = 0;
@@ -157,16 +157,16 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev,
 
 	if (data[0] == 1) {
 		i_MaxChannel = 8;
-	}			// if (data[0] == 1)
+	}			/*  if (data[0] == 1) */
 	else {
 		if (data[0] == 2) {
 			i_MaxChannel = 6;
-		}		// if(data[0]==2)
+		}		/*  if(data[0]==2) */
 		else {
 			printk("\nThe specified port event  does not exist\n");
 			return -EINVAL;
-		}		//else if(data[0]==2)
-	}			//else  if (data[0] == 1)
+		}		/* else if(data[0]==2) */
+	}			/* else  if (data[0] == 1) */
 	switch (data[1]) {
 	case 0:
 		data[1] = APCI1500_AND;
@@ -180,7 +180,7 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev,
 	default:
 		printk("\nThe specified interrupt logic does not exist\n");
 		return -EINVAL;
-	}			//switch(data[1]);
+	}			/* switch(data[1]); */
 
 	i_Logic = data[1];
 	for (i_Count = i_MaxChannel, i = 0; i_Count > 0; i_Count--, i++) {
@@ -224,8 +224,8 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev,
 		default:
 			printk("\nThe option indicated in the event mask does not exist\n");
 			return -EINVAL;
-		}		// switch(i_EventMask)
-	}			//for (i_Count = i_MaxChannel; i_Count >0;i_Count --)
+		}		/*  switch(i_EventMask) */
+	}			/* for (i_Count = i_MaxChannel; i_Count >0;i_Count --) */
 
 	if (data[0] == 1) {
 		    /****************************/
@@ -247,7 +247,7 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev,
 			      /********************************************/
 				printk("\nTransition error on an OR PRIORITY logic\n");
 				return -EINVAL;
-			}	// if (data[1]== APCI1500_OR_PRIORITY && i_PatternTransition != 0)
+			}	/*  if (data[1]== APCI1500_OR_PRIORITY && i_PatternTransition != 0) */
 
 		       /*************************************/
 			/* Tests if more than one transition */
@@ -261,7 +261,7 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev,
 						((i_PatternTransition >>
 							i_Count) & 0x1);
 
-				}	//for (i_Count = 0; i_Count < 8; i_Count++)
+				}	/* for (i_Count = 0; i_Count < 8; i_Count++) */
 
 				if (i_PatternTransitionCount > 1) {
 				  /****************************************/
@@ -269,8 +269,8 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev,
 				  /****************************************/
 					printk("\n Transition error on an AND logic\n");
 					return -EINVAL;
-				}	// if (i_PatternTransitionCount > 1)
-			}	// if (data[1]== APCI1500_AND)
+				}	/*  if (i_PatternTransitionCount > 1) */
+			}	/*  if (data[1]== APCI1500_AND) */
 
 			    /*****************************************************************/
 			/* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */
@@ -359,12 +359,12 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev,
 				devpriv->iobase +
 				APCI1500_Z8536_CONTROL_REGISTER);
 
-		}		// if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY)
+		}		/*  if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) */
 		else {
 			printk("\nThe choice for interrupt logic does not exist\n");
 			return -EINVAL;
-		}		// else }// if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY)
-	}			//   if (data[0]== 1)
+		}		/*  else }// if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) */
+	}			/*    if (data[0]== 1) */
 
 		 /************************************/
 	/* Test if event setting for port 2 */
@@ -487,12 +487,12 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev,
 			outb(0xF4,
 				devpriv->iobase +
 				APCI1500_Z8536_CONTROL_REGISTER);
-		}		//  if (data[1] == APCI1500_OR)
+		}		/*   if (data[1] == APCI1500_OR) */
 		else {
 			printk("\nThe choice for interrupt logic does not exist\n");
 			return -EINVAL;
-		}		//elseif (data[1] == APCI1500_OR)
-	}			//if(data[0]==2)
+		}		/* elseif (data[1] == APCI1500_OR) */
+	}			/* if(data[0]==2) */
 
 	return insn->n;
 }
@@ -506,11 +506,11 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev,
 | Task              :  Allows or disallows a port event                      |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|		              UINT ui_Channel : Channel number to read       |
+|		              unsigned int ui_Channel : Channel number to read       |
 |                     unsigned int *data          : Data Pointer to read status  |
-                      data[0]                 :0 Start input event
-                                               1 Stop input event
-                      data[1]                 :No of port (1 or 2)
+|                      data[0]                 :0 Start input event
+|                                               1 Stop input event
+|                      data[1]                 :No of port (1 or 2)
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -519,8 +519,8 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev,
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int i_Event1InterruptStatus = 0, i_Event2InterruptStatus =
 		0, i_RegValue;
@@ -589,12 +589,12 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub
 						devpriv->iobase +
 						APCI1500_Z8536_CONTROL_REGISTER);
 
-				}	// if(i_Event1Status==1)
+				}	/*  if(i_Event1Status==1) */
 				else {
 					printk("\nEvent 1 not initialised\n");
 					return -EINVAL;
-				}	//else if(i_Event1Status==1)
-			}	//if (data[1]==1)
+				}	/* else if(i_Event1Status==1) */
+			}	/* if (data[1]==1) */
 			if (data[1] == 2) {
 
 				if (i_Event2Status == 1) {
@@ -640,17 +640,17 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub
 						devpriv->iobase +
 						APCI1500_Z8536_CONTROL_REGISTER);
 					i_Event2InterruptStatus = 1;
-				}	// if(i_Event2Status==1)
+				}	/*  if(i_Event2Status==1) */
 				else {
 					printk("\nEvent 2 not initialised\n");
 					return -EINVAL;
-				}	//else if(i_Event2Status==1)
-			}	// if(data[1]==2)
-		}		// if (data[1] == 1 || data[0] == 2)
+				}	/* else if(i_Event2Status==1) */
+			}	/*  if(data[1]==2) */
+		}		/*  if (data[1] == 1 || data[0] == 2) */
 		else {
 			printk("\nThe port parameter is in error\n");
 			return -EINVAL;
-		}		//else if (data[1] == 1 || data[0] == 2)
+		}		/* else if (data[1] == 1 || data[0] == 2) */
 
 		break;
 
@@ -701,12 +701,12 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub
 						devpriv->iobase +
 						APCI1500_Z8536_CONTROL_REGISTER);
 					i_Event1InterruptStatus = 0;
-				}	// if(i_Event1Status==1)
+				}	/*  if(i_Event1Status==1) */
 				else {
 					printk("\nEvent 1 not initialised\n");
 					return -EINVAL;
-				}	//else if(i_Event1Status==1)
-			}	//if (data[1]==1)
+				}	/* else if(i_Event1Status==1) */
+			}	/* if (data[1]==1) */
 			if (data[1] == 2) {
 			 /*****************************/
 				/* Test if event initialised */
@@ -744,23 +744,23 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub
 						devpriv->iobase +
 						APCI1500_Z8536_CONTROL_REGISTER);
 					i_Event2InterruptStatus = 0;
-				}	// if(i_Event2Status==1)
+				}	/*  if(i_Event2Status==1) */
 				else {
 					printk("\nEvent 2 not initialised\n");
 					return -EINVAL;
-				}	//else if(i_Event2Status==1)
-			}	//if(data[1]==2)
+				}	/* else if(i_Event2Status==1) */
+			}	/* if(data[1]==2) */
 
-		}		// if (data[1] == 1 || data[1] == 2)
+		}		/*  if (data[1] == 1 || data[1] == 2) */
 		else {
 			printk("\nThe port parameter is in error\n");
 			return -EINVAL;
-		}		//else if (data[1] == 1 || data[1] == 2)
+		}		/* else if (data[1] == 1 || data[1] == 2) */
 		break;
 	default:
 		printk("\nThe option of START/STOP logic does not exist\n");
 		return -EINVAL;
-	}			//switch(data[0])
+	}			/* switch(data[0]) */
 
 	return insn->n;
 }
@@ -774,7 +774,7 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub
 | Task              : Return the status of the digital input                 |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|		              UINT ui_Channel : Channel number to read       |
+|		              unsigned int ui_Channel : Channel number to read       |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -784,8 +784,8 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1500_Initialisation(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1500_Initialisation(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int i_DummyRead = 0;
     /******************/
@@ -943,11 +943,11 @@ INT i_APCI1500_Initialisation(struct comedi_device * dev, struct comedi_subdevic
 | Task              : Return the status of the Requested digital inputs      |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To be Read    |
-|                      UINT *data             : Data Pointer
-                      data[0]                 : 0 Read a single channel
-                                                1 read a port value
-                      data[1]                 : port value
+|                     unsigned int ui_NoOfChannels    : No Of Channels To be Read    |
+|                      unsigned int *data             : Data Pointer
+|                      data[0]                 : 0 Read a single channel
+|                                                1 read a port value
+|                      data[1]                 : port value
 +----------------------------------------------------------------------------+
 | Output Parameters :	--	data[0]    :The read status value
 +----------------------------------------------------------------------------+
@@ -957,31 +957,31 @@ INT i_APCI1500_Initialisation(struct comedi_device * dev, struct comedi_subdevic
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1500_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1500_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_PortValue = data[1];
-	UINT ui_Mask = 0;
-	UINT ui_Channel;
-	UINT ui_TmpValue = 0;
+	unsigned int ui_PortValue = data[1];
+	unsigned int ui_Mask = 0;
+	unsigned int ui_Channel;
+	unsigned int ui_TmpValue = 0;
 	ui_Channel = CR_CHAN(insn->chanspec);
 
 	switch (data[0]) {
 	case 0:
 		if (ui_Channel >= 0 && ui_Channel <= 15) {
 			ui_TmpValue =
-				(UINT) inw(devpriv->i_IobaseAddon +
+				(unsigned int) inw(devpriv->i_IobaseAddon +
 				APCI1500_DIGITAL_IP);
 			*data = (ui_TmpValue >> ui_Channel) & 0x1;
-		}		//if(ui_Channel >= 0 && ui_Channel <=15)
+		}		/* if(ui_Channel >= 0 && ui_Channel <=15) */
 		else {
 			printk("\nThe channel specification are in error\n");
-			return -EINVAL;	// "sorry channel spec wrong "
-		}		//else if(ui_Channel >= 0 && ui_Channel <=15)
+			return -EINVAL;	/*  "sorry channel spec wrong " */
+		}		/* else if(ui_Channel >= 0 && ui_Channel <=15) */
 		break;
 	case 1:
 
-		*data = (UINT) inw(devpriv->i_IobaseAddon +
+		*data = (unsigned int) inw(devpriv->i_IobaseAddon +
 			APCI1500_DIGITAL_IP);
 		switch (ui_Channel) {
 		case 2:
@@ -1001,35 +1001,35 @@ INT i_APCI1500_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 
 		default:
 			printk("\nSpecified channel cannot be read \n");
-			return -EINVAL;	// "sorry channel spec wrong "
+			return -EINVAL;	/*  "sorry channel spec wrong " */
 			break;
-		}		//switch(ui_Channel)
+		}		/* switch(ui_Channel) */
 		break;
 	default:
 		printk("\nThe specified functionality does not exist\n");
 		return -EINVAL;
-	}			//switch(data[0])
+	}			/* switch(data[0]) */
 	return insn->n;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI1500_ConfigDigitalOutputErrorInterrupt
-                      (struct comedi_device *dev,struct comedi_subdevice *s struct comedi_insn
-                      *insn,unsigned int *data)                                  |
+|                      (struct comedi_device *dev,struct comedi_subdevice *s struct comedi_insn
+|                      *insn,unsigned int *data)                                  |
 |				                                                     |
 +----------------------------------------------------------------------------+
 | Task              : Configures the digital output memory and the digital
-                      output error interrupt                                 |
+|                      output error interrupt                                 |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 |                     unsigned int *data         : Data Pointer contains         |
 |                                          configuration parameters as below |
 |                      struct comedi_subdevice *s,   :pointer to subdevice structure
-                       struct comedi_insn *insn      :pointer to insn structure                                                                                                                |
+|                       struct comedi_insn *insn      :pointer to insn structure                                                                                                                |
 |					  data[0]  :1:Memory on                          |
 |					            0:Memory off                         |
-                              data[1]  :1 Enable the voltage error interrupt
+|                              data[1]  :1 Enable the voltage error interrupt
 |							   :0 Disable the voltage error interrupt 		                                                                                                    |
 |																	 |
 +----------------------------------------------------------------------------+
@@ -1040,8 +1040,8 @@ INT i_APCI1500_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 	devpriv->b_OutputMemoryStatus = data[0];
 	return insn->n;
@@ -1056,8 +1056,8 @@ int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device * dev,
 | Task              : Writes port value  To the selected port                |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To Write      |
-|                     UINT *data              : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To Write      |
+|                     unsigned int *data              : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -1067,24 +1067,24 @@ int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1500_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	static UINT ui_Temp = 0;
-	UINT ui_Temp1;
+	static unsigned int ui_Temp = 0;
+	unsigned int ui_Temp1;
 
-	UINT ui_NoOfChannel = CR_CHAN(insn->chanspec);	// get the channel
+	unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec);	/*  get the channel */
 
 	if (!devpriv->b_OutputMemoryStatus) {
 		ui_Temp = 0;
 
-	}			//if(!devpriv->b_OutputMemoryStatus )
+	}			/* if(!devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outw(data[0],
 				devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP);
-		}		//if(data[1]==0)
+		}		/* if(data[1]==0) */
 		else {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
@@ -1113,19 +1113,19 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 
 				default:
 					comedi_error(dev, " chan spec wrong");
-					return -EINVAL;	// "sorry channel spec wrong "
+					return -EINVAL;	/*  "sorry channel spec wrong " */
 
-				}	//switch(ui_NoOfChannels)
+				}	/* switch(ui_NoOfChannels) */
 
 				outw(data[0],
 					devpriv->i_IobaseAddon +
 					APCI1500_DIGITAL_OP);
-			}	// if(data[1]==1)
+			}	/*  if(data[1]==1) */
 			else {
 				printk("\nSpecified channel not supported\n");
-			}	//else if(data[1]==1)
-		}		//elseif(data[1]==0)
-	}			//if(data[3]==0)
+			}	/* else if(data[1]==1) */
+		}		/* elseif(data[1]==0) */
+	}			/* if(data[3]==0) */
 	else {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
@@ -1140,7 +1140,7 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 				outw(data[0],
 					devpriv->i_IobaseAddon +
 					APCI1500_DIGITAL_OP);
-			}	//if(data[1]==0)
+			}	/* if(data[1]==0) */
 			else {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
@@ -1190,48 +1190,48 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 						comedi_error(dev,
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
+						return -EINVAL;	/*  "sorry channel spec wrong " */
 
-					}	//switch(ui_NoOfChannels)
+					}	/* switch(ui_NoOfChannels) */
 
 					outw(data[0],
 						devpriv->i_IobaseAddon +
 						APCI1500_DIGITAL_OP);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 					printk("\nSpecified channel not supported\n");
-				}	//else if(data[1]==1)
-			}	//elseif(data[1]==0)
-		}		//if(data[3]==1);
+				}	/* else if(data[1]==1) */
+			}	/* elseif(data[1]==0) */
+		}		/* if(data[3]==1); */
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
-		}		//if else data[3]==1)
-	}			//if else data[3]==0)
+		}		/* if else data[3]==1) */
+	}			/* if else data[3]==0) */
 	ui_Temp = data[0];
-	return (insn->n);;
+	return insn->n;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI1500_ConfigCounterTimerWatchdog(comedi_device
-                   *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)|
+|                   *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)|
 |				                                                     |
 +----------------------------------------------------------------------------+
 | Task              : Configures The Watchdog                                |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                      struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data         : Data Pointer to read status                                                       data[0]                : 2     APCI1500_1_8_KHZ
 |                                              1     APCI1500_3_6_KHZ        |
 |                                              0     APCI1500_115_KHZ
-                      data[1]                : 0     Counter1/Timer1
-                                               1     Counter2/Timer2
-                                               2     Counter3/Watchdog
-                      data[2]                : 0     Counter
-                                               1     Timer/Watchdog
-                      data[3]                :         This parameter has    |
+|                      data[1]                : 0     Counter1/Timer1
+|                                               1     Counter2/Timer2
+|                                               2     Counter3/Watchdog
+|                      data[2]                : 0     Counter
+|                                               1     Timer/Watchdog
+|                      data[3]                :         This parameter has    |
 |                                                      two meanings.         |
 |                                                    - If the counter/timer  |
 |                                                      is used as a counter  |
@@ -1243,15 +1243,15 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 |                                                      the divider factor    |
 |                                                      for the output is     |
 |                                                      given.
-                       data[4]                 : 0    APCI1500_CONTINUOUS
-                                                 1    APCI1500_SINGLE
-                       data[5]                 : 0    Software Trigger
-                                                 1    Hardware Trigger
-
-                       data[6]                  :0    Software gate
-                                                 1    Hardware gate
-                       data[7]                  :0    Interrupt Disable
-                                                 1    Interrupt Enable
+|                       data[4]                 : 0    APCI1500_CONTINUOUS
+|                                                 1    APCI1500_SINGLE
+|                       data[5]                 : 0    Software Trigger
+|                                                 1    Hardware Trigger
+|
+|                       data[6]                  :0    Software gate
+|                                                 1    Hardware gate
+|                       data[7]                  :0    Interrupt Disable
+|                                                 1    Interrupt Enable
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -1261,27 +1261,27 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 	int i_TimerCounterMode, i_MasterConfiguration;
 
 	devpriv->tsk_Current = current;
 
-//Selection of the input clock
+/* Selection of the input clock */
 	if (data[0] == 0 || data[0] == 1 || data[0] == 2) {
 		outw(data[0], devpriv->i_IobaseAddon + APCI1500_CLK_SELECT);
-	}			// if(data[0]==0||data[0]==1||data[0]==2)
+	}			/*  if(data[0]==0||data[0]==1||data[0]==2) */
 	else {
 		if (data[0] != 3) {
 			printk("\nThe option for input clock selection does not exist\n");
 			return -EINVAL;
-		}		// if(data[0]!=3)
-	}			//elseif(data[0]==0||data[0]==1||data[0]==2)
-	//Select the counter/timer
+		}		/*  if(data[0]!=3) */
+	}			/* elseif(data[0]==0||data[0]==1||data[0]==2) */
+	/* Select the counter/timer */
 	switch (data[1]) {
 	case COUNTER1:
-		//selecting counter or timer
+		/* selecting counter or timer */
 		switch (data[2]) {
 		case 0:
 			data[2] = APCI1500_COUNTER;
@@ -1292,9 +1292,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nThis choice is not a timer nor a counter\n");
 			return -EINVAL;
-		}		// switch(data[2])
+		}		/*  switch(data[2]) */
 
-		//Selecting  single or continuous mode
+		/* Selecting  single or continuous mode */
 		switch (data[4]) {
 		case 0:
 			data[4] = APCI1500_CONTINUOUS;
@@ -1305,7 +1305,7 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nThis option for single/continuous mode does not exist\n");
 			return -EINVAL;
-		}		// switch(data[4])
+		}		/*  switch(data[4]) */
 
 		i_TimerCounterMode = data[2] | data[4] | 7;
 			 /*************************/
@@ -1428,21 +1428,21 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 				outb(0x2,
 					devpriv->iobase +
 					APCI1500_Z8536_CONTROL_REGISTER);
-			}	//if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE)
+			}	/* if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */
 			else {
 				printk("\nError in selection of interrupt enable or disable\n");
 				return -EINVAL;
-			}	//elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE)
-		}		// if ((data[3]>= 0) && (data[3] <= 65535))
+			}	/* elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */
+		}		/*  if ((data[3]>= 0) && (data[3] <= 65535)) */
 		else {
 			printk("\nError in selection of reload value\n");
 			return -EINVAL;
-		}		//else if ((data[3]>= 0) && (data[3] <= 65535))
+		}		/* else if ((data[3]>= 0) && (data[3] <= 65535)) */
 		i_TimerCounterWatchdogInterrupt = data[7];
 		i_TimerCounter1Init = 1;
 		break;
 
-	case COUNTER2:		//selecting counter or timer
+	case COUNTER2:		/* selecting counter or timer */
 		switch (data[2]) {
 		case 0:
 			data[2] = APCI1500_COUNTER;
@@ -1453,9 +1453,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nThis choice is not a timer nor a counter\n");
 			return -EINVAL;
-		}		// switch(data[2])
+		}		/*  switch(data[2]) */
 
-		//Selecting  single or continuous mode
+		/* Selecting  single or continuous mode */
 		switch (data[4]) {
 		case 0:
 			data[4] = APCI1500_CONTINUOUS;
@@ -1466,9 +1466,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nThis option for single/continuous mode does not exist\n");
 			return -EINVAL;
-		}		// switch(data[4])
+		}		/*  switch(data[4]) */
 
-		//Selecting  software or hardware trigger
+		/* Selecting  software or hardware trigger */
 		switch (data[5]) {
 		case 0:
 			data[5] = APCI1500_SOFTWARE_TRIGGER;
@@ -1479,9 +1479,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nThis choice for software or hardware trigger does not exist\n");
 			return -EINVAL;
-		}		// switch(data[5])
+		}		/*  switch(data[5]) */
 
-		//Selecting  software or hardware gate
+		/* Selecting  software or hardware gate */
 		switch (data[6]) {
 		case 0:
 			data[6] = APCI1500_SOFTWARE_GATE;
@@ -1492,7 +1492,7 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nThis choice for software or hardware gate does not exist\n");
 			return -EINVAL;
-		}		// switch(data[6])
+		}		/*  switch(data[6]) */
 
 		i_TimerCounterMode = data[2] | data[4] | data[5] | data[6] | 7;
 
@@ -1616,21 +1616,21 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 				outb(0x2,
 					devpriv->iobase +
 					APCI1500_Z8536_CONTROL_REGISTER);
-			}	//if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE)
+			}	/* if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */
 			else {
 				printk("\nError in selection of interrupt enable or disable\n");
 				return -EINVAL;
-			}	//elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE)
-		}		// if ((data[3]>= 0) && (data[3] <= 65535))
+			}	/* elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */
+		}		/*  if ((data[3]>= 0) && (data[3] <= 65535)) */
 		else {
 			printk("\nError in selection of reload value\n");
 			return -EINVAL;
-		}		//else if ((data[3]>= 0) && (data[3] <= 65535))
+		}		/* else if ((data[3]>= 0) && (data[3] <= 65535)) */
 		i_TimerCounterWatchdogInterrupt = data[7];
 		i_TimerCounter2Init = 1;
 		break;
 
-	case COUNTER3:		//selecting counter or watchdog
+	case COUNTER3:		/* selecting counter or watchdog */
 		switch (data[2]) {
 		case 0:
 			data[2] = APCI1500_COUNTER;
@@ -1641,9 +1641,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nThis choice is not a watchdog nor a counter\n");
 			return -EINVAL;
-		}		// switch(data[2])
+		}		/*  switch(data[2]) */
 
-		//Selecting  single or continuous mode
+		/* Selecting  single or continuous mode */
 		switch (data[4]) {
 		case 0:
 			data[4] = APCI1500_CONTINUOUS;
@@ -1654,9 +1654,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nThis option for single/continuous mode does not exist\n");
 			return -EINVAL;
-		}		// switch(data[4])
+		}		/*  switch(data[4]) */
 
-		//Selecting  software or hardware gate
+		/* Selecting  software or hardware gate */
 		switch (data[6]) {
 		case 0:
 			data[6] = APCI1500_SOFTWARE_GATE;
@@ -1667,7 +1667,7 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nThis choice for software or hardware gate does not exist\n");
 			return -EINVAL;
-		}		// switch(data[6])
+		}		/*  switch(data[6]) */
 
 		      /*****************************/
 		/* Test if used for watchdog */
@@ -1680,10 +1680,10 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 			/* - Pulses output           */
 			     /*****************************/
 			i_TimerCounterMode = data[2] | data[4] | 0x54;
-		}		//if (data[2] == APCI1500_WATCHDOG)
+		}		/* if (data[2] == APCI1500_WATCHDOG) */
 		else {
 			i_TimerCounterMode = data[2] | data[4] | data[6] | 7;
-		}		//elseif (data[2] == APCI1500_WATCHDOG)
+		}		/* elseif (data[2] == APCI1500_WATCHDOG) */
 				 /*************************/
 		/* Test the reload value */
 			     /*************************/
@@ -1809,25 +1809,25 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 						devpriv->iobase +
 						APCI1500_Z8536_CONTROL_REGISTER);
 
-				}	//elseif(data[2]==APCI1500_COUNTER)
+				}	/* elseif(data[2]==APCI1500_COUNTER) */
 
-			}	//if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE)
+			}	/* if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */
 			else {
 				printk("\nError in selection of interrupt enable or disable\n");
 				return -EINVAL;
-			}	//elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE)
-		}		// if ((data[3]>= 0) && (data[3] <= 65535))
+			}	/* elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */
+		}		/*  if ((data[3]>= 0) && (data[3] <= 65535)) */
 		else {
 			printk("\nError in selection of reload value\n");
 			return -EINVAL;
-		}		//else if ((data[3]>= 0) && (data[3] <= 65535))
+		}		/* else if ((data[3]>= 0) && (data[3] <= 65535)) */
 		i_TimerCounterWatchdogInterrupt = data[7];
 		i_WatchdogCounter3Init = 1;
 		break;
 
 	default:
 		printk("\nThe specified counter\timer option does not exist\n");
-	}			//switch(data[1])
+	}			/* switch(data[1]) */
 	i_CounterLogic = data[2];
 	return insn->n;
 }
@@ -1836,22 +1836,22 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI1500_StartStopTriggerTimerCounterWatchdog      |
 |				(struct comedi_device *dev,struct comedi_subdevice *s,
-                         struct comedi_insn *insn,unsigned int *data);                  |
+|                         struct comedi_insn *insn,unsigned int *data);                  |
 +----------------------------------------------------------------------------+
 | Task              : Start / Stop or trigger the timer counter or Watchdog  |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev     : Driver handle                 |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                      struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data         : Data Pointer to read status   |
-                      data[0]                : 0     Counter1/Timer1
-                                               1     Counter2/Timer2
-                                               2     Counter3/Watchdog
-                      data[1]                : 0     start
-                                               1     stop
-                                               2     Trigger
-                      data[2]                : 0     Counter
-                                               1     Timer/Watchdog
+|                      data[0]                : 0     Counter1/Timer1
+|                                               1     Counter2/Timer2
+|                                               2     Counter3/Watchdog
+|                      data[1]                : 0     start
+|                                               1     stop
+|                                               2     Trigger
+|                      data[2]                : 0     Counter
+|                                               1     Timer/Watchdog
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -1860,8 +1860,8 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev,
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 	int i_CommandAndStatusValue;
 
@@ -1871,11 +1871,11 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 		case START:
 			if (i_TimerCounter1Init == 1) {
 				if (i_TimerCounterWatchdogInterrupt == 1) {
-					i_CommandAndStatusValue = 0xC4;	//Enable the interrupt
-				}	// if(i_TimerCounterWatchdogInterrupt==1)
+					i_CommandAndStatusValue = 0xC4;	/* Enable the interrupt */
+				}	/*  if(i_TimerCounterWatchdogInterrupt==1) */
 				else {
-					i_CommandAndStatusValue = 0xE4;	//disable the interrupt
-				}	//elseif(i_TimerCounterWatchdogInterrupt==1)
+					i_CommandAndStatusValue = 0xE4;	/* disable the interrupt */
+				}	/* elseif(i_TimerCounterWatchdogInterrupt==1) */
 					      /**************************/
 				/* Starts timer/counter 1 */
 					      /**************************/
@@ -1889,7 +1889,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 				outb(i_CommandAndStatusValue,
 					devpriv->iobase +
 					APCI1500_Z8536_CONTROL_REGISTER);
-			}	//if( i_TimerCounter1Init==1)
+			}	/* if( i_TimerCounter1Init==1) */
 			else {
 				printk("\nCounter/Timer1 not configured\n");
 				return -EINVAL;
@@ -1922,14 +1922,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 						 /************************/
 
 					i_CommandAndStatusValue = 0x6;
-				}	//if( i_TimerCounter1Enabled==1)
+				}	/* if( i_TimerCounter1Enabled==1) */
 				else {
 						   /***************/
 					/* Set Trigger */
 						   /***************/
 
 					i_CommandAndStatusValue = 0x2;
-				}	//elseif(i_TimerCounter1Enabled==1)
+				}	/* elseif(i_TimerCounter1Enabled==1) */
 
 						/********************************************/
 				/* Selects the commands and status register */
@@ -1940,7 +1940,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 				outb(i_CommandAndStatusValue,
 					devpriv->iobase +
 					APCI1500_Z8536_CONTROL_REGISTER);
-			}	//if( i_TimerCounter1Init==1)
+			}	/* if( i_TimerCounter1Init==1) */
 			else {
 				printk("\nCounter/Timer1 not configured\n");
 				return -EINVAL;
@@ -1950,7 +1950,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nThe specified option for start/stop/trigger does not exist\n");
 			return -EINVAL;
-		}		//switch(data[1])
+		}		/* switch(data[1]) */
 		break;
 
 	case COUNTER2:
@@ -1958,11 +1958,11 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 		case START:
 			if (i_TimerCounter2Init == 1) {
 				if (i_TimerCounterWatchdogInterrupt == 1) {
-					i_CommandAndStatusValue = 0xC4;	//Enable the interrupt
-				}	// if(i_TimerCounterWatchdogInterrupt==1)
+					i_CommandAndStatusValue = 0xC4;	/* Enable the interrupt */
+				}	/*  if(i_TimerCounterWatchdogInterrupt==1) */
 				else {
-					i_CommandAndStatusValue = 0xE4;	//disable the interrupt
-				}	//elseif(i_TimerCounterWatchdogInterrupt==1)
+					i_CommandAndStatusValue = 0xE4;	/* disable the interrupt */
+				}	/* elseif(i_TimerCounterWatchdogInterrupt==1) */
 					      /**************************/
 				/* Starts timer/counter 2 */
 					      /**************************/
@@ -1976,7 +1976,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 				outb(i_CommandAndStatusValue,
 					devpriv->iobase +
 					APCI1500_Z8536_CONTROL_REGISTER);
-			}	//if( i_TimerCounter2Init==1)
+			}	/* if( i_TimerCounter2Init==1) */
 			else {
 				printk("\nCounter/Timer2 not configured\n");
 				return -EINVAL;
@@ -2008,14 +2008,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 						 /************************/
 
 					i_CommandAndStatusValue = 0x6;
-				}	//if( i_TimerCounter2Enabled==1)
+				}	/* if( i_TimerCounter2Enabled==1) */
 				else {
 						   /***************/
 					/* Set Trigger */
 						   /***************/
 
 					i_CommandAndStatusValue = 0x2;
-				}	//elseif(i_TimerCounter2Enabled==1)
+				}	/* elseif(i_TimerCounter2Enabled==1) */
 
 						/********************************************/
 				/* Selects the commands and status register */
@@ -2026,7 +2026,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 				outb(i_CommandAndStatusValue,
 					devpriv->iobase +
 					APCI1500_Z8536_CONTROL_REGISTER);
-			}	//if( i_TimerCounter2Init==1)
+			}	/* if( i_TimerCounter2Init==1) */
 			else {
 				printk("\nCounter/Timer2 not configured\n");
 				return -EINVAL;
@@ -2035,7 +2035,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nThe specified option for start/stop/trigger does not exist\n");
 			return -EINVAL;
-		}		//switch(data[1])
+		}		/* switch(data[1]) */
 		break;
 	case COUNTER3:
 		switch (data[1]) {
@@ -2043,11 +2043,11 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 			if (i_WatchdogCounter3Init == 1) {
 
 				if (i_TimerCounterWatchdogInterrupt == 1) {
-					i_CommandAndStatusValue = 0xC4;	//Enable the interrupt
-				}	// if(i_TimerCounterWatchdogInterrupt==1)
+					i_CommandAndStatusValue = 0xC4;	/* Enable the interrupt */
+				}	/*  if(i_TimerCounterWatchdogInterrupt==1) */
 				else {
-					i_CommandAndStatusValue = 0xE4;	//disable the interrupt
-				}	//elseif(i_TimerCounterWatchdogInterrupt==1)
+					i_CommandAndStatusValue = 0xE4;	/* disable the interrupt */
+				}	/* elseif(i_TimerCounterWatchdogInterrupt==1) */
 					      /**************************/
 				/* Starts Watchdog/counter 3 */
 					      /**************************/
@@ -2062,7 +2062,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 					devpriv->iobase +
 					APCI1500_Z8536_CONTROL_REGISTER);
 
-			}	// if( i_WatchdogCounter3init==1)
+			}	/*  if( i_WatchdogCounter3init==1) */
 			else {
 				printk("\nWatchdog/Counter3 not configured\n");
 				return -EINVAL;
@@ -2089,7 +2089,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 
 		case TRIGGER:
 			switch (data[2]) {
-			case 0:	//triggering counter 3
+			case 0:	/* triggering counter 3 */
 				if (i_WatchdogCounter3Init == 1) {
 					if (i_WatchdogCounter3Enabled == 1) {
 							       /************************/
@@ -2097,14 +2097,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 							       /************************/
 
 						i_CommandAndStatusValue = 0x6;
-					}	//if( i_WatchdogCounter3Enabled==1)
+					}	/* if( i_WatchdogCounter3Enabled==1) */
 					else {
 							   /***************/
 						/* Set Trigger */
 							   /***************/
 
 						i_CommandAndStatusValue = 0x2;
-					}	//elseif(i_WatchdogCounter3Enabled==1)
+					}	/* elseif(i_WatchdogCounter3Enabled==1) */
 
 						/********************************************/
 					/* Selects the commands and status register */
@@ -2115,14 +2115,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 					outb(i_CommandAndStatusValue,
 						devpriv->iobase +
 						APCI1500_Z8536_CONTROL_REGISTER);
-				}	//if( i_WatchdogCounter3Init==1)
+				}	/* if( i_WatchdogCounter3Init==1) */
 				else {
 					printk("\nCounter3 not configured\n");
 					return -EINVAL;
 				}
 				break;
 			case 1:
-				//triggering Watchdog 3
+				/* triggering Watchdog 3 */
 				if (i_WatchdogCounter3Init == 1) {
 
 						/********************************************/
@@ -2134,7 +2134,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 					outb(0x6,
 						devpriv->iobase +
 						APCI1500_Z8536_CONTROL_REGISTER);
-				}	//if( i_WatchdogCounter3Init==1)
+				}	/* if( i_WatchdogCounter3Init==1) */
 				else {
 					printk("\nWatchdog 3 not configured\n");
 					return -EINVAL;
@@ -2143,17 +2143,17 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 			default:
 				printk("\nWrong choice of watchdog/counter3\n");
 				return -EINVAL;
-			}	//switch(data[2])
+			}	/* switch(data[2]) */
 			break;
 		default:
 			printk("\nThe specified option for start/stop/trigger does not exist\n");
 			return -EINVAL;
-		}		//switch(data[1])
+		}		/* switch(data[1]) */
 		break;
 	default:
 		printk("\nThe specified choice for counter/watchdog/timer does not exist\n");
 		return -EINVAL;
-	}			//switch(data[0])
+	}			/* switch(data[0]) */
 	return insn->n;
 }
 
@@ -2161,18 +2161,18 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI1500_ReadCounterTimerWatchdog                |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                    unsigned int *data); 	                                     |
+|                    unsigned int *data); 	                                     |
 +----------------------------------------------------------------------------+
 | Task              : Read The Watchdog                                      |
 +----------------------------------------------------------------------------+
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                      struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data          : Data Pointer to read status  |
-                      data[0]                : 0     Counter1/Timer1
-                                               1     Counter2/Timer2
-                                               2     Counter3/Watchdog
-
+|                      data[0]                : 0     Counter1/Timer1
+|                                               1     Counter2/Timer2
+|                                               2     Counter3/Watchdog
+|
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -2182,13 +2182,13 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 	int i_CommandAndStatusValue;
 	switch (data[0]) {
 	case COUNTER1:
-		//Read counter/timer1
+		/* Read counter/timer1 */
 		if (i_TimerCounter1Init == 1) {
 			if (i_TimerCounter1Enabled == 1) {
 		  /************************/
@@ -2196,14 +2196,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev,
 		  /************************/
 
 				i_CommandAndStatusValue = 0xC;
-			}	//if( i_TimerCounter1Init==1)
+			}	/* if( i_TimerCounter1Init==1) */
 			else {
 		    /***************/
 				/* Set RCC */
 		    /***************/
 
 				i_CommandAndStatusValue = 0x8;
-			}	//elseif(i_TimerCounter1Init==1)
+			}	/* elseif(i_TimerCounter1Init==1) */
 
 		/********************************************/
 			/* Selects the commands and status register */
@@ -2232,14 +2232,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev,
 			data[0] =
 				data[0] | inb(devpriv->iobase +
 				APCI1500_Z8536_CONTROL_REGISTER);
-		}		//if( i_TimerCounter1Init==1)
+		}		/* if( i_TimerCounter1Init==1) */
 		else {
 			printk("\nTimer/Counter1 not configured\n");
 			return -EINVAL;
-		}		//elseif( i_TimerCounter1Init==1)
+		}		/* elseif( i_TimerCounter1Init==1) */
 		break;
 	case COUNTER2:
-		//Read counter/timer2
+		/* Read counter/timer2 */
 		if (i_TimerCounter2Init == 1) {
 			if (i_TimerCounter2Enabled == 1) {
 		  /************************/
@@ -2247,14 +2247,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev,
 		  /************************/
 
 				i_CommandAndStatusValue = 0xC;
-			}	//if( i_TimerCounter2Init==1)
+			}	/* if( i_TimerCounter2Init==1) */
 			else {
 		    /***************/
 				/* Set RCC */
 		    /***************/
 
 				i_CommandAndStatusValue = 0x8;
-			}	//elseif(i_TimerCounter2Init==1)
+			}	/* elseif(i_TimerCounter2Init==1) */
 
 		/********************************************/
 			/* Selects the commands and status register */
@@ -2283,14 +2283,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev,
 			data[0] =
 				data[0] | inb(devpriv->iobase +
 				APCI1500_Z8536_CONTROL_REGISTER);
-		}		//if( i_TimerCounter2Init==1)
+		}		/* if( i_TimerCounter2Init==1) */
 		else {
 			printk("\nTimer/Counter2 not configured\n");
 			return -EINVAL;
-		}		//elseif( i_TimerCounter2Init==1)
+		}		/* elseif( i_TimerCounter2Init==1) */
 		break;
 	case COUNTER3:
-		//Read counter/watchdog2
+		/* Read counter/watchdog2 */
 		if (i_WatchdogCounter3Init == 1) {
 			if (i_WatchdogCounter3Enabled == 1) {
 		  /************************/
@@ -2298,14 +2298,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev,
 		  /************************/
 
 				i_CommandAndStatusValue = 0xC;
-			}	//if( i_TimerCounter2Init==1)
+			}	/* if( i_TimerCounter2Init==1) */
 			else {
 		    /***************/
 				/* Set RCC */
 		    /***************/
 
 				i_CommandAndStatusValue = 0x8;
-			}	//elseif(i_WatchdogCounter3Init==1)
+			}	/* elseif(i_WatchdogCounter3Init==1) */
 
 		/********************************************/
 			/* Selects the commands and status register */
@@ -2334,16 +2334,16 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev,
 			data[0] =
 				data[0] | inb(devpriv->iobase +
 				APCI1500_Z8536_CONTROL_REGISTER);
-		}		//if( i_WatchdogCounter3Init==1)
+		}		/* if( i_WatchdogCounter3Init==1) */
 		else {
 			printk("\nWatchdogCounter3 not configured\n");
 			return -EINVAL;
-		}		//elseif( i_WatchdogCounter3Init==1)
+		}		/* elseif( i_WatchdogCounter3Init==1) */
 		break;
 	default:
 		printk("\nThe choice of timer/counter/watchdog does not exist\n");
 		return -EINVAL;
-	}			//switch(data[0])
+	}			/* switch(data[0]) */
 
 	return insn->n;
 }
@@ -2352,13 +2352,13 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 | Function   Name   : int  i_APCI1500_ReadInterruptMask                      |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                    unsigned int *data); 	                                     |
+|                    unsigned int *data); 	                                     |
 +----------------------------------------------------------------------------+
 | Task              : Read the interrupt mask                                |
 +----------------------------------------------------------------------------+
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                      struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data          : Data Pointer to read status  |
 
 
@@ -2370,8 +2370,8 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev,
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI1500_ReadInterruptMask(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1500_ReadInterruptMask(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	data[0] = i_InterruptMask;
 	data[1] = i_InputChannel;
@@ -2383,15 +2383,15 @@ int i_APCI1500_ReadInterruptMask(struct comedi_device * dev, struct comedi_subde
 +----------------------------------------------------------------------------+
 | Function   Name   : int  i_APCI1500_ConfigureInterrupt                     |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                    unsigned int *data); 	                                     |
+|                    unsigned int *data); 	                                     |
 +----------------------------------------------------------------------------+
 | Task              : Configures the interrupt registers                     |
 +----------------------------------------------------------------------------+
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                      struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data          : Data Pointer                 |
-
+|
 
 +----------------------------------------------------------------------------+
 | Output Parameters :	--
@@ -2401,26 +2401,26 @@ int i_APCI1500_ReadInterruptMask(struct comedi_device * dev, struct comedi_subde
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI1500_ConfigureInterrupt(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1500_ConfigureInterrupt(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Status;
+	unsigned int ui_Status;
 	int i_RegValue;
 	int i_Constant;
 	devpriv->tsk_Current = current;
 	outl(0x0, devpriv->i_IobaseAmcc + 0x38);
 	if (data[0] == 1) {
 		i_Constant = 0xC0;
-	}			//if(data[0]==1)
+	}			/* if(data[0]==1) */
 	else {
 		if (data[0] == 0) {
 			i_Constant = 0x00;
-		}		//if{data[0]==0)
+		}		/* if{data[0]==0) */
 		else {
 			printk("\nThe parameter passed to driver is in error for enabling the voltage interrupt\n");
 			return -EINVAL;
-		}		//else if(data[0]==0)
-	}			//elseif(data[0]==1)
+		}		/* else if(data[0]==0) */
+	}			/* elseif(data[0]==1) */
 
 	 /*****************************************************/
 	/* Selects the mode specification register of port B */
@@ -2580,7 +2580,7 @@ static void v_APCI1500_Interrupt(int irq, void *d)
 {
 
 	struct comedi_device *dev = d;
-	UINT ui_InterruptStatus = 0;
+	unsigned int ui_InterruptStatus = 0;
 	int i_RegValue = 0;
 	i_InterruptMask = 0;
 
@@ -2599,11 +2599,11 @@ static void v_APCI1500_Interrupt(int irq, void *d)
       /*************************************************/
 		/* Selects the master interrupt control register */
       /*************************************************/
-		//outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER);
+		/* outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); */
 	/**********************************************/
 		/* Disables  the main interrupt on the board */
 	/**********************************************/
-		//outb(0x00,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER);
+		/* outb(0x00,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); */
 
    /*****************************************************/
 		/* Selects the command and status register of port A */
@@ -2647,11 +2647,11 @@ static void v_APCI1500_Interrupt(int irq, void *d)
 
 				i_InputChannel = 1 + (i_RegValue >> 1);
 
-			}	// if(i_Logic==APCI1500_OR_PRIORITY)
+			}	/*  if(i_Logic==APCI1500_OR_PRIORITY) */
 			else {
 				i_InputChannel = 0;
-			}	//elseif(i_Logic==APCI1500_OR_PRIORITY)
-		}		// if ((i_RegValue & 0x60) == 0x60)
+			}	/* elseif(i_Logic==APCI1500_OR_PRIORITY) */
+		}		/*  if ((i_RegValue & 0x60) == 0x60) */
 
 	   /*****************************************************/
 		/* Selects the command and status register of port B */
@@ -2679,7 +2679,7 @@ static void v_APCI1500_Interrupt(int irq, void *d)
 			/* Reads port B */
 	     /****************/
 			i_RegValue =
-				inb((UINT) devpriv->iobase +
+				inb((unsigned int) devpriv->iobase +
 				APCI1500_Z8536_PORT_B);
 
 			i_RegValue = i_RegValue & 0xC0;
@@ -2688,7 +2688,7 @@ static void v_APCI1500_Interrupt(int irq, void *d)
 	      /**************************************/
 
 			if (i_RegValue) {
-				//Disable the interrupt
+				/* Disable the interrupt */
 		     /*****************************************************/
 				/* Selects the command and status register of port B */
 		     /*****************************************************/
@@ -2697,17 +2697,17 @@ static void v_APCI1500_Interrupt(int irq, void *d)
 				if (i_RegValue & 0x80) {
 					i_InterruptMask =
 						i_InterruptMask | 0x40;
-				}	//if (i_RegValue & 0x80)
+				}	/* if (i_RegValue & 0x80) */
 
 				if (i_RegValue & 0x40) {
 					i_InterruptMask =
 						i_InterruptMask | 0x80;
-				}	//if (i_RegValue & 0x40)
-			}	// if (i_RegValue)
+				}	/* if (i_RegValue & 0x40) */
+			}	/*  if (i_RegValue) */
 			else {
 				i_InterruptMask = i_InterruptMask | 2;
-			}	// if (i_RegValue)
-		}		//if ((i_RegValue & 0x60) == 0x60)
+			}	/*  if (i_RegValue) */
+		}		/* if ((i_RegValue & 0x60) == 0x60) */
 
 		/*****************************************************/
 		/* Selects the command and status register of timer 1 */
@@ -2731,7 +2731,7 @@ static void v_APCI1500_Interrupt(int irq, void *d)
 				devpriv->iobase +
 				APCI1500_Z8536_CONTROL_REGISTER);
 			i_InterruptMask = i_InterruptMask | 4;
-		}		// if ((i_RegValue & 0x60) == 0x60)
+		}		/*  if ((i_RegValue & 0x60) == 0x60) */
 		/*****************************************************/
 		/* Selects the command and status register of timer 2 */
 		/*****************************************************/
@@ -2754,7 +2754,7 @@ static void v_APCI1500_Interrupt(int irq, void *d)
 				devpriv->iobase +
 				APCI1500_Z8536_CONTROL_REGISTER);
 			i_InterruptMask = i_InterruptMask | 8;
-		}		// if ((i_RegValue & 0x60) == 0x60)
+		}		/*  if ((i_RegValue & 0x60) == 0x60) */
 
 		/*****************************************************/
 		/* Selects the command and status register of timer 3 */
@@ -2779,13 +2779,13 @@ static void v_APCI1500_Interrupt(int irq, void *d)
 				APCI1500_Z8536_CONTROL_REGISTER);
 			if (i_CounterLogic == APCI1500_COUNTER) {
 				i_InterruptMask = i_InterruptMask | 0x10;
-			}	//if(i_CounterLogic==APCI1500_COUNTER)
+			}	/* if(i_CounterLogic==APCI1500_COUNTER) */
 			else {
 				i_InterruptMask = i_InterruptMask | 0x20;
 			}
-		}		// if ((i_RegValue & 0x60) == 0x60)
+		}		/*  if ((i_RegValue & 0x60) == 0x60) */
 
-		send_sig(SIGIO, devpriv->tsk_Current, 0);	// send signal to the sample
+		send_sig(SIGIO, devpriv->tsk_Current, 0);	/*  send signal to the sample */
 	       /***********************/
 		/* Enable all Interrupts */
 	       /***********************/
@@ -2799,11 +2799,11 @@ static void v_APCI1500_Interrupt(int irq, void *d)
 		/* Authorizes the main interrupt on the board */
 	       /**********************************************/
 		outb(0xD0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-	}			//  if ((ui_InterruptStatus & 0x800000) == 0x800000)
+	}			/*   if ((ui_InterruptStatus & 0x800000) == 0x800000) */
 	else {
 		printk("\nInterrupt from unknown source\n");
 
-	}			//else if ((ui_InterruptStatus & 0x800000) == 0x800000)
+	}			/* else if ((ui_InterruptStatus & 0x800000) == 0x800000) */
 	return;
 }
 
@@ -2822,7 +2822,7 @@ static void v_APCI1500_Interrupt(int irq, void *d)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1500_Reset(struct comedi_device * dev)
+int i_APCI1500_Reset(struct comedi_device *dev)
 {
 	int i_DummyRead = 0;
 	i_TimerCounter1Init = 0;
@@ -2982,7 +2982,7 @@ INT i_APCI1500_Reset(struct comedi_device * dev)
 		devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
 	/* Deletes all interrupts */
 	outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-	//reset all the digital outputs
+	/* reset all the digital outputs */
 	outw(0x0, devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP);
 /*******************************/
 /* Disable the board interrupt */

+ 2 - 2
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.h

@@ -17,11 +17,11 @@
 
 /*********      Definitions for APCI-1500 card  *****/
 
-// Card Specific information
+/* Card Specific information */
 #define APCI1500_BOARD_VENDOR_ID           0x10e8
 #define APCI1500_ADDRESS_RANGE              4
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 #define  APCI1500_DIGITAL_OP                 	2
 #define  APCI1500_DIGITAL_IP                    0

+ 87 - 87
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c

@@ -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.
 
@@ -63,7 +63,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |		       struct comedi_subdevice *s,   :pointer to subdevice structure
-                       struct comedi_insn *insn      :pointer to insn structure     |
+|                       struct comedi_insn *insn      :pointer to insn structure     |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -73,22 +73,22 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1516_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_TmpValue = 0;
-	UINT ui_Channel;
+	unsigned int ui_TmpValue = 0;
+	unsigned int ui_Channel;
 	ui_Channel = CR_CHAN(insn->chanspec);
 	if (ui_Channel >= 0 && ui_Channel <= 7) {
-		ui_TmpValue = (UINT) inw(devpriv->iobase + APCI1516_DIGITAL_IP);
-		//  since only 1 channel reqd  to bring it to last bit it is rotated
-		//  8 +(chan - 1) times then ANDed with 1 for last bit.
+		ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI1516_DIGITAL_IP);
+		/*   since only 1 channel reqd  to bring it to last bit it is rotated */
+		/*   8 +(chan - 1) times then ANDed with 1 for last bit. */
 		*data = (ui_TmpValue >> ui_Channel) & 0x1;
-	}			//if(ui_Channel >= 0 && ui_Channel <=7)
+	}			/* if(ui_Channel >= 0 && ui_Channel <=7) */
 	else {
-		//comedi_error(dev," \n chan spec wrong\n");
-		return -EINVAL;	// "sorry channel spec wrong "
-	}			//else if(ui_Channel >= 0 && ui_Channel <=7)
+		/* comedi_error(dev," \n chan spec wrong\n"); */
+		return -EINVAL;	/*  "sorry channel spec wrong " */
+	}			/* else if(ui_Channel >= 0 && ui_Channel <=7) */
 
 	return insn->n;
 }
@@ -103,7 +103,7 @@ INT i_APCI1516_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                      struct comedi_subdevice *s,   :pointer to subdevice structure
-                       struct comedi_insn *insn      :pointer to insn structure     |
+|                       struct comedi_insn *insn      :pointer to insn structure     |
 |                      unsigned int *data         : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -114,17 +114,17 @@ INT i_APCI1516_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 
-	UINT ui_PortValue = data[0];
-	UINT ui_Mask = 0;
-	UINT ui_NoOfChannels;
+	unsigned int ui_PortValue = data[0];
+	unsigned int ui_Mask = 0;
+	unsigned int ui_NoOfChannels;
 
 	ui_NoOfChannels = CR_CHAN(insn->chanspec);
 
-	*data = (UINT) inw(devpriv->iobase + APCI1516_DIGITAL_IP);
+	*data = (unsigned int) inw(devpriv->iobase + APCI1516_DIGITAL_IP);
 	switch (ui_NoOfChannels) {
 	case 2:
 		ui_Mask = 3;
@@ -139,9 +139,9 @@ INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 
 	default:
 		printk("\nWrong parameters\n");
-		return -EINVAL;	// "sorry channel spec wrong "
+		return -EINVAL;	/*  "sorry channel spec wrong " */
 		break;
-	}			//switch(ui_NoOfChannels)
+	}			/* switch(ui_NoOfChannels) */
 
 	return insn->n;
 }
@@ -149,7 +149,7 @@ INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 /*
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI1516_ConfigDigitalOutput (struct comedi_device *dev,
-                    struct comedi_subdevice *s struct comedi_insn *insn,unsigned int *data)    |
+|                    struct comedi_subdevice *s struct comedi_insn *insn,unsigned int *data)    |
 |				                                                     |
 +----------------------------------------------------------------------------+
 | Task              : Configures The Digital Output Subdevice.               |
@@ -158,7 +158,7 @@ INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 |                     unsigned int *data         : Data Pointer contains         |
 |                                          configuration parameters as below |
 |                      struct comedi_subdevice *s,   :pointer to subdevice structure
-                       struct comedi_insn *insn      :pointer to insn structure                                                           |
+|                      struct comedi_insn *insn      :pointer to insn structure                                                           |
 |					  data[0]  :1:Memory on                          |
 |					            0:Memory off                         |
 |										                             |
@@ -171,8 +171,8 @@ INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI1516_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	devpriv->b_OutputMemoryStatus = data[0];
 	return insn->n;
@@ -182,13 +182,13 @@ int i_APCI1516_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI1516_WriteDigitalOutput                      |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                     unsigned int *data)                                         |
+|                     unsigned int *data)                                         |
 +----------------------------------------------------------------------------+
 | Task              : Writes port value  To the selected port                |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                     struct comedi_insn *insn      :pointer to insn structure      |
 |                    unsigned int *data           : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -199,21 +199,21 @@ int i_APCI1516_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1516_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Temp, ui_Temp1;
-	UINT ui_NoOfChannel = CR_CHAN(insn->chanspec);	// get the channel
+	unsigned int ui_Temp, ui_Temp1;
+	unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec);	/*  get the channel */
 
 	printk("EL311003 : @=%x\n", devpriv->iobase + APCI1516_DIGITAL_OP);
 
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp = inw(devpriv->iobase + APCI1516_DIGITAL_OP);
 
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	else {
 		ui_Temp = 0;
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
@@ -222,7 +222,7 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 			printk("EL311003 : d=%d @=%x\n", data[0],
 				devpriv->iobase + APCI1516_DIGITAL_OP);
 
-		}		//if(data[1]==0)
+		}		/* if(data[1]==0) */
 		else {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
@@ -245,21 +245,21 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 
 				default:
 					comedi_error(dev, " chan spec wrong");
-					return -EINVAL;	// "sorry channel spec wrong "
+					return -EINVAL;	/*  "sorry channel spec wrong " */
 
-				}	//switch(ui_NoOfChannels)
+				}	/* switch(ui_NoOfChannels) */
 
 				outw(data[0],
 					devpriv->iobase + APCI1516_DIGITAL_OP);
 
 				printk("EL311003 : d=%d @=%x\n", data[0],
 					devpriv->iobase + APCI1516_DIGITAL_OP);
-			}	// if(data[1]==1)
+			}	/*  if(data[1]==1) */
 			else {
 				printk("\nSpecified channel not supported\n");
-			}	//else if(data[1]==1)
-		}		//elseif(data[1]==0)
-	}			//if(data[3]==0)
+			}	/* else if(data[1]==1) */
+		}		/* elseif(data[1]==0) */
+	}			/* if(data[3]==0) */
 	else {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
@@ -275,7 +275,7 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 				printk("EL311003 : d=%d @=%x\n", data[0],
 					devpriv->iobase + APCI1516_DIGITAL_OP);
 
-			}	//if(data[1]==0)
+			}	/* if(data[1]==0) */
 			else {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
@@ -312,9 +312,9 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 						comedi_error(dev,
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
+						return -EINVAL;	/*  "sorry channel spec wrong " */
 
-					}	//switch(ui_NoOfChannels)
+					}	/* switch(ui_NoOfChannels) */
 
 					outw(data[0],
 						devpriv->iobase +
@@ -324,17 +324,17 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 						data[0],
 						devpriv->iobase +
 						APCI1516_DIGITAL_OP);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 					printk("\nSpecified channel not supported\n");
-				}	//else if(data[1]==1)
-			}	//elseif(data[1]==0)
-		}		//if(data[3]==1);
+				}	/* else if(data[1]==1) */
+			}	/* elseif(data[1]==0) */
+		}		/* if(data[3]==1); */
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
-		}		//if else data[3]==1)
-	}			//if else data[3]==0)
+		}		/* if else data[3]==1) */
+	}			/* if else data[3]==0) */
 	return (insn->n);;
 }
 
@@ -342,13 +342,13 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI1516_ReadDigitalOutput                       |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                    unsigned int *data) 	                                     |
+|                    unsigned int *data) 	                                     |
 +----------------------------------------------------------------------------+
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                     struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -359,17 +359,17 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1516_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 
-	UINT ui_Temp;
-	UINT ui_NoOfChannel = CR_CHAN(insn->chanspec);	// get the channel
+	unsigned int ui_Temp;
+	unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec);	/*  get the channel */
 	ui_Temp = data[0];
 	*data = inw(devpriv->iobase + APCI1516_DIGITAL_OP_RW);
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			//if(ui_Temp==0)
+	}			/* if(ui_Temp==0) */
 	else {
 		if (ui_Temp == 1) {
 			switch (ui_NoOfChannel) {
@@ -387,28 +387,28 @@ INT i_APCI1516_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 
 			default:
 				comedi_error(dev, " chan spec wrong");
-				return -EINVAL;	// "sorry channel spec wrong "
+				return -EINVAL;	/*  "sorry channel spec wrong " */
 
-			}	//switch(ui_NoOfChannels)
-		}		//if(ui_Temp==1)
+			}	/* switch(ui_NoOfChannels) */
+		}		/* if(ui_Temp==1) */
 		else {
 			printk("\nSpecified channel not supported \n");
-		}		//elseif(ui_Temp==1)
-	}			//elseif(ui_Temp==0)
+		}		/* elseif(ui_Temp==1) */
+	}			/* elseif(ui_Temp==0) */
 	return insn->n;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI1516_ConfigWatchdog(struct comedi_device *dev,
-                      struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)  |
+|                      struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)  |
 |				                                                     |
 +----------------------------------------------------------------------------+
 | Task              : Configures The Watchdog                                |
 +----------------------------------------------------------------------------+
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                      struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data          : Data Pointer to read status                                                     |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -419,15 +419,15 @@ INT i_APCI1516_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI1516_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	if (data[0] == 0) {
-		//Disable the watchdog
+		/* Disable the watchdog */
 		outw(0x0,
 			devpriv->i_IobaseAddon +
 			APCI1516_WATCHDOG_ENABLEDISABLE);
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outw(data[1],
 			devpriv->i_IobaseAddon +
 			APCI1516_WATCHDOG_RELOAD_VALUE);
@@ -435,11 +435,11 @@ int i_APCI1516_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic
 		outw(data[1],
 			devpriv->i_IobaseAddon +
 			APCI1516_WATCHDOG_RELOAD_VALUE + 2);
-	}			//if(data[0]==0)
+	}			/* if(data[0]==0) */
 	else {
 		printk("\nThe input parameters are wrong\n");
 		return -EINVAL;
-	}			//elseif(data[0]==0)
+	}			/* elseif(data[0]==0) */
 
 	return insn->n;
 }
@@ -465,19 +465,19 @@ int i_APCI1516_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic
     +----------------------------------------------------------------------------+
   */
 
-int i_APCI1516_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	switch (data[0]) {
-	case 0:		//stop the watchdog
-		outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE);	//disable the watchdog
+	case 0:		/* stop the watchdog */
+		outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE);	/* disable the watchdog */
 		break;
-	case 1:		//start the watchdog
+	case 1:		/* start the watchdog */
 		outw(0x0001,
 			devpriv->i_IobaseAddon +
 			APCI1516_WATCHDOG_ENABLEDISABLE);
 		break;
-	case 2:		//Software trigger
+	case 2:		/* Software trigger */
 		outw(0x0201,
 			devpriv->i_IobaseAddon +
 			APCI1516_WATCHDOG_ENABLEDISABLE);
@@ -485,7 +485,7 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 	default:
 		printk("\nSpecified functionality does not exist\n");
 		return -EINVAL;
-	}			// switch(data[0])
+	}			/*  switch(data[0]) */
 	return insn->n;
 }
 
@@ -510,8 +510,8 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI1516_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1516_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	data[0] = inw(devpriv->i_IobaseAddon + APCI1516_WATCHDOG_STATUS) & 0x1;
 	return insn->n;
@@ -532,9 +532,9 @@ int i_APCI1516_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1516_Reset(struct comedi_device * dev)
+int i_APCI1516_Reset(struct comedi_device *dev)
 {
-	outw(0x0, devpriv->iobase + APCI1516_DIGITAL_OP);	//RESETS THE DIGITAL OUTPUTS
+	outw(0x0, devpriv->iobase + APCI1516_DIGITAL_OP);	/* RESETS THE DIGITAL OUTPUTS */
 	outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE);
 	outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE);
 	outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE + 2);

+ 15 - 14
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.h

@@ -17,17 +17,17 @@
 
 /*********      Definitions for APCI-1516 card  *****/
 
-// Card Specific information
+/* Card Specific information */
 #define APCI1516_BOARD_VENDOR_ID                 0x15B8
 #define APCI1516_ADDRESS_RANGE                   8
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 #define APCI1516_DIGITAL_OP                 	4
 #define APCI1516_DIGITAL_OP_RW                 	4
 #define APCI1516_DIGITAL_IP                     0
 
-// TIMER COUNTER WATCHDOG DEFINES
+/* TIMER COUNTER WATCHDOG DEFINES */
 
 #define ADDIDATA_WATCHDOG                          2
 #define APCI1516_DIGITAL_OP_WATCHDOG               0
@@ -35,24 +35,25 @@
 #define APCI1516_WATCHDOG_RELOAD_VALUE             4
 #define APCI1516_WATCHDOG_STATUS                   16
 
-// Hardware Layer  functions for Apci1516
+/* Hardware Layer  functions for Apci1516 */
 
-//Digital Input
-INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+/* Digital Input */
+int i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				    struct comedi_insn *insn, unsigned int *data);
-INT i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 
-//Digital Output
+/* Digital Output */
 int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
-INT i_APCI1516_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1516_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				  struct comedi_insn *insn, unsigned int *data);
-INT i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 
-// TIMER
-// timer value is passed as u seconds
+/*
+* TIMER timer value is passed as u seconds
+*/
 int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			      struct comedi_insn *insn, unsigned int *data);
 int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
@@ -60,5 +61,5 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s
 int i_APCI1516_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			    struct comedi_insn *insn, unsigned int *data);
 
-//reset
-INT i_APCI1516_Reset(struct comedi_device *dev);
+/* reset */
+int i_APCI1516_Reset(struct comedi_device *dev);

+ 265 - 242
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c

@@ -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.
 
@@ -55,9 +55,9 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 #include <linux/delay.h>
 #include "hwdrv_apci1564.h"
 
-//Global variables
-UINT ui_InterruptStatus_1564 = 0;
-UINT ui_InterruptData, ui_Type;
+/* Global variables */
+unsigned int ui_InterruptStatus_1564 = 0;
+unsigned int ui_InterruptData, ui_Type;
 
 /*
 +----------------------------------------------------------------------------+
@@ -86,8 +86,8 @@ UINT ui_InterruptData, ui_Type;
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	devpriv->tsk_Current = current;
    /*******************************/
@@ -106,13 +106,13 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd
 			outl(0x4,
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 				APCI1564_DIGITAL_IP_IRQ);
-		}		// if  (data[1] == ADDIDATA_OR)
+		}		/*  if  (data[1] == ADDIDATA_OR) */
 		else {
 			outl(0x6,
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 				APCI1564_DIGITAL_IP_IRQ);
-		}		// else if  (data[1] == ADDIDATA_OR)
-	}			// if  (data[0] == ADDIDATA_ENABLE)
+		}		/*  else if  (data[1] == ADDIDATA_OR) */
+	}			/*  if  (data[0] == ADDIDATA_ENABLE) */
 	else {
 		outl(0x0,
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
@@ -123,7 +123,7 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd
 		outl(0x0,
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 			APCI1564_DIGITAL_IP_IRQ);
-	}			// else if  (data[0] == ADDIDATA_ENABLE)
+	}			/*  else if  (data[0] == ADDIDATA_ENABLE) */
 
 	return insn->n;
 }
@@ -137,7 +137,7 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd
 | Task              : Return the status of the digital input                 |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|		              UINT ui_Channel : Channel number to read       |
+|		              unsigned int ui_Channel : Channel number to read       |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -147,24 +147,26 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1564_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_TmpValue = 0;
-	UINT ui_Channel;
+	unsigned int ui_TmpValue = 0;
+	unsigned int ui_Channel;
 
 	ui_Channel = CR_CHAN(insn->chanspec);
 	if (ui_Channel >= 0 && ui_Channel <= 31) {
 		ui_TmpValue =
-			(UINT) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP);
-		//  since only 1 channel reqd  to bring it to last bit it is rotated
-		//  8 +(chan - 1) times then ANDed with 1 for last bit.
+			(unsigned int) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP);
+/*
+* since only 1 channel reqd to bring it to last bit it is rotated 8
+* +(chan - 1) times then ANDed with 1 for last bit.
+*/
 		*data = (ui_TmpValue >> ui_Channel) & 0x1;
-	}			// if  (ui_Channel >= 0 && ui_Channel <=31)
+	}			/*  if  (ui_Channel >= 0 && ui_Channel <=31) */
 	else {
 		comedi_error(dev, "Not a valid channel number !!! \n");
-		return -EINVAL;	// "sorry channel spec wrong "
-	}			//else if  (ui_Channel >= 0 && ui_Channel <=31)
+		return -EINVAL;	/*  "sorry channel spec wrong " */
+	}			/* else if  (ui_Channel >= 0 && ui_Channel <=31) */
 	return insn->n;
 }
 
@@ -177,8 +179,8 @@ INT i_APCI1564_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde
 | Task              : Return the status of the Requested digital inputs      |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To be Read    |
-|                      UINT *data             : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To be Read    |
+|                      unsigned int *data             : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -187,16 +189,16 @@ INT i_APCI1564_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_PortValue = data[0];
-	UINT ui_Mask = 0;
-	UINT ui_NoOfChannels;
+	unsigned int ui_PortValue = data[0];
+	unsigned int ui_Mask = 0;
+	unsigned int ui_NoOfChannels;
 
 	ui_NoOfChannels = CR_CHAN(insn->chanspec);
 	if (data[1] == 0) {
-		*data = (UINT) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP);
+		*data = (unsigned int) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP);
 		switch (ui_NoOfChannels) {
 		case 2:
 			ui_Mask = 3;
@@ -218,15 +220,15 @@ INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 			break;
 		default:
 			comedi_error(dev, "Not a valid Channel number !!!\n");
-			return -EINVAL;	// "sorry channel spec wrong "
+			return -EINVAL;	/*  "sorry channel spec wrong " */
 			break;
-		}		// switch  (ui_NoOfChannels)
-	}			// if  (data[1]==0)
+		}		/*  switch  (ui_NoOfChannels) */
+	}			/*  if  (data[1]==0) */
 	else {
 		if (data[1] == 1) {
 			*data = ui_InterruptStatus_1564;
-		}		// if  (data[1]==1)
-	}			// else if  (data[1]==0)
+		}		/*  if  (data[1]==1) */
+	}			/*  else if  (data[1]==0) */
 	return insn->n;
 }
 
@@ -239,7 +241,7 @@ INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 | Task              : Configures The Digital Output Subdevice.               |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 |					  data[1]            : 1 Enable  VCC  Interrupt  |
@@ -255,34 +257,34 @@ INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1564_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	ULONG ul_Command = 0;
+	unsigned int ul_Command = 0;
 
 	if ((data[0] != 0) && (data[0] != 1)) {
 		comedi_error(dev,
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 		return -EINVAL;
-	}			// if  ((data[0]!=0) && (data[0]!=1))
+	}			/*  if  ((data[0]!=0) && (data[0]!=1)) */
 	if (data[0]) {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
-	}			// if  (data[0])
+	}			/*  if  (data[0]) */
 	else {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
-	}			// else if  (data[0])
+	}			/*  else if  (data[0]) */
 	if (data[1] == ADDIDATA_ENABLE) {
 		ul_Command = ul_Command | 0x1;
-	}			// if  (data[1] == ADDIDATA_ENABLE)
+	}			/*  if  (data[1] == ADDIDATA_ENABLE) */
 	else {
 		ul_Command = ul_Command & 0xFFFFFFFE;
-	}			// else if  (data[1] == ADDIDATA_ENABLE)
+	}			/*  else if  (data[1] == ADDIDATA_ENABLE) */
 	if (data[2] == ADDIDATA_ENABLE) {
 		ul_Command = ul_Command | 0x2;
-	}			// if  (data[2] == ADDIDATA_ENABLE)
+	}			/*  if  (data[2] == ADDIDATA_ENABLE) */
 	else {
 		ul_Command = ul_Command & 0xFFFFFFFD;
-	}			// else if  (data[2] == ADDIDATA_ENABLE)
+	}			/*  else if  (data[2] == ADDIDATA_ENABLE) */
 	outl(ul_Command,
 		devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 		APCI1564_DIGITAL_OP_INTERRUPT);
@@ -302,8 +304,8 @@ INT i_APCI1564_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 | Task              : Writes port value  To the selected port                |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To Write      |
-|                     UINT *data              : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To Write      |
+|                     unsigned int *data              : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -312,28 +314,28 @@ INT i_APCI1564_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Temp, ui_Temp1;
-	UINT ui_NoOfChannel;
+	unsigned int ui_Temp, ui_Temp1;
+	unsigned int ui_NoOfChannel;
 
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp =
 			inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 			APCI1564_DIGITAL_OP_RW);
-	}			// if  (devpriv->b_OutputMemoryStatus )
+	}			/*  if  (devpriv->b_OutputMemoryStatus ) */
 	else {
 		ui_Temp = 0;
-	}			// else if  (devpriv->b_OutputMemoryStatus )
+	}			/*  else if  (devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outl(data[0],
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 				APCI1564_DIGITAL_OP_RW);
-		}		// if  (data[1]==0)
+		}		/*  if  (data[1]==0) */
 		else {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
@@ -362,18 +364,18 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					break;
 				default:
 					comedi_error(dev, " chan spec wrong");
-					return -EINVAL;	// "sorry channel spec wrong "
-				}	// switch (ui_NoOfChannels)
+					return -EINVAL;	/*  "sorry channel spec wrong " */
+				}	/*  switch (ui_NoOfChannels) */
 				outl(data[0],
 					devpriv->i_IobaseAmcc +
 					APCI1564_DIGITAL_OP +
 					APCI1564_DIGITAL_OP_RW);
-			}	// if  (data[1]==1)
+			}	/*  if  (data[1]==1) */
 			else {
 				printk("\nSpecified channel not supported\n");
-			}	// else if  (data[1]==1)
-		}		// else if (data[1]==0)
-	}			//if(data[3]==0)
+			}	/*  else if  (data[1]==1) */
+		}		/*  else if (data[1]==0) */
+	}			/* if(data[3]==0) */
 	else {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
@@ -389,7 +391,7 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					devpriv->i_IobaseAmcc +
 					APCI1564_DIGITAL_OP +
 					APCI1564_DIGITAL_OP_RW);
-			}	// if  (data[1]==0)
+			}	/*  if  (data[1]==0) */
 			else {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
@@ -447,23 +449,23 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 						comedi_error(dev,
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
-					}	//switch(ui_NoOfChannels)
+						return -EINVAL;	/*  "sorry channel spec wrong " */
+					}	/* switch(ui_NoOfChannels) */
 					outl(data[0],
 						devpriv->i_IobaseAmcc +
 						APCI1564_DIGITAL_OP +
 						APCI1564_DIGITAL_OP_RW);
-				}	// if  (data[1]==1)
+				}	/*  if  (data[1]==1) */
 				else {
 					printk("\nSpecified channel not supported\n");
-				}	// else if  (data[1]==1)
-			}	// else if  (data[1]==0)
-		}		// if  (data[3]==1);
+				}	/*  else if  (data[1]==1) */
+			}	/*  else if  (data[1]==0) */
+		}		/*  if  (data[3]==1); */
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
-		}		// else if (data[3]==1)
-	}			// else if (data[3]==0)
+		}		/*  else if (data[3]==1) */
+	}			/*  else if (data[3]==0) */
 	return insn->n;
 }
 
@@ -476,8 +478,8 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To read       |
-|                     UINT *data              : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To read       |
+|                     unsigned int *data              : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -486,11 +488,11 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Temp;
-	UINT ui_NoOfChannel;
+	unsigned int ui_Temp;
+	unsigned int ui_NoOfChannel;
 
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	ui_Temp = data[0];
@@ -498,7 +500,7 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 		APCI1564_DIGITAL_OP_RW);
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			// if  (ui_Temp==0)
+	}			/*  if  (ui_Temp==0) */
 	else {
 		if (ui_Temp == 1) {
 			switch (ui_NoOfChannel) {
@@ -523,14 +525,14 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 
 			default:
 				comedi_error(dev, " chan spec wrong");
-				return -EINVAL;	// "sorry channel spec wrong "
+				return -EINVAL;	/*  "sorry channel spec wrong " */
 				break;
-			}	// switch(ui_NoOfChannels)
-		}		// if  (ui_Temp==1)
+			}	/*  switch(ui_NoOfChannels) */
+		}		/*  if  (ui_Temp==1) */
 		else {
 			printk("\nSpecified channel not supported \n");
-		}		// else if (ui_Temp==1)
-	}			// else if  (ui_Temp==0)
+		}		/*  else if (ui_Temp==1) */
+	}			/*  else if  (ui_Temp==0) */
 	return insn->n;
 }
 
@@ -543,7 +545,7 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 | Task              : Configures The Timer , Counter or Watchdog             |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 |					  data[0]            : 0 Configure As Timer      |
@@ -564,34 +566,34 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	ULONG ul_Command1 = 0;
+	unsigned int ul_Command1 = 0;
 	devpriv->tsk_Current = current;
 	if (data[0] == ADDIDATA_WATCHDOG) {
 		devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG;
 
-		//Disable the watchdog
+		/* Disable the watchdog */
 		outl(0x0,
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
 			APCI1564_TCW_PROG);
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outl(data[3],
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
 			APCI1564_TCW_RELOAD_VALUE);
-	}			// if  (data[0]==ADDIDATA_WATCHDOG)
+	}			/*  if  (data[0]==ADDIDATA_WATCHDOG) */
 	else if (data[0] == ADDIDATA_TIMER) {
-		//First Stop The Timer
+		/* First Stop The Timer */
 		ul_Command1 =
 			inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			APCI1564_TCW_PROG);
 		ul_Command1 = ul_Command1 & 0xFFFFF9FEUL;
-		outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG);	//Stop The Timer
+		outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG);	/* Stop The Timer */
 
 		devpriv->b_TimerSelectMode = ADDIDATA_TIMER;
 		if (data[1] == 1) {
-			outl(0x02, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG);	//Enable TIMER int & DISABLE ALL THE OTHER int SOURCES
+			outl(0x02, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG);	/* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */
 			outl(0x0,
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 				APCI1564_DIGITAL_IP_IRQ);
@@ -614,18 +616,18 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 			outl(0x0,
 				devpriv->iobase + APCI1564_COUNTER4 +
 				APCI1564_TCW_IRQ);
-		}		// if  (data[1]==1)
+		}		/*  if  (data[1]==1) */
 		else {
-			outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG);	//disable Timer interrupt
-		}		// else if  (data[1]==1)
+			outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG);	/* disable Timer interrupt */
+		}		/*  else if  (data[1]==1) */
 
-		// Loading Timebase
+		/*  Loading Timebase */
 
 		outl(data[2],
 			devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			APCI1564_TCW_TIMEBASE);
 
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outl(data[3],
 			devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			APCI1564_TCW_RELOAD_VALUE);
@@ -635,18 +637,18 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 			APCI1564_TCW_PROG);
 		ul_Command1 =
 			(ul_Command1 & 0xFFF719E2UL) | 2UL << 13UL | 0x10UL;
-		outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG);	//mode 2
-	}			// else if  (data[0]==ADDIDATA_TIMER)
+		outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG);	/* mode 2 */
+	}			/*  else if  (data[0]==ADDIDATA_TIMER) */
 	else if (data[0] == ADDIDATA_COUNTER) {
 		devpriv->b_TimerSelectMode = ADDIDATA_COUNTER;
 		devpriv->b_ModeSelectRegister = data[5];
 
-		//First Stop The Counter
+		/* First Stop The Counter */
 		ul_Command1 =
 			inl(devpriv->iobase + ((data[5] - 1) * 0x20) +
 			APCI1564_TCW_PROG);
 		ul_Command1 = ul_Command1 & 0xFFFFF9FEUL;
-		outl(ul_Command1, devpriv->iobase + ((data[5] - 1) * 0x20) + APCI1564_TCW_PROG);	//Stop The Timer
+		outl(ul_Command1, devpriv->iobase + ((data[5] - 1) * 0x20) + APCI1564_TCW_PROG);	/* Stop The Timer */
 
       /************************/
 		/* Set the reload value */
@@ -666,12 +668,12 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
       /******************************/
 		ul_Command1 =
 			(ul_Command1 & 0xFFFC19E2UL) | 0x80000UL |
-			(ULONG) ((ULONG) data[4] << 16UL);
+			(unsigned int) ((unsigned int) data[4] << 16UL);
 		outl(ul_Command1,
 			devpriv->iobase + ((data[5] - 1) * 0x20) +
 			APCI1564_TCW_PROG);
 
-		// Enable or Disable Interrupt
+		/*  Enable or Disable Interrupt */
 		ul_Command1 = (ul_Command1 & 0xFFFFF9FD) | (data[1] << 1);
 		outl(ul_Command1,
 			devpriv->iobase + ((data[5] - 1) * 0x20) +
@@ -684,10 +686,10 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 		outl(ul_Command1,
 			devpriv->iobase + ((data[5] - 1) * 0x20) +
 			APCI1564_TCW_PROG);
-	}			// else if  (data[0]==ADDIDATA_COUNTER)
+	}			/*  else if  (data[0]==ADDIDATA_COUNTER) */
 	else {
 		printk(" Invalid subdevice.");
-	}			// else if  (data[0]==ADDIDATA_WATCHDOG)
+	}			/*  else if  (data[0]==ADDIDATA_WATCHDOG) */
 
 	return insn->n;
 }
@@ -701,7 +703,7 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 | Task              : Start / Stop The Selected Timer , Counter or Watchdog  |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 |					  data[0]            : 0 Timer                   |
@@ -718,22 +720,22 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	ULONG ul_Command1 = 0;
+	unsigned int ul_Command1 = 0;
 	if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
 		switch (data[1]) {
-		case 0:	//stop the watchdog
-			outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_PROG);	//disable the watchdog
+		case 0:	/* stop the watchdog */
+			outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_PROG);	/* disable the watchdog */
 			break;
-		case 1:	//start the watchdog
+		case 1:	/* start the watchdog */
 			outl(0x0001,
 				devpriv->i_IobaseAmcc +
 				APCI1564_DIGITAL_OP_WATCHDOG +
 				APCI1564_TCW_PROG);
 			break;
-		case 2:	//Software trigger
+		case 2:	/* Software trigger */
 			outl(0x0201,
 				devpriv->i_IobaseAmcc +
 				APCI1564_DIGITAL_OP_WATCHDOG +
@@ -742,8 +744,8 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 		default:
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
-		}		// switch (data[1])
-	}			// if  (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG)
+		}		/*  switch (data[1]) */
+	}			/*  if  (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */
 	if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
 		if (data[1] == 1) {
 			ul_Command1 =
@@ -751,13 +753,13 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 				APCI1564_TCW_PROG);
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
 
-			//Enable the Timer
+			/* Enable the Timer */
 			outl(ul_Command1,
 				devpriv->i_IobaseAmcc + APCI1564_TIMER +
 				APCI1564_TCW_PROG);
-		}		// if  (data[1]==1)
+		}		/*  if  (data[1]==1) */
 		else if (data[1] == 0) {
-			//Stop The Timer
+			/* Stop The Timer */
 
 			ul_Command1 =
 				inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
@@ -766,29 +768,29 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 			outl(ul_Command1,
 				devpriv->i_IobaseAmcc + APCI1564_TIMER +
 				APCI1564_TCW_PROG);
-		}		// else if(data[1]==0)
-	}			// if  (devpriv->b_TimerSelectMode==ADDIDATA_TIMER)
+		}		/*  else if(data[1]==0) */
+	}			/*  if  (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */
 	if (devpriv->b_TimerSelectMode == ADDIDATA_COUNTER) {
 		ul_Command1 =
 			inl(devpriv->iobase + ((devpriv->b_ModeSelectRegister -
 					1) * 0x20) + APCI1564_TCW_PROG);
 		if (data[1] == 1) {
-			//Start the Counter subdevice
+			/* Start the Counter subdevice */
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
-		}		// if  (data[1] == 1)
+		}		/*  if  (data[1] == 1) */
 		else if (data[1] == 0) {
-			// Stops the Counter subdevice
+			/*  Stops the Counter subdevice */
 			ul_Command1 = 0;
 
-		}		// else if  (data[1] == 0)
+		}		/*  else if  (data[1] == 0) */
 		else if (data[1] == 2) {
-			// Clears the Counter subdevice
+			/*  Clears the Counter subdevice */
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x400;
-		}		// else if  (data[1] == 3)
+		}		/*  else if  (data[1] == 3) */
 		outl(ul_Command1,
 			devpriv->iobase + ((devpriv->b_ModeSelectRegister -
 					1) * 0x20) + APCI1564_TCW_PROG);
-	}			// if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER)
+	}			/*  if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) */
 	return insn->n;
 }
 
@@ -801,7 +803,7 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 | Task              : Read The Selected Timer , Counter or Watchdog          |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 
@@ -813,13 +815,13 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	ULONG ul_Command1 = 0;
+	unsigned int ul_Command1 = 0;
 
 	if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
-		// Stores the status of the Watchdog
+		/*  Stores the status of the Watchdog */
 		data[0] =
 			inl(devpriv->i_IobaseAmcc +
 			APCI1564_DIGITAL_OP_WATCHDOG +
@@ -827,18 +829,18 @@ INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev,
 		data[1] =
 			inl(devpriv->i_IobaseAmcc +
 			APCI1564_DIGITAL_OP_WATCHDOG);
-	}			// if  (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG)
+	}			/*  if  (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */
 	else if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
-		// Stores the status of the Timer
+		/*  Stores the status of the Timer */
 		data[0] =
 			inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			APCI1564_TCW_TRIG_STATUS) & 0x1;
 
-		// Stores the Actual value of the Timer
+		/*  Stores the Actual value of the Timer */
 		data[1] = inl(devpriv->i_IobaseAmcc + APCI1564_TIMER);
-	}			// else if  (devpriv->b_TimerSelectMode==ADDIDATA_TIMER)
+	}			/*  else if  (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */
 	else if (devpriv->b_TimerSelectMode == ADDIDATA_COUNTER) {
-		// Read the Counter Actual Value.
+		/*  Read the Counter Actual Value. */
 		data[0] =
 			inl(devpriv->iobase + ((devpriv->b_ModeSelectRegister -
 					1) * 0x20) +
@@ -850,28 +852,28 @@ INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev,
       /***********************************/
 		/* Get the software trigger status */
       /***********************************/
-		data[1] = (BYTE) ((ul_Command1 >> 1) & 1);
+		data[1] = (unsigned char) ((ul_Command1 >> 1) & 1);
 
       /***********************************/
 		/* Get the hardware trigger status */
       /***********************************/
-		data[2] = (BYTE) ((ul_Command1 >> 2) & 1);
+		data[2] = (unsigned char) ((ul_Command1 >> 2) & 1);
 
       /*********************************/
 		/* Get the software clear status */
       /*********************************/
-		data[3] = (BYTE) ((ul_Command1 >> 3) & 1);
+		data[3] = (unsigned char) ((ul_Command1 >> 3) & 1);
 
       /***************************/
 		/* Get the overflow status */
       /***************************/
-		data[4] = (BYTE) ((ul_Command1 >> 0) & 1);
-	}			// else  if  (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER)
+		data[4] = (unsigned char) ((ul_Command1 >> 0) & 1);
+	}			/*  else  if  (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) */
 	else if ((devpriv->b_TimerSelectMode != ADDIDATA_TIMER)
 		&& (devpriv->b_TimerSelectMode != ADDIDATA_WATCHDOG)
 		&& (devpriv->b_TimerSelectMode != ADDIDATA_COUNTER)) {
 		printk("\n Invalid Subdevice !!!\n");
-	}			// else if ((devpriv->b_TimerSelectMode!=ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode!=ADDIDATA_WATCHDOG)&& (devpriv->b_TimerSelectMode!=ADDIDATA_COUNTER))
+	}			/*  else if ((devpriv->b_TimerSelectMode!=ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode!=ADDIDATA_WATCHDOG)&& (devpriv->b_TimerSelectMode!=ADDIDATA_COUNTER)) */
 	return insn->n;
 }
 
@@ -892,8 +894,8 @@ INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI1564_ReadInterruptStatus(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI1564_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	*data = ui_Type;
 	return insn->n;
@@ -919,10 +921,10 @@ int i_APCI1564_ReadInterruptStatus(struct comedi_device * dev, struct comedi_sub
 static void v_APCI1564_Interrupt(int irq, void *d)
 {
 	struct comedi_device *dev = d;
-	UINT ui_DO, ui_DI;
-	UINT ui_Timer;
-	UINT ui_C1, ui_C2, ui_C3, ui_C4;
-	ULONG ul_Command2 = 0;
+	unsigned int ui_DO, ui_DI;
+	unsigned int ui_Timer;
+	unsigned int ui_C1, ui_C2, ui_C3, ui_C4;
+	unsigned int ul_Command2 = 0;
 	ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 		APCI1564_DIGITAL_IP_IRQ) & 0x01;
 	ui_DO = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
@@ -941,7 +943,7 @@ static void v_APCI1564_Interrupt(int irq, void *d)
 	if (ui_DI == 0 && ui_DO == 0 && ui_Timer == 0 && ui_C1 == 0
 		&& ui_C2 == 0 && ui_C3 == 0 && ui_C4 == 0) {
 		printk("\nInterrupt from unknown source\n");
-	}			// if(ui_DI==0 && ui_DO==0 && ui_Timer==0 && ui_C1==0 && ui_C2==0 && ui_C3==0 && ui_C4==0)
+	}			/*  if(ui_DI==0 && ui_DO==0 && ui_Timer==0 && ui_C1==0 && ui_C2==0 && ui_C3==0 && ui_C4==0) */
 
 	if (ui_DI == 1) {
 		ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
@@ -953,116 +955,137 @@ static void v_APCI1564_Interrupt(int irq, void *d)
 			inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 			APCI1564_DIGITAL_IP_INTERRUPT_STATUS);
 		ui_InterruptStatus_1564 = ui_InterruptStatus_1564 & 0X000FFFF0;
-		send_sig(SIGIO, devpriv->tsk_Current, 0);	// send signal to the sample
-		outl(ui_DI, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ);	//enable the interrupt
+		send_sig(SIGIO, devpriv->tsk_Current, 0);	/*  send signal to the sample */
+		outl(ui_DI, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ);	/* enable the interrupt */
 		return;
 	}
 
 	if (ui_DO == 1) {
-		// Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt.
+		/*  Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. */
 		ui_Type =
 			inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 			APCI1564_DIGITAL_OP_INTERRUPT_STATUS) & 0x3;
-		//Disable the  Interrupt
+		/* Disable the  Interrupt */
 		outl(0x0,
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 			APCI1564_DIGITAL_OP_INTERRUPT);
 
-		//Sends signal to user space
+		/* Sends signal to user space */
 		send_sig(SIGIO, devpriv->tsk_Current, 0);
 
-	}			// if  (ui_DO)
+	}			/*  if  (ui_DO) */
 
-	if ((ui_Timer == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_TIMER)) {
-		// Disable Timer Interrupt
-		ul_Command2 =
-			inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
-			APCI1564_TCW_PROG);
-		outl(0x0,
-			devpriv->i_IobaseAmcc + APCI1564_TIMER +
-			APCI1564_TCW_PROG);
+	if (ui_Timer == 1) {
+		devpriv->b_TimerSelectMode = ADDIDATA_TIMER;
+		if (devpriv->b_TimerSelectMode) {
 
-		//Send a signal to from kernel to user space
-		send_sig(SIGIO, devpriv->tsk_Current, 0);
+			/*  Disable Timer Interrupt */
+			ul_Command2 =
+				inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
+				    APCI1564_TCW_PROG);
+			outl(0x0,
+			     devpriv->i_IobaseAmcc + APCI1564_TIMER +
+			     APCI1564_TCW_PROG);
 
-		// Enable Timer Interrupt
+			/* Send a signal to from kernel to user space */
+			send_sig(SIGIO, devpriv->tsk_Current, 0);
 
-		outl(ul_Command2,
-			devpriv->i_IobaseAmcc + APCI1564_TIMER +
-			APCI1564_TCW_PROG);
-	}			// if  ((ui_Timer == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_TIMER))
+			/*  Enable Timer Interrupt */
 
-	if ((ui_C1 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) {
-		// Disable Counter Interrupt
-		ul_Command2 =
-			inl(devpriv->iobase + APCI1564_COUNTER1 +
-			APCI1564_TCW_PROG);
-		outl(0x0,
-			devpriv->iobase + APCI1564_COUNTER1 +
-			APCI1564_TCW_PROG);
+			outl(ul_Command2,
+			     devpriv->i_IobaseAmcc + APCI1564_TIMER +
+			     APCI1564_TCW_PROG);
+		}
+	}/* if  (ui_Timer == 1) */
 
-		//Send a signal to from kernel to user space
-		send_sig(SIGIO, devpriv->tsk_Current, 0);
 
-		// Enable Counter Interrupt
-		outl(ul_Command2,
-			devpriv->iobase + APCI1564_COUNTER1 +
-			APCI1564_TCW_PROG);
-	}			// if  ((ui_C1 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER))
+	if (ui_C1 == 1) {
+		devpriv->b_TimerSelectMode = ADDIDATA_COUNTER;
+		if (devpriv->b_TimerSelectMode) {
 
-	if ((ui_C2 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) {
-		// Disable Counter Interrupt
-		ul_Command2 =
-			inl(devpriv->iobase + APCI1564_COUNTER2 +
-			APCI1564_TCW_PROG);
-		outl(0x0,
-			devpriv->iobase + APCI1564_COUNTER2 +
-			APCI1564_TCW_PROG);
+			/*  Disable Counter Interrupt */
+			ul_Command2 =
+				inl(devpriv->iobase + APCI1564_COUNTER1 +
+				    APCI1564_TCW_PROG);
+			outl(0x0,
+			     devpriv->iobase + APCI1564_COUNTER1 +
+			     APCI1564_TCW_PROG);
 
-		//Send a signal to from kernel to user space
-		send_sig(SIGIO, devpriv->tsk_Current, 0);
+			/* Send a signal to from kernel to user space */
+			send_sig(SIGIO, devpriv->tsk_Current, 0);
 
-		// Enable Counter Interrupt
-		outl(ul_Command2,
-			devpriv->iobase + APCI1564_COUNTER2 +
-			APCI1564_TCW_PROG);
-	}			// if  ((ui_C2 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER))
+			/*  Enable Counter Interrupt */
+			outl(ul_Command2,
+			     devpriv->iobase + APCI1564_COUNTER1 +
+			     APCI1564_TCW_PROG);
+		}
+	} /* if  (ui_C1 == 1) */
 
-	if ((ui_C3 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) {
-		// Disable Counter Interrupt
-		ul_Command2 =
-			inl(devpriv->iobase + APCI1564_COUNTER3 +
-			APCI1564_TCW_PROG);
-		outl(0x0,
-			devpriv->iobase + APCI1564_COUNTER3 +
-			APCI1564_TCW_PROG);
+	if (ui_C2 == 1) {
+		devpriv->b_TimerSelectMode = ADDIDATA_COUNTER;
+		if (devpriv->b_TimerSelectMode) {
 
-		//Send a signal to from kernel to user space
-		send_sig(SIGIO, devpriv->tsk_Current, 0);
+			/*  Disable Counter Interrupt */
+			ul_Command2 =
+				inl(devpriv->iobase + APCI1564_COUNTER2 +
+				    APCI1564_TCW_PROG);
+			outl(0x0,
+			     devpriv->iobase + APCI1564_COUNTER2 +
+			     APCI1564_TCW_PROG);
 
-		// Enable Counter Interrupt
-		outl(ul_Command2,
-			devpriv->iobase + APCI1564_COUNTER3 +
-			APCI1564_TCW_PROG);
-	}			// if ((ui_C3 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER))
+			/* Send a signal to from kernel to user space */
+			send_sig(SIGIO, devpriv->tsk_Current, 0);
 
-	if ((ui_C4 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) {
-		// Disable Counter Interrupt
-		ul_Command2 =
-			inl(devpriv->iobase + APCI1564_COUNTER4 +
-			APCI1564_TCW_PROG);
-		outl(0x0,
-			devpriv->iobase + APCI1564_COUNTER4 +
-			APCI1564_TCW_PROG);
+			/*  Enable Counter Interrupt */
+			outl(ul_Command2,
+			     devpriv->iobase + APCI1564_COUNTER2 +
+			     APCI1564_TCW_PROG);
+		}
+	} /*  if  ((ui_C2 == 1) */
 
-		//Send a signal to from kernel to user space
-		send_sig(SIGIO, devpriv->tsk_Current, 0);
+	if (ui_C3 == 1) {
+		devpriv->b_TimerSelectMode = ADDIDATA_COUNTER;
+		if (devpriv->b_TimerSelectMode) {
 
-		// Enable Counter Interrupt
-		outl(ul_Command2,
-			devpriv->iobase + APCI1564_COUNTER4 +
-			APCI1564_TCW_PROG);
-	}			// if ((ui_C4 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER))
+			/*  Disable Counter Interrupt */
+			ul_Command2 =
+				inl(devpriv->iobase + APCI1564_COUNTER3 +
+				    APCI1564_TCW_PROG);
+			outl(0x0,
+			     devpriv->iobase + APCI1564_COUNTER3 +
+			     APCI1564_TCW_PROG);
+
+			/* Send a signal to from kernel to user space */
+			send_sig(SIGIO, devpriv->tsk_Current, 0);
+
+			/*  Enable Counter Interrupt */
+			outl(ul_Command2,
+			     devpriv->iobase + APCI1564_COUNTER3 +
+			     APCI1564_TCW_PROG);
+		}
+	}	/*  if ((ui_C3 == 1) */
+
+	if (ui_C4 == 1) {
+		devpriv->b_TimerSelectMode = ADDIDATA_COUNTER;
+		if (devpriv->b_TimerSelectMode) {
+
+			/*  Disable Counter Interrupt */
+			ul_Command2 =
+				inl(devpriv->iobase + APCI1564_COUNTER4 +
+				    APCI1564_TCW_PROG);
+			outl(0x0,
+			     devpriv->iobase + APCI1564_COUNTER4 +
+			     APCI1564_TCW_PROG);
+
+			/* Send a signal to from kernel to user space */
+			send_sig(SIGIO, devpriv->tsk_Current, 0);
+
+			/*  Enable Counter Interrupt */
+			outl(ul_Command2,
+			     devpriv->iobase + APCI1564_COUNTER4 +
+			     APCI1564_TCW_PROG);
+		}
+	}	/*  if (ui_C4 == 1) */
 	return;
 }
 
@@ -1081,16 +1104,16 @@ static void v_APCI1564_Interrupt(int irq, void *d)
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI1564_Reset(struct comedi_device * dev)
+int i_APCI1564_Reset(struct comedi_device *dev)
 {
-	outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_IRQ);	//disable the interrupts
-	inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_INTERRUPT_STATUS);	//Reset the interrupt status register
-	outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_INTERRUPT_MODE1);	//Disable the and/or interrupt
+	outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_IRQ);	/* disable the interrupts */
+	inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_INTERRUPT_STATUS);	/* Reset the interrupt status register */
+	outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_INTERRUPT_MODE1);	/* Disable the and/or interrupt */
 	outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_INTERRUPT_MODE2);
 	devpriv->b_DigitalOutputRegister = 0;
 	ui_Type = 0;
-	outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP);	//Resets the output channels
-	outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_INTERRUPT);	//Disables the interrupt.
+	outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP);	/* Resets the output channels */
+	outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_INTERRUPT);	/* Disables the interrupt. */
 	outl(0x0,
 		devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
 		APCI1564_TCW_RELOAD_VALUE);

+ 27 - 25
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.h

@@ -20,45 +20,45 @@
 #define APCI1564_BOARD_VENDOR_ID                0x15B8
 #define APCI1564_ADDRESS_RANGE                  128
 
-//DIGITAL INPUT-OUTPUT DEFINE
-// Input defines
+/* DIGITAL INPUT-OUTPUT DEFINE */
+/* Input defines */
 #define APCI1564_DIGITAL_IP                     0x04
 #define APCI1564_DIGITAL_IP_INTERRUPT_MODE1     4
 #define APCI1564_DIGITAL_IP_INTERRUPT_MODE2     8
 #define APCI1564_DIGITAL_IP_IRQ                 16
 
-// Output defines
+/* Output defines */
 #define APCI1564_DIGITAL_OP                 	0x18
 #define APCI1564_DIGITAL_OP_RW               	0
 #define APCI1564_DIGITAL_OP_INTERRUPT           4
 #define APCI1564_DIGITAL_OP_IRQ                 12
 
-//Digital Input IRQ Function Selection
+/* Digital Input IRQ Function Selection */
 #define ADDIDATA_OR                             0
 #define ADDIDATA_AND                            1
 
-//Digital Input Interrupt Status
+/* Digital Input Interrupt Status */
 #define APCI1564_DIGITAL_IP_INTERRUPT_STATUS    12
 
-//Digital Output Interrupt Status
+/* Digital Output Interrupt Status */
 #define APCI1564_DIGITAL_OP_INTERRUPT_STATUS    8
 
-//Digital Input Interrupt Enable Disable.
+/* Digital Input Interrupt Enable Disable. */
 #define APCI1564_DIGITAL_IP_INTERRUPT_ENABLE    0x4
 #define APCI1564_DIGITAL_IP_INTERRUPT_DISABLE   0xFFFFFFFB
 
-//Digital Output Interrupt Enable Disable.
+/* Digital Output Interrupt Enable Disable. */
 #define APCI1564_DIGITAL_OP_VCC_INTERRUPT_ENABLE   0x1
 #define APCI1564_DIGITAL_OP_VCC_INTERRUPT_DISABLE  0xFFFFFFFE
 #define APCI1564_DIGITAL_OP_CC_INTERRUPT_ENABLE    0x2
 #define APCI1564_DIGITAL_OP_CC_INTERRUPT_DISABLE   0xFFFFFFFD
 
-//ADDIDATA Enable Disable
+/* ADDIDATA Enable Disable */
 
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_DISABLE                           0
 
-// TIMER COUNTER WATCHDOG DEFINES
+/* TIMER COUNTER WATCHDOG DEFINES */
 
 #define ADDIDATA_TIMER                             0
 #define ADDIDATA_COUNTER                           1
@@ -78,30 +78,32 @@
 #define APCI1564_TCW_WARN_TIMEVAL                  24
 #define APCI1564_TCW_WARN_TIMEBASE                 28
 
-// Hardware Layer  functions for Apci1564
+/* Hardware Layer  functions for Apci1564 */
 
-//DI
-// for di read
-INT i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+/*
+* DI for di read
+*/
+int i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				  struct comedi_insn *insn, unsigned int *data);
-INT i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
-INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				    struct comedi_insn *insn, unsigned int *data);
 
-//DO
+/* DO */
 int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
-INT i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				  struct comedi_insn *insn, unsigned int *data);
-INT i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 int i_APCI1564_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 
-// TIMER
-// timer value is passed as u seconds
-INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev,
+/*
+* TIMER timer value is passed as u seconds
+*/
+int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev,
 					  struct comedi_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);
 int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
@@ -112,8 +114,8 @@ int i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device *dev,
 					struct comedi_subdevice *s,
 					struct comedi_insn *insn, unsigned int *data);
 
-// INTERRUPT
+/* intERRUPT */
 static void v_APCI1564_Interrupt(int irq, void *d);
 
-// RESET
-INT i_APCI1564_Reset(struct comedi_device *dev);
+/* RESET */
+int i_APCI1564_Reset(struct comedi_device *dev);

+ 67 - 67
drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c

@@ -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.
 
@@ -57,7 +57,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT   i_APCI16XX_InsnConfigInitTTLIO                   |
+| Function Name     : int   i_APCI16XX_InsnConfigInitTTLIO                   |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -69,11 +69,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                for you call any other function witch access of TTL.        |
 |                APCI16XX_TTL_INITDIRECTION(user inputs for direction)       |
 +----------------------------------------------------------------------------+
-| Input Parameters  : b_InitType    = (BYTE) data[0];                        |
-|                     b_Port0Mode   = (BYTE) data[1];                        |
-|                     b_Port1Mode   = (BYTE) data[2];                        |
-|                     b_Port2Mode   = (BYTE) data[3];                        |
-|                     b_Port3Mode   = (BYTE) data[4];                        |
+| Input Parameters  : b_InitType    = (unsigned char) data[0];                        |
+|                     b_Port0Mode   = (unsigned char) data[1];                        |
+|                     b_Port1Mode   = (unsigned char) data[2];                        |
+|                     b_Port2Mode   = (unsigned char) data[3];                        |
+|                     b_Port3Mode   = (unsigned char) data[4];                        |
 |                     ........                                               |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -90,14 +90,14 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_Command = 0;
-	BYTE b_Cpt = 0;
-	BYTE b_NumberOfPort =
-		(BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
+	int i_ReturnValue = insn->n;
+	unsigned char b_Command = 0;
+	unsigned char b_Cpt = 0;
+	unsigned char b_NumberOfPort =
+		(unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
 
 	/************************/
 	/* Test the buffer size */
@@ -108,7 +108,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 		/* Get the command */
 		/* **************** */
 
-		b_Command = (BYTE) data[0];
+		b_Command = (unsigned char) data[0];
 
 	   /********************/
 		/* Test the command */
@@ -122,7 +122,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 	      /***************************************/
 
 			if ((b_Command == APCI16XX_TTL_INITDIRECTION)
-				&& ((BYTE) (insn->n - 1) != b_NumberOfPort)) {
+				&& ((unsigned char) (insn->n - 1) != b_NumberOfPort)) {
 		 /*******************/
 				/* Data size error */
 		 /*******************/
@@ -132,7 +132,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 			}
 
 			if ((b_Command == APCI16XX_TTL_OUTPUTMEMORY)
-				&& ((BYTE) (insn->n) != 2)) {
+				&& ((unsigned char) (insn->n) != 2)) {
 		 /*******************/
 				/* Data size error */
 		 /*******************/
@@ -182,8 +182,8 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 		 /************************/
 
 				printk("\nPort %d direction selection error",
-					(INT) b_Cpt);
-				i_ReturnValue = -(INT) b_Cpt;
+					(int) b_Cpt);
+				i_ReturnValue = -(int) b_Cpt;
 			}
 
 	      /**************************/
@@ -239,7 +239,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 		}
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -250,7 +250,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT     i_APCI16XX_InsnBitsReadTTLIO                   |
+| Function Name     : int     i_APCI16XX_InsnBitsReadTTLIO                   |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -266,11 +266,11 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 |              APCI16XX_TTL_READCHANNEL                                      |
 |                    b_SelectedPort= CR_RANGE(insn->chanspec);               |
 |                    b_InputChannel= CR_CHAN(insn->chanspec);                |
-|                    b_ReadType	  = (BYTE) data[0];                          |
+|                    b_ReadType	  = (unsigned char) data[0];                          |
 |                                                                            |
 |              APCI16XX_TTL_READPORT                                         |
 |                    b_SelectedPort= CR_RANGE(insn->chanspec);               |
-|                    b_ReadType	  = (BYTE) data[0];                          |
+|                    b_ReadType	  = (unsigned char) data[0];                          |
 +----------------------------------------------------------------------------+
 | Output Parameters : data[0]    0 : Channle is not active                   |
 |                                1 : Channle is active                       |
@@ -283,17 +283,17 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_Command = 0;
-	BYTE b_NumberOfPort =
-		(BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
-	BYTE b_SelectedPort = CR_RANGE(insn->chanspec);
-	BYTE b_InputChannel = CR_CHAN(insn->chanspec);
-	BYTE *pb_Status;
-	DWORD dw_Status;
+	int i_ReturnValue = insn->n;
+	unsigned char b_Command = 0;
+	unsigned char b_NumberOfPort =
+		(unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
+	unsigned char b_SelectedPort = CR_RANGE(insn->chanspec);
+	unsigned char b_InputChannel = CR_CHAN(insn->chanspec);
+	unsigned char *pb_Status;
+	unsigned int dw_Status;
 
 	/************************/
 	/* Test the buffer size */
@@ -304,7 +304,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
 		/* Get the command */
 		/* **************** */
 
-		b_Command = (BYTE) data[0];
+		b_Command = (unsigned char) data[0];
 
 	   /********************/
 		/* Test the command */
@@ -380,7 +380,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
 	/**************************/
 
 	if (i_ReturnValue >= 0) {
-		pb_Status = (PBYTE) & data[0];
+		pb_Status = (unsigned char *) &data[0];
 
 	   /*******************************/
 		/* Get the digital inpu status */
@@ -394,7 +394,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
 		/* Save the port value */
 	   /***********************/
 
-		*pb_Status = (BYTE) dw_Status;
+		*pb_Status = (unsigned char) dw_Status;
 
 	   /***************************************/
 		/* Test if read channel status command */
@@ -405,12 +405,12 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
 		}
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT i_APCI16XX_InsnReadTTLIOAllPortValue               |
+| Function Name     : int i_APCI16XX_InsnReadTTLIOAllPortValue               |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -430,13 +430,13 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	BYTE b_Command = (BYTE) CR_AREF(insn->chanspec);
-	INT i_ReturnValue = insn->n;
-	BYTE b_Cpt = 0;
-	BYTE b_NumberOfPort = 0;
+	unsigned char b_Command = (unsigned char) CR_AREF(insn->chanspec);
+	int i_ReturnValue = insn->n;
+	unsigned char b_Cpt = 0;
+	unsigned char b_NumberOfPort = 0;
 	unsigned int *pls_ReadData = data;
 
 	/********************/
@@ -450,7 +450,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 	   /**********************************/
 
 		b_NumberOfPort =
-			(BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 32);
+			(unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 32);
 		if ((b_NumberOfPort * 32) <
 			devpriv->ps_BoardInfo->i_NbrTTLChannel) {
 			b_NumberOfPort = b_NumberOfPort + 1;
@@ -524,7 +524,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 		i_ReturnValue = -100;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -535,7 +535,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT     i_APCI16XX_InsnBitsWriteTTLIO                  |
+| Function Name     : int     i_APCI16XX_InsnBitsWriteTTLIO                  |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -551,11 +551,11 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 |              APCI16XX_TTL_WRITECHANNEL_ON | APCI16XX_TTL_WRITECHANNEL_OFF  |
 |                    b_SelectedPort = CR_RANGE(insn->chanspec);              |
 |                    b_OutputChannel= CR_CHAN(insn->chanspec);               |
-|                    b_Command      = (BYTE) data[0];                        |
+|                    b_Command      = (unsigned char) data[0];                        |
 |                                                                            |
 |              APCI16XX_TTL_WRITEPORT_ON | APCI16XX_TTL_WRITEPORT_OFF        |
 |                    b_SelectedPort = CR_RANGE(insn->chanspec);              |
-|                    b_Command      = (BYTE) data[0];                        |
+|                    b_Command      = (unsigned char) data[0];                        |
 +----------------------------------------------------------------------------+
 | Output Parameters : data[0] : TTL output port 0 to 3 data                  |
 |                     data[1] : TTL output port 4 to 7 data                  |
@@ -570,16 +570,16 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_Command = 0;
-	BYTE b_NumberOfPort =
-		(BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
-	BYTE b_SelectedPort = CR_RANGE(insn->chanspec);
-	BYTE b_OutputChannel = CR_CHAN(insn->chanspec);
-	DWORD dw_Status = 0;
+	int i_ReturnValue = insn->n;
+	unsigned char b_Command = 0;
+	unsigned char b_NumberOfPort =
+		(unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8);
+	unsigned char b_SelectedPort = CR_RANGE(insn->chanspec);
+	unsigned char b_OutputChannel = CR_CHAN(insn->chanspec);
+	unsigned int dw_Status = 0;
 
 	/************************/
 	/* Test the buffer size */
@@ -590,7 +590,7 @@ int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev,
 		/* Get the command */
 		/* **************** */
 
-		b_Command = (BYTE) data[0];
+		b_Command = (unsigned char) data[0];
 
 	   /********************/
 		/* Test the command */
@@ -758,7 +758,7 @@ int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev,
 			devpriv->iobase + 20 + ((b_SelectedPort / 4) * 4));
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -774,7 +774,7 @@ int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI16XX_Reset(struct comedi_device * dev)
+int i_APCI16XX_Reset(struct comedi_device *dev)
 {
 	return 0;
 }

+ 68 - 68
drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c

@@ -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.
 
@@ -62,7 +62,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 | Task              : Configures The Digital Output Subdevice.               |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 |			  data[0]            : 1 Digital Memory On               |
@@ -75,20 +75,20 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI2016_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2016_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	if ((data[0] != 0) && (data[0] != 1)) {
 		comedi_error(dev,
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 		return -EINVAL;
-	}			// if  ((data[0]!=0) && (data[0]!=1))
+	}			/*  if  ((data[0]!=0) && (data[0]!=1)) */
 	if (data[0]) {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
-	}			// if  (data[0]
+	}			/*  if  (data[0] */
 	else {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
-	}			// else if  (data[0]
+	}			/*  else if  (data[0] */
 	return insn->n;
 }
 
@@ -101,8 +101,8 @@ int i_APCI2016_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 | Task              : Writes port value  To the selected port                |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To Write      |
-|                     UINT *data              : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To Write      |
+|                     unsigned int *data              : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -111,34 +111,34 @@ int i_APCI2016_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2016_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_NoOfChannel;
-	UINT ui_Temp, ui_Temp1;
+	unsigned int ui_NoOfChannel;
+	unsigned int ui_Temp, ui_Temp1;
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	if ((ui_NoOfChannel < 0) || (ui_NoOfChannel > 15)) {
 		comedi_error(dev,
 			"Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n");
 		return -EINVAL;
-	}			// if  ((ui_NoOfChannel<0) || (ui_NoOfChannel>15))
+	}			/*  if  ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) */
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp = inw(devpriv->iobase + APCI2016_DIGITAL_OP);
-	}			// if  (devpriv->b_OutputMemoryStatus )
+	}			/*  if  (devpriv->b_OutputMemoryStatus ) */
 	else {
 		ui_Temp = 0;
-	}			// else if  (devpriv->b_OutputMemoryStatus )
+	}			/*  else if  (devpriv->b_OutputMemoryStatus ) */
 	if ((data[1] != 0) && (data[1] != 1)) {
 		comedi_error(dev,
 			"Invalid Data[1] value !!!, Data[1] should be 0 or 1\n");
 		return -EINVAL;
-	}			// if  ((data[1]!=0) && (data[1]!=1))
+	}			/*  if  ((data[1]!=0) && (data[1]!=1)) */
 
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outw(data[0], devpriv->iobase + APCI2016_DIGITAL_OP);
-		}		// if (data[1]==0)
+		}		/*  if (data[1]==0) */
 		else {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
@@ -162,16 +162,16 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					break;
 				default:
 					comedi_error(dev, " chan spec wrong");
-					return -EINVAL;	// "sorry channel spec wrong "
-				}	//switch(ui_NoOfChannels)
+					return -EINVAL;	/*  "sorry channel spec wrong " */
+				}	/* switch(ui_NoOfChannels) */
 				outw(data[0],
 					devpriv->iobase + APCI2016_DIGITAL_OP);
-			}	// if  (data[1]==1)
+			}	/*  if  (data[1]==1) */
 			else {
 				printk("\nSpecified channel not supported\n");
-			}	// else if  (data[1]==1)
-		}		// else if (data[1]==0)
-	}			// if (data[3]==0)
+			}	/*  else if  (data[1]==1) */
+		}		/*  else if (data[1]==0) */
+	}			/*  if (data[3]==0) */
 	else {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
@@ -183,7 +183,7 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 				data[0] = data[0] & ui_Temp;
 				outw(data[0],
 					devpriv->iobase + APCI2016_DIGITAL_OP);
-			}	// if  (data[1]==0)
+			}	/*  if  (data[1]==0) */
 			else {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
@@ -228,22 +228,22 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 						comedi_error(dev,
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
-					}	//switch(ui_NoOfChannels)
+						return -EINVAL;	/*  "sorry channel spec wrong " */
+					}	/* switch(ui_NoOfChannels) */
 					outw(data[0],
 						devpriv->iobase +
 						APCI2016_DIGITAL_OP);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 					printk("\nSpecified channel not supported\n");
-				}	//else if(data[1]==1)
-			}	//elseif(data[1]==0)
-		}		//if(data[3]==1);
+				}	/* else if(data[1]==1) */
+			}	/* elseif(data[1]==0) */
+		}		/* if(data[3]==1); */
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
-		}		//if else data[3]==1)
-	}			//if else data[3]==0)
+		}		/* if else data[3]==1) */
+	}			/* if else data[3]==0) */
 	return insn->n;
 }
 
@@ -256,8 +256,8 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To read       |
-|                     UINT *data              : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To read       |
+|                     unsigned int *data              : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -266,27 +266,27 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI2016_BitsDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Temp;
-	UINT ui_NoOfChannel;
+	unsigned int ui_Temp;
+	unsigned int ui_NoOfChannel;
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	if ((ui_NoOfChannel < 0) || (ui_NoOfChannel > 15)) {
 		comedi_error(dev,
 			"Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n");
 		return -EINVAL;
-	}			// if  ((ui_NoOfChannel<0) || (ui_NoOfChannel>15))
+	}			/*  if  ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) */
 	if ((data[0] != 0) && (data[0] != 1)) {
 		comedi_error(dev,
 			"Invalid Data[0] value !!!, Data[0] should be 0 or 1\n");
 		return -EINVAL;
-	}			// if  ((data[0]!=0) && (data[0]!=1))
+	}			/*  if  ((data[0]!=0) && (data[0]!=1)) */
 	ui_Temp = data[0];
 	*data = inw(devpriv->iobase + APCI2016_DIGITAL_OP_RW);
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			// if  (ui_Temp==0)
+	}			/*  if  (ui_Temp==0) */
 	else {
 		if (ui_Temp == 1) {
 			switch (ui_NoOfChannel) {
@@ -307,13 +307,13 @@ int i_APCI2016_BitsDigitalOutput(struct comedi_device * dev, struct comedi_subde
 
 			default:
 				comedi_error(dev, " chan spec wrong");
-				return -EINVAL;	// "sorry channel spec wrong "
-			}	//switch(ui_NoOfChannel)
-		}		// if  (ui_Temp==1)
+				return -EINVAL;	/*  "sorry channel spec wrong " */
+			}	/* switch(ui_NoOfChannel) */
+		}		/*  if  (ui_Temp==1) */
 		else {
 			printk("\nSpecified channel not supported \n");
-		}		// else if  (ui_Temp==1)
-	}			// if  (ui_Temp==0)
+		}		/*  else if  (ui_Temp==1) */
+	}			/*  if  (ui_Temp==0) */
 	return insn->n;
 }
 
@@ -337,16 +337,16 @@ int i_APCI2016_BitsDigitalOutput(struct comedi_device * dev, struct comedi_subde
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI2016_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2016_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 
 	if (data[0] == 0) {
-		//Disable the watchdog
+		/* Disable the watchdog */
 		outw(0x0,
 			devpriv->i_IobaseAddon +
 			APCI2016_WATCHDOG_ENABLEDISABLE);
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outw(data[1],
 			devpriv->i_IobaseAddon +
 			APCI2016_WATCHDOG_RELOAD_VALUE);
@@ -380,20 +380,20 @@ int i_APCI2016_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI2016_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2016_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 
 	switch (data[0]) {
-	case 0:		//stop the watchdog
-		outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE);	//disable the watchdog
+	case 0:		/* stop the watchdog */
+		outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE);	/* disable the watchdog */
 		break;
-	case 1:		//start the watchdog
+	case 1:		/* start the watchdog */
 		outw(0x0001,
 			devpriv->i_IobaseAddon +
 			APCI2016_WATCHDOG_ENABLEDISABLE);
 		break;
-	case 2:		//Software trigger
+	case 2:		/* Software trigger */
 		outw(0x0201,
 			devpriv->i_IobaseAddon +
 			APCI2016_WATCHDOG_ENABLEDISABLE);
@@ -401,7 +401,7 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 	default:
 		printk("\nSpecified functionality does not exist\n");
 		return -EINVAL;
-	}			// switch(data[0])
+	}			/*  switch(data[0]) */
 
 	return insn->n;
 }
@@ -427,8 +427,8 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI2016_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2016_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	udelay(5);
 	data[0] = inw(devpriv->i_IobaseAddon + APCI2016_WATCHDOG_STATUS) & 0x1;
@@ -450,9 +450,9 @@ int i_APCI2016_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI2016_Reset(struct comedi_device * dev)
+int i_APCI2016_Reset(struct comedi_device *dev)
 {
-	outw(0x0, devpriv->iobase + APCI2016_DIGITAL_OP);	// Resets the digital output channels
+	outw(0x0, devpriv->iobase + APCI2016_DIGITAL_OP);	/*  Resets the digital output channels */
 	outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE);
 	outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE);
 	outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE + 2);

+ 14 - 12
drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.h

@@ -19,17 +19,17 @@
 #define APCI2016_BOARD_VENDOR_ID 0x15B8
 #define APCI2016_ADDRESS_RANGE   8
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 #define APCI2016_DIGITAL_OP                 	0x04
 #define APCI2016_DIGITAL_OP_RW                 	4
 
-//ADDIDATA Enable Disable
+/* ADDIDATA Enable Disable */
 
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_DISABLE                           0
 
-// TIMER COUNTER WATCHDOG DEFINES
+/* TIMER COUNTER WATCHDOG DEFINES */
 
 #define ADDIDATA_WATCHDOG                          2
 #define APCI2016_DIGITAL_OP_WATCHDOG               0
@@ -37,9 +37,9 @@
 #define APCI2016_WATCHDOG_RELOAD_VALUE             4
 #define APCI2016_WATCHDOG_STATUS                   16
 
-// Hardware Layer  functions for Apci2016
+/* Hardware Layer  functions for Apci2016 */
 
-//DO
+/* DO */
 int i_APCI2016_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 
@@ -49,8 +49,10 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde
 int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 
-// TIMER
-// timer value is passed as u seconds
+/*
+* TIMER
+* timer value is passed as u seconds
+*/
 
 int i_APCI2016_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			      struct comedi_insn *insn, unsigned int *data);
@@ -61,10 +63,10 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s
 int i_APCI2016_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			    struct comedi_insn *insn, unsigned int *data);
 
-// Interrupt functions.....
+/* Interrupt functions..... */
 
-// void v_APCI2016_Interrupt(int irq, void *d) ;
+/* void v_APCI2016_Interrupt(int irq, void *d); */
 
- //void v_APCI2016_Interrupt(int irq, void *d);
-// RESET
-INT i_APCI2016_Reset(struct comedi_device *dev);
+/* void v_APCI2016_Interrupt(int irq, void *d); */
+/* RESET */
+int i_APCI2016_Reset(struct comedi_device *dev);

+ 88 - 88
drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c

@@ -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.
 
@@ -53,7 +53,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 */
 
 #include "hwdrv_apci2032.h"
-UINT ui_InterruptData, ui_Type;
+unsigned int ui_InterruptData, ui_Type;
 /*
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2032_ConfigDigitalOutput                     |
@@ -63,7 +63,7 @@ UINT ui_InterruptData, ui_Type;
 | Task              : Configures The Digital Output Subdevice.               |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 |					  data[1]            : 1 Enable  VCC  Interrupt  |
@@ -79,36 +79,36 @@ UINT ui_InterruptData, ui_Type;
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI2032_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2032_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	ULONG ul_Command = 0;
+	unsigned int ul_Command = 0;
 	devpriv->tsk_Current = current;
 
 	if ((data[0] != 0) && (data[0] != 1)) {
 		comedi_error(dev,
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 		return -EINVAL;
-	}			//if  ( (data[0]!=0) && (data[0]!=1) )
+	}			/* if  ( (data[0]!=0) && (data[0]!=1) ) */
 	if (data[0]) {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
-	}			// if  (data[0])
+	}			/*  if  (data[0]) */
 	else {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
-	}			//else if  (data[0])
+	}			/* else if  (data[0]) */
 
 	if (data[1] == ADDIDATA_ENABLE) {
 		ul_Command = ul_Command | 0x1;
-	}			//if  (data[1] == ADDIDATA_ENABLE)
+	}			/* if  (data[1] == ADDIDATA_ENABLE) */
 	else {
 		ul_Command = ul_Command & 0xFFFFFFFE;
-	}			//elseif  (data[1] == ADDIDATA_ENABLE)
+	}			/* elseif  (data[1] == ADDIDATA_ENABLE) */
 	if (data[2] == ADDIDATA_ENABLE) {
 		ul_Command = ul_Command | 0x2;
-	}			//if  (data[2] == ADDIDATA_ENABLE)
+	}			/* if  (data[2] == ADDIDATA_ENABLE) */
 	else {
 		ul_Command = ul_Command & 0xFFFFFFFD;
-	}			//elseif  (data[2] == ADDIDATA_ENABLE)
+	}			/* elseif  (data[2] == ADDIDATA_ENABLE) */
 	outl(ul_Command, devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT);
 	ui_InterruptData = inl(devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT);
 	return insn->n;
@@ -123,8 +123,8 @@ int i_APCI2032_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 | Task              : Writes port value  To the selected port                |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To Write      |
-|                     UINT *data              : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To Write      |
+|                     unsigned int *data              : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -134,23 +134,23 @@ int i_APCI2032_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2032_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Temp, ui_Temp1;
-	UINT ui_NoOfChannel = CR_CHAN(insn->chanspec);	// get the channel
+	unsigned int ui_Temp, ui_Temp1;
+	unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec);	/*  get the channel */
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp = inl(devpriv->iobase + APCI2032_DIGITAL_OP);
 
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	else {
 		ui_Temp = 0;
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outl(data[0], devpriv->iobase + APCI2032_DIGITAL_OP);
-		}		//if(data[1]==0)
+		}		/* if(data[1]==0) */
 		else {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
@@ -184,18 +184,18 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 
 				default:
 					comedi_error(dev, " chan spec wrong");
-					return -EINVAL;	// "sorry channel spec wrong "
+					return -EINVAL;	/*  "sorry channel spec wrong " */
 
-				}	//switch(ui_NoOfChannels)
+				}	/* switch(ui_NoOfChannels) */
 
 				outl(data[0],
 					devpriv->iobase + APCI2032_DIGITAL_OP);
-			}	// if(data[1]==1)
+			}	/*  if(data[1]==1) */
 			else {
 				printk("\nSpecified channel not supported\n");
-			}	//else if(data[1]==1)
-		}		//elseif(data[1]==0)
-	}			//if(data[3]==0)
+			}	/* else if(data[1]==1) */
+		}		/* elseif(data[1]==0) */
+	}			/* if(data[3]==0) */
 	else {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
@@ -209,7 +209,7 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 				data[0] = data[0] & ui_Temp;
 				outl(data[0],
 					devpriv->iobase + APCI2032_DIGITAL_OP);
-			}	//if(data[1]==0)
+			}	/* if(data[1]==0) */
 			else {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
@@ -272,25 +272,25 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 						comedi_error(dev,
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
+						return -EINVAL;	/*  "sorry channel spec wrong " */
 
-					}	//switch(ui_NoOfChannels)
+					}	/* switch(ui_NoOfChannels) */
 
 					outl(data[0],
 						devpriv->iobase +
 						APCI2032_DIGITAL_OP);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 					printk("\nSpecified channel not supported\n");
-				}	//else if(data[1]==1)
-			}	//elseif(data[1]==0)
-		}		//if(data[3]==1);
+				}	/* else if(data[1]==1) */
+			}	/* elseif(data[1]==0) */
+		}		/* if(data[3]==1); */
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
-		}		//if else data[3]==1)
-	}			//if else data[3]==0)
-	return (insn->n);;
+		}		/* if else data[3]==1) */
+	}			/* if else data[3]==0) */
+	return insn->n;
 }
 
 /*
@@ -302,8 +302,8 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To read       |
-|                     UINT *data              : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To read       |
+|                     unsigned int *data              : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -313,17 +313,17 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI2032_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2032_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Temp;
-	UINT ui_NoOfChannel;
+	unsigned int ui_Temp;
+	unsigned int ui_NoOfChannel;
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	ui_Temp = data[0];
 	*data = inl(devpriv->iobase + APCI2032_DIGITAL_OP_RW);
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			//if  (ui_Temp==0)
+	}			/* if  (ui_Temp==0) */
 	else {
 		if (ui_Temp == 1) {
 			switch (ui_NoOfChannel) {
@@ -349,28 +349,28 @@ INT i_APCI2032_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 
 			default:
 				comedi_error(dev, " chan spec wrong");
-				return -EINVAL;	// "sorry channel spec wrong "
+				return -EINVAL;	/*  "sorry channel spec wrong " */
 
-			}	//switch(ui_NoOfChannels)
-		}		//if  (ui_Temp==1)
+			}	/* switch(ui_NoOfChannels) */
+		}		/* if  (ui_Temp==1) */
 		else {
 			printk("\nSpecified channel not supported \n");
-		}		//elseif  (ui_Temp==1)
+		}		/* elseif  (ui_Temp==1) */
 	}
 	return insn->n;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function   Name   : INT i_APCI2032_ConfigWatchdog(comedi_device
-                   *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)|
+| Function   Name   : int i_APCI2032_ConfigWatchdog(comedi_device
+|                   *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)|
 |				                                                     |
 +----------------------------------------------------------------------------+
 | Task              : Configures The Watchdog                                |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                      struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data          : Data Pointer to read status                                                                                                             |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -380,15 +380,15 @@ INT i_APCI2032_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI2032_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	if (data[0] == 0) {
-		//Disable the watchdog
+		/* Disable the watchdog */
 		outl(0x0,
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			APCI2032_TCW_PROG);
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outl(data[1],
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			APCI2032_TCW_RELOAD_VALUE);
@@ -421,19 +421,19 @@ INT i_APCI2032_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic
     +----------------------------------------------------------------------------+
   */
 
-int i_APCI2032_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	switch (data[0]) {
-	case 0:		//stop the watchdog
-		outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG);	//disable the watchdog
+	case 0:		/* stop the watchdog */
+		outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG);	/* disable the watchdog */
 		break;
-	case 1:		//start the watchdog
+	case 1:		/* start the watchdog */
 		outl(0x0001,
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			APCI2032_TCW_PROG);
 		break;
-	case 2:		//Software trigger
+	case 2:		/* Software trigger */
 		outl(0x0201,
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			APCI2032_TCW_PROG);
@@ -449,13 +449,13 @@ int i_APCI2032_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2032_ReadWatchdog                            |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                    unsigned int *data); 	                                     |
+|                    unsigned int *data); 	                                     |
 +----------------------------------------------------------------------------+
 | Task              : Read The Watchdog                                      |
 +----------------------------------------------------------------------------+
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                      struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -466,8 +466,8 @@ int i_APCI2032_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI2032_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 
 	data[0] =
@@ -498,13 +498,13 @@ void v_APCI2032_Interrupt(int irq, void *d)
 	struct comedi_device *dev = d;
 	unsigned int ui_DO;
 
-	ui_DO = inl(devpriv->iobase + APCI2032_DIGITAL_OP_IRQ) & 0x1;	//Check if VCC OR CC interrupt has occured.
+	ui_DO = inl(devpriv->iobase + APCI2032_DIGITAL_OP_IRQ) & 0x1;	/* Check if VCC OR CC interrupt has occured. */
 
 	if (ui_DO == 0) {
 		printk("\nInterrupt from unKnown source\n");
-	}			// if(ui_DO==0)
+	}			/*  if(ui_DO==0) */
 	if (ui_DO) {
-		// Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt.
+		/*  Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. */
 		ui_Type =
 			inl(devpriv->iobase +
 			APCI2032_DIGITAL_OP_INTERRUPT_STATUS) & 0x3;
@@ -512,16 +512,16 @@ void v_APCI2032_Interrupt(int irq, void *d)
 			devpriv->iobase + APCI2032_DIGITAL_OP +
 			APCI2032_DIGITAL_OP_INTERRUPT);
 		if (ui_Type == 1) {
-			//Sends signal to user space
+			/* Sends signal to user space */
 			send_sig(SIGIO, devpriv->tsk_Current, 0);
-		}		// if (ui_Type==1)
+		}		/*  if (ui_Type==1) */
 		else {
 			if (ui_Type == 2) {
-				// Sends signal to user space
+				/*  Sends signal to user space */
 				send_sig(SIGIO, devpriv->tsk_Current, 0);
-			}	//if (ui_Type==2)
-		}		//else if (ui_Type==1)
-	}			//if(ui_DO)
+			}	/* if (ui_Type==2) */
+		}		/* else if (ui_Type==1) */
+	}			/* if(ui_DO) */
 
 	return;
 
@@ -544,8 +544,8 @@ void v_APCI2032_Interrupt(int irq, void *d)
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI2032_ReadInterruptStatus(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2032_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	*data = ui_Type;
 	return insn->n;
@@ -567,13 +567,13 @@ int i_APCI2032_ReadInterruptStatus(struct comedi_device * dev, struct comedi_sub
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI2032_Reset(struct comedi_device * dev)
+int i_APCI2032_Reset(struct comedi_device *dev)
 {
 	devpriv->b_DigitalOutputRegister = 0;
 	ui_Type = 0;
-	outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP);	//Resets the output channels
-	outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT);	//Disables the interrupt.
-	outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG);	//disable the watchdog
-	outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_RELOAD_VALUE);	//reload=0
+	outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP);	/* Resets the output channels */
+	outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT);	/* Disables the interrupt. */
+	outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG);	/* disable the watchdog */
+	outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_RELOAD_VALUE);	/* reload=0 */
 	return 0;
 }

+ 17 - 15
drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.h

@@ -17,32 +17,32 @@
 
 /*********      Definitions for APCI-2032 card  *****/
 
-// Card Specific information
+/* Card Specific information */
 #define APCI2032_BOARD_VENDOR_ID                 0x15B8
 #define APCI2032_ADDRESS_RANGE                   63
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 #define APCI2032_DIGITAL_OP                 	0
 #define APCI2032_DIGITAL_OP_RW                 	0
 #define APCI2032_DIGITAL_OP_INTERRUPT           4
 #define APCI2032_DIGITAL_OP_IRQ                 12
 
-//Digital Output Interrupt Status
+/* Digital Output Interrupt Status */
 #define APCI2032_DIGITAL_OP_INTERRUPT_STATUS    8
 
-//Digital Output Interrupt Enable Disable.
+/* Digital Output Interrupt Enable Disable. */
 #define APCI2032_DIGITAL_OP_VCC_INTERRUPT_ENABLE   0x1
 #define APCI2032_DIGITAL_OP_VCC_INTERRUPT_DISABLE  0xFFFFFFFE
 #define APCI2032_DIGITAL_OP_CC_INTERRUPT_ENABLE    0x2
 #define APCI2032_DIGITAL_OP_CC_INTERRUPT_DISABLE   0xFFFFFFFD
 
-//ADDIDATA Enable Disable
+/* ADDIDATA Enable Disable */
 
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_DISABLE                           0
 
-// TIMER COUNTER WATCHDOG DEFINES
+/* TIMER COUNTER WATCHDOG DEFINES */
 
 #define ADDIDATA_WATCHDOG                          2
 #define APCI2032_DIGITAL_OP_WATCHDOG               16
@@ -52,30 +52,32 @@
 #define APCI2032_TCW_TRIG_STATUS                   16
 #define APCI2032_TCW_IRQ                           20
 
-// Hardware Layer  functions for Apci2032
+/* Hardware Layer  functions for Apci2032 */
 
-//DO
+/* DO */
 int i_APCI2032_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
-INT i_APCI2032_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI2032_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				  struct comedi_insn *insn, unsigned int *data);
-INT i_APCI2032_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI2032_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 int i_APCI2032_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 
-// TIMER
-// timer value is passed as u seconds
-INT i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+/* TIMER
+ * timer value is passed as u seconds
+*/
+
+int i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			      struct comedi_insn *insn, unsigned int *data);
 int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 				      struct comedi_insn *insn, unsigned int *data);
 int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			    struct comedi_insn *insn, unsigned int *data);
 
-// Interrupt functions.....
+/* Interrupt functions..... */
 
 void v_APCI2032_Interrupt(int irq, void *d);
 
-//Reset functions
+/* Reset functions */
 int i_APCI2032_Reset(struct comedi_device *dev);

+ 87 - 87
drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c

@@ -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.
 
@@ -63,7 +63,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |		       struct comedi_subdevice *s,   :pointer to subdevice structure
-                       struct comedi_insn *insn      :pointer to insn structure     |
+|                       struct comedi_insn *insn      :pointer to insn structure     |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -73,20 +73,20 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI2200_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_TmpValue = 0;
-	UINT ui_Channel;
+	unsigned int ui_TmpValue = 0;
+	unsigned int ui_Channel;
 	ui_Channel = CR_CHAN(insn->chanspec);
 	if (ui_Channel >= 0 && ui_Channel <= 7) {
-		ui_TmpValue = (UINT) inw(devpriv->iobase + APCI2200_DIGITAL_IP);
+		ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI2200_DIGITAL_IP);
 		*data = (ui_TmpValue >> ui_Channel) & 0x1;
-	}			//if(ui_Channel >= 0 && ui_Channel <=7)
+	}			/* if(ui_Channel >= 0 && ui_Channel <=7) */
 	else {
 		printk("\nThe specified channel does not exist\n");
-		return -EINVAL;	// "sorry channel spec wrong "
-	}			//else if(ui_Channel >= 0 && ui_Channel <=7)
+		return -EINVAL;	/*  "sorry channel spec wrong " */
+	}			/* else if(ui_Channel >= 0 && ui_Channel <=7) */
 
 	return insn->n;
 }
@@ -101,7 +101,7 @@ INT i_APCI2200_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                      struct comedi_subdevice *s,   :pointer to subdevice structure
-                       struct comedi_insn *insn      :pointer to insn structure     |
+|                       struct comedi_insn *insn      :pointer to insn structure     |
 |                      unsigned int *data         : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -112,17 +112,17 @@ INT i_APCI2200_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 
-	UINT ui_PortValue = data[0];
-	UINT ui_Mask = 0;
-	UINT ui_NoOfChannels;
+	unsigned int ui_PortValue = data[0];
+	unsigned int ui_Mask = 0;
+	unsigned int ui_NoOfChannels;
 
 	ui_NoOfChannels = CR_CHAN(insn->chanspec);
 
-	*data = (UINT) inw(devpriv->iobase + APCI2200_DIGITAL_IP);
+	*data = (unsigned int) inw(devpriv->iobase + APCI2200_DIGITAL_IP);
 	switch (ui_NoOfChannels) {
 	case 2:
 		ui_Mask = 3;
@@ -137,9 +137,9 @@ INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 
 	default:
 		printk("\nWrong parameters\n");
-		return -EINVAL;	// "sorry channel spec wrong "
+		return -EINVAL;	/*  "sorry channel spec wrong " */
 		break;
-	}			//switch(ui_NoOfChannels)
+	}			/* switch(ui_NoOfChannels) */
 
 	return insn->n;
 }
@@ -147,7 +147,7 @@ INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 /*
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2200_ConfigDigitalOutput (struct comedi_device *dev,
-                    struct comedi_subdevice *s struct comedi_insn *insn,unsigned int *data)    |
+|                    struct comedi_subdevice *s struct comedi_insn *insn,unsigned int *data)    |
 |				                                                     |
 +----------------------------------------------------------------------------+
 | Task              : Configures The Digital Output Subdevice.               |
@@ -156,7 +156,7 @@ INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 |                     unsigned int *data         : Data Pointer contains         |
 |                                          configuration parameters as below |
 |                      struct comedi_subdevice *s,   :pointer to subdevice structure
-                       struct comedi_insn *insn      :pointer to insn structure                                                           |
+|                       struct comedi_insn *insn      :pointer to insn structure                                                           |
 |					  data[0]  :1:Memory on                          |
 |					            0:Memory off                         |
 |										                             |
@@ -169,8 +169,8 @@ INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI2200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	devpriv->b_OutputMemoryStatus = data[0];
 	return insn->n;
@@ -180,13 +180,13 @@ int i_APCI2200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2200_WriteDigitalOutput                      |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                     unsigned int *data)                                         |
+|                     unsigned int *data)                                         |
 +----------------------------------------------------------------------------+
 | Task              : Writes port value  To the selected port                |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                      struct comedi_insn *insn      :pointer to insn structure      |
 |                    unsigned int *data           : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -197,23 +197,23 @@ int i_APCI2200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Temp, ui_Temp1;
-	UINT ui_NoOfChannel = CR_CHAN(insn->chanspec);	// get the channel
+	unsigned int ui_Temp, ui_Temp1;
+	unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec);	/*  get the channel */
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp = inw(devpriv->iobase + APCI2200_DIGITAL_OP);
 
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	else {
 		ui_Temp = 0;
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outw(data[0], devpriv->iobase + APCI2200_DIGITAL_OP);
-		}		//if(data[1]==0)
+		}		/* if(data[1]==0) */
 		else {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
@@ -240,18 +240,18 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					break;
 				default:
 					comedi_error(dev, " chan spec wrong");
-					return -EINVAL;	// "sorry channel spec wrong "
+					return -EINVAL;	/*  "sorry channel spec wrong " */
 
-				}	//switch(ui_NoOfChannels)
+				}	/* switch(ui_NoOfChannels) */
 
 				outw(data[0],
 					devpriv->iobase + APCI2200_DIGITAL_OP);
-			}	// if(data[1]==1)
+			}	/*  if(data[1]==1) */
 			else {
 				printk("\nSpecified channel not supported\n");
-			}	//else if(data[1]==1)
-		}		//elseif(data[1]==0)
-	}			//if(data[3]==0)
+			}	/* else if(data[1]==1) */
+		}		/* elseif(data[1]==0) */
+	}			/* if(data[3]==0) */
 	else {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
@@ -263,7 +263,7 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 				data[0] = data[0] & ui_Temp;
 				outw(data[0],
 					devpriv->iobase + APCI2200_DIGITAL_OP);
-			}	//if(data[1]==0)
+			}	/* if(data[1]==0) */
 			else {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
@@ -312,38 +312,38 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 						comedi_error(dev,
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
+						return -EINVAL;	/*  "sorry channel spec wrong " */
 
-					}	//switch(ui_NoOfChannels)
+					}	/* switch(ui_NoOfChannels) */
 
 					outw(data[0],
 						devpriv->iobase +
 						APCI2200_DIGITAL_OP);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 					printk("\nSpecified channel not supported\n");
-				}	//else if(data[1]==1)
-			}	//elseif(data[1]==0)
-		}		//if(data[3]==1);
+				}	/* else if(data[1]==1) */
+			}	/* elseif(data[1]==0) */
+		}		/* if(data[3]==1); */
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
-		}		//if else data[3]==1)
-	}			//if else data[3]==0)
-	return (insn->n);;
+		}		/* if else data[3]==1) */
+	}			/* if else data[3]==0) */
+	return insn->n;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2200_ReadDigitalOutput                       |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                    unsigned int *data) 	                                     |
+|                    unsigned int *data) 	                                     |
 +----------------------------------------------------------------------------+
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                     struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -354,17 +354,17 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI2200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 
-	UINT ui_Temp;
-	UINT ui_NoOfChannel = CR_CHAN(insn->chanspec);	// get the channel
+	unsigned int ui_Temp;
+	unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec);	/*  get the channel */
 	ui_Temp = data[0];
 	*data = inw(devpriv->iobase + APCI2200_DIGITAL_OP);
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			//if(ui_Temp==0)
+	}			/* if(ui_Temp==0) */
 	else {
 		if (ui_Temp == 1) {
 			switch (ui_NoOfChannel) {
@@ -386,28 +386,28 @@ INT i_APCI2200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 
 			default:
 				comedi_error(dev, " chan spec wrong");
-				return -EINVAL;	// "sorry channel spec wrong "
+				return -EINVAL;	/*  "sorry channel spec wrong " */
 
-			}	//switch(ui_NoOfChannels)
-		}		//if(ui_Temp==1)
+			}	/* switch(ui_NoOfChannels) */
+		}		/* if(ui_Temp==1) */
 		else {
 			printk("\nSpecified channel not supported \n");
-		}		//elseif(ui_Temp==1)
-	}			//elseif(ui_Temp==0)
+		}		/* elseif(ui_Temp==1) */
+	}			/* elseif(ui_Temp==0) */
 	return insn->n;
 }
 
 /*
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2200_ConfigWatchdog(struct comedi_device *dev,
-                      struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)  |
+|                      struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)  |
 |				                                                     |
 +----------------------------------------------------------------------------+
 | Task              : Configures The Watchdog                                |
 +----------------------------------------------------------------------------+
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                      struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data          : Data Pointer to read status                                                                                                             |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -418,15 +418,15 @@ INT i_APCI2200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI2200_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	if (data[0] == 0) {
-		//Disable the watchdog
+		/* Disable the watchdog */
 		outw(0x0,
 			devpriv->iobase + APCI2200_WATCHDOG +
 			APCI2200_WATCHDOG_ENABLEDISABLE);
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outw(data[1],
 			devpriv->iobase + APCI2200_WATCHDOG +
 			APCI2200_WATCHDOG_RELOAD_VALUE);
@@ -434,11 +434,11 @@ int i_APCI2200_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic
 		outw(data[1],
 			devpriv->iobase + APCI2200_WATCHDOG +
 			APCI2200_WATCHDOG_RELOAD_VALUE + 2);
-	}			//if(data[0]==0)
+	}			/* if(data[0]==0) */
 	else {
 		printk("\nThe input parameters are wrong\n");
 		return -EINVAL;
-	}			//elseif(data[0]==0)
+	}			/* elseif(data[0]==0) */
 
 	return insn->n;
 }
@@ -464,19 +464,19 @@ int i_APCI2200_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic
     +----------------------------------------------------------------------------+
   */
 
-int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	switch (data[0]) {
-	case 0:		//stop the watchdog
-		outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE);	//disable the watchdog
+	case 0:		/* stop the watchdog */
+		outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE);	/* disable the watchdog */
 		break;
-	case 1:		//start the watchdog
+	case 1:		/* start the watchdog */
 		outw(0x0001,
 			devpriv->iobase + APCI2200_WATCHDOG +
 			APCI2200_WATCHDOG_ENABLEDISABLE);
 		break;
-	case 2:		//Software trigger
+	case 2:		/* Software trigger */
 		outw(0x0201,
 			devpriv->iobase + APCI2200_WATCHDOG +
 			APCI2200_WATCHDOG_ENABLEDISABLE);
@@ -484,7 +484,7 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 	default:
 		printk("\nSpecified functionality does not exist\n");
 		return -EINVAL;
-	}			// switch(data[0])
+	}			/*  switch(data[0]) */
 	return insn->n;
 }
 
@@ -492,13 +492,13 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2200_ReadWatchdog                            |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                    unsigned int *data); 	                                     |
+|                    unsigned int *data); 	                                     |
 +----------------------------------------------------------------------------+
 | Task              : Read The Watchdog                                      |
 +----------------------------------------------------------------------------+
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
-                      struct comedi_insn *insn      :pointer to insn structure      |
+|                      struct comedi_insn *insn      :pointer to insn structure      |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
@@ -509,8 +509,8 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI2200_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI2200_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	data[0] =
 		inw(devpriv->iobase + APCI2200_WATCHDOG +
@@ -533,9 +533,9 @@ int i_APCI2200_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI2200_Reset(struct comedi_device * dev)
+int i_APCI2200_Reset(struct comedi_device *dev)
 {
-	outw(0x0, devpriv->iobase + APCI2200_DIGITAL_OP);	//RESETS THE DIGITAL OUTPUTS
+	outw(0x0, devpriv->iobase + APCI2200_DIGITAL_OP);	/* RESETS THE DIGITAL OUTPUTS */
 	outw(0x0,
 		devpriv->iobase + APCI2200_WATCHDOG +
 		APCI2200_WATCHDOG_ENABLEDISABLE);

+ 13 - 13
drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.h

@@ -17,39 +17,39 @@
 
 /*********      Definitions for APCI-2200 card  *****/
 
-// Card Specific information
+/* Card Specific information */
 #define APCI2200_BOARD_VENDOR_ID                 0x15b8
 #define APCI2200_ADDRESS_RANGE                   64
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 #define APCI2200_DIGITAL_OP                 	4
 #define APCI2200_DIGITAL_IP                     0
 
-// TIMER COUNTER WATCHDOG DEFINES
+/* TIMER COUNTER WATCHDOG DEFINES */
 
 #define APCI2200_WATCHDOG                          0x08
 #define APCI2200_WATCHDOG_ENABLEDISABLE            12
 #define APCI2200_WATCHDOG_RELOAD_VALUE             4
 #define APCI2200_WATCHDOG_STATUS                   16
 
-// Hardware Layer  functions for Apci2200
+/* Hardware Layer  functions for Apci2200 */
 
-//Digital Input
-INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+/* Digital Input */
+int i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				    struct comedi_insn *insn, unsigned int *data);
-INT i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 
-//Digital Output
+/* Digital Output */
 int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
-INT i_APCI2200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI2200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				  struct comedi_insn *insn, unsigned int *data);
-INT i_APCI2200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI2200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 
-// TIMER
+/* TIMER */
 int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			      struct comedi_insn *insn, unsigned int *data);
 int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
@@ -57,5 +57,5 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s
 int i_APCI2200_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			    struct comedi_insn *insn, unsigned int *data);
 
-//reset
-INT i_APCI2200_Reset(struct comedi_device *dev);
+/* reset */
+int i_APCI2200_Reset(struct comedi_device *dev);

+ 512 - 543
drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c

@@ -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.
 
@@ -45,9 +45,9 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 */
 
 #include "hwdrv_apci3120.h"
-static UINT ui_Temp = 0;
+static unsigned int ui_Temp = 0;
 
-// FUNCTION DEFINITIONS
+/* FUNCTION DEFINITIONS */
 
 /*
 +----------------------------------------------------------------------------+
@@ -74,20 +74,20 @@ static UINT ui_Temp = 0;
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_InsnConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT i;
+	unsigned int i;
 
 	if ((data[0] != APCI3120_EOC_MODE) && (data[0] != APCI3120_EOS_MODE))
 		return -1;
 
-	// Check for Conversion time to be added ??
+	/*  Check for Conversion time to be added ?? */
 	devpriv->ui_EocEosConversionTime = data[2];
 
 	if (data[0] == APCI3120_EOS_MODE) {
 
-		//Test the number of the channel
+		/* Test the number of the channel */
 		for (i = 0; i < data[3]; i++) {
 
 			if (CR_CHAN(data[4 + i]) >= this_board->i_NbrAiChannel) {
@@ -102,14 +102,14 @@ int i_APCI3120_InsnConfigAnalogInput(struct comedi_device * dev, struct comedi_s
 			devpriv->b_EocEosInterrupt = APCI3120_ENABLE;
 		} else
 			devpriv->b_EocEosInterrupt = APCI3120_DISABLE;
-		// Copy channel list and Range List to devpriv
+		/*  Copy channel list and Range List to devpriv */
 
 		devpriv->ui_AiNbrofChannels = data[3];
 		for (i = 0; i < devpriv->ui_AiNbrofChannels; i++) {
 			devpriv->ui_AiChannelList[i] = data[4 + i];
 		}
 
-	} else			// EOC
+	} else			/*  EOC */
 	{
 		devpriv->b_InterruptMode = APCI3120_EOC_MODE;
 		if (data[1]) {
@@ -145,28 +145,28 @@ int i_APCI3120_InsnConfigAnalogInput(struct comedi_device * dev, struct comedi_s
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	USHORT us_ConvertTiming, us_TmpValue, i;
-	BYTE b_Tmp;
+	unsigned short us_ConvertTiming, us_TmpValue, i;
+	unsigned char b_Tmp;
 
-	// fix convertion time to 10 us
+	/*  fix convertion time to 10 us */
 	if (!devpriv->ui_EocEosConversionTime) {
 		printk("No timer0 Value using 10 us\n");
 		us_ConvertTiming = 10;
 	} else
-		us_ConvertTiming = (USHORT) (devpriv->ui_EocEosConversionTime / 1000);	// nano to useconds
+		us_ConvertTiming = (unsigned short) (devpriv->ui_EocEosConversionTime / 1000);	/*  nano to useconds */
 
-	// this_board->i_hwdrv_InsnReadAnalogInput(dev,us_ConvertTiming,insn->n,&insn->chanspec,data,insn->unused[0]);
+	/*  this_board->i_hwdrv_InsnReadAnalogInput(dev,us_ConvertTiming,insn->n,&insn->chanspec,data,insn->unused[0]); */
 
-	// Clear software registers
+	/*  Clear software registers */
 	devpriv->b_TimerSelectMode = 0;
 	devpriv->b_ModeSelectRegister = 0;
 	devpriv->us_OutputRegister = 0;
-//        devpriv->b_DigitalOutputRegister=0;
+/* devpriv->b_DigitalOutputRegister=0; */
 
-	if (insn->unused[0] == 222)	// second insn read
+	if (insn->unused[0] == 222)	/*  second insn read */
 	{
 
 		for (i = 0; i < insn->n; i++) {
@@ -174,14 +174,16 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 		}
 
 	} else {
-		devpriv->tsk_Current = current;	// Save the current process task structure
-		//Testing if board have the new Quartz and calculate the time value
-		//to set in the timer
+		devpriv->tsk_Current = current;	/*  Save the current process task structure */
+/*
+ * Testing if board have the new Quartz and calculate the time value
+ * to set in the timer
+ */
 
 		us_TmpValue =
-			(USHORT) inw(devpriv->iobase + APCI3120_RD_STATUS);
+			(unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS);
 
-		//EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001
+		/* EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 */
 		if ((us_TmpValue & 0x00B0) == 0x00B0
 			|| !strcmp(this_board->pc_DriverName, "apci3001")) {
 			us_ConvertTiming = (us_ConvertTiming * 2) - 2;
@@ -190,25 +192,26 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 				((us_ConvertTiming * 12926) / 10000) - 1;
 		}
 
-		us_TmpValue = (USHORT) devpriv->b_InterruptMode;
+		us_TmpValue = (unsigned short) devpriv->b_InterruptMode;
 
 		switch (us_TmpValue) {
 
 		case APCI3120_EOC_MODE:
 
-			// Testing the interrupt flag and set the EOC bit
-			// Clears the FIFO
+/*
+ * Testing the interrupt flag and set the EOC bit Clears the FIFO
+ */
 			inw(devpriv->iobase + APCI3120_RESET_FIFO);
 
-			// Initialize the sequence array
+			/*  Initialize the sequence array */
 
-			//if (!i_APCI3120_SetupChannelList(dev,s,1,chanlist,0))  return -EINVAL;
+			/* if (!i_APCI3120_SetupChannelList(dev,s,1,chanlist,0))  return -EINVAL; */
 
 			if (!i_APCI3120_SetupChannelList(dev, s, 1,
 					&insn->chanspec, 0))
 				return -EINVAL;
 
-			//Initialize Timer 0 mode 4
+			/* Initialize Timer 0 mode 4 */
 			devpriv->b_TimerSelectMode =
 				(devpriv->
 				b_TimerSelectMode & 0xFC) |
@@ -216,14 +219,14 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 			outb(devpriv->b_TimerSelectMode,
 				devpriv->iobase + APCI3120_TIMER_CRT1);
 
-			// Reset the scan bit and Disables the  EOS, DMA, EOC interrupt
+			/*  Reset the scan bit and Disables the  EOS, DMA, EOC interrupt */
 			devpriv->b_ModeSelectRegister =
 				devpriv->
 				b_ModeSelectRegister & APCI3120_DISABLE_SCAN;
 
 			if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) {
 
-				//Disables the EOS,DMA and enables the EOC interrupt
+				/* Disables the EOS,DMA and enables the EOC interrupt */
 				devpriv->b_ModeSelectRegister =
 					(devpriv->
 					b_ModeSelectRegister &
@@ -241,7 +244,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 			outb(devpriv->b_ModeSelectRegister,
 				devpriv->iobase + APCI3120_WRITE_MODE_SELECT);
 
-			// Sets gate 0
+			/*  Sets gate 0 */
 			devpriv->us_OutputRegister =
 				(devpriv->
 				us_OutputRegister & APCI3120_CLEAR_PA_PR) |
@@ -249,30 +252,30 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 			outw(devpriv->us_OutputRegister,
 				devpriv->iobase + APCI3120_WR_ADDRESS);
 
-			// Select Timer 0
+			/*  Select Timer 0 */
 			b_Tmp = ((devpriv->
 					b_DigitalOutputRegister) & 0xF0) |
 				APCI3120_SELECT_TIMER_0_WORD;
 			outb(b_Tmp, devpriv->iobase + APCI3120_TIMER_CRT0);
 
-			//Set the convertion time
+			/* Set the convertion time */
 			outw(us_ConvertTiming,
 				devpriv->iobase + APCI3120_TIMER_VALUE);
 
 			us_TmpValue =
-				(USHORT) inw(dev->iobase + APCI3120_RD_STATUS);
+				(unsigned short) inw(dev->iobase + APCI3120_RD_STATUS);
 
 			if (devpriv->b_EocEosInterrupt == APCI3120_DISABLE) {
 
 				do {
-					// Waiting for the end of conversion
+					/*  Waiting for the end of conversion */
 					us_TmpValue =
 						inw(devpriv->iobase +
 						APCI3120_RD_STATUS);
 				} while ((us_TmpValue & APCI3120_EOC) ==
 					APCI3120_EOC);
 
-				//Read the result in FIFO  and put it in insn data pointer
+				/* Read the result in FIFO  and put it in insn data pointer */
 				us_TmpValue = inw(devpriv->iobase + 0);
 				*data = us_TmpValue;
 
@@ -284,9 +287,9 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 		case APCI3120_EOS_MODE:
 
 			inw(devpriv->iobase);
-			// Clears the FIFO
+			/*  Clears the FIFO */
 			inw(devpriv->iobase + APCI3120_RESET_FIFO);
-			// clear PA PR  and disable timer 0
+			/*  clear PA PR  and disable timer 0 */
 
 			devpriv->us_OutputRegister =
 				(devpriv->
@@ -301,7 +304,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 					devpriv->ui_AiChannelList, 0))
 				return -EINVAL;
 
-			//Initialize Timer 0 mode 2
+			/* Initialize Timer 0 mode 2 */
 			devpriv->b_TimerSelectMode =
 				(devpriv->
 				b_TimerSelectMode & 0xFC) |
@@ -309,26 +312,26 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 			outb(devpriv->b_TimerSelectMode,
 				devpriv->iobase + APCI3120_TIMER_CRT1);
 
-			//Select Timer 0
+			/* Select Timer 0 */
 			b_Tmp = ((devpriv->
 					b_DigitalOutputRegister) & 0xF0) |
 				APCI3120_SELECT_TIMER_0_WORD;
 			outb(b_Tmp, devpriv->iobase + APCI3120_TIMER_CRT0);
 
-			//Set the convertion time
+			/* Set the convertion time */
 			outw(us_ConvertTiming,
 				devpriv->iobase + APCI3120_TIMER_VALUE);
 
-			//Set the scan bit
+			/* Set the scan bit */
 			devpriv->b_ModeSelectRegister =
 				devpriv->
 				b_ModeSelectRegister | APCI3120_ENABLE_SCAN;
 			outb(devpriv->b_ModeSelectRegister,
 				devpriv->iobase + APCI3120_WRITE_MODE_SELECT);
 
-			//If Interrupt function is loaded
+			/* If Interrupt function is loaded */
 			if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) {
-				//Disables the EOC,DMA and enables the EOS interrupt
+				/* Disables the EOC,DMA and enables the EOS interrupt */
 				devpriv->b_ModeSelectRegister =
 					(devpriv->
 					b_ModeSelectRegister &
@@ -347,7 +350,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 
 			inw(devpriv->iobase + APCI3120_RD_STATUS);
 
-			//Sets gate 0
+			/* Sets gate 0 */
 
 			devpriv->us_OutputRegister =
 				devpriv->
@@ -355,28 +358,27 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 			outw(devpriv->us_OutputRegister,
 				devpriv->iobase + APCI3120_WR_ADDRESS);
 
-			//Start conversion
+			/* Start conversion */
 			outw(0, devpriv->iobase + APCI3120_START_CONVERSION);
 
-			//Waiting of end of convertion if interrupt is not installed
+			/* Waiting of end of convertion if interrupt is not installed */
 			if (devpriv->b_EocEosInterrupt == APCI3120_DISABLE) {
-				//Waiting the end of convertion
+				/* Waiting the end of convertion */
 				do {
 					us_TmpValue =
 						inw(devpriv->iobase +
 						APCI3120_RD_STATUS);
-				}
-				while ((us_TmpValue & APCI3120_EOS) !=
-					APCI3120_EOS);
+				} while ((us_TmpValue & APCI3120_EOS) !=
+					 APCI3120_EOS);
 
 				for (i = 0; i < devpriv->ui_AiNbrofChannels;
 					i++) {
-					//Read the result in FIFO and write them in shared memory
+					/* Read the result in FIFO and write them in shared memory */
 					us_TmpValue = inw(devpriv->iobase);
-					data[i] = (UINT) us_TmpValue;
+					data[i] = (unsigned int) us_TmpValue;
 				}
 
-				devpriv->b_InterruptMode = APCI3120_EOC_MODE;	// Restore defaults.
+				devpriv->b_InterruptMode = APCI3120_EOC_MODE;	/*  Restore defaults. */
 			}
 			break;
 
@@ -384,7 +386,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 			printk("inputs wrong\n");
 
 		}
-		devpriv->ui_EocEosConversionTime = 0;	// re initializing the variable;
+		devpriv->ui_EocEosConversionTime = 0;	/*  re initializing the variable; */
 	}
 
 	return insn->n;
@@ -409,38 +411,41 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_subdevice * s)
+int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s)
 {
-	// Disable A2P Fifo write and AMWEN signal
+	/*  Disable A2P Fifo write and AMWEN signal */
 	outw(0, devpriv->i_IobaseAddon + 4);
 
-	//Disable Bus Master ADD ON
+	/* Disable Bus Master ADD ON */
 	outw(APCI3120_ADD_ON_AGCSTS_LOW, devpriv->i_IobaseAddon + 0);
 	outw(0, devpriv->i_IobaseAddon + 2);
 	outw(APCI3120_ADD_ON_AGCSTS_HIGH, devpriv->i_IobaseAddon + 0);
 	outw(0, devpriv->i_IobaseAddon + 2);
 
-	//Disable BUS Master PCI
+	/* Disable BUS Master PCI */
 	outl(0, devpriv->i_IobaseAmcc + AMCC_OP_REG_MCSR);
 
-	//outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR)&(~AINT_WRITE_COMPL), devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR);    // stop amcc irqs
-	//outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR)&(~EN_A2P_TRANSFERS), devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR); // stop DMA
+	/* outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR)&(~AINT_WRITE_COMPL),
+	 * devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR);  stop amcc irqs */
+
+	/* outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR)&(~EN_A2P_TRANSFERS),
+	 * devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR);  stop DMA */
 
-	//Disable ext trigger
+	/* Disable ext trigger */
 	i_APCI3120_ExttrigDisable(dev);
 
 	devpriv->us_OutputRegister = 0;
-	//stop  counters
+	/* stop  counters */
 	outw(devpriv->
 		us_OutputRegister & APCI3120_DISABLE_TIMER0 &
 		APCI3120_DISABLE_TIMER1, dev->iobase + APCI3120_WR_ADDRESS);
 
 	outw(APCI3120_DISABLE_ALL_TIMER, dev->iobase + APCI3120_WR_ADDRESS);
 
-	//DISABLE_ALL_INTERRUPT
+	/* DISABLE_ALL_INTERRUPT */
 	outb(APCI3120_DISABLE_ALL_INTERRUPT,
 		dev->iobase + APCI3120_WRITE_MODE_SELECT);
-	//Flush FIFO
+	/* Flush FIFO */
 	inb(dev->iobase + APCI3120_RESET_FIFO);
 	inw(dev->iobase + APCI3120_RD_STATUS);
 	devpriv->ui_AiActualScan = 0;
@@ -476,13 +481,13 @@ int i_APCI3120_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_s
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_cmd * cmd)
+int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_cmd *cmd)
 {
 	int err = 0;
-	int tmp;		// divisor1,divisor2;
+	int tmp;		/*  divisor1,divisor2; */
 
-	// step 1: make sure trigger sources are trivially valid
+	/*  step 1: make sure trigger sources are trivially valid */
 
 	tmp = cmd->start_src;
 	cmd->start_src &= TRIG_NOW | TRIG_EXT;
@@ -512,7 +517,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 	if (err)
 		return 1;
 
-	//step 2: make sure trigger sources are unique and mutually compatible
+	/* step 2: make sure trigger sources are unique and mutually compatible */
 
 	if (cmd->start_src != TRIG_NOW && cmd->start_src != TRIG_EXT) {
 		err++;
@@ -536,14 +541,14 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 	if (err)
 		return 2;
 
-	// step 3: make sure arguments are trivially compatible
+	/*  step 3: make sure arguments are trivially compatible */
 
 	if (cmd->start_arg != 0) {
 		cmd->start_arg = 0;
 		err++;
 	}
 
-	if (cmd->scan_begin_src == TRIG_TIMER)	// Test Delay timing
+	if (cmd->scan_begin_src == TRIG_TIMER)	/*  Test Delay timing */
 	{
 		if (cmd->scan_begin_arg < this_board->ui_MinDelaytimeNs) {
 			cmd->scan_begin_arg = this_board->ui_MinDelaytimeNs;
@@ -551,7 +556,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 		}
 	}
 
-	if (cmd->convert_src == TRIG_TIMER)	// Test Acquisition timing
+	if (cmd->convert_src == TRIG_TIMER)	/*  Test Acquisition timing */
 	{
 		if (cmd->scan_begin_src == TRIG_TIMER) {
 			if ((cmd->convert_arg)
@@ -585,7 +590,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 			cmd->stop_arg = 1;
 			err++;
 		}
-	} else {		// TRIG_NONE
+	} else {		/*  TRIG_NONE */
 		if (cmd->stop_arg != 0) {
 			cmd->stop_arg = 0;
 			err++;
@@ -595,7 +600,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 	if (err)
 		return 3;
 
-	// step 4: fix up any arguments
+	/*  step 4: fix up any arguments */
 
 	if (cmd->convert_src == TRIG_TIMER) {
 
@@ -633,19 +638,19 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s)
+int i_APCI3120_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s)
 {
 	struct comedi_cmd *cmd = &s->async->cmd;
 
-	//loading private structure with cmd structure inputs
+	/* loading private structure with cmd structure inputs */
 	devpriv->ui_AiFlags = cmd->flags;
 	devpriv->ui_AiNbrofChannels = cmd->chanlist_len;
 	devpriv->ui_AiScanLength = cmd->scan_end_arg;
 	devpriv->pui_AiChannelList = cmd->chanlist;
 
-	//UPDATE-0.7.57->0.7.68devpriv->AiData=s->async->data;
+	/* UPDATE-0.7.57->0.7.68devpriv->AiData=s->async->data; */
 	devpriv->AiData = s->async->prealloc_buf;
-	//UPDATE-0.7.57->0.7.68devpriv->ui_AiDataLength=s->async->data_len;
+	/* UPDATE-0.7.57->0.7.68devpriv->ui_AiDataLength=s->async->data_len; */
 	devpriv->ui_AiDataLength = s->async->prealloc_bufsz;
 
 	if (cmd->stop_src == TRIG_COUNT) {
@@ -654,11 +659,11 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd
 		devpriv->ui_AiNbrofScans = 0;
 	}
 
-	devpriv->ui_AiTimer0 = 0;	// variables changed to timer0,timer1
+	devpriv->ui_AiTimer0 = 0;	/*  variables changed to timer0,timer1 */
 	devpriv->ui_AiTimer1 = 0;
 	if ((devpriv->ui_AiNbrofScans == 0) || (devpriv->ui_AiNbrofScans == -1))
-		devpriv->b_AiContinuous = 1;	// user want neverending analog acquisition
-	// stopped using cancel
+		devpriv->b_AiContinuous = 1;	/*  user want neverending analog acquisition */
+	/*  stopped using cancel */
 
 	if (cmd->start_src == TRIG_EXT)
 		devpriv->b_ExttrigEnable = APCI3120_ENABLE;
@@ -666,22 +671,22 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd
 		devpriv->b_ExttrigEnable = APCI3120_DISABLE;
 
 	if (cmd->scan_begin_src == TRIG_FOLLOW) {
-		// mode 1 or 3
+		/*  mode 1 or 3 */
 		if (cmd->convert_src == TRIG_TIMER) {
-			// mode 1
+			/*  mode 1 */
 
-			devpriv->ui_AiTimer0 = cmd->convert_arg;	// timer constant in nano seconds
-			//return this_board->i_hwdrv_CommandAnalogInput(1,dev,s);
+			devpriv->ui_AiTimer0 = cmd->convert_arg;	/*  timer constant in nano seconds */
+			/* return this_board->i_hwdrv_CommandAnalogInput(1,dev,s); */
 			return i_APCI3120_CyclicAnalogInput(1, dev, s);
 		}
 
 	}
 	if ((cmd->scan_begin_src == TRIG_TIMER)
 		&& (cmd->convert_src == TRIG_TIMER)) {
-		// mode 2
+		/*  mode 2 */
 		devpriv->ui_AiTimer1 = cmd->scan_begin_arg;
-		devpriv->ui_AiTimer0 = cmd->convert_arg;	// variable changed timer2 to timer0
-		//return this_board->i_hwdrv_CommandAnalogInput(2,dev,s);
+		devpriv->ui_AiTimer0 = cmd->convert_arg;	/*  variable changed timer2 to timer0 */
+		/* return this_board->i_hwdrv_CommandAnalogInput(2,dev,s); */
 		return i_APCI3120_CyclicAnalogInput(2, dev, s);
 	}
 	return -1;
@@ -707,73 +712,74 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
-	struct comedi_subdevice * s)
+int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev,
+	struct comedi_subdevice *s)
 {
-	BYTE b_Tmp;
-	UINT ui_Tmp, ui_DelayTiming = 0, ui_TimerValue1 = 0, dmalen0 =
+	unsigned char b_Tmp;
+	unsigned int ui_Tmp, ui_DelayTiming = 0, ui_TimerValue1 = 0, dmalen0 =
 		0, dmalen1 = 0, ui_TimerValue2 =
 		0, ui_TimerValue0, ui_ConvertTiming;
-	USHORT us_TmpValue;
+	unsigned short us_TmpValue;
 
-	//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
-	//devpriv->b_AiCyclicAcquisition=APCI3120_ENABLE;
-	//END JK 07.05.04: Comparison between WIN32 and Linux driver
+	/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
+	/* devpriv->b_AiCyclicAcquisition=APCI3120_ENABLE; */
+	/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
 
 	/*******************/
 	/* Resets the FIFO */
 	/*******************/
 	inb(dev->iobase + APCI3120_RESET_FIFO);
 
-	//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
-	//inw(dev->iobase+APCI3120_RD_STATUS);
-	//END JK 07.05.04: Comparison between WIN32 and Linux driver
+	/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
+	/* inw(dev->iobase+APCI3120_RD_STATUS); */
+	/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
 
 	/***************************/
 	/* Acquisition initialized */
 	/***************************/
-	//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
+	/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
 	devpriv->b_AiCyclicAcquisition = APCI3120_ENABLE;
-	//END JK 07.05.04: Comparison between WIN32 and Linux driver
+	/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
 
-	// clear software  registers
+	/*  clear software  registers */
 	devpriv->b_TimerSelectMode = 0;
 	devpriv->us_OutputRegister = 0;
 	devpriv->b_ModeSelectRegister = 0;
-	//devpriv->b_DigitalOutputRegister=0;
+	/* devpriv->b_DigitalOutputRegister=0; */
 
-	//COMMENT JK 07.05.04: Followings calls are in i_APCI3120_StartAnalogInputAcquisition
+	/* COMMENT JK 07.05.04: Followings calls are in i_APCI3120_StartAnalogInputAcquisition */
 
-   /****************************/
-	/* Clear Timer Write TC INT */
-   /****************************/
+	/****************************/
+	/* Clear Timer Write TC int */
+	/****************************/
 	outl(APCI3120_CLEAR_WRITE_TC_INT,
 		devpriv->i_IobaseAmcc + APCI3120_AMCC_OP_REG_INTCSR);
 
-   /************************************/
+	/************************************/
 	/* Clears the timer status register */
-   /************************************/
-	//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
-	//inw(dev->iobase+APCI3120_TIMER_STATUS_REGISTER);
-	inb(dev->iobase + APCI3120_TIMER_STATUS_REGISTER);
-	//END JK 07.05.04: Comparison between WIN32 and Linux driver
+	/************************************/
+
+	/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
+	/* inw(dev->iobase+APCI3120_TIMER_STATUS_REGISTER); */
+	/* inb(dev->iobase + APCI3120_TIMER_STATUS_REGISTER); */
+	/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
 
-   /**************************/
+	/**************************/
 	/* Disables All Timer     */
 	/* Sets PR and PA to 0    */
-   /**************************/
+	/**************************/
 	devpriv->us_OutputRegister = devpriv->us_OutputRegister &
 		APCI3120_DISABLE_TIMER0 &
 		APCI3120_DISABLE_TIMER1 & APCI3120_CLEAR_PA_PR;
 
 	outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS);
 
-   /*******************/
+	/*******************/
 	/* Resets the FIFO */
-   /*******************/
-	//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
+	/*******************/
+	/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
 	inb(devpriv->iobase + APCI3120_RESET_FIFO);
-	//END JK 07.05.04: Comparison between WIN32 and Linux driver
+	/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
 
 	devpriv->ui_AiActualScan = 0;
 	devpriv->ui_AiActualScanPosition = 0;
@@ -781,7 +787,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 	devpriv->ui_AiBufferPtr = 0;
 	devpriv->ui_DmaActualBuffer = 0;
 
-	// value for timer2  minus -2 has to be done .....dunno y??
+	/*  value for timer2  minus -2 has to be done .....dunno y?? */
 	ui_TimerValue2 = devpriv->ui_AiNbrofScans - 2;
 	ui_ConvertTiming = devpriv->ui_AiTimer0;
 
@@ -795,31 +801,31 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 			devpriv->pui_AiChannelList, 0))
 		return -EINVAL;
 
-	us_TmpValue = (USHORT) inw(dev->iobase + APCI3120_RD_STATUS);
+	us_TmpValue = (unsigned short) inw(dev->iobase + APCI3120_RD_STATUS);
 /*** EL241003 : add this section in comment because floats must not be used
-	 if((us_TmpValue & 0x00B0)==0x00B0)
+	if((us_TmpValue & 0x00B0)==0x00B0)
 	 {
-           f_ConvertValue=(((float)ui_ConvertTiming * 0.002) - 2);
-		ui_TimerValue0=(UINT)f_ConvertValue;
+		f_ConvertValue=(((float)ui_ConvertTiming * 0.002) - 2);
+		ui_TimerValue0=(unsigned int)f_ConvertValue;
 		if (mode==2)
 		{
 			f_DelayValue     = (((float)ui_DelayTiming * 0.00002) - 2);
-			ui_TimerValue1  =   (UINT) f_DelayValue;
+			ui_TimerValue1  =   (unsigned int) f_DelayValue;
 		}
 	 }
-   	 else
+	else
 	 {
 		f_ConvertValue=(((float)ui_ConvertTiming * 0.0012926) - 1);
-		ui_TimerValue0=(UINT)f_ConvertValue;
+		ui_TimerValue0=(unsigned int)f_ConvertValue;
 		if (mode == 2)
 		{
 		     f_DelayValue     = (((float)ui_DelayTiming * 0.000012926) - 1);
-		     ui_TimerValue1  =   (UINT) f_DelayValue;
+		     ui_TimerValue1  =   (unsigned int) f_DelayValue;
 		}
 	}
 ***********************************************************************************************/
 /*** EL241003 Begin : add this section to replace floats calculation by integer calculations **/
-	//EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001
+	/* EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 */
 	if ((us_TmpValue & 0x00B0) == 0x00B0
 		|| !strcmp(this_board->pc_DriverName, "apci3001")) {
 		ui_TimerValue0 = ui_ConvertTiming * 2 - 2000;
@@ -844,79 +850,82 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 /*** EL241003 End ******************************************************************************/
 
 	if (devpriv->b_ExttrigEnable == APCI3120_ENABLE) {
-		i_APCI3120_ExttrigEnable(dev);	// activate EXT trigger
+		i_APCI3120_ExttrigEnable(dev);	/*  activate EXT trigger */
 	}
 	switch (mode) {
 	case 1:
-		// init timer0 in mode 2
+		/*  init timer0 in mode 2 */
 		devpriv->b_TimerSelectMode =
 			(devpriv->
 			b_TimerSelectMode & 0xFC) | APCI3120_TIMER_0_MODE_2;
 		outb(devpriv->b_TimerSelectMode,
 			dev->iobase + APCI3120_TIMER_CRT1);
 
-		//Select Timer 0
+		/* Select Timer 0 */
 		b_Tmp = ((devpriv->
 				b_DigitalOutputRegister) & 0xF0) |
 			APCI3120_SELECT_TIMER_0_WORD;
 		outb(b_Tmp, dev->iobase + APCI3120_TIMER_CRT0);
-		//Set the convertion time
-		outw(((USHORT) ui_TimerValue0),
+		/* Set the convertion time */
+		outw(((unsigned short) ui_TimerValue0),
 			dev->iobase + APCI3120_TIMER_VALUE);
 		break;
 
 	case 2:
-		// init timer1 in mode 2
+		/*  init timer1 in mode 2 */
 		devpriv->b_TimerSelectMode =
 			(devpriv->
 			b_TimerSelectMode & 0xF3) | APCI3120_TIMER_1_MODE_2;
 		outb(devpriv->b_TimerSelectMode,
 			dev->iobase + APCI3120_TIMER_CRT1);
 
-		//Select Timer 1
+		/* Select Timer 1 */
 		b_Tmp = ((devpriv->
 				b_DigitalOutputRegister) & 0xF0) |
 			APCI3120_SELECT_TIMER_1_WORD;
 		outb(b_Tmp, dev->iobase + APCI3120_TIMER_CRT0);
-		//Set the convertion time
-		outw(((USHORT) ui_TimerValue1),
+		/* Set the convertion time */
+		outw(((unsigned short) ui_TimerValue1),
 			dev->iobase + APCI3120_TIMER_VALUE);
 
-		// init timer0 in mode 2
+		/*  init timer0 in mode 2 */
 		devpriv->b_TimerSelectMode =
 			(devpriv->
 			b_TimerSelectMode & 0xFC) | APCI3120_TIMER_0_MODE_2;
 		outb(devpriv->b_TimerSelectMode,
 			dev->iobase + APCI3120_TIMER_CRT1);
 
-		//Select Timer 0
+		/* Select Timer 0 */
 		b_Tmp = ((devpriv->
 				b_DigitalOutputRegister) & 0xF0) |
 			APCI3120_SELECT_TIMER_0_WORD;
 		outb(b_Tmp, dev->iobase + APCI3120_TIMER_CRT0);
 
-		//Set the convertion time
-		outw(((USHORT) ui_TimerValue0),
+		/* Set the convertion time */
+		outw(((unsigned short) ui_TimerValue0),
 			dev->iobase + APCI3120_TIMER_VALUE);
 		break;
 
 	}
-	//   ##########common for all modes#################
+	/*    ##########common for all modes################# */
 
 	/***********************/
 	/* Clears the SCAN bit */
 	/***********************/
-	//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
-	//devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister | APCI3120_DISABLE_SCAN;
+
+	/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
+	/* devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister | APCI3120_DISABLE_SCAN; */
+
 	devpriv->b_ModeSelectRegister = devpriv->b_ModeSelectRegister &
 		APCI3120_DISABLE_SCAN;
-	//END JK 07.05.04: Comparison between WIN32 and Linux driver
+	/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
+
 	outb(devpriv->b_ModeSelectRegister,
 		dev->iobase + APCI3120_WRITE_MODE_SELECT);
 
-	// If DMA is disabled
+	/*  If DMA is disabled */
 	if (devpriv->us_UseDma == APCI3120_DISABLE) {
-		// disable EOC and enable EOS
+		/*  disable EOC and enable EOS */
 		devpriv->b_InterruptMode = APCI3120_EOS_MODE;
 		devpriv->b_EocEosInterrupt = APCI3120_ENABLE;
 
@@ -928,15 +937,17 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 			dev->iobase + APCI3120_WRITE_MODE_SELECT);
 
 		if (!devpriv->b_AiContinuous) {
-			// configure Timer2 For counting  EOS
-			//Reset gate 2 of Timer 2 to disable it (Set Bit D14 to 0)
+/*
+ * configure Timer2 For counting EOS Reset gate 2 of Timer 2 to
+ * disable it (Set Bit D14 to 0)
+ */
 			devpriv->us_OutputRegister =
 				devpriv->
 				us_OutputRegister & APCI3120_DISABLE_TIMER2;
 			outw(devpriv->us_OutputRegister,
 				dev->iobase + APCI3120_WR_ADDRESS);
 
-			// DISABLE TIMER INTERRUPT
+			/*  DISABLE TIMER intERRUPT */
 			devpriv->b_ModeSelectRegister =
 				devpriv->
 				b_ModeSelectRegister &
@@ -944,7 +955,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 			outb(devpriv->b_ModeSelectRegister,
 				dev->iobase + APCI3120_WRITE_MODE_SELECT);
 
-			//(1) Init timer 2 in mode 0 and write timer value
+			/* (1) Init timer 2 in mode 0 and write timer value */
 			devpriv->b_TimerSelectMode =
 				(devpriv->
 				b_TimerSelectMode & 0x0F) |
@@ -952,7 +963,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 			outb(devpriv->b_TimerSelectMode,
 				dev->iobase + APCI3120_TIMER_CRT1);
 
-			//Writing LOW WORD
+			/* Writing LOW unsigned short */
 			b_Tmp = ((devpriv->
 					b_DigitalOutputRegister) & 0xF0) |
 				APCI3120_SELECT_TIMER_2_LOW_WORD;
@@ -960,7 +971,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 			outw(LOWORD(ui_TimerValue2),
 				dev->iobase + APCI3120_TIMER_VALUE);
 
-			//Writing HIGH WORD
+			/* Writing HIGH unsigned short */
 			b_Tmp = ((devpriv->
 					b_DigitalOutputRegister) & 0xF0) |
 				APCI3120_SELECT_TIMER_2_HIGH_WORD;
@@ -968,20 +979,20 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 			outw(HIWORD(ui_TimerValue2),
 				dev->iobase + APCI3120_TIMER_VALUE);
 
-			//(2) Reset FC_TIMER BIT  Clearing timer status register
+			/* (2) Reset FC_TIMER BIT  Clearing timer status register */
 			inb(dev->iobase + APCI3120_TIMER_STATUS_REGISTER);
-			// enable timer counter and disable watch dog
+			/*  enable timer counter and disable watch dog */
 			devpriv->b_ModeSelectRegister =
 				(devpriv->
 				b_ModeSelectRegister |
 				APCI3120_ENABLE_TIMER_COUNTER) &
 				APCI3120_DISABLE_WATCHDOG;
-			// select EOS clock input for timer 2
+			/*  select EOS clock input for timer 2 */
 			devpriv->b_ModeSelectRegister =
 				devpriv->
 				b_ModeSelectRegister |
 				APCI3120_TIMER2_SELECT_EOS;
-			// Enable timer2  interrupt
+			/*  Enable timer2  interrupt */
 			devpriv->b_ModeSelectRegister =
 				devpriv->
 				b_ModeSelectRegister |
@@ -992,15 +1003,16 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 			devpriv->b_Timer2Interrupt = APCI3120_ENABLE;
 		}
 	} else {
-		// If DMA Enabled
-		//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
-		//inw(dev->iobase+0);// reset EOC bit
-		//END JK 07.05.04: Comparison between WIN32 and Linux driver
+		/* If DMA Enabled */
+
+		/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
+		/* inw(dev->iobase+0); reset EOC bit */
+		/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
 		devpriv->b_InterruptMode = APCI3120_DMA_MODE;
 
-      /************************************/
+		/************************************/
 		/* Disables the EOC, EOS interrupt  */
-	  /************************************/
+		/************************************/
 		devpriv->b_ModeSelectRegister = devpriv->b_ModeSelectRegister &
 			APCI3120_DISABLE_EOC_INT & APCI3120_DISABLE_EOS_INT;
 
@@ -1012,18 +1024,18 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 
 		if (!devpriv->b_AiContinuous) {
 
-			if (dmalen0 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2)) {	// must we fill full first buffer?
+			if (dmalen0 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2)) {	/*  must we fill full first buffer? */
 				dmalen0 =
 					devpriv->ui_AiNbrofScans *
 					devpriv->ui_AiScanLength * 2;
-			} else if (dmalen1 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2 - dmalen0))	// and must we fill full second buffer when first is once filled?
+			} else if (dmalen1 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2 - dmalen0))	/*  and must we fill full second buffer when first is once filled? */
 				dmalen1 =
 					devpriv->ui_AiNbrofScans *
 					devpriv->ui_AiScanLength * 2 - dmalen0;
 		}
 
 		if (devpriv->ui_AiFlags & TRIG_WAKE_EOS) {
-			// don't we want wake up every scan?
+			/*  don't we want wake up every scan? */
 			if (dmalen0 > (devpriv->ui_AiScanLength * 2)) {
 				dmalen0 = devpriv->ui_AiScanLength * 2;
 				if (devpriv->ui_AiScanLength & 1)
@@ -1036,7 +1048,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 				if (dmalen1 < 4)
 					dmalen1 = 4;
 			}
-		} else {	// isn't output buff smaller that our DMA buff?
+		} else {	/*  isn't output buff smaller that our DMA buff? */
 			if (dmalen0 > (devpriv->ui_AiDataLength)) {
 				dmalen0 = devpriv->ui_AiDataLength;
 			}
@@ -1047,14 +1059,16 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 		devpriv->ui_DmaBufferUsesize[0] = dmalen0;
 		devpriv->ui_DmaBufferUsesize[1] = dmalen1;
 
-		//Initialize DMA
+		/* Initialize DMA */
 
-		// Set Transfer count enable bit and A2P_fifo reset bit in AGCSTS register
-		//1
+/*
+ * Set Transfer count enable bit and A2P_fifo reset bit in AGCSTS
+ * register 1
+ */
 		ui_Tmp = AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO;
 		outl(ui_Tmp, devpriv->i_IobaseAmcc + AMCC_OP_REG_AGCSTS);
 
-		// changed  since 16 bit interface for add on
+		/*  changed  since 16 bit interface for add on */
 		/*********************/
 		/* ENABLE BUS MASTER */
 		/*********************/
@@ -1066,104 +1080,121 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 		outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH,
 			devpriv->i_IobaseAddon + 2);
 
-		// TO VERIFIED
-		//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
+/*
+ * TO VERIFIED BEGIN JK 07.05.04: Comparison between WIN32 and Linux
+ * driver
+ */
 		outw(0x1000, devpriv->i_IobaseAddon + 2);
-		//END JK 07.05.04: Comparison between WIN32 and Linux driver
+		/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
 
-		//2  No change
-		// A2P FIFO MANAGEMENT
-		// A2P fifo reset  & transfer control enable
-		 /***********************/
+		/* 2 No change */
 		/* A2P FIFO MANAGEMENT */
-		 /***********************/
+		/* A2P fifo reset & transfer control enable */
+
+		/***********************/
+		/* A2P FIFO MANAGEMENT */
+		/***********************/
 		outl(APCI3120_A2P_FIFO_MANAGEMENT, devpriv->i_IobaseAmcc +
 			APCI3120_AMCC_OP_MCSR);
 
-		//3
-		//beginning address of dma buf
-		//The 32 bit address of dma buffer is converted into two 16 bit addresses
-		// Can done by using _attach and put into into an array
-		// array used may be for differnet pages
+/*
+ * 3
+ * beginning address of dma buf The 32 bit address of dma buffer
+ * is converted into two 16 bit addresses Can done by using _attach
+ * and put into into an array array used may be for differnet pages
+ */
 
-		// DMA Start Adress Low
+		/*  DMA Start Adress Low */
 		outw(APCI3120_ADD_ON_MWAR_LOW, devpriv->i_IobaseAddon + 0);
 		outw((devpriv->ul_DmaBufferHw[0] & 0xFFFF),
 			devpriv->i_IobaseAddon + 2);
 
-		 /*************************/
+		/*************************/
 		/* DMA Start Adress High */
-		 /*************************/
+		/*************************/
 		outw(APCI3120_ADD_ON_MWAR_HIGH, devpriv->i_IobaseAddon + 0);
 		outw((devpriv->ul_DmaBufferHw[0] / 65536),
 			devpriv->i_IobaseAddon + 2);
 
-		//4
-		// amount of bytes to be transfered  set transfer count
-		// used ADDON MWTC register
-		//commented testing             outl(devpriv->ui_DmaBufferUsesize[0], devpriv->i_IobaseAddon+AMCC_OP_REG_AMWTC);
-
-		 /**************************/
+/*
+ * 4
+ * amount of bytes to be transfered set transfer count used ADDON
+ * MWTC register commented testing
+ * outl(devpriv->ui_DmaBufferUsesize[0],
+ * devpriv->i_IobaseAddon+AMCC_OP_REG_AMWTC);
+ */
+
+		/**************************/
 		/* Nbr of acquisition LOW */
-		 /**************************/
+		/**************************/
 		outw(APCI3120_ADD_ON_MWTC_LOW, devpriv->i_IobaseAddon + 0);
 		outw((devpriv->ui_DmaBufferUsesize[0] & 0xFFFF),
 			devpriv->i_IobaseAddon + 2);
 
-		 /***************************/
+		/***************************/
 		/* Nbr of acquisition HIGH */
-		 /***************************/
+		/***************************/
 		outw(APCI3120_ADD_ON_MWTC_HIGH, devpriv->i_IobaseAddon + 0);
 		outw((devpriv->ui_DmaBufferUsesize[0] / 65536),
 			devpriv->i_IobaseAddon + 2);
 
-		//5
-		// To configure A2P FIFO
-		// testing outl( FIFO_ADVANCE_ON_BYTE_2,devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR);
+/*
+ * 5
+ * To configure A2P FIFO testing outl(
+ * FIFO_ADVANCE_ON_BYTE_2,devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR);
+ */
 
 		/******************/
 		/* A2P FIFO RESET */
 		/******************/
-		// TO VERIFY
-		//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
+/*
+ * TO VERIFY BEGIN JK 07.05.04: Comparison between WIN32 and Linux
+ * driver
+ */
 		outl(0x04000000UL, devpriv->i_IobaseAmcc + AMCC_OP_REG_MCSR);
-		//END JK 07.05.04: Comparison between WIN32 and Linux driver
+		/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
+
+/*
+ * 6
+ * ENABLE A2P FIFO WRITE AND ENABLE AMWEN AMWEN_ENABLE |
+ * A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03
+ */
 
-		//6
-		//ENABLE A2P FIFO WRITE AND ENABLE AMWEN
-		// AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03
-		//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
-		//outw(3,devpriv->i_IobaseAddon + 4);
-		//END JK 07.05.04: Comparison between WIN32 and Linux driver
+		/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
+		/* outw(3,devpriv->i_IobaseAddon + 4); */
+		/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
 
-		//7
-		//initialise end of dma interrupt  AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI)
+/*
+ * 7
+ * initialise end of dma interrupt AINT_WRITE_COMPL =
+ * ENABLE_WRITE_TC_INT(ADDI)
+ */
 		/***************************************************/
-		/* A2P FIFO CONFIGURATE, END OF DMA INTERRUPT INIT */
+		/* A2P FIFO CONFIGURATE, END OF DMA intERRUPT INIT */
 		/***************************************************/
 		outl((APCI3120_FIFO_ADVANCE_ON_BYTE_2 |
 				APCI3120_ENABLE_WRITE_TC_INT),
 			devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR);
 
-		//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
+		/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
 		/******************************************/
 		/* ENABLE A2P FIFO WRITE AND ENABLE AMWEN */
 		/******************************************/
 		outw(3, devpriv->i_IobaseAddon + 4);
-		//END JK 07.05.04: Comparison between WIN32 and Linux driver
+		/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
 
 		/******************/
 		/* A2P FIFO RESET */
 		/******************/
-		//BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver
+		/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
 		outl(0x04000000UL,
 			devpriv->i_IobaseAmcc + APCI3120_AMCC_OP_MCSR);
-		//END JK 07.05.04: Comparison between WIN32 and Linux driver
+		/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
 	}
 
 	if ((devpriv->us_UseDma == APCI3120_DISABLE)
 		&& !devpriv->b_AiContinuous) {
-		// set gate 2   to start conversion
+		/*  set gate 2   to start conversion */
 		devpriv->us_OutputRegister =
 			devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER2;
 		outw(devpriv->us_OutputRegister,
@@ -1172,14 +1203,14 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 
 	switch (mode) {
 	case 1:
-		// set gate 0   to start conversion
+		/*  set gate 0   to start conversion */
 		devpriv->us_OutputRegister =
 			devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER0;
 		outw(devpriv->us_OutputRegister,
 			dev->iobase + APCI3120_WR_ADDRESS);
 		break;
 	case 2:
-		// set  gate 0 and gate 1
+		/*  set  gate 0 and gate 1 */
 		devpriv->us_OutputRegister =
 			devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER1;
 		devpriv->us_OutputRegister =
@@ -1196,7 +1227,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 
 /*
 +----------------------------------------------------------------------------+
-| 			INTERNAL FUNCTIONS						                 |
+| 			intERNAL FUNCTIONS						                 |
 +----------------------------------------------------------------------------+
 */
 
@@ -1218,7 +1249,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_Reset(struct comedi_device * dev)
+int i_APCI3120_Reset(struct comedi_device *dev)
 {
 	unsigned int i;
 	unsigned short us_TmpValue;
@@ -1226,47 +1257,49 @@ int i_APCI3120_Reset(struct comedi_device * dev)
 	devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE;
 	devpriv->b_EocEosInterrupt = APCI3120_DISABLE;
 	devpriv->b_InterruptMode = APCI3120_EOC_MODE;
-	devpriv->ui_EocEosConversionTime = 0;	// set eoc eos conv time to 0
+	devpriv->ui_EocEosConversionTime = 0;	/*  set eoc eos conv time to 0 */
 	devpriv->b_OutputMemoryStatus = 0;
 
-	// variables used in timer subdevice
+	/*  variables used in timer subdevice */
 	devpriv->b_Timer2Mode = 0;
 	devpriv->b_Timer2Interrupt = 0;
-	devpriv->b_ExttrigEnable = 0;	// Disable ext trigger
+	devpriv->b_ExttrigEnable = 0;	/*  Disable ext trigger */
 
 	/* Disable all interrupts, watchdog for the anolog output */
 	devpriv->b_ModeSelectRegister = 0;
 	outb(devpriv->b_ModeSelectRegister,
 		dev->iobase + APCI3120_WRITE_MODE_SELECT);
 
-	// Disables all counters, ext trigger and clears PA, PR
+	/*  Disables all counters, ext trigger and clears PA, PR */
 	devpriv->us_OutputRegister = 0;
 	outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS);
 
-	//Code to set the all anolog o/p channel to 0v
-	//8191 is decimal value for zero(0 v)volt in bipolar mode(default)
-	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_1, dev->iobase + APCI3120_ANALOG_OUTPUT_1);	//channel 1
-	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_2, dev->iobase + APCI3120_ANALOG_OUTPUT_1);	//channel 2
-	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_3, dev->iobase + APCI3120_ANALOG_OUTPUT_1);	//channel 3
-	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_4, dev->iobase + APCI3120_ANALOG_OUTPUT_1);	//channel 4
-
-	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_5, dev->iobase + APCI3120_ANALOG_OUTPUT_2);	//channel 5
-	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_6, dev->iobase + APCI3120_ANALOG_OUTPUT_2);	//channel 6
-	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_7, dev->iobase + APCI3120_ANALOG_OUTPUT_2);	//channel 7
-	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_8, dev->iobase + APCI3120_ANALOG_OUTPUT_2);	//channel 8
-
-	//  Reset digital output to L0W
-
-//ES05  outb(0x0,dev->iobase+APCI3120_DIGITAL_OUTPUT);
+/*
+ * Code to set the all anolog o/p channel to 0v 8191 is decimal
+ * value for zero(0 v)volt in bipolar mode(default)
+ */
+	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_1, dev->iobase + APCI3120_ANALOG_OUTPUT_1);	/* channel 1 */
+	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_2, dev->iobase + APCI3120_ANALOG_OUTPUT_1);	/* channel 2 */
+	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_3, dev->iobase + APCI3120_ANALOG_OUTPUT_1);	/* channel 3 */
+	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_4, dev->iobase + APCI3120_ANALOG_OUTPUT_1);	/* channel 4 */
+
+	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_5, dev->iobase + APCI3120_ANALOG_OUTPUT_2);	/* channel 5 */
+	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_6, dev->iobase + APCI3120_ANALOG_OUTPUT_2);	/* channel 6 */
+	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_7, dev->iobase + APCI3120_ANALOG_OUTPUT_2);	/* channel 7 */
+	outw(8191 | APCI3120_ANALOG_OP_CHANNEL_8, dev->iobase + APCI3120_ANALOG_OUTPUT_2);	/* channel 8 */
+
+	/*   Reset digital output to L0W */
+
+/* ES05  outb(0x0,dev->iobase+APCI3120_DIGITAL_OUTPUT); */
 	udelay(10);
 
-	inw(dev->iobase + 0);	//make a dummy read
-	inb(dev->iobase + APCI3120_RESET_FIFO);	// flush FIFO
-	inw(dev->iobase + APCI3120_RD_STATUS);	// flush A/D status register
+	inw(dev->iobase + 0);	/* make a dummy read */
+	inb(dev->iobase + APCI3120_RESET_FIFO);	/*  flush FIFO */
+	inw(dev->iobase + APCI3120_RD_STATUS);	/*  flush A/D status register */
 
-	//code to reset the RAM sequence
+	/* code to reset the RAM sequence */
 	for (i = 0; i < 16; i++) {
-		us_TmpValue = i << 8;	//select the location
+		us_TmpValue = i << 8;	/* select the location */
 		outw(us_TmpValue, dev->iobase + APCI3120_SEQ_RAM_ADDRESS);
 	}
 	return 0;
@@ -1296,10 +1329,10 @@ int i_APCI3120_Reset(struct comedi_device * dev)
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_SetupChannelList(struct comedi_device * dev, struct comedi_subdevice * s,
+int i_APCI3120_SetupChannelList(struct comedi_device *dev, struct comedi_subdevice *s,
 	int n_chan, unsigned int *chanlist, char check)
 {
-	unsigned int i;		//, differencial=0, bipolar=0;
+	unsigned int i;		/* , differencial=0, bipolar=0; */
 	unsigned int gain;
 	unsigned short us_TmpValue;
 
@@ -1309,29 +1342,29 @@ int i_APCI3120_SetupChannelList(struct comedi_device * dev, struct comedi_subdev
 			comedi_error(dev, "range/channel list is empty!");
 		return 0;
 	}
-	// All is ok, so we can setup channel/range list
+	/*  All is ok, so we can setup channel/range list */
 	if (check)
 		return 1;
 
-	//Code  to set the PA and PR...Here it set PA to 0..
+	/* Code  to set the PA and PR...Here it set PA to 0.. */
 	devpriv->us_OutputRegister =
 		devpriv->us_OutputRegister & APCI3120_CLEAR_PA_PR;
 	devpriv->us_OutputRegister = ((n_chan - 1) & 0xf) << 8;
 	outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS);
 
 	for (i = 0; i < n_chan; i++) {
-		// store range list to card
-		us_TmpValue = CR_CHAN(chanlist[i]);	// get channel number;
+		/*  store range list to card */
+		us_TmpValue = CR_CHAN(chanlist[i]);	/*  get channel number; */
 
 		if (CR_RANGE(chanlist[i]) < APCI3120_BIPOLAR_RANGES) {
-			us_TmpValue &= ((~APCI3120_UNIPOLAR) & 0xff);	// set bipolar
+			us_TmpValue &= ((~APCI3120_UNIPOLAR) & 0xff);	/*  set bipolar */
 		} else {
-			us_TmpValue |= APCI3120_UNIPOLAR;	// enable unipolar......
+			us_TmpValue |= APCI3120_UNIPOLAR;	/*  enable unipolar...... */
 		}
 
-		gain = CR_RANGE(chanlist[i]);	// get gain number
-		us_TmpValue |= ((gain & 0x03) << 4);	//<<4 for G0 and G1 bit in RAM
-		us_TmpValue |= i << 8;	//To select the RAM LOCATION....
+		gain = CR_RANGE(chanlist[i]);	/*  get gain number */
+		us_TmpValue |= ((gain & 0x03) << 4);	/* <<4 for G0 and G1 bit in RAM */
+		us_TmpValue |= i << 8;	/* To select the RAM LOCATION.... */
 		outw(us_TmpValue, dev->iobase + APCI3120_SEQ_RAM_ADDRESS);
 
 		printk("\n Gain = %i",
@@ -1339,7 +1372,7 @@ int i_APCI3120_SetupChannelList(struct comedi_device * dev, struct comedi_subdev
 		printk("\n Channel = %i", CR_CHAN(chanlist[i]));
 		printk("\n Polarity = %i", us_TmpValue & APCI3120_UNIPOLAR);
 	}
-	return 1;		// we can serve this with scan logic
+	return 1;		/*  we can serve this with scan logic */
 }
 
 /*
@@ -1360,7 +1393,7 @@ int i_APCI3120_SetupChannelList(struct comedi_device * dev, struct comedi_subdev
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_ExttrigEnable(struct comedi_device * dev)
+int i_APCI3120_ExttrigEnable(struct comedi_device *dev)
 {
 
 	devpriv->us_OutputRegister |= APCI3120_ENABLE_EXT_TRIGGER;
@@ -1385,7 +1418,7 @@ int i_APCI3120_ExttrigEnable(struct comedi_device * dev)
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_ExttrigDisable(struct comedi_device * dev)
+int i_APCI3120_ExttrigDisable(struct comedi_device *dev)
 {
 	devpriv->us_OutputRegister &= ~APCI3120_ENABLE_EXT_TRIGGER;
 	outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS);
@@ -1394,7 +1427,7 @@ int i_APCI3120_ExttrigDisable(struct comedi_device * dev)
 
 /*
 +----------------------------------------------------------------------------+
-|                    INTERRUPT FUNCTIONS		    		                 |
+|                    intERRUPT FUNCTIONS		    		                 |
 +----------------------------------------------------------------------------+
 */
 
@@ -1422,33 +1455,33 @@ int i_APCI3120_ExttrigDisable(struct comedi_device * dev)
 void v_APCI3120_Interrupt(int irq, void *d)
 {
 	struct comedi_device *dev = d;
-	USHORT int_daq;
+	unsigned short int_daq;
 
 	unsigned int int_amcc, ui_Check, i;
-	USHORT us_TmpValue;
-	BYTE b_DummyRead;
+	unsigned short us_TmpValue;
+	unsigned char b_DummyRead;
 
 	struct comedi_subdevice *s = dev->subdevices + 0;
 	ui_Check = 1;
 
-	int_daq = inw(dev->iobase + APCI3120_RD_STATUS) & 0xf000;	// get IRQ reasons
-	int_amcc = inl(devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR);	// get AMCC INT register
+	int_daq = inw(dev->iobase + APCI3120_RD_STATUS) & 0xf000;	/*  get IRQ reasons */
+	int_amcc = inl(devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR);	/*  get AMCC int register */
 
 	if ((!int_daq) && (!(int_amcc & ANY_S593X_INT))) {
 		comedi_error(dev, "IRQ from unknow source");
 		return;
 	}
 
-	outl(int_amcc | 0x00ff0000, devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR);	// shutdown IRQ reasons in AMCC
+	outl(int_amcc | 0x00ff0000, devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR);	/*  shutdown IRQ reasons in AMCC */
 
 	int_daq = (int_daq >> 12) & 0xF;
 
 	if (devpriv->b_ExttrigEnable == APCI3120_ENABLE) {
-		//Disable ext trigger
+		/* Disable ext trigger */
 		i_APCI3120_ExttrigDisable(dev);
 		devpriv->b_ExttrigEnable = APCI3120_DISABLE;
 	}
-	//clear the timer 2 interrupt
+	/* clear the timer 2 interrupt */
 	inb(devpriv->i_IobaseAmcc + APCI3120_TIMER_STATUS_REGISTER);
 
 	if (int_amcc & MASTER_ABORT_INT)
@@ -1456,19 +1489,19 @@ void v_APCI3120_Interrupt(int irq, void *d)
 	if (int_amcc & TARGET_ABORT_INT)
 		comedi_error(dev, "AMCC IRQ - TARGET DMA ABORT!");
 
-	// Ckeck if EOC interrupt
+	/*  Ckeck if EOC interrupt */
 	if (((int_daq & 0x8) == 0)
 		&& (devpriv->b_InterruptMode == APCI3120_EOC_MODE)) {
 		if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) {
 
-			// Read the AI Value
+			/*  Read the AI Value */
 
 			devpriv->ui_AiReadData[0] =
-				(UINT) inw(devpriv->iobase + 0);
+				(unsigned int) inw(devpriv->iobase + 0);
 			devpriv->b_EocEosInterrupt = APCI3120_DISABLE;
-			send_sig(SIGIO, devpriv->tsk_Current, 0);	// send signal to the sample
+			send_sig(SIGIO, devpriv->tsk_Current, 0);	/*  send signal to the sample */
 		} else {
-			//Disable EOC Interrupt
+			/* Disable EOC Interrupt */
 			devpriv->b_ModeSelectRegister =
 				devpriv->
 				b_ModeSelectRegister & APCI3120_DISABLE_EOC_INT;
@@ -1478,10 +1511,10 @@ void v_APCI3120_Interrupt(int irq, void *d)
 		}
 	}
 
-	// Check If EOS interrupt
+	/*  Check If EOS interrupt */
 	if ((int_daq & 0x2) && (devpriv->b_InterruptMode == APCI3120_EOS_MODE)) {
 
-		if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE)	// enable this in without DMA ???
+		if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE)	/*  enable this in without DMA ??? */
 		{
 
 			if (devpriv->b_AiCyclicAcquisition == APCI3120_ENABLE) {
@@ -1501,12 +1534,12 @@ void v_APCI3120_Interrupt(int irq, void *d)
 					i++) {
 					us_TmpValue = inw(devpriv->iobase + 0);
 					devpriv->ui_AiReadData[i] =
-						(UINT) us_TmpValue;
+						(unsigned int) us_TmpValue;
 				}
 				devpriv->b_EocEosInterrupt = APCI3120_DISABLE;
 				devpriv->b_InterruptMode = APCI3120_EOC_MODE;
 
-				send_sig(SIGIO, devpriv->tsk_Current, 0);	// send signal to the sample
+				send_sig(SIGIO, devpriv->tsk_Current, 0);	/*  send signal to the sample */
 
 			}
 
@@ -1516,12 +1549,12 @@ void v_APCI3120_Interrupt(int irq, void *d)
 				b_ModeSelectRegister & APCI3120_DISABLE_EOS_INT;
 			outb(devpriv->b_ModeSelectRegister,
 				dev->iobase + APCI3120_WRITE_MODE_SELECT);
-			devpriv->b_EocEosInterrupt = APCI3120_DISABLE;	//Default settings
+			devpriv->b_EocEosInterrupt = APCI3120_DISABLE;	/* Default settings */
 			devpriv->b_InterruptMode = APCI3120_EOC_MODE;
 		}
 
 	}
-	//Timer2 interrupt
+	/* Timer2 interrupt */
 	if (int_daq & 0x1) {
 
 		switch (devpriv->b_Timer2Mode) {
@@ -1534,18 +1567,18 @@ void v_APCI3120_Interrupt(int irq, void *d)
 			outb(devpriv->b_ModeSelectRegister,
 				dev->iobase + APCI3120_WRITE_MODE_SELECT);
 
-			// stop timer 2
+			/*  stop timer 2 */
 			devpriv->us_OutputRegister =
 				devpriv->
 				us_OutputRegister & APCI3120_DISABLE_ALL_TIMER;
 			outw(devpriv->us_OutputRegister,
 				dev->iobase + APCI3120_WR_ADDRESS);
 
-			//stop timer 0 and timer 1
+			/* stop timer 0 and timer 1 */
 			i_APCI3120_StopCyclicAcquisition(dev, s);
 			devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE;
 
-			//UPDATE-0.7.57->0.7.68comedi_done(dev,s);
+			/* UPDATE-0.7.57->0.7.68comedi_done(dev,s); */
 			s->async->events |= COMEDI_CB_EOA;
 			comedi_event(dev, s);
 
@@ -1553,19 +1586,19 @@ void v_APCI3120_Interrupt(int irq, void *d)
 
 		case APCI3120_TIMER:
 
-			//Send a signal to from kernel to user space
+			/* Send a signal to from kernel to user space */
 			send_sig(SIGIO, devpriv->tsk_Current, 0);
 			break;
 
 		case APCI3120_WATCHDOG:
 
-			//Send a signal to from kernel to user space
+			/* Send a signal to from kernel to user space */
 			send_sig(SIGIO, devpriv->tsk_Current, 0);
 			break;
 
 		default:
 
-			// disable Timer Interrupt
+			/*  disable Timer Interrupt */
 
 			devpriv->b_ModeSelectRegister =
 				devpriv->
@@ -1585,7 +1618,7 @@ void v_APCI3120_Interrupt(int irq, void *d)
 		if (devpriv->b_AiCyclicAcquisition == APCI3120_ENABLE) {
 
 			/****************************/
-			/* Clear Timer Write TC INT */
+			/* Clear Timer Write TC int */
 			/****************************/
 
 			outl(APCI3120_CLEAR_WRITE_TC_INT,
@@ -1596,7 +1629,7 @@ void v_APCI3120_Interrupt(int irq, void *d)
 			/* Clears the timer status register */
 			/************************************/
 			inw(dev->iobase + APCI3120_TIMER_STATUS_REGISTER);
-			v_APCI3120_InterruptDma(irq, d);	// do some data transfer
+			v_APCI3120_InterruptDma(irq, d);	/*  do some data transfer */
 		} else {
 			/* Stops the Timer */
 			outw(devpriv->
@@ -1630,32 +1663,8 @@ void v_APCI3120_Interrupt(int irq, void *d)
 +----------------------------------------------------------------------------+
 */
 
-/*
- * int i_APCI3120_InterruptHandleEos(struct comedi_device *dev)
-{
-       int n_chan,i;
-       short *data;
-       struct comedi_subdevice *s=dev->subdevices+0;
-       struct comedi_async *async = s->async;
-       data=async->data+async->buf_int_ptr;
-        n_chan=devpriv->ui_AiNbrofChannels;
-
-       for(i=0;i<n_chan;i++)
-         {
-           data[i]=inw(dev->iobase+0);
-         }
-       async->buf_int_count+=n_chan*sizeof(short);
-       async->buf_int_ptr+=n_chan*sizeof(short);
-       comedi_eos(dev,s);
-       if (s->async->buf_int_ptr>=s->async->data_len) //  for buffer rool over
-		         {
-*//* buffer rollover */
-/*	        s->async->buf_int_ptr=0;
-		comedi_eobuf(dev,s);
-         }
- 	return 0;
-}*/
-int i_APCI3120_InterruptHandleEos(struct comedi_device * dev)
+
+int i_APCI3120_InterruptHandleEos(struct comedi_device *dev)
 {
 	int n_chan, i;
 	struct comedi_subdevice *s = dev->subdevices + 0;
@@ -1704,7 +1713,7 @@ void v_APCI3120_InterruptDma(int irq, void *d)
 	unsigned int next_dma_buf, samplesinbuf;
 	unsigned long low_word, high_word, var;
 
-	UINT ui_Tmp;
+	unsigned int ui_Tmp;
 	samplesinbuf =
 		devpriv->ui_DmaBufferUsesize[devpriv->ui_DmaActualBuffer] -
 		inl(devpriv->i_IobaseAmcc + AMCC_OP_REG_MWTC);
@@ -1720,20 +1729,20 @@ void v_APCI3120_InterruptDma(int irq, void *d)
 
 		return;
 	}
-	samplesinbuf = samplesinbuf >> 1;	// number of received samples
+	samplesinbuf = samplesinbuf >> 1;	/*  number of received samples */
 	if (devpriv->b_DmaDoubleBuffer) {
-		// switch DMA buffers if is used double buffering
+		/*  switch DMA buffers if is used double buffering */
 		next_dma_buf = 1 - devpriv->ui_DmaActualBuffer;
 
 		ui_Tmp = AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO;
 		outl(ui_Tmp, devpriv->i_IobaseAddon + AMCC_OP_REG_AGCSTS);
 
-		// changed  since 16 bit interface for add on
+		/*  changed  since 16 bit interface for add on */
 		outw(APCI3120_ADD_ON_AGCSTS_LOW, devpriv->i_IobaseAddon + 0);
 		outw(APCI3120_ENABLE_TRANSFER_ADD_ON_LOW,
 			devpriv->i_IobaseAddon + 2);
 		outw(APCI3120_ADD_ON_AGCSTS_HIGH, devpriv->i_IobaseAddon + 0);
-		outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2);	// 0x1000 is out putted in windows driver
+		outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2);	/*  0x1000 is out putted in windows driver */
 
 		var = devpriv->ul_DmaBufferHw[next_dma_buf];
 		low_word = var & 0xffff;
@@ -1761,54 +1770,18 @@ void v_APCI3120_InterruptDma(int irq, void *d)
 		outw(APCI3120_ADD_ON_MWTC_HIGH, devpriv->i_IobaseAddon + 0);
 		outw(high_word, devpriv->i_IobaseAddon + 2);
 
-		// To configure A2P FIFO
-		// ENABLE A2P FIFO WRITE AND ENABLE AMWEN
-		// AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03
+/*
+ * To configure A2P FIFO
+ * ENABLE A2P FIFO WRITE AND ENABLE AMWEN
+ * AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03
+ */
 		outw(3, devpriv->i_IobaseAddon + 4);
-		//initialise end of dma interrupt  AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI)
+		/* initialise end of dma interrupt  AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI) */
 		outl((APCI3120_FIFO_ADVANCE_ON_BYTE_2 |
 				APCI3120_ENABLE_WRITE_TC_INT),
 			devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR);
 
 	}
-/*UPDATE-0.7.57->0.7.68
-	ptr=(short *)devpriv->ul_DmaBufferVirtual[devpriv->ui_DmaActualBuffer];
-
-
-	// if there is not enough space left in the buffer to copy all data contained in the DMABufferVirtual
-	if(s->async->buf_int_ptr+samplesinbuf*sizeof(short)>=devpriv->ui_AiDataLength)
-	{
-		m=(devpriv->ui_AiDataLength-s->async->buf_int_ptr)/sizeof(short);
-		v_APCI3120_InterruptDmaMoveBlock16bit(dev,s,(void *)ptr,((void *)(devpriv->AiData))+s->async->buf_int_ptr,m);
-		s->async->buf_int_count+=m*sizeof(short);
-		ptr+=m*sizeof(short);
-                samplesinbuf-=m;
-		s->async->buf_int_ptr=0;
-		comedi_eobuf(dev,s);
-	}
-
-	if (samplesinbuf)
-	{
-	        v_APCI3120_InterruptDmaMoveBlock16bit(dev,s,(void *)ptr,((void *)(devpriv->AiData))+s->async->buf_int_ptr,samplesinbuf);
-
-		s->async->buf_int_count+=samplesinbuf*sizeof(short);
-		s->async->buf_int_ptr+=samplesinbuf*sizeof(short);
-		if (!(devpriv->ui_AiFlags & TRIG_WAKE_EOS))
-		{
-			comedi_bufcheck(dev,s);
-                }
-	}
-	if (!devpriv->b_AiContinuous)
-	if ( devpriv->ui_AiActualScan>=devpriv->ui_AiNbrofScans )
-	{
-	    // all data sampled
-	    i_APCI3120_StopCyclicAcquisition(dev,s);
-            devpriv->b_AiCyclicAcquisition=APCI3120_DISABLE;
-	    //DPRINTK("\n Single DMA completed..\n");
-		comedi_done(dev,s);
-            	return;
-	}
-*/
 	if (samplesinbuf) {
 		v_APCI3120_InterruptDmaMoveBlock16bit(dev, s,
 			devpriv->ul_DmaBufferVirtual[devpriv->
@@ -1821,7 +1794,7 @@ void v_APCI3120_InterruptDma(int irq, void *d)
 	}
 	if (!devpriv->b_AiContinuous)
 		if (devpriv->ui_AiActualScan >= devpriv->ui_AiNbrofScans) {
-			// all data sampled
+			/*  all data sampled */
 			i_APCI3120_StopCyclicAcquisition(dev, s);
 			devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE;
 			s->async->events |= COMEDI_CB_EOA;
@@ -1829,22 +1802,26 @@ void v_APCI3120_InterruptDma(int irq, void *d)
 			return;
 		}
 
-	if (devpriv->b_DmaDoubleBuffer) {	// switch dma buffers
+	if (devpriv->b_DmaDoubleBuffer) {	/*  switch dma buffers */
 		devpriv->ui_DmaActualBuffer = 1 - devpriv->ui_DmaActualBuffer;
 	} else {
-		// restart DMA if is not used double buffering
-		//ADDED REINITIALISE THE DMA
+/*
+ * restart DMA if is not used double buffering
+ * ADDED REINITIALISE THE DMA
+ */
 		ui_Tmp = AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO;
 		outl(ui_Tmp, devpriv->i_IobaseAddon + AMCC_OP_REG_AGCSTS);
 
-		// changed  since 16 bit interface for add on
+		/*  changed  since 16 bit interface for add on */
 		outw(APCI3120_ADD_ON_AGCSTS_LOW, devpriv->i_IobaseAddon + 0);
 		outw(APCI3120_ENABLE_TRANSFER_ADD_ON_LOW,
 			devpriv->i_IobaseAddon + 2);
 		outw(APCI3120_ADD_ON_AGCSTS_HIGH, devpriv->i_IobaseAddon + 0);
-		outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2);	//
-		// A2P FIFO MANAGEMENT
-		// A2P fifo reset  & transfer control enable
+		outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2);	/*  */
+/*
+ * A2P FIFO MANAGEMENT
+ * A2P fifo reset & transfer control enable
+ */
 		outl(APCI3120_A2P_FIFO_MANAGEMENT,
 			devpriv->i_IobaseAmcc + AMCC_OP_REG_MCSR);
 
@@ -1858,7 +1835,7 @@ void v_APCI3120_InterruptDma(int irq, void *d)
 		outw(high_word, devpriv->i_IobaseAddon + 2);
 
 		var = devpriv->ui_DmaBufferUsesize[0];
-		low_word = var & 0xffff;	//changed
+		low_word = var & 0xffff;	/* changed */
 		var = devpriv->ui_DmaBufferUsesize[0];
 		high_word = var / 65536;
 		outw(APCI3120_ADD_ON_MWTC_LOW, devpriv->i_IobaseAddon + 0);
@@ -1866,11 +1843,13 @@ void v_APCI3120_InterruptDma(int irq, void *d)
 		outw(APCI3120_ADD_ON_MWTC_HIGH, devpriv->i_IobaseAddon + 0);
 		outw(high_word, devpriv->i_IobaseAddon + 2);
 
-		// To configure A2P FIFO
-		//ENABLE A2P FIFO WRITE AND ENABLE AMWEN
-		// AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03
+/*
+ * To configure A2P FIFO
+ * ENABLE A2P FIFO WRITE AND ENABLE AMWEN
+ * AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03
+ */
 		outw(3, devpriv->i_IobaseAddon + 4);
-		//initialise end of dma interrupt  AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI)
+		/* initialise end of dma interrupt  AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI) */
 		outl((APCI3120_FIFO_ADVANCE_ON_BYTE_2 |
 				APCI3120_ENABLE_WRITE_TC_INT),
 			devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR);
@@ -1897,37 +1876,8 @@ void v_APCI3120_InterruptDma(int irq, void *d)
 +----------------------------------------------------------------------------+
 */
 
-/*void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,struct comedi_subdevice *s,short *dma,short *data,int n)
-{
-	int i,j,m;
-
-	j=s->async->cur_chan;
-	m=devpriv->ui_AiActualScanPosition;
-        for(i=0;i<n;i++)
-	{
-		*data=*dma;
-   		data++; dma++;
-		j++;
-		if(j>=devpriv->ui_AiNbrofChannels)
-		{
-			m+=j;
-			j=0;
-			if(m>=devpriv->ui_AiScanLength)
-			{
-				m=0;
-			        devpriv->ui_AiActualScan++;
-				if (devpriv->ui_AiFlags & TRIG_WAKE_EOS)
-;//UPDATE-0.7.57->0.7.68					comedi_eos(dev,s);
-			}
-		}
-	}
-        devpriv->ui_AiActualScanPosition=m;
-	s->async->cur_chan=j;
-
-}
-*/
-void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device * dev,
-	struct comedi_subdevice * s, short * dma_buffer, unsigned int num_samples)
+void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,
+	struct comedi_subdevice *s, short *dma_buffer, unsigned int num_samples)
 {
 	devpriv->ui_AiActualScan +=
 		(s->async->cur_chan + num_samples) / devpriv->ui_AiScanLength;
@@ -1968,71 +1918,77 @@ void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 
-	UINT ui_Timervalue2;
-	USHORT us_TmpValue;
-	BYTE b_Tmp;
+	unsigned int ui_Timervalue2;
+	unsigned short us_TmpValue;
+	unsigned char b_Tmp;
 
 	if (!data[1])
 		comedi_error(dev, "config:No timer constant !");
 
-	devpriv->b_Timer2Interrupt = (BYTE) data[2];	// save info whether to enable or disable interrupt
+	devpriv->b_Timer2Interrupt = (unsigned char) data[2];	/*  save info whether to enable or disable interrupt */
 
-	ui_Timervalue2 = data[1] / 1000;	// convert nano seconds  to u seconds
+	ui_Timervalue2 = data[1] / 1000;	/*  convert nano seconds  to u seconds */
 
-	//this_board->i_hwdrv_InsnConfigTimer(dev, ui_Timervalue2,(BYTE)data[0]);
-	us_TmpValue = (USHORT) inw(devpriv->iobase + APCI3120_RD_STATUS);
+	/* this_board->i_hwdrv_InsnConfigTimer(dev, ui_Timervalue2,(unsigned char)data[0]); */
+	us_TmpValue = (unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS);
 
-	//EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001
-	// and calculate the time value to set in the timer
+/*
+ * EL250804: Testing if board APCI3120 have the new Quartz or if it
+ * is an APCI3001 and calculate the time value to set in the timer
+ */
 	if ((us_TmpValue & 0x00B0) == 0x00B0
 		|| !strcmp(this_board->pc_DriverName, "apci3001")) {
-		//Calculate the time value to set in the timer
+		/* Calculate the time value to set in the timer */
 		ui_Timervalue2 = ui_Timervalue2 / 50;
 	} else {
-		//Calculate the time value to set in the timer
+		/* Calculate the time value to set in the timer */
 		ui_Timervalue2 = ui_Timervalue2 / 70;
 	}
 
-	//Reset gate 2 of Timer 2 to disable it (Set Bit D14 to 0)
+	/* Reset gate 2 of Timer 2 to disable it (Set Bit D14 to 0) */
 	devpriv->us_OutputRegister =
 		devpriv->us_OutputRegister & APCI3120_DISABLE_TIMER2;
 	outw(devpriv->us_OutputRegister, devpriv->iobase + APCI3120_WR_ADDRESS);
 
-	// Disable TIMER Interrupt
+	/*  Disable TIMER Interrupt */
 	devpriv->b_ModeSelectRegister =
 		devpriv->
 		b_ModeSelectRegister & APCI3120_DISABLE_TIMER_INT & 0xEF;
 
-	// Disable Eoc and Eos Interrupts
+	/*  Disable Eoc and Eos Interrupts */
 	devpriv->b_ModeSelectRegister =
 		devpriv->
 		b_ModeSelectRegister & APCI3120_DISABLE_EOC_INT &
 		APCI3120_DISABLE_EOS_INT;
 	outb(devpriv->b_ModeSelectRegister,
 		devpriv->iobase + APCI3120_WRITE_MODE_SELECT);
-	if (data[0] == APCI3120_TIMER)	//initialize timer
+	if (data[0] == APCI3120_TIMER)	/* initialize timer */
 	{
+		/* devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister |
+		 * APCI3120_ENABLE_TIMER_INT; */
 
-		//devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister| APCI3120_ENABLE_TIMER_INT ;
-		//outb(devpriv->b_ModeSelectRegister,devpriv->iobase+APCI3120_WRITE_MODE_SELECT);
+		/* outb(devpriv->b_ModeSelectRegister,devpriv->iobase+APCI3120_WRITE_MODE_SELECT); */
 
-		//Set the Timer 2 in mode 2(Timer)
+		/* Set the Timer 2 in mode 2(Timer) */
 		devpriv->b_TimerSelectMode =
 			(devpriv->
 			b_TimerSelectMode & 0x0F) | APCI3120_TIMER_2_MODE_2;
 		outb(devpriv->b_TimerSelectMode,
 			devpriv->iobase + APCI3120_TIMER_CRT1);
 
-		//Configure the timer 2 for writing the LOW WORD of timer is Delay value
-		//You must make a b_tmp variable with DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0
-		//you can set the digital output and configure the timer 2,and if you don't make this, digital output
-		//are erase (Set to 0)
-
-		//Writing LOW WORD
+/*
+ * Configure the timer 2 for writing the LOW unsigned short of timer
+ * is Delay value You must make a b_tmp variable with
+ * DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0
+ * you can set the digital output and configure the timer 2,and if
+ * you don't make this, digital output are erase (Set to 0)
+ */
+
+		/* Writing LOW unsigned short */
 		b_Tmp = ((devpriv->
 				b_DigitalOutputRegister) & 0xF0) |
 			APCI3120_SELECT_TIMER_2_LOW_WORD;
@@ -2040,20 +1996,20 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi
 		outw(LOWORD(ui_Timervalue2),
 			devpriv->iobase + APCI3120_TIMER_VALUE);
 
-		//Writing HIGH WORD
+		/* Writing HIGH unsigned short */
 		b_Tmp = ((devpriv->
 				b_DigitalOutputRegister) & 0xF0) |
 			APCI3120_SELECT_TIMER_2_HIGH_WORD;
 		outb(b_Tmp, devpriv->iobase + APCI3120_TIMER_CRT0);
 		outw(HIWORD(ui_Timervalue2),
 			devpriv->iobase + APCI3120_TIMER_VALUE);
-		// timer2 in Timer mode enabled
+		/*  timer2 in Timer mode enabled */
 		devpriv->b_Timer2Mode = APCI3120_TIMER;
 
-	} else			// Initialize Watch dog
+	} else			/*  Initialize Watch dog */
 	{
 
-		//Set the Timer 2 in mode 5(Watchdog)
+		/* Set the Timer 2 in mode 5(Watchdog) */
 
 		devpriv->b_TimerSelectMode =
 			(devpriv->
@@ -2061,12 +2017,15 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi
 		outb(devpriv->b_TimerSelectMode,
 			devpriv->iobase + APCI3120_TIMER_CRT1);
 
-		//Configure the timer 2 for writing the LOW WORD of timer is Delay value
-		//You must make a b_tmp variable with DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0
-		//you can set the digital output and configure the timer 2,and if you don't make this, digital output
-		//are erase (Set to 0)
-
-		//Writing LOW WORD
+/*
+ * Configure the timer 2 for writing the LOW unsigned short of timer
+ * is Delay value You must make a b_tmp variable with
+ * DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0
+ * you can set the digital output and configure the timer 2,and if
+ * you don't make this, digital output are erase (Set to 0)
+ */
+
+		/* Writing LOW unsigned short */
 		b_Tmp = ((devpriv->
 				b_DigitalOutputRegister) & 0xF0) |
 			APCI3120_SELECT_TIMER_2_LOW_WORD;
@@ -2074,7 +2033,7 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi
 		outw(LOWORD(ui_Timervalue2),
 			devpriv->iobase + APCI3120_TIMER_VALUE);
 
-		//Writing HIGH WORD
+		/* Writing HIGH unsigned short */
 		b_Tmp = ((devpriv->
 				b_DigitalOutputRegister) & 0xF0) |
 			APCI3120_SELECT_TIMER_2_HIGH_WORD;
@@ -2082,7 +2041,7 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi
 
 		outw(HIWORD(ui_Timervalue2),
 			devpriv->iobase + APCI3120_TIMER_VALUE);
-		//watchdog enabled
+		/* watchdog enabled */
 		devpriv->b_Timer2Mode = APCI3120_WATCHDOG;
 
 	}
@@ -2119,13 +2078,13 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3120_InsnWriteTimer(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 
-	UINT ui_Timervalue2 = 0;
-	USHORT us_TmpValue;
-	BYTE b_Tmp;
+	unsigned int ui_Timervalue2 = 0;
+	unsigned short us_TmpValue;
+	unsigned char b_Tmp;
 
 	if ((devpriv->b_Timer2Mode != APCI3120_WATCHDOG)
 		&& (devpriv->b_Timer2Mode != APCI3120_TIMER)) {
@@ -2133,7 +2092,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic
 		return -EINVAL;
 	}
 
-	if (data[0] == 2)	// write new value
+	if (data[0] == 2)	/*  write new value */
 	{
 		if (devpriv->b_Timer2Mode != APCI3120_TIMER) {
 			comedi_error(dev,
@@ -2147,35 +2106,35 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic
 			ui_Timervalue2 = 0;
 	}
 
-	//this_board->i_hwdrv_InsnWriteTimer(dev,data[0],ui_Timervalue2);
+	/* this_board->i_hwdrv_InsnWriteTimer(dev,data[0],ui_Timervalue2); */
 
 	switch (data[0]) {
 	case APCI3120_START:
 
-		// Reset FC_TIMER BIT
+		/*  Reset FC_TIMER BIT */
 		inb(devpriv->iobase + APCI3120_TIMER_STATUS_REGISTER);
-		if (devpriv->b_Timer2Mode == APCI3120_TIMER)	//start timer
+		if (devpriv->b_Timer2Mode == APCI3120_TIMER)	/* start timer */
 		{
-			//Enable Timer
+			/* Enable Timer */
 			devpriv->b_ModeSelectRegister =
 				devpriv->b_ModeSelectRegister & 0x0B;
-		} else		//start watch dog
+		} else		/* start watch dog */
 		{
-			//Enable WatchDog
+			/* Enable WatchDog */
 			devpriv->b_ModeSelectRegister =
 				(devpriv->
 				b_ModeSelectRegister & 0x0B) |
 				APCI3120_ENABLE_WATCHDOG;
 		}
 
-		//enable disable interrupt
+		/* enable disable interrupt */
 		if ((devpriv->b_Timer2Interrupt) == APCI3120_ENABLE) {
 
 			devpriv->b_ModeSelectRegister =
 				devpriv->
 				b_ModeSelectRegister |
 				APCI3120_ENABLE_TIMER_INT;
-			// save the task structure to pass info to user
+			/*  save the task structure to pass info to user */
 			devpriv->tsk_Current = current;
 		} else {
 
@@ -2187,9 +2146,9 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic
 		outb(devpriv->b_ModeSelectRegister,
 			devpriv->iobase + APCI3120_WRITE_MODE_SELECT);
 
-		if (devpriv->b_Timer2Mode == APCI3120_TIMER)	//start timer
+		if (devpriv->b_Timer2Mode == APCI3120_TIMER)	/* start timer */
 		{
-			//For Timer mode is  Gate2 must be activated   **timer started
+			/* For Timer mode is  Gate2 must be activated   **timer started */
 			devpriv->us_OutputRegister =
 				devpriv->
 				us_OutputRegister | APCI3120_ENABLE_TIMER2;
@@ -2201,62 +2160,64 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic
 
 	case APCI3120_STOP:
 		if (devpriv->b_Timer2Mode == APCI3120_TIMER) {
-			//Disable timer
+			/* Disable timer */
 			devpriv->b_ModeSelectRegister =
 				devpriv->
 				b_ModeSelectRegister &
 				APCI3120_DISABLE_TIMER_COUNTER;
 		} else {
-			//Disable WatchDog
+			/* Disable WatchDog */
 			devpriv->b_ModeSelectRegister =
 				devpriv->
 				b_ModeSelectRegister &
 				APCI3120_DISABLE_WATCHDOG;
 		}
-		// Disable timer interrupt
+		/*  Disable timer interrupt */
 		devpriv->b_ModeSelectRegister =
 			devpriv->
 			b_ModeSelectRegister & APCI3120_DISABLE_TIMER_INT;
 
-		// Write above states  to register
+		/*  Write above states  to register */
 		outb(devpriv->b_ModeSelectRegister,
 			devpriv->iobase + APCI3120_WRITE_MODE_SELECT);
 
-		// Reset Gate 2
+		/*  Reset Gate 2 */
 		devpriv->us_OutputRegister =
 			devpriv->us_OutputRegister & APCI3120_DISABLE_TIMER_INT;
 		outw(devpriv->us_OutputRegister,
 			devpriv->iobase + APCI3120_WR_ADDRESS);
 
-		// Reset FC_TIMER BIT
+		/*  Reset FC_TIMER BIT */
 		inb(devpriv->iobase + APCI3120_TIMER_STATUS_REGISTER);
 
-		// Disable timer
-		//devpriv->b_Timer2Mode=APCI3120_DISABLE;
+		/* Disable timer */
+		/* devpriv->b_Timer2Mode=APCI3120_DISABLE;  */
 
 		break;
 
-	case 2:		//write new value to Timer
+	case 2:		/* write new value to Timer */
 		if (devpriv->b_Timer2Mode != APCI3120_TIMER) {
 			comedi_error(dev,
 				"write :timer2  not configured  in TIMER MODE");
 			return -EINVAL;
 		}
-		// ui_Timervalue2=data[1]; // passed as argument
+		/*  ui_Timervalue2=data[1]; // passed as argument */
 		us_TmpValue =
-			(USHORT) inw(devpriv->iobase + APCI3120_RD_STATUS);
+			(unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS);
 
-		//EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001
-		// and calculate the time value to set in the timer
+/*
+ * EL250804: Testing if board APCI3120 have the new Quartz or if it
+ * is an APCI3001 and calculate the time value to set in the timer
+ */
 		if ((us_TmpValue & 0x00B0) == 0x00B0
 			|| !strcmp(this_board->pc_DriverName, "apci3001")) {
-			//Calculate the time value to set in the timer
+			/* Calculate the time value to set in the timer */
 			ui_Timervalue2 = ui_Timervalue2 / 50;
 		} else {
-			//Calculate the time value to set in the timer
+			/* Calculate the time value to set in the timer */
 			ui_Timervalue2 = ui_Timervalue2 / 70;
 		}
-		//Writing LOW WORD
+		/* Writing LOW unsigned short */
 		b_Tmp = ((devpriv->
 				b_DigitalOutputRegister) & 0xF0) |
 			APCI3120_SELECT_TIMER_2_LOW_WORD;
@@ -2265,7 +2226,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic
 		outw(LOWORD(ui_Timervalue2),
 			devpriv->iobase + APCI3120_TIMER_VALUE);
 
-		//Writing HIGH WORD
+		/* Writing HIGH unsigned short */
 		b_Tmp = ((devpriv->
 				b_DigitalOutputRegister) & 0xF0) |
 			APCI3120_SELECT_TIMER_2_HIGH_WORD;
@@ -2276,7 +2237,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic
 
 		break;
 	default:
-		return -EINVAL;	// Not a valid input
+		return -EINVAL;	/*  Not a valid input */
 	}
 
 	return insn->n;
@@ -2305,21 +2266,21 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic
 |                    													     |
 +----------------------------------------------------------------------------+
 */
-int i_APCI3120_InsnReadTimer(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3120_InsnReadTimer(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	BYTE b_Tmp;
-	USHORT us_TmpValue, us_TmpValue_2, us_StatusValue;
+	unsigned char b_Tmp;
+	unsigned short us_TmpValue, us_TmpValue_2, us_StatusValue;
 
 	if ((devpriv->b_Timer2Mode != APCI3120_WATCHDOG)
 		&& (devpriv->b_Timer2Mode != APCI3120_TIMER)) {
 		comedi_error(dev, "\nread:timer2  not configured ");
 	}
 
-	//this_board->i_hwdrv_InsnReadTimer(dev,data);
+	/* this_board->i_hwdrv_InsnReadTimer(dev,data); */
 	if (devpriv->b_Timer2Mode == APCI3120_TIMER) {
 
-		//Read the LOW WORD of Timer 2 register
+		/* Read the LOW unsigned short of Timer 2 register */
 		b_Tmp = ((devpriv->
 				b_DigitalOutputRegister) & 0xF0) |
 			APCI3120_SELECT_TIMER_2_LOW_WORD;
@@ -2327,7 +2288,7 @@ int i_APCI3120_InsnReadTimer(struct comedi_device * dev, struct comedi_subdevice
 
 		us_TmpValue = inw(devpriv->iobase + APCI3120_TIMER_VALUE);
 
-		//Read the HIGH WORD of Timer 2 register
+		/* Read the HIGH unsigned short of Timer 2 register */
 		b_Tmp = ((devpriv->
 				b_DigitalOutputRegister) & 0xF0) |
 			APCI3120_SELECT_TIMER_2_HIGH_WORD;
@@ -2335,20 +2296,20 @@ int i_APCI3120_InsnReadTimer(struct comedi_device * dev, struct comedi_subdevice
 
 		us_TmpValue_2 = inw(devpriv->iobase + APCI3120_TIMER_VALUE);
 
-		// combining both words
-		data[0] = (UINT) ((us_TmpValue) | ((us_TmpValue_2) << 16));
+		/*  combining both words */
+		data[0] = (unsigned int) ((us_TmpValue) | ((us_TmpValue_2) << 16));
 
-	} else			// Read watch dog status
+	} else			/*  Read watch dog status */
 	{
 
 		us_StatusValue = inw(devpriv->iobase + APCI3120_RD_STATUS);
 		us_StatusValue =
 			((us_StatusValue & APCI3120_FC_TIMER) >> 12) & 1;
 		if (us_StatusValue == 1) {
-			// RESET FC_TIMER BIT
+			/*  RESET FC_TIMER BIT */
 			inb(devpriv->iobase + APCI3120_TIMER_STATUS_REGISTER);
 		}
-		data[0] = us_StatusValue;	// when data[0] = 1 then the watch dog has rundown
+		data[0] = us_StatusValue;	/*  when data[0] = 1 then the watch dog has rundown */
 	}
 	return insn->n;
 }
@@ -2384,21 +2345,23 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev,
 				    struct comedi_insn *insn,
 				    unsigned int *data)
 {
-	UINT ui_Chan, ui_TmpValue;
+	unsigned int ui_Chan, ui_TmpValue;
 
-	ui_Chan = CR_CHAN(insn->chanspec);	// channel specified
+	ui_Chan = CR_CHAN(insn->chanspec);	/*  channel specified */
 
-	//this_board->i_hwdrv_InsnReadDigitalInput(dev,ui_Chan,data);
+	/* this_board->i_hwdrv_InsnReadDigitalInput(dev,ui_Chan,data); */
 	if (ui_Chan >= 0 && ui_Chan <= 3) {
-		ui_TmpValue = (UINT) inw(devpriv->iobase + APCI3120_RD_STATUS);
+		ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS);
 
-		//      since only 1 channel reqd  to bring it to last bit it is rotated
-		//  8 +(chan - 1) times then ANDed with 1 for last bit.
+/*
+ * since only 1 channel reqd to bring it to last bit it is rotated 8
+ * +(chan - 1) times then ANDed with 1 for last bit.
+ */
 		*data = (ui_TmpValue >> (ui_Chan + 8)) & 1;
-		//return 0;
+		/* return 0; */
 	} else {
-		//      comedi_error(dev," chan spec wrong");
-		return -EINVAL;	// "sorry channel spec wrong "
+		/*       comedi_error(dev," chan spec wrong"); */
+		return -EINVAL;	/*  "sorry channel spec wrong " */
 	}
 	return insn->n;
 
@@ -2423,18 +2386,18 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev,
 |                    													     |
 +----------------------------------------------------------------------------+
 */
-int i_APCI3120_InsnBitsDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_TmpValue;
-	ui_TmpValue = (UINT) inw(devpriv->iobase + APCI3120_RD_STATUS);
+	unsigned int ui_TmpValue;
+	ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS);
 	/*****	state of 4 channels  in the 11, 10, 9, 8   bits of status reg
 			rotated right 8 times to bring them to last four bits
 			ANDed with oxf for  value.
 	*****/
 
 	*data = (ui_TmpValue >> 8) & 0xf;
-	//this_board->i_hwdrv_InsnBitsDigitalInput(dev,data);
+	/* this_board->i_hwdrv_InsnBitsDigitalInput(dev,data); */
 	return insn->n;
 }
 
@@ -2462,8 +2425,8 @@ int i_APCI3120_InsnBitsDigitalInput(struct comedi_device * dev, struct comedi_su
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 
 	if ((data[0] != 0) && (data[0] != 1)) {
@@ -2481,7 +2444,7 @@ int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device * dev,
 	if (!devpriv->b_OutputMemoryStatus) {
 		ui_Temp = 0;
 
-	}			//if(!devpriv->b_OutputMemoryStatus )
+	}			/* if(!devpriv->b_OutputMemoryStatus ) */
 
 	return insn->n;
 }
@@ -2499,16 +2462,16 @@ int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device * dev,
 |                     struct comedi_subdevice *s									 |
 |                     struct comedi_insn *insn                                      |
 |                     unsigned int *data 										 |
-                      data[0]     Value to be written
-                      data[1]    :1 Set digital o/p ON
-                      data[1]     2 Set digital o/p OFF with memory ON
+|                      data[0]     Value to be written
+|                      data[1]    :1 Set digital o/p ON
+|                      data[1]     2 Set digital o/p OFF with memory ON
 +----------------------------------------------------------------------------+
 | Return Value      :              					                         |
 |                    													     |
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device * dev,
+int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device *dev,
 				     struct comedi_subdevice *s,
 				     struct comedi_insn *insn,
 				     unsigned int *data)
@@ -2530,7 +2493,7 @@ int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device * dev,
 	default:
 		printk("\nThe parameter passed is in error \n");
 		return -EINVAL;
-	}			// switch(data[1])
+	}			/*  switch(data[1]) */
 	outb(data[0], devpriv->iobase + APCI3120_DIGITAL_OUTPUT);
 
 	devpriv->b_DigitalOutputRegister = data[0] & 0xF0;
@@ -2567,9 +2530,9 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev,
 				      unsigned int *data)
 {
 
-	UINT ui_Temp1;
+	unsigned int ui_Temp1;
 
-	UINT ui_NoOfChannel = CR_CHAN(insn->chanspec);	// get the channel
+	unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec);	/*  get the channel */
 
 	if ((data[0] != 0) && (data[0] != 1)) {
 		comedi_error(dev,
@@ -2586,7 +2549,7 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev,
 	switch (data[1]) {
 	case 1:
 		data[0] = (data[0] << ui_NoOfChannel);
-//ES05                   data[0]=(data[0]<<4)|ui_Temp;
+/* ES05                   data[0]=(data[0]<<4)|ui_Temp; */
 		data[0] = (data[0] << 4) | devpriv->b_DigitalOutputRegister;
 		break;
 
@@ -2595,24 +2558,24 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev,
 		ui_Temp1 = 1;
 		ui_Temp1 = ui_Temp1 << ui_NoOfChannel;
 		ui_Temp1 = ui_Temp1 << 4;
-//ES05                   ui_Temp=ui_Temp|ui_Temp1;
+/* ES05                   ui_Temp=ui_Temp|ui_Temp1; */
 		devpriv->b_DigitalOutputRegister =
 			devpriv->b_DigitalOutputRegister | ui_Temp1;
 
 		data[0] = (data[0] << ui_NoOfChannel) ^ 0xf;
 		data[0] = data[0] << 4;
-//ES05                   data[0]=data[0]& ui_Temp;
+/* ES05                   data[0]=data[0]& ui_Temp; */
 		data[0] = data[0] & devpriv->b_DigitalOutputRegister;
 		break;
 	default:
 		printk("\nThe parameter passed is in error \n");
 		return -EINVAL;
-	}			// switch(data[1])
+	}			/*  switch(data[1]) */
 	outb(data[0], devpriv->iobase + APCI3120_DIGITAL_OUTPUT);
 
-//ES05        ui_Temp=data[0] & 0xf0;
+/* ES05        ui_Temp=data[0] & 0xf0; */
 	devpriv->b_DigitalOutputRegister = data[0] & 0xf0;
-	return (insn->n);
+	return insn->n;
 
 }
 
@@ -2646,14 +2609,14 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev,
 				     struct comedi_insn *insn,
 				     unsigned int *data)
 {
-	UINT ui_Range, ui_Channel;
-	USHORT us_TmpValue;
+	unsigned int ui_Range, ui_Channel;
+	unsigned short us_TmpValue;
 
 	ui_Range = CR_RANGE(insn->chanspec);
 	ui_Channel = CR_CHAN(insn->chanspec);
 
-	//this_board->i_hwdrv_InsnWriteAnalogOutput(dev, ui_Range, ui_Channel,data[0]);
-	if (ui_Range)		// if 1 then unipolar
+	/* this_board->i_hwdrv_InsnWriteAnalogOutput(dev, ui_Range, ui_Channel,data[0]); */
+	if (ui_Range)		/*  if 1 then unipolar */
 	{
 
 		if (data[0] != 0)
@@ -2665,7 +2628,7 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev,
 				((((ui_Channel & 0x03) << 14) & 0xC000) | (1 <<
 					13) | 8192);
 
-	} else			// if 0 then   bipolar
+	} else			/*  if 0 then   bipolar */
 	{
 		data[0] =
 			((((ui_Channel & 0x03) << 14) & 0xC000) | (0 << 13) |
@@ -2673,24 +2636,30 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev,
 
 	}
 
-	//out put n values at the given channel.
-	// rt_printk("\nwaiting for DA_READY BIT");
-	do			//Waiting of DA_READY BIT
+/*
+ * out put n values at the given channel. printk("\nwaiting for
+ * DA_READY BIT");
+ */
+	do			/* Waiting of DA_READY BIT */
 	{
 		us_TmpValue =
-			((USHORT) inw(devpriv->iobase +
+			((unsigned short) inw(devpriv->iobase +
 				APCI3120_RD_STATUS)) & 0x0001;
 	} while (us_TmpValue != 0x0001);
 
 	if (ui_Channel <= 3)
-		// for channel 0-3 out at  the register 1 (wrDac1-8)
-		// data[i] typecasted to ushort since  word write is to be done
-		outw((USHORT) data[0],
+/*
+ * for channel 0-3 out at the register 1 (wrDac1-8) data[i]
+ * typecasted to ushort since word write is to be done
+ */
+		outw((unsigned short) data[0],
 			devpriv->iobase + APCI3120_ANALOG_OUTPUT_1);
 	else
-		// for channel 4-7 out at the register 2 (wrDac5-8)
-		//data[i] typecasted to ushort since  word write is to be done
-		outw((USHORT) data[0],
+/*
+ * for channel 4-7 out at the register 2 (wrDac5-8) data[i]
+ * typecasted to ushort since word write is to be done
+ */
+		outw((unsigned short) data[0],
 			devpriv->iobase + APCI3120_ANALOG_OUTPUT_2);
 
 	return insn->n;

+ 75 - 67
drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h

@@ -1,5 +1,5 @@
 
-// hwdrv_apci3120.h
+/* hwdrv_apci3120.h */
 
 /*
  * Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
@@ -18,9 +18,9 @@
  * any later version.
  */
 
-// comedi related defines
+/* comedi related defines */
 
-//ANALOG INPUT RANGE
+/* ANALOG INPUT RANGE */
 static const struct comedi_lrange range_apci3120_ai = { 8, {
 						     BIP_RANGE(10),
 						     BIP_RANGE(5),
@@ -33,14 +33,14 @@ static const struct comedi_lrange range_apci3120_ai = { 8, {
 						     }
 };
 
-// ANALOG OUTPUT RANGE
+/* ANALOG OUTPUT RANGE */
 static const struct comedi_lrange range_apci3120_ao = { 2, {
 						     BIP_RANGE(10),
 						     UNI_RANGE(10)
 						     }
 };
 
-#define APCI3120_BIPOLAR_RANGES	4	// used for test on mixture of BIP/UNI ranges
+#define APCI3120_BIPOLAR_RANGES	4	/*  used for test on mixture of BIP/UNI ranges */
 
 #define APCI3120_BOARD_VENDOR_ID                 0x10E8
 #define APCI3120_ADDRESS_RANGE            			16
@@ -55,17 +55,17 @@ static const struct comedi_lrange range_apci3120_ao = { 2, {
 #define     APCI3120_EOS_MODE         2
 #define     APCI3120_DMA_MODE         3
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 #define APCI3120_DIGITAL_OUTPUT                  	0x0D
 #define APCI3120_RD_STATUS                       	0x02
 #define APCI3120_RD_FIFO                     		0x00
 
-// digital output insn_write ON /OFF selection
+/* digital output insn_write ON /OFF selection */
 #define	APCI3120_SET4DIGITALOUTPUTON				1
 #define APCI3120_SET4DIGITALOUTPUTOFF				0
 
-// analog output SELECT BIT
+/* analog output SELECT BIT */
 #define APCI3120_ANALOG_OP_CHANNEL_1   0x0000
 #define APCI3120_ANALOG_OP_CHANNEL_2   0x4000
 #define APCI3120_ANALOG_OP_CHANNEL_3   0x8000
@@ -75,32 +75,32 @@ static const struct comedi_lrange range_apci3120_ao = { 2, {
 #define APCI3120_ANALOG_OP_CHANNEL_7   0x8000
 #define APCI3120_ANALOG_OP_CHANNEL_8   0xC000
 
-// Enable external trigger bit in nWrAddress
+/* Enable external trigger bit in nWrAddress */
 #define APCI3120_ENABLE_EXT_TRIGGER    0x8000
 
-//ANALOG OUTPUT AND INPUT DEFINE
-#define APCI3120_UNIPOLAR 0x80	//$$ RAM sequence polarity BIT
-#define APCI3120_BIPOLAR  0x00	//$$ RAM sequence polarity BIT
-#define APCI3120_ANALOG_OUTPUT_1 0x08	// (ADDRESS )
-#define APCI3120_ANALOG_OUTPUT_2 0x0A	// (ADDRESS )
-#define APCI3120_1_GAIN              0x00	//$$ RAM sequence Gain Bits for gain 1
-#define APCI3120_2_GAIN              0x10	//$$ RAM sequence Gain Bits for gain 2
-#define APCI3120_5_GAIN              0x20	//$$ RAM sequence Gain Bits for gain 5
-#define APCI3120_10_GAIN             0x30	//$$ RAM sequence Gain Bits for gain 10
-#define APCI3120_SEQ_RAM_ADDRESS        0x06	//$$ EARLIER NAMED APCI3120_FIFO_ADDRESS
-#define APCI3120_RESET_FIFO          0x0C	//(ADDRESS)
-#define APCI3120_TIMER_0_MODE_2      0x01	//$$ Bits for timer mode
+/* ANALOG OUTPUT AND INPUT DEFINE */
+#define APCI3120_UNIPOLAR 0x80	/* $$ RAM sequence polarity BIT */
+#define APCI3120_BIPOLAR  0x00	/* $$ RAM sequence polarity BIT */
+#define APCI3120_ANALOG_OUTPUT_1 0x08	/*  (ADDRESS ) */
+#define APCI3120_ANALOG_OUTPUT_2 0x0A	/*  (ADDRESS ) */
+#define APCI3120_1_GAIN              0x00	/* $$ RAM sequence Gain Bits for gain 1 */
+#define APCI3120_2_GAIN              0x10	/* $$ RAM sequence Gain Bits for gain 2 */
+#define APCI3120_5_GAIN              0x20	/* $$ RAM sequence Gain Bits for gain 5 */
+#define APCI3120_10_GAIN             0x30	/* $$ RAM sequence Gain Bits for gain 10 */
+#define APCI3120_SEQ_RAM_ADDRESS        0x06	/* $$ EARLIER NAMED APCI3120_FIFO_ADDRESS */
+#define APCI3120_RESET_FIFO          0x0C	/* (ADDRESS) */
+#define APCI3120_TIMER_0_MODE_2      0x01	/* $$ Bits for timer mode */
 #define APCI3120_TIMER_0_MODE_4       0x2
 #define APCI3120_SELECT_TIMER_0_WORD 0x00
-#define APCI3120_ENABLE_TIMER0     0x1000	//$$Gatebit 0 in nWrAddress
+#define APCI3120_ENABLE_TIMER0     0x1000	/* $$Gatebit 0 in nWrAddress */
 #define APCI3120_CLEAR_PR          0xF0FF
 #define APCI3120_CLEAR_PA          0xFFF0
 #define APCI3120_CLEAR_PA_PR       (APCI3120_CLEAR_PR & APCI3120_CLEAR_PA)
 
-// nWrMode_Select
-#define APCI3120_ENABLE_SCAN          0x8	//$$ bit in nWrMode_Select
+/* nWrMode_Select */
+#define APCI3120_ENABLE_SCAN          0x8	/* $$ bit in nWrMode_Select */
 #define APCI3120_DISABLE_SCAN      (~APCI3120_ENABLE_SCAN)
-#define APCI3120_ENABLE_EOS_INT       0x2	//$$ bit in nWrMode_Select
+#define APCI3120_ENABLE_EOS_INT       0x2	/* $$ bit in nWrMode_Select */
 
 #define APCI3120_DISABLE_EOS_INT   (~APCI3120_ENABLE_EOS_INT)
 #define APCI3120_ENABLE_EOC_INT       0x1
@@ -108,50 +108,50 @@ static const struct comedi_lrange range_apci3120_ao = { 2, {
 #define APCI3120_DISABLE_ALL_INTERRUPT_WITHOUT_TIMER   (APCI3120_DISABLE_EOS_INT & APCI3120_DISABLE_EOC_INT)
 #define APCI3120_DISABLE_ALL_INTERRUPT   (APCI3120_DISABLE_TIMER_INT & APCI3120_DISABLE_EOS_INT & APCI3120_DISABLE_EOC_INT)
 
-//status register bits
+/* status register bits */
 #define APCI3120_EOC                     0x8000
 #define APCI3120_EOS                     0x2000
 
-// software trigger dummy register
-#define APCI3120_START_CONVERSION        0x02	//(ADDRESS)
+/* software trigger dummy register */
+#define APCI3120_START_CONVERSION        0x02	/* (ADDRESS) */
 
-//TIMER DEFINE
+/* TIMER DEFINE */
 #define APCI3120_QUARTZ_A				  70
 #define APCI3120_QUARTZ_B				  50
 #define APCI3120_TIMER                            1
 #define APCI3120_WATCHDOG                         2
 #define APCI3120_TIMER_DISABLE                    0
 #define APCI3120_TIMER_ENABLE                     1
-#define APCI3120_ENABLE_TIMER2                    0x4000	//$$ gatebit 2 in nWrAddress
+#define APCI3120_ENABLE_TIMER2                    0x4000	/* $$ gatebit 2 in nWrAddress */
 #define APCI3120_DISABLE_TIMER2                   (~APCI3120_ENABLE_TIMER2)
-#define APCI3120_ENABLE_TIMER_INT                 0x04	//$$ ENAIRQ_FC_Bit in nWrModeSelect
+#define APCI3120_ENABLE_TIMER_INT                 0x04	/* $$ ENAIRQ_FC_Bit in nWrModeSelect */
 #define APCI3120_DISABLE_TIMER_INT                (~APCI3120_ENABLE_TIMER_INT)
-#define APCI3120_WRITE_MODE_SELECT                0x0E	// (ADDRESS)
+#define APCI3120_WRITE_MODE_SELECT                0x0E	/*  (ADDRESS) */
 #define APCI3120_SELECT_TIMER_0_WORD  0x00
 #define APCI3120_SELECT_TIMER_1_WORD  0x01
 #define APCI3120_TIMER_1_MODE_2       0x4
 
-//$$ BIT FOR MODE IN nCsTimerCtr1
+/* $$ BIT FOR MODE IN nCsTimerCtr1 */
 #define APCI3120_TIMER_2_MODE_0                   0x0
 #define APCI3120_TIMER_2_MODE_2                   0x10
 #define APCI3120_TIMER_2_MODE_5                   0x30
 
-//$$ BIT FOR MODE IN nCsTimerCtr0
+/* $$ BIT FOR MODE IN nCsTimerCtr0 */
 #define APCI3120_SELECT_TIMER_2_LOW_WORD          0x02
 #define APCI3120_SELECT_TIMER_2_HIGH_WORD         0x03
 
-#define APCI3120_TIMER_CRT0                       0x0D	//(ADDRESS for cCsTimerCtr0)
-#define APCI3120_TIMER_CRT1                       0x0C	//(ADDRESS for cCsTimerCtr1)
+#define APCI3120_TIMER_CRT0                       0x0D	/* (ADDRESS for cCsTimerCtr0) */
+#define APCI3120_TIMER_CRT1                       0x0C	/* (ADDRESS for cCsTimerCtr1) */
 
-#define APCI3120_TIMER_VALUE                      0x04	//ADDRESS for nCsTimerWert
-#define APCI3120_TIMER_STATUS_REGISTER            0x0D	//ADDRESS for delete timer 2 interrupt
-#define APCI3120_RD_STATUS                        0x02	//ADDRESS
-#define APCI3120_WR_ADDRESS                       0x00	//ADDRESS
-#define APCI3120_ENABLE_WATCHDOG                  0x20	//$$BIT in nWrMode_Select
+#define APCI3120_TIMER_VALUE                      0x04	/* ADDRESS for nCsTimerWert */
+#define APCI3120_TIMER_STATUS_REGISTER            0x0D	/* ADDRESS for delete timer 2 interrupt */
+#define APCI3120_RD_STATUS                        0x02	/* ADDRESS */
+#define APCI3120_WR_ADDRESS                       0x00	/* ADDRESS */
+#define APCI3120_ENABLE_WATCHDOG                  0x20	/* $$BIT in nWrMode_Select */
 #define APCI3120_DISABLE_WATCHDOG                 (~APCI3120_ENABLE_WATCHDOG)
-#define APCI3120_ENABLE_TIMER_COUNTER    		  0x10	//$$BIT in nWrMode_Select
+#define APCI3120_ENABLE_TIMER_COUNTER    		  0x10	/* $$BIT in nWrMode_Select */
 #define APCI3120_DISABLE_TIMER_COUNTER            (~APCI3120_ENABLE_TIMER_COUNTER)
-#define APCI3120_FC_TIMER                         0x1000	//bit in  status register
+#define APCI3120_FC_TIMER                         0x1000	/* bit in  status register */
 #define APCI3120_ENABLE_TIMER0                    0x1000
 #define APCI3120_ENABLE_TIMER1                    0x2000
 #define APCI3120_ENABLE_TIMER2                    0x4000
@@ -159,25 +159,27 @@ static const struct comedi_lrange range_apci3120_ao = { 2, {
 #define APCI3120_DISABLE_TIMER1		              (~APCI3120_ENABLE_TIMER1)
 #define APCI3120_DISABLE_TIMER2	                  (~APCI3120_ENABLE_TIMER2)
 
-#define APCI3120_TIMER2_SELECT_EOS                0xC0	// ADDED on 20-6
-#define APCI3120_COUNTER                          3	// on 20-6
-#define APCI3120_DISABLE_ALL_TIMER                ( APCI3120_DISABLE_TIMER0 & APCI3120_DISABLE_TIMER1 & APCI3120_DISABLE_TIMER2 )	// on 20-6
+#define APCI3120_TIMER2_SELECT_EOS                0xC0	/*  ADDED on 20-6 */
+#define APCI3120_COUNTER                          3	/*  on 20-6 */
+#define APCI3120_DISABLE_ALL_TIMER                (APCI3120_DISABLE_TIMER0 & APCI3120_DISABLE_TIMER1 & APCI3120_DISABLE_TIMER2)	/*  on 20-6 */
 
 #define MAX_ANALOGINPUT_CHANNELS    32
 
-typedef struct {
-	BYTE b_Type;		/* EOC or EOS */
-	BYTE b_InterruptFlag;	/* Interrupt use or not                    */
-	UINT ui_ConvertTiming;	/* Selection of the convertion time        */
-	BYTE b_NbrOfChannel;	/* Number of channel to read               */
-	UINT ui_ChannelList[MAX_ANALOGINPUT_CHANNELS];	/* Number of the channel to be read        */
-	UINT ui_RangeList[MAX_ANALOGINPUT_CHANNELS];	/* Gain of each channel                    */
+struct str_AnalogReadInformation {
 
-} str_AnalogReadInformation;
+	unsigned char b_Type;		/* EOC or EOS */
+	unsigned char b_InterruptFlag;	/* Interrupt use or not                    */
+	unsigned int ui_ConvertTiming;	/* Selection of the convertion time        */
+	unsigned char b_NbrOfChannel;	/* Number of channel to read               */
+	unsigned int ui_ChannelList[MAX_ANALOGINPUT_CHANNELS];	/* Number of the channel to be read        */
+	unsigned int ui_RangeList[MAX_ANALOGINPUT_CHANNELS];	/* Gain of each channel                    */
+
+};
 
-// Function Declaration For APCI-3120
 
-// Internal functions
+/* Function Declaration For APCI-3120 */
+
+/* Internal functions */
 int i_APCI3120_SetupChannelList(struct comedi_device *dev, struct comedi_subdevice *s,
 				int n_chan, unsigned int *chanlist, char check);
 int i_APCI3120_ExttrigEnable(struct comedi_device *dev);
@@ -186,9 +188,9 @@ int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_su
 int i_APCI3120_Reset(struct comedi_device *dev);
 int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev,
 				 struct comedi_subdevice *s);
-// Interrupt functions
+/* Interrupt functions */
 void v_APCI3120_Interrupt(int irq, void *d);
-//UPDATE-0.7.57->0.7.68 void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,struct comedi_subdevice *s,short *dma,short *data,int n);
+/* UPDATE-0.7.57->0.7.68 void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,struct comedi_subdevice *s,short *dma,short *data,int n); */
 void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,
 					   struct comedi_subdevice *s,
 					   short *dma_buffer,
@@ -196,7 +198,7 @@ void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,
 int i_APCI3120_InterruptHandleEos(struct comedi_device *dev);
 void v_APCI3120_InterruptDma(int irq, void *d);
 
-// TIMER
+/* TIMER */
 
 int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevice *s,
 			       struct comedi_insn *insn, unsigned int *data);
@@ -205,16 +207,19 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device *dev, struct comedi_subdevice
 int i_APCI3120_InsnReadTimer(struct comedi_device *dev, struct comedi_subdevice *s,
 			     struct comedi_insn *insn, unsigned int *data);
 
-//DI
-// for di read
+/*
+* DI for di read
+*/
 
 int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				    struct comedi_insn *insn, unsigned int *data);
 int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				    struct comedi_insn *insn, unsigned int *data);
 
-//DO
-//int i_APCI3120_WriteDigitalOutput(struct comedi_device *dev, BYTE data);
+/* DO */
+/* int i_APCI3120_WriteDigitalOutput(struct comedi_device *dev,
+ * unsigned char data);
+ */
 int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device *dev,
 				       struct comedi_subdevice *s, struct comedi_insn *insn,
 				       unsigned int *data);
@@ -223,12 +228,15 @@ int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device *dev, struct comedi_su
 int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				      struct comedi_insn *insn, unsigned int *data);
 
-//AO
-//int i_APCI3120_Write1AnalogValue(struct comedi_device *dev,UINT ui_Range,UINT ui_Channel,UINT data );
+/* AO */
+/* int i_APCI3120_Write1AnalogValue(struct comedi_device *dev,UINT ui_Range,
+ * UINT ui_Channel,UINT data );
+ */
+
 int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				     struct comedi_insn *insn, unsigned int *data);
 
-//AI HArdware layer
+/* AI HArdware layer */
 
 int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				     struct comedi_insn *insn, unsigned int *data);
@@ -237,5 +245,5 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subd
 int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				      struct comedi_cmd *cmd);
 int i_APCI3120_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s);
-//int i_APCI3120_CancelAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s);
+/* int i_APCI3120_CancelAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); */
 int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s);

+ 847 - 854
drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c

@@ -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.
 
@@ -57,73 +57,73 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
   +----------------------------------------------------------------------------+
 */
 #include "hwdrv_apci3200.h"
-//Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+/* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 #include "addi_amcc_S5920.h"
-//#define PRINT_INFO
+/* #define PRINT_INFO */
 
-//End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+/* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
-//BEGIN JK 06.07.04: Management of sevrals boards
+/* BEGIN JK 06.07.04: Management of sevrals boards */
 /*
-  INT i_CJCAvailable=1;
-  INT i_CJCPolarity=0;
-  INT i_CJCGain=2;//changed from 0 to 2
-  INT i_InterruptFlag=0;
-  INT i_ADDIDATAPolarity;
-  INT i_ADDIDATAGain;
-  INT i_AutoCalibration=0;   //: auto calibration
-  INT i_ADDIDATAConversionTime;
-  INT i_ADDIDATAConversionTimeUnit;
-  INT i_ADDIDATAType;
-  INT i_ChannelNo;
-  INT i_ChannelCount=0;
-  INT i_ScanType;
-  INT i_FirstChannel;
-  INT i_LastChannel;
-  INT i_Sum=0;
-  INT i_Offset;
-  UINT ui_Channel_num=0;
+  int i_CJCAvailable=1;
+  int i_CJCPolarity=0;
+  int i_CJCGain=2;/* changed from 0 to 2 */
+  int i_InterruptFlag=0;
+  int i_ADDIDATAPolarity;
+  int i_ADDIDATAGain;
+  int i_AutoCalibration=0;   /* : auto calibration */
+  int i_ADDIDATAConversionTime;
+  int i_ADDIDATAConversionTimeUnit;
+  int i_ADDIDATAType;
+  int i_ChannelNo;
+  int i_ChannelCount=0;
+  int i_ScanType;
+  int i_FirstChannel;
+  int i_LastChannel;
+  int i_Sum=0;
+  int i_Offset;
+  unsigned int ui_Channel_num=0;
   static int i_Count=0;
-  INT i_Initialised=0;
-  UINT ui_InterruptChannelValue[96]; //Buffer
+  int i_Initialised=0;
+  unsigned int ui_InterruptChannelValue[96]; /* Buffer */
 */
-str_BoardInfos s_BoardInfos[100];	// 100 will be the max number of boards to be used
-//END JK 06.07.04: Management of sevrals boards
+struct str_BoardInfos s_BoardInfos[100];	/*  100 will be the max number of boards to be used */
+/* END JK 06.07.04: Management of sevrals boards */
 
-//Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+/* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
 /*+----------------------------------------------------------------------------+*/
-/*| Function   Name   : INT i_AddiHeaderRW_ReadEeprom                          |*/
-/*|                               (INT    i_NbOfWordsToRead,                   |*/
-/*|                                DWORD dw_PCIBoardEepromAddress,             |*/
-/*|                                WORD   w_EepromStartAddress,                |*/
-/*|                                PWORD pw_DataRead)                          |*/
+/*| Function   Name   : int i_AddiHeaderRW_ReadEeprom                          |*/
+/*|                               (int    i_NbOfWordsToRead,                   |*/
+/*|                                unsigned int dw_PCIBoardEepromAddress,             |*/
+/*|                                unsigned short   w_EepromStartAddress,                |*/
+/*|                                unsigned short * pw_DataRead)                          |*/
 /*+----------------------------------------------------------------------------+*/
 /*| Task              : Read word from the 5920 eeprom.                        |*/
 /*+----------------------------------------------------------------------------+*/
-/*| Input Parameters  : INT    i_NbOfWordsToRead : Nbr. of word to read        |*/
-/*|                     DWORD dw_PCIBoardEepromAddress : Address of the eeprom |*/
-/*|                     WORD   w_EepromStartAddress : Eeprom strat address     |*/
+/*| Input Parameters  : int    i_NbOfWordsToRead : Nbr. of word to read        |*/
+/*|                     unsigned int dw_PCIBoardEepromAddress : Address of the eeprom |*/
+/*|                     unsigned short   w_EepromStartAddress : Eeprom strat address     |*/
 /*+----------------------------------------------------------------------------+*/
-/*| Output Parameters : PWORD pw_DataRead : Read data                          |*/
+/*| Output Parameters : unsigned short * pw_DataRead : Read data                          |*/
 /*+----------------------------------------------------------------------------+*/
 /*| Return Value      : -                                                      |*/
 /*+----------------------------------------------------------------------------+*/
 
-INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead,
-	DWORD dw_PCIBoardEepromAddress,
-	WORD w_EepromStartAddress, PWORD pw_DataRead)
+int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead,
+	unsigned int dw_PCIBoardEepromAddress,
+	unsigned short w_EepromStartAddress, unsigned short *pw_DataRead)
 {
-	DWORD dw_eeprom_busy = 0;
-	INT i_Counter = 0;
-	INT i_WordCounter;
-	INT i;
-	BYTE pb_ReadByte[1];
-	BYTE b_ReadLowByte = 0;
-	BYTE b_ReadHighByte = 0;
-	BYTE b_SelectedAddressLow = 0;
-	BYTE b_SelectedAddressHigh = 0;
-	WORD w_ReadWord = 0;
+	unsigned int dw_eeprom_busy = 0;
+	int i_Counter = 0;
+	int i_WordCounter;
+	int i;
+	unsigned char pb_ReadByte[1];
+	unsigned char b_ReadLowByte = 0;
+	unsigned char b_ReadHighByte = 0;
+	unsigned char b_SelectedAddressLow = 0;
+	unsigned char b_SelectedAddressHigh = 0;
+	unsigned short w_ReadWord = 0;
 
 	for (i_WordCounter = 0; i_WordCounter < i_NbOfWordsToRead;
 		i_WordCounter++) {
@@ -132,106 +132,99 @@ 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
-			b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256;	//Read the high 8 bit part
+			b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256;	/* Read the low 8 bit part */
+			b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256;	/* Read the high 8 bit part */
 
-			//Select the load low address mode
+			/* Select the load low address mode */
 			outb(NVCMD_LOAD_LOW,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				3);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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
+			/* Load the low address */
 			outb(b_SelectedAddressLow,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				2);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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
+			/* Select the load high address mode */
 			outb(NVCMD_LOAD_HIGH,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				3);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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
+			/* Load the high address */
 			outb(b_SelectedAddressHigh,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				2);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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
+			/* Select the READ mode */
 			outb(NVCMD_BEGIN_READ,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				3);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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
+			/* Read data into the EEPROM */
 			*pb_ReadByte =
 				inb(dw_PCIBoardEepromAddress +
 				AMCC_OP_REG_MCSR + 2);
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 				dw_eeprom_busy =
 					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) {
+			/* Select the upper address part */
+			if (i_Counter == 0)
 				b_ReadLowByte = pb_ReadByte[0];
-			} else {
+			else
 				b_ReadHighByte = pb_ReadByte[0];
-			}
 
-			//Sleep
-			for (i = 0; i < 10000; i++) ;
+
+			/* Sleep */
+			msleep(1);
 
 		}
 		w_ReadWord =
@@ -240,10 +233,10 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead,
 
 		pw_DataRead[i_WordCounter] = w_ReadWord;
 
-		w_EepromStartAddress += 2;	// to read the next word
+		w_EepromStartAddress += 2;	/*  to read the next word */
 
-	}			// for (...) i_NbOfWordsToRead
-	return (0);
+	}			/*  for (...) i_NbOfWordsToRead */
+	return 0;
 }
 
 /*+----------------------------------------------------------------------------+*/
@@ -258,31 +251,31 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead,
 /*| Return Value      : -                                                      |*/
 /*+----------------------------------------------------------------------------+*/
 
-void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress,
-	str_BoardInfos * BoardInformations)
+void v_GetAPCI3200EepromCalibrationValue(unsigned int dw_PCIBoardEepromAddress,
+	struct str_BoardInfos *BoardInformations)
 {
-	WORD w_AnalogInputMainHeaderAddress;
-	WORD w_AnalogInputComponentAddress;
-	WORD w_NumberOfModuls = 0;
-	WORD w_CurrentSources[2];
-	WORD w_ModulCounter = 0;
-	WORD w_FirstHeaderSize = 0;
-	WORD w_NumberOfInputs = 0;
-	WORD w_CJCFlag = 0;
-	WORD w_NumberOfGainValue = 0;
-	WORD w_SingleHeaderAddress = 0;
-	WORD w_SingleHeaderSize = 0;
-	WORD w_Input = 0;
-	WORD w_GainFactorAddress = 0;
-	WORD w_GainFactorValue[2];
-	WORD w_GainIndex = 0;
-	WORD w_GainValue = 0;
+	unsigned short w_AnalogInputMainHeaderAddress;
+	unsigned short w_AnalogInputComponentAddress;
+	unsigned short w_NumberOfModuls = 0;
+	unsigned short w_CurrentSources[2];
+	unsigned short w_ModulCounter = 0;
+	unsigned short w_FirstHeaderSize = 0;
+	unsigned short w_NumberOfInputs = 0;
+	unsigned short w_CJCFlag = 0;
+	unsigned short w_NumberOfGainValue = 0;
+	unsigned short w_SingleHeaderAddress = 0;
+	unsigned short w_SingleHeaderSize = 0;
+	unsigned short w_Input = 0;
+	unsigned short w_GainFactorAddress = 0;
+	unsigned short w_GainFactorValue[2];
+	unsigned short w_GainIndex = 0;
+	unsigned short w_GainValue = 0;
 
   /*****************************************/
   /** Get the Analog input header address **/
   /*****************************************/
-	i_AddiHeaderRW_ReadEeprom(1,	//i_NbOfWordsToRead
-		dw_PCIBoardEepromAddress, 0x116,	//w_EepromStartAddress: Analog input header address
+	i_AddiHeaderRW_ReadEeprom(1,	/* i_NbOfWordsToRead */
+		dw_PCIBoardEepromAddress, 0x116,	/* w_EepromStartAddress: Analog input header address */
 		&w_AnalogInputMainHeaderAddress);
 
   /*******************************************/
@@ -293,8 +286,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress,
   /******************************/
   /** Get the number of moduls **/
   /******************************/
-	i_AddiHeaderRW_ReadEeprom(1,	//i_NbOfWordsToRead
-		dw_PCIBoardEepromAddress, w_AnalogInputMainHeaderAddress + 0x02,	//w_EepromStartAddress: Number of conponment
+	i_AddiHeaderRW_ReadEeprom(1,	/* i_NbOfWordsToRead */
+		dw_PCIBoardEepromAddress, w_AnalogInputMainHeaderAddress + 0x02,	/* w_EepromStartAddress: Number of conponment */
 		&w_NumberOfModuls);
 
 	for (w_ModulCounter = 0; w_ModulCounter < w_NumberOfModuls;
@@ -309,8 +302,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress,
       /****************************/
       /** Read first header size **/
       /****************************/
-		i_AddiHeaderRW_ReadEeprom(1,	//i_NbOfWordsToRead
-			dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress,	// Address of the first header
+		i_AddiHeaderRW_ReadEeprom(1,	/* i_NbOfWordsToRead */
+			dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress,	/*  Address of the first header */
 			&w_FirstHeaderSize);
 
 		w_FirstHeaderSize = w_FirstHeaderSize >> 4;
@@ -318,8 +311,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress,
       /***************************/
       /** Read number of inputs **/
       /***************************/
-		i_AddiHeaderRW_ReadEeprom(1,	//i_NbOfWordsToRead
-			dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x06,	// Number of inputs for the first modul
+		i_AddiHeaderRW_ReadEeprom(1,	/* i_NbOfWordsToRead */
+			dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x06,	/*  Number of inputs for the first modul */
 			&w_NumberOfInputs);
 
 		w_NumberOfInputs = w_NumberOfInputs >> 4;
@@ -327,17 +320,17 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress,
       /***********************/
       /** Read the CJC flag **/
       /***********************/
-		i_AddiHeaderRW_ReadEeprom(1,	//i_NbOfWordsToRead
-			dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x08,	// CJC flag
+		i_AddiHeaderRW_ReadEeprom(1,	/* i_NbOfWordsToRead */
+			dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x08,	/*  CJC flag */
 			&w_CJCFlag);
 
-		w_CJCFlag = (w_CJCFlag >> 3) & 0x1;	// Get only the CJC flag
+		w_CJCFlag = (w_CJCFlag >> 3) & 0x1;	/*  Get only the CJC flag */
 
       /*******************************/
       /** Read number of gain value **/
       /*******************************/
-		i_AddiHeaderRW_ReadEeprom(1,	//i_NbOfWordsToRead
-			dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x44,	// Number of gain value
+		i_AddiHeaderRW_ReadEeprom(1,	/* i_NbOfWordsToRead */
+			dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x44,	/*  Number of gain value */
 			&w_NumberOfGainValue);
 
 		w_NumberOfGainValue = w_NumberOfGainValue & 0xFF;
@@ -354,8 +347,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress,
       /********************************************/
       /** Read current sources value for input 1 **/
       /********************************************/
-		i_AddiHeaderRW_ReadEeprom(1,	//i_NbOfWordsToRead
-			dw_PCIBoardEepromAddress, w_SingleHeaderAddress,	//w_EepromStartAddress: Single header address
+		i_AddiHeaderRW_ReadEeprom(1,	/* i_NbOfWordsToRead */
+			dw_PCIBoardEepromAddress, w_SingleHeaderAddress,	/* w_EepromStartAddress: Single header address */
 			&w_SingleHeaderSize);
 
 		w_SingleHeaderSize = w_SingleHeaderSize >> 4;
@@ -370,8 +363,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress,
 	  /************************************/
 	  /** Read gain value for the module **/
 	  /************************************/
-			i_AddiHeaderRW_ReadEeprom(1,	//i_NbOfWordsToRead
-				dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 70 + (2 * (1 + (w_NumberOfGainValue / 16))) + (0x02 * w_GainIndex),	// Gain value
+			i_AddiHeaderRW_ReadEeprom(1,	/* i_NbOfWordsToRead */
+				dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 70 + (2 * (1 + (w_NumberOfGainValue / 16))) + (0x02 * w_GainIndex),	/*  Gain value */
 				&w_GainValue);
 
 			BoardInformations->s_Module[w_ModulCounter].
@@ -386,8 +379,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress,
 	  /*************************************/
 	  /** Read gain factor for the module **/
 	  /*************************************/
-			i_AddiHeaderRW_ReadEeprom(2,	//i_NbOfWordsToRead
-				dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 70 + ((2 * w_NumberOfGainValue) + (2 * (1 + (w_NumberOfGainValue / 16)))) + (0x04 * w_GainIndex),	// Gain factor
+			i_AddiHeaderRW_ReadEeprom(2,	/* i_NbOfWordsToRead */
+				dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 70 + ((2 * w_NumberOfGainValue) + (2 * (1 + (w_NumberOfGainValue / 16)))) + (0x04 * w_GainIndex),	/*  Gain factor */
 				w_GainFactorValue);
 
 			BoardInformations->s_Module[w_ModulCounter].
@@ -409,7 +402,7 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress,
 	  /********************************************/
 	  /** Read current sources value for input 1 **/
 	  /********************************************/
-			i_AddiHeaderRW_ReadEeprom(2,	//i_NbOfWordsToRead
+			i_AddiHeaderRW_ReadEeprom(2,	/* i_NbOfWordsToRead */
 				dw_PCIBoardEepromAddress,
 				(w_Input * w_SingleHeaderSize) +
 				w_SingleHeaderAddress + 0x0C, w_CurrentSources);
@@ -432,7 +425,7 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress,
       /***************************************/
       /** Read the CJC current source value **/
       /***************************************/
-		i_AddiHeaderRW_ReadEeprom(2,	//i_NbOfWordsToRead
+		i_AddiHeaderRW_ReadEeprom(2,	/* i_NbOfWordsToRead */
 			dw_PCIBoardEepromAddress,
 			(w_Input * w_SingleHeaderSize) + w_SingleHeaderAddress +
 			0x0C, w_CurrentSources);
@@ -453,9 +446,9 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD 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;
@@ -464,9 +457,9 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev,
 	printk("\n Channel = %u", ui_Channel_num);
 #endif
 
-	//Test if single or differential mode
+	/* Test if single or differential mode */
 	if (s_BoardInfos[dev->minor].i_ConnectionType == 1) {
-		//if diff
+		/* if diff */
 
 		if ((ui_Channel_num >= 0) && (ui_Channel_num <= 1))
 			i_DiffChannel = ui_Channel_num, i_Module = 0;
@@ -478,7 +471,7 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev,
 			i_DiffChannel = ui_Channel_num - 6, i_Module = 3;
 
 	} else {
-		// if single
+		/*  if single */
 		if ((ui_Channel_num == 0) || (ui_Channel_num == 1))
 			i_DiffChannel = 0, i_Module = 0;
 		else if ((ui_Channel_num == 2) || (ui_Channel_num == 3))
@@ -497,7 +490,7 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev,
 			i_DiffChannel = 1, i_Module = 3;
 	}
 
-	//Test if thermocouple or RTD mode
+	/* Test if thermocouple or RTD mode */
 	*CJCCurrentSource =
 		s_BoardInfos[dev->minor].s_Module[i_Module].ul_CurrentSourceCJC;
 #ifdef PRINT_INFO
@@ -510,22 +503,22 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev,
 #ifdef PRINT_INFO
 	printk("\n ChannelCurrentSource = %lu", *ChannelCurrentSource);
 #endif
-	//      }
-	//   }
+	/*       } */
+	/*    } */
 
-	//Channle gain factor
+	/* Channle gain factor */
 	*ChannelGainFactor =
 		s_BoardInfos[dev->minor].s_Module[i_Module].
 		ul_GainFactor[s_BoardInfos[dev->minor].i_ADDIDATAGain];
 #ifdef PRINT_INFO
 	printk("\n ChannelGainFactor = %lu", *ChannelGainFactor);
 #endif
-	//End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+	/* 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
+/* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
 /*
   +----------------------------------------------------------------------------+
@@ -536,9 +529,9 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev,
   | Task              : Read  value  of the selected channel or port           |
   +----------------------------------------------------------------------------+
   | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-  |                     UINT ui_NoOfChannels    : No Of Channels To read  for Port
+  |                     unsigned int ui_NoOfChannels    : No Of Channels To read  for Port
   Channel Numberfor single channel
-  |                     UINT data[0]            : 0: Read single channel
+  |                     unsigned int data[0]            : 0: Read single channel
   1: Read port value
   data[1]              Port number
   +----------------------------------------------------------------------------+
@@ -550,24 +543,24 @@ 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)
 {
-	UINT ui_Temp = 0;
-	UINT ui_NoOfChannel = 0;
+	unsigned int ui_Temp = 0;
+	unsigned int ui_NoOfChannel = 0;
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	ui_Temp = data[0];
 	*data = inl(devpriv->i_IobaseReserved);
 
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			//if  (ui_Temp==0)
+	}			/* if  (ui_Temp==0) */
 	else {
 		if (ui_Temp == 1) {
 			if (data[1] < 0 || data[1] > 1) {
 				printk("\nThe port number is in error\n");
 				return -EINVAL;
-			}	//if(data[1] < 0 || data[1] >1)
+			}	/* if(data[1] < 0 || data[1] >1) */
 			switch (ui_NoOfChannel) {
 
 			case 2:
@@ -578,13 +571,13 @@ INT i_APCI3200_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdev
 				break;
 			default:
 				comedi_error(dev, " chan spec wrong");
-				return -EINVAL;	// "sorry channel spec wrong "
+				return -EINVAL;	/*  "sorry channel spec wrong " */
 
-			}	//switch(ui_NoOfChannels)
-		}		//if  (ui_Temp==1)
+			}	/* switch(ui_NoOfChannels) */
+		}		/* if  (ui_Temp==1) */
 		else {
 			printk("\nSpecified channel not supported \n");
-		}		//elseif  (ui_Temp==1)
+		}		/* elseif  (ui_Temp==1) */
 	}
 	return insn->n;
 }
@@ -608,21 +601,21 @@ 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)) {
 		comedi_error(dev,
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 		return -EINVAL;
-	}			//if  ( (data[0]!=0) && (data[0]!=1) )
+	}			/* if  ( (data[0]!=0) && (data[0]!=1) ) */
 	if (data[0]) {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
-	}			// if  (data[0])
+	}			/*  if  (data[0]) */
 	else {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
-	}			//else if  (data[0])
+	}			/* else if  (data[0]) */
 	return insn->n;
 }
 
@@ -653,23 +646,23 @@ 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)
 {
-	UINT ui_Temp = 0, ui_Temp1 = 0;
-	UINT ui_NoOfChannel = CR_CHAN(insn->chanspec);	// get the channel
+	unsigned int ui_Temp = 0, ui_Temp1 = 0;
+	unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec);	/*  get the channel */
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp = inl(devpriv->i_IobaseAddon);
 
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	else {
 		ui_Temp = 0;
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outl(data[0], devpriv->i_IobaseAddon);
-		}		//if(data[1]==0)
+		}		/* if(data[1]==0) */
 		else {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
@@ -682,15 +675,15 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 				case 3:
 					data[0] = (data[0] | ui_Temp);
 					break;
-				}	//switch(ui_NoOfChannels)
+				}	/* switch(ui_NoOfChannels) */
 
 				outl(data[0], devpriv->i_IobaseAddon);
-			}	// if(data[1]==1)
+			}	/*  if(data[1]==1) */
 			else {
 				printk("\nSpecified channel not supported\n");
-			}	//else if(data[1]==1)
-		}		//elseif(data[1]==0)
-	}			//if(data[3]==0)
+			}	/* else if(data[1]==1) */
+		}		/* elseif(data[1]==0) */
+	}			/* if(data[3]==0) */
 	else {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
@@ -701,7 +694,7 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 				data[0] = (data[0] << ui_NoOfChannel) ^ 0xf;
 				data[0] = data[0] & ui_Temp;
 				outl(data[0], devpriv->i_IobaseAddon);
-			}	//if(data[1]==0)
+			}	/* if(data[1]==0) */
 			else {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
@@ -725,21 +718,21 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 						comedi_error(dev,
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
-					}	//switch(ui_NoOfChannels)
+						return -EINVAL;	/*  "sorry channel spec wrong " */
+					}	/* switch(ui_NoOfChannels) */
 
 					outl(data[0], devpriv->i_IobaseAddon);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 					printk("\nSpecified channel not supported\n");
-				}	//else if(data[1]==1)
-			}	//elseif(data[1]==0)
-		}		//if(data[3]==1);
+				}	/* else if(data[1]==1) */
+			}	/* elseif(data[1]==0) */
+		}		/* if(data[3]==1); */
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
-		}		//if else data[3]==1)
-	}			//if else data[3]==0)
+		}		/* if else data[3]==1) */
+	}			/* if else data[3]==0) */
 	return insn->n;
 }
 
@@ -752,8 +745,8 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
   | Task              : Read  value  of the selected channel or port           |
   +----------------------------------------------------------------------------+
   | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-  |                     UINT ui_NoOfChannels    : No Of Channels To read       |
-  |                     UINT *data              : Data Pointer to read status  |
+  |                     unsigned int ui_NoOfChannels    : No Of Channels To read       |
+  |                     unsigned int *data              : Data Pointer to read status  |
   data[0]                 :0 read single channel
   1 read port value
   data[1]                  port no
@@ -766,23 +759,23 @@ 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)
 {
-	UINT ui_Temp;
-	UINT ui_NoOfChannel;
+	unsigned int ui_Temp;
+	unsigned int ui_NoOfChannel;
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	ui_Temp = data[0];
 	*data = inl(devpriv->i_IobaseAddon);
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			// if  (ui_Temp==0)
+	}			/*  if  (ui_Temp==0) */
 	else {
 		if (ui_Temp == 1) {
 			if (data[1] < 0 || data[1] > 1) {
 				printk("\nThe port selection is in error\n");
 				return -EINVAL;
-			}	//if(data[1] <0 ||data[1] >1)
+			}	/* if(data[1] <0 ||data[1] >1) */
 			switch (ui_NoOfChannel) {
 			case 2:
 				*data = (*data >> (2 * data[1])) & 3;
@@ -793,20 +786,20 @@ INT i_APCI3200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 
 			default:
 				comedi_error(dev, " chan spec wrong");
-				return -EINVAL;	// "sorry channel spec wrong "
+				return -EINVAL;	/*  "sorry channel spec wrong " */
 				break;
-			}	// switch(ui_NoOfChannels)
-		}		// if  (ui_Temp==1)
+			}	/*  switch(ui_NoOfChannels) */
+		}		/*  if  (ui_Temp==1) */
 		else {
 			printk("\nSpecified channel not supported \n");
-		}		// else if (ui_Temp==1)
-	}			// else if  (ui_Temp==0)
+		}		/*  else if (ui_Temp==1) */
+	}			/*  else if  (ui_Temp==0) */
 	return insn->n;
 }
 
 /*
   +----------------------------------------------------------------------------+
-  | Function   Name   : INT i_APCI3200_ConfigAnalogInput                       |
+  | Function   Name   : int i_APCI3200_ConfigAnalogInput                       |
   |			  (struct comedi_device *dev,struct comedi_subdevice *s,               |
   |                      struct comedi_insn *insn,unsigned int *data)                     |
   +----------------------------------------------------------------------------+
@@ -874,30 +867,30 @@ 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)
 {
 
-	UINT ul_Config = 0, ul_Temp = 0;
-	UINT ui_ChannelNo = 0;
-	UINT ui_Dummy = 0;
-	INT i_err = 0;
+	unsigned int ul_Config = 0, ul_Temp = 0;
+	unsigned int ui_ChannelNo = 0;
+	unsigned int ui_Dummy = 0;
+	int i_err = 0;
 
-	//Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+	/* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
 #ifdef PRINT_INFO
-	INT i = 0, i2 = 0;
+	int i = 0, i2 = 0;
 #endif
-	//End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+	/* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	// Initialize the structure
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/*  Initialize the structure */
 	if (s_BoardInfos[dev->minor].b_StructInitialized != 1) {
 		s_BoardInfos[dev->minor].i_CJCAvailable = 1;
 		s_BoardInfos[dev->minor].i_CJCPolarity = 0;
-		s_BoardInfos[dev->minor].i_CJCGain = 2;	//changed from 0 to 2
+		s_BoardInfos[dev->minor].i_CJCGain = 2;	/* changed from 0 to 2 */
 		s_BoardInfos[dev->minor].i_InterruptFlag = 0;
-		s_BoardInfos[dev->minor].i_AutoCalibration = 0;	//: auto calibration
+		s_BoardInfos[dev->minor].i_AutoCalibration = 0;	/* : auto calibration */
 		s_BoardInfos[dev->minor].i_ChannelCount = 0;
 		s_BoardInfos[dev->minor].i_Sum = 0;
 		s_BoardInfos[dev->minor].ui_Channel_num = 0;
@@ -905,11 +898,11 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde
 		s_BoardInfos[dev->minor].i_Initialised = 0;
 		s_BoardInfos[dev->minor].b_StructInitialized = 1;
 
-		//Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+		/* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 		s_BoardInfos[dev->minor].i_ConnectionType = 0;
-		//End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+		/* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
-		//Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+		/* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 		memset(s_BoardInfos[dev->minor].s_Module, 0,
 			sizeof(s_BoardInfos[dev->minor].s_Module[MAX_MODULE]));
 
@@ -938,72 +931,72 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde
 			}
 		}
 #endif
-		//End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+		/* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 	}
 
 	if (data[0] != 0 && data[0] != 1 && data[0] != 2) {
 		printk("\nThe selection of acquisition type is in error\n");
 		i_err++;
-	}			//if(data[0]!=0 && data[0]!=1 && data[0]!=2)
+	}			/* if(data[0]!=0 && data[0]!=1 && data[0]!=2) */
 	if (data[0] == 1) {
 		if (data[14] != 0 && data[14] != 1 && data[14] != 2
 			&& data[14] != 4) {
 			printk("\n Error in selection of RTD connection type\n");
 			i_err++;
-		}		//if(data[14]!=0 && data[14]!=1 && data[14]!=2 && data[14]!=4)
-	}			//if(data[0]==1 )
+		}		/* if(data[14]!=0 && data[14]!=1 && data[14]!=2 && data[14]!=4) */
+	}			/* if(data[0]==1 ) */
 	if (data[1] < 0 || data[1] > 7) {
 		printk("\nThe selection of gain is in error\n");
 		i_err++;
-	}			// if(data[1]<0 || data[1]>7)
+	}			/*  if(data[1]<0 || data[1]>7) */
 	if (data[2] != 0 && data[2] != 1) {
 		printk("\nThe selection of polarity is in error\n");
 		i_err++;
-	}			//if(data[2]!=0 &&  data[2]!=1)
+	}			/* if(data[2]!=0 &&  data[2]!=1) */
 	if (data[3] != 0) {
 		printk("\nThe selection of offset range  is in error\n");
 		i_err++;
-	}			// if(data[3]!=0)
+	}			/*  if(data[3]!=0) */
 	if (data[4] != 0 && data[4] != 1) {
 		printk("\nThe selection of coupling is in error\n");
 		i_err++;
-	}			//if(data[4]!=0 &&  data[4]!=1)
+	}			/* if(data[4]!=0 &&  data[4]!=1) */
 	if (data[5] != 0 && data[5] != 1) {
 		printk("\nThe selection of single/differential mode is in error\n");
 		i_err++;
-	}			//if(data[5]!=0 &&  data[5]!=1)
+	}			/* if(data[5]!=0 &&  data[5]!=1) */
 	if (data[8] != 0 && data[8] != 1 && data[2] != 2) {
 		printk("\nError in selection of functionality\n");
-	}			//if(data[8]!=0 && data[8]!=1 && data[2]!=2)
+	}			/* if(data[8]!=0 && data[8]!=1 && data[2]!=2) */
 	if (data[12] == 0 || data[12] == 1) {
 		if (data[6] != 20 && data[6] != 40 && data[6] != 80
 			&& data[6] != 160) {
 			printk("\nThe selection of conversion time reload value is in error\n");
 			i_err++;
-		}		// if (data[6]!=20 && data[6]!=40 && data[6]!=80 && data[6]!=160 )
+		}		/*  if (data[6]!=20 && data[6]!=40 && data[6]!=80 && data[6]!=160 ) */
 		if (data[7] != 2) {
 			printk("\nThe selection of conversion time unit  is in error\n");
 			i_err++;
-		}		// if(data[7]!=2)
+		}		/*  if(data[7]!=2) */
 	}
 	if (data[9] != 0 && data[9] != 1) {
 		printk("\nThe selection of interrupt enable is in error\n");
 		i_err++;
-	}			//if(data[9]!=0 &&  data[9]!=1)
+	}			/* if(data[9]!=0 &&  data[9]!=1) */
 	if (data[11] < 0 || data[11] > 4) {
 		printk("\nThe selection of module is in error\n");
 		i_err++;
-	}			//if(data[11] <0 ||  data[11]>1)
+	}			/* if(data[11] <0 ||  data[11]>1) */
 	if (data[12] < 0 || data[12] > 3) {
 		printk("\nThe selection of singlechannel/scan selection is in error\n");
 		i_err++;
-	}			//if(data[12] < 0 ||  data[12]> 3)
+	}			/* if(data[12] < 0 ||  data[12]> 3) */
 	if (data[13] < 0 || data[13] > 16) {
 		printk("\nThe selection of number of channels is in error\n");
 		i_err++;
-	}			// if(data[13] <0 ||data[13] >15)
+	}			/*  if(data[13] <0 ||data[13] >15) */
 
-	//BEGIN JK 06.07.04: Management of sevrals boards
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
 	/*
 	   i_ChannelCount=data[13];
 	   i_ScanType=data[12];
@@ -1014,7 +1007,7 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde
 	   i_ADDIDATAType=data[0];
 	 */
 
-	// Save acquisition configuration for the actual board
+	/*  Save acquisition configuration for the actual board */
 	s_BoardInfos[dev->minor].i_ChannelCount = data[13];
 	s_BoardInfos[dev->minor].i_ScanType = data[12];
 	s_BoardInfos[dev->minor].i_ADDIDATAPolarity = data[2];
@@ -1022,307 +1015,307 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde
 	s_BoardInfos[dev->minor].i_ADDIDATAConversionTime = data[6];
 	s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit = data[7];
 	s_BoardInfos[dev->minor].i_ADDIDATAType = data[0];
-	//Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
+	/* Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
 	s_BoardInfos[dev->minor].i_ConnectionType = data[5];
-	//End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-	//END JK 06.07.04: Management of sevrals boards
+	/* End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+	/* END JK 06.07.04: Management of sevrals boards */
 
-	//Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-	memset(s_BoardInfos[dev->minor].ui_ScanValueArray, 0, (7 + 12) * sizeof(unsigned int));	// 7 is the maximal number of channels
-	//End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
+	/* Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+	memset(s_BoardInfos[dev->minor].ui_ScanValueArray, 0, (7 + 12) * sizeof(unsigned int));	/*  7 is the maximal number of channels */
+	/* End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
 
-	//BEGIN JK 02.07.04 : This while can't be do, it block the process when using severals boards
-	//while(i_InterruptFlag==1)
+	/* BEGIN JK 02.07.04 : This while can't be do, it block the process when using severals boards */
+	/* while(i_InterruptFlag==1) */
 	while (s_BoardInfos[dev->minor].i_InterruptFlag == 1) {
 #ifndef MSXBOX
 		udelay(1);
 #else
-		// In the case where the driver is compiled for the MSX-Box
-		// we used a printk to have a little delay because udelay
-		// seems to be broken under the MSX-Box.
-		// This solution hat to be studied.
+		/*  In the case where the driver is compiled for the MSX-Box */
+		/*  we used a printk to have a little delay because udelay */
+		/*  seems to be broken under the MSX-Box. */
+		/*  This solution hat to be studied. */
 		printk("");
 #endif
 	}
-	//END JK 02.07.04 : This while can't be do, it block the process when using severals boards
+	/* END JK 02.07.04 : This while can't be do, it block the process when using severals boards */
 
-	ui_ChannelNo = CR_CHAN(insn->chanspec);	// get the channel
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//i_ChannelNo=ui_ChannelNo;
-	//ui_Channel_num =ui_ChannelNo;
+	ui_ChannelNo = CR_CHAN(insn->chanspec);	/*  get the channel */
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* i_ChannelNo=ui_ChannelNo; */
+	/* ui_Channel_num =ui_ChannelNo; */
 
 	s_BoardInfos[dev->minor].i_ChannelNo = ui_ChannelNo;
 	s_BoardInfos[dev->minor].ui_Channel_num = ui_ChannelNo;
 
-	//END JK 06.07.04: Management of sevrals boards
+	/* END JK 06.07.04: Management of sevrals boards */
 
 	if (data[5] == 0) {
 		if (ui_ChannelNo < 0 || ui_ChannelNo > 15) {
 			printk("\nThe Selection of the channel is in error\n");
 			i_err++;
-		}		// if(ui_ChannelNo<0 || ui_ChannelNo>15)
-	}			//if(data[5]==0)
+		}		/*  if(ui_ChannelNo<0 || ui_ChannelNo>15) */
+	}			/* if(data[5]==0) */
 	else {
 		if (data[14] == 2) {
 			if (ui_ChannelNo < 0 || ui_ChannelNo > 3) {
 				printk("\nThe Selection of the channel is in error\n");
 				i_err++;
-			}	// if(ui_ChannelNo<0 || ui_ChannelNo>3)
-		}		//if(data[14]==2)
+			}	/*  if(ui_ChannelNo<0 || ui_ChannelNo>3) */
+		}		/* if(data[14]==2) */
 		else {
 			if (ui_ChannelNo < 0 || ui_ChannelNo > 7) {
 				printk("\nThe Selection of the channel is in error\n");
 				i_err++;
-			}	// if(ui_ChannelNo<0 || ui_ChannelNo>7)
-		}		//elseif(data[14]==2)
-	}			//elseif(data[5]==0)
+			}	/*  if(ui_ChannelNo<0 || ui_ChannelNo>7) */
+		}		/* elseif(data[14]==2) */
+	}			/* elseif(data[5]==0) */
 	if (data[12] == 0 || data[12] == 1) {
 		switch (data[5]) {
 		case 0:
 			if (ui_ChannelNo >= 0 && ui_ChannelNo <= 3) {
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//i_Offset=0;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* i_Offset=0; */
 				s_BoardInfos[dev->minor].i_Offset = 0;
-				//END JK 06.07.04: Management of sevrals boards
-			}	//if(ui_ChannelNo >=0 && ui_ChannelNo <=3)
+				/* END JK 06.07.04: Management of sevrals boards */
+			}	/* if(ui_ChannelNo >=0 && ui_ChannelNo <=3) */
 			if (ui_ChannelNo >= 4 && ui_ChannelNo <= 7) {
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//i_Offset=64;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* i_Offset=64; */
 				s_BoardInfos[dev->minor].i_Offset = 64;
-				//END JK 06.07.04: Management of sevrals boards
-			}	//if(ui_ChannelNo >=4 && ui_ChannelNo <=7)
+				/* END JK 06.07.04: Management of sevrals boards */
+			}	/* if(ui_ChannelNo >=4 && ui_ChannelNo <=7) */
 			if (ui_ChannelNo >= 8 && ui_ChannelNo <= 11) {
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//i_Offset=128;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* i_Offset=128; */
 				s_BoardInfos[dev->minor].i_Offset = 128;
-				//END JK 06.07.04: Management of sevrals boards
-			}	//if(ui_ChannelNo >=8 && ui_ChannelNo <=11)
+				/* END JK 06.07.04: Management of sevrals boards */
+			}	/* if(ui_ChannelNo >=8 && ui_ChannelNo <=11) */
 			if (ui_ChannelNo >= 12 && ui_ChannelNo <= 15) {
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//i_Offset=192;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* i_Offset=192; */
 				s_BoardInfos[dev->minor].i_Offset = 192;
-				//END JK 06.07.04: Management of sevrals boards
-			}	//if(ui_ChannelNo >=12 && ui_ChannelNo <=15)
+				/* END JK 06.07.04: Management of sevrals boards */
+			}	/* if(ui_ChannelNo >=12 && ui_ChannelNo <=15) */
 			break;
 		case 1:
 			if (data[14] == 2) {
 				if (ui_ChannelNo == 0) {
-					//BEGIN JK 06.07.04: Management of sevrals boards
-					//i_Offset=0;
+					/* BEGIN JK 06.07.04: Management of sevrals boards */
+					/* i_Offset=0; */
 					s_BoardInfos[dev->minor].i_Offset = 0;
-					//END JK 06.07.04: Management of sevrals boards
-				}	//if(ui_ChannelNo ==0 )
+					/* END JK 06.07.04: Management of sevrals boards */
+				}	/* if(ui_ChannelNo ==0 ) */
 				if (ui_ChannelNo == 1) {
-					//BEGIN JK 06.07.04: Management of sevrals boards
-					//i_Offset=0;
+					/* BEGIN JK 06.07.04: Management of sevrals boards */
+					/* i_Offset=0; */
 					s_BoardInfos[dev->minor].i_Offset = 64;
-					//END JK 06.07.04: Management of sevrals boards
-				}	// if(ui_ChannelNo ==1)
+					/* END JK 06.07.04: Management of sevrals boards */
+				}	/*  if(ui_ChannelNo ==1) */
 				if (ui_ChannelNo == 2) {
-					//BEGIN JK 06.07.04: Management of sevrals boards
-					//i_Offset=128;
+					/* BEGIN JK 06.07.04: Management of sevrals boards */
+					/* i_Offset=128; */
 					s_BoardInfos[dev->minor].i_Offset = 128;
-					//END JK 06.07.04: Management of sevrals boards
-				}	//if(ui_ChannelNo ==2 )
+					/* END JK 06.07.04: Management of sevrals boards */
+				}	/* if(ui_ChannelNo ==2 ) */
 				if (ui_ChannelNo == 3) {
-					//BEGIN JK 06.07.04: Management of sevrals boards
-					//i_Offset=192;
+					/* BEGIN JK 06.07.04: Management of sevrals boards */
+					/* i_Offset=192; */
 					s_BoardInfos[dev->minor].i_Offset = 192;
-					//END JK 06.07.04: Management of sevrals boards
-				}	//if(ui_ChannelNo ==3)
+					/* END JK 06.07.04: Management of sevrals boards */
+				}	/* if(ui_ChannelNo ==3) */
 
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//i_ChannelNo=0;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* i_ChannelNo=0; */
 				s_BoardInfos[dev->minor].i_ChannelNo = 0;
-				//END JK 06.07.04: Management of sevrals boards
+				/* END JK 06.07.04: Management of sevrals boards */
 				ui_ChannelNo = 0;
 				break;
-			}	//if(data[14]==2)
+			}	/* if(data[14]==2) */
 			if (ui_ChannelNo >= 0 && ui_ChannelNo <= 1) {
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//i_Offset=0;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* i_Offset=0; */
 				s_BoardInfos[dev->minor].i_Offset = 0;
-				//END JK 06.07.04: Management of sevrals boards
-			}	//if(ui_ChannelNo >=0 && ui_ChannelNo <=1)
+				/* END JK 06.07.04: Management of sevrals boards */
+			}	/* if(ui_ChannelNo >=0 && ui_ChannelNo <=1) */
 			if (ui_ChannelNo >= 2 && ui_ChannelNo <= 3) {
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//i_ChannelNo=i_ChannelNo-2;
-				//i_Offset=64;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* i_ChannelNo=i_ChannelNo-2; */
+				/* i_Offset=64; */
 				s_BoardInfos[dev->minor].i_ChannelNo =
 					s_BoardInfos[dev->minor].i_ChannelNo -
 					2;
 				s_BoardInfos[dev->minor].i_Offset = 64;
-				//END JK 06.07.04: Management of sevrals boards
+				/* END JK 06.07.04: Management of sevrals boards */
 				ui_ChannelNo = ui_ChannelNo - 2;
-			}	//if(ui_ChannelNo >=2 && ui_ChannelNo <=3)
+			}	/* if(ui_ChannelNo >=2 && ui_ChannelNo <=3) */
 			if (ui_ChannelNo >= 4 && ui_ChannelNo <= 5) {
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//i_ChannelNo=i_ChannelNo-4;
-				//i_Offset=128;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* i_ChannelNo=i_ChannelNo-4; */
+				/* i_Offset=128; */
 				s_BoardInfos[dev->minor].i_ChannelNo =
 					s_BoardInfos[dev->minor].i_ChannelNo -
 					4;
 				s_BoardInfos[dev->minor].i_Offset = 128;
-				//END JK 06.07.04: Management of sevrals boards
+				/* END JK 06.07.04: Management of sevrals boards */
 				ui_ChannelNo = ui_ChannelNo - 4;
-			}	//if(ui_ChannelNo >=4 && ui_ChannelNo <=5)
+			}	/* if(ui_ChannelNo >=4 && ui_ChannelNo <=5) */
 			if (ui_ChannelNo >= 6 && ui_ChannelNo <= 7) {
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//i_ChannelNo=i_ChannelNo-6;
-				//i_Offset=192;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* i_ChannelNo=i_ChannelNo-6; */
+				/* i_Offset=192; */
 				s_BoardInfos[dev->minor].i_ChannelNo =
 					s_BoardInfos[dev->minor].i_ChannelNo -
 					6;
 				s_BoardInfos[dev->minor].i_Offset = 192;
-				//END JK 06.07.04: Management of sevrals boards
+				/* END JK 06.07.04: Management of sevrals boards */
 				ui_ChannelNo = ui_ChannelNo - 6;
-			}	//if(ui_ChannelNo >=6 && ui_ChannelNo <=7)
+			}	/* if(ui_ChannelNo >=6 && ui_ChannelNo <=7) */
 			break;
 
 		default:
 			printk("\n This selection of polarity does not exist\n");
 			i_err++;
-		}		//switch(data[2])
-	}			//if(data[12]==0 || data[12]==1)
+		}		/* switch(data[2]) */
+	}			/* if(data[12]==0 || data[12]==1) */
 	else {
 		switch (data[11]) {
 		case 1:
-			//BEGIN JK 06.07.04: Management of sevrals boards
-			//i_Offset=0;
+			/* BEGIN JK 06.07.04: Management of sevrals boards */
+			/* i_Offset=0; */
 			s_BoardInfos[dev->minor].i_Offset = 0;
-			//END JK 06.07.04: Management of sevrals boards
+			/* END JK 06.07.04: Management of sevrals boards */
 			break;
 		case 2:
-			//BEGIN JK 06.07.04: Management of sevrals boards
-			//i_Offset=64;
+			/* BEGIN JK 06.07.04: Management of sevrals boards */
+			/* i_Offset=64; */
 			s_BoardInfos[dev->minor].i_Offset = 64;
-			//END JK 06.07.04: Management of sevrals boards
+			/* END JK 06.07.04: Management of sevrals boards */
 			break;
 		case 3:
-			//BEGIN JK 06.07.04: Management of sevrals boards
-			//i_Offset=128;
+			/* BEGIN JK 06.07.04: Management of sevrals boards */
+			/* i_Offset=128; */
 			s_BoardInfos[dev->minor].i_Offset = 128;
-			//END JK 06.07.04: Management of sevrals boards
+			/* END JK 06.07.04: Management of sevrals boards */
 			break;
 		case 4:
-			//BEGIN JK 06.07.04: Management of sevrals boards
-			//i_Offset=192;
+			/* BEGIN JK 06.07.04: Management of sevrals boards */
+			/* i_Offset=192; */
 			s_BoardInfos[dev->minor].i_Offset = 192;
-			//END JK 06.07.04: Management of sevrals boards
+			/* END JK 06.07.04: Management of sevrals boards */
 			break;
 		default:
 			printk("\nError in module selection\n");
 			i_err++;
-		}		// switch(data[11])
-	}			// elseif(data[12]==0 || data[12]==1)
+		}		/*  switch(data[11]) */
+	}			/*  elseif(data[12]==0 || data[12]==1) */
 	if (i_err) {
 		i_APCI3200_Reset(dev);
 		return -EINVAL;
 	}
-	//if(i_ScanType!=1)
+	/* if(i_ScanType!=1) */
 	if (s_BoardInfos[dev->minor].i_ScanType != 1) {
-		//BEGIN JK 06.07.04: Management of sevrals boards
-		//i_Count=0;
-		//i_Sum=0;
+		/* BEGIN JK 06.07.04: Management of sevrals boards */
+		/* i_Count=0; */
+		/* i_Sum=0; */
 		s_BoardInfos[dev->minor].i_Count = 0;
 		s_BoardInfos[dev->minor].i_Sum = 0;
-		//END JK 06.07.04: Management of sevrals boards
-	}			//if(i_ScanType!=1)
+		/* END JK 06.07.04: Management of sevrals boards */
+	}			/* if(i_ScanType!=1) */
 
 	ul_Config =
 		data[1] | (data[2] << 6) | (data[5] << 7) | (data[3] << 8) |
 		(data[4] << 9);
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//END JK 06.07.04: Management of sevrals boards
+	/* END JK 06.07.04: Management of sevrals boards */
   /*********************************/
 	/* Write the channel to configure */
   /*********************************/
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//outl(0 | ui_ChannelNo , devpriv->iobase+i_Offset + 0x4);
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* outl(0 | ui_ChannelNo , devpriv->iobase+i_Offset + 0x4); */
 	outl(0 | ui_ChannelNo,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0x4);
-	//END JK 06.07.04: Management of sevrals boards
+	/* END JK 06.07.04: Management of sevrals boards */
 
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//END JK 06.07.04: Management of sevrals boards
+	/* END JK 06.07.04: Management of sevrals boards */
   /**************************/
 	/* Reset the configuration */
   /**************************/
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//outl(0 , devpriv->iobase+i_Offset + 0x0);
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* outl(0 , devpriv->iobase+i_Offset + 0x0); */
 	outl(0, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0x0);
-	//END JK 06.07.04: Management of sevrals boards
+	/* END JK 06.07.04: Management of sevrals boards */
 
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//END JK 06.07.04: Management of sevrals boards
+	/* END JK 06.07.04: Management of sevrals boards */
 
   /***************************/
 	/* Write the configuration */
   /***************************/
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//outl(ul_Config , devpriv->iobase+i_Offset + 0x0);
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* outl(ul_Config , devpriv->iobase+i_Offset + 0x0); */
 	outl(ul_Config,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0x0);
-	//END JK 06.07.04: Management of sevrals boards
+	/* END JK 06.07.04: Management of sevrals boards */
 
   /***************************/
 	/*Reset the calibration bit */
   /***************************/
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//ul_Temp = inl(devpriv->iobase+i_Offset + 12);
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* ul_Temp = inl(devpriv->iobase+i_Offset + 12); */
 	ul_Temp = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12);
-	//END JK 06.07.04: Management of sevrals boards
+	/* END JK 06.07.04: Management of sevrals boards */
 
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//END JK 06.07.04: Management of sevrals boards
+	/* END JK 06.07.04: Management of sevrals boards */
 
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//outl((ul_Temp & 0xFFF9FFFF) , devpriv->iobase+.i_Offset + 12);
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* outl((ul_Temp & 0xFFF9FFFF) , devpriv->iobase+.i_Offset + 12); */
 	outl((ul_Temp & 0xFFF9FFFF),
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12);
-	//END JK 06.07.04: Management of sevrals boards
+	/* END JK 06.07.04: Management of sevrals boards */
 
 	if (data[9] == 1) {
 		devpriv->tsk_Current = current;
-		//BEGIN JK 06.07.04: Management of sevrals boards
-		//i_InterruptFlag=1;
+		/* BEGIN JK 06.07.04: Management of sevrals boards */
+		/* i_InterruptFlag=1; */
 		s_BoardInfos[dev->minor].i_InterruptFlag = 1;
-		//END JK 06.07.04: Management of sevrals boards
-	}			// if(data[9]==1)
+		/* END JK 06.07.04: Management of sevrals boards */
+	}			/*  if(data[9]==1) */
 	else {
-		//BEGIN JK 06.07.04: Management of sevrals boards
-		//i_InterruptFlag=0;
+		/* BEGIN JK 06.07.04: Management of sevrals boards */
+		/* i_InterruptFlag=0; */
 		s_BoardInfos[dev->minor].i_InterruptFlag = 0;
-		//END JK 06.07.04: Management of sevrals boards
-	}			//else  if(data[9]==1)
+		/* END JK 06.07.04: Management of sevrals boards */
+	}			/* else  if(data[9]==1) */
 
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//i_Initialised=1;
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* i_Initialised=1; */
 	s_BoardInfos[dev->minor].i_Initialised = 1;
-	//END JK 06.07.04: Management of sevrals boards
+	/* END JK 06.07.04: Management of sevrals boards */
 
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//if(i_ScanType==1)
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* if(i_ScanType==1) */
 	if (s_BoardInfos[dev->minor].i_ScanType == 1)
-		//END JK 06.07.04: Management of sevrals boards
+		/* END JK 06.07.04: Management of sevrals boards */
 	{
-		//BEGIN JK 06.07.04: Management of sevrals boards
-		//i_Sum=i_Sum+1;
+		/* BEGIN JK 06.07.04: Management of sevrals boards */
+		/* i_Sum=i_Sum+1; */
 		s_BoardInfos[dev->minor].i_Sum =
 			s_BoardInfos[dev->minor].i_Sum + 1;
-		//END JK 06.07.04: Management of sevrals boards
+		/* END JK 06.07.04: Management of sevrals boards */
 
 		insn->unused[0] = 0;
 		i_APCI3200_ReadAnalogInput(dev, s, insn, &ui_Dummy);
@@ -1340,8 +1333,8 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde
   | Task              : Read  value  of the selected channel			         |
   +----------------------------------------------------------------------------+
   | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-  |                     UINT ui_NoOfChannels    : No Of Channels To read       |
-  |                     UINT *data              : Data Pointer to read status  |
+  |                     unsigned int ui_NoOfChannels    : No Of Channels To read       |
+  |                     unsigned int *data              : Data Pointer to read status  |
   +----------------------------------------------------------------------------+
   | Output Parameters :	--													 |
   |				data[0]  : Digital Value Of Input             |
@@ -1361,21 +1354,21 @@ 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)
 {
-	UINT ui_DummyValue = 0;
+	unsigned int ui_DummyValue = 0;
 	int i_ConvertCJCCalibration;
 	int i = 0;
 
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//if(i_Initialised==0)
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* if(i_Initialised==0) */
 	if (s_BoardInfos[dev->minor].i_Initialised == 0)
-		//END JK 06.07.04: Management of sevrals boards
+		/* END JK 06.07.04: Management of sevrals boards */
 	{
 		i_APCI3200_Reset(dev);
 		return -EINVAL;
-	}			//if(i_Initialised==0);
+	}			/* if(i_Initialised==0); */
 
 #ifdef PRINT_INFO
 	printk("\n insn->unused[0] = %i", insn->unused[0]);
@@ -1386,14 +1379,14 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi
 
 		i_APCI3200_Read1AnalogInputChannel(dev, s, insn,
 			&ui_DummyValue);
-		//BEGIN JK 06.07.04: Management of sevrals boards
-		//ui_InterruptChannelValue[i_Count+0]=ui_DummyValue;
+		/* BEGIN JK 06.07.04: Management of sevrals boards */
+		/* ui_InterruptChannelValue[i_Count+0]=ui_DummyValue; */
 		s_BoardInfos[dev->minor].
 			ui_InterruptChannelValue[s_BoardInfos[dev->minor].
 			i_Count + 0] = ui_DummyValue;
-		//END JK 06.07.04: Management of sevrals boards
+		/* END JK 06.07.04: Management of sevrals boards */
 
-		//Begin JK 25.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+		/* Begin JK 25.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 		i_APCI3200_GetChannelCalibrationValue(dev,
 			s_BoardInfos[dev->minor].ui_Channel_num,
 			&s_BoardInfos[dev->minor].
@@ -1414,62 +1407,62 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi
 		printk("\n s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+8] = %lu", s_BoardInfos[dev->minor].ui_InterruptChannelValue[s_BoardInfos[dev->minor].i_Count + 8]);
 #endif
 
-		//End JK 25.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+		/* End JK 25.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
-		//BEGIN JK 06.07.04: Management of sevrals boards
-		//if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1))
+		/* BEGIN JK 06.07.04: Management of sevrals boards */
+		/* if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1)) */
 		if ((s_BoardInfos[dev->minor].i_ADDIDATAType == 2)
 			&& (s_BoardInfos[dev->minor].i_InterruptFlag == FALSE)
 			&& (s_BoardInfos[dev->minor].i_CJCAvailable == 1))
-			//END JK 06.07.04: Management of sevrals boards
+			/* END JK 06.07.04: Management of sevrals boards */
 		{
 			i_APCI3200_ReadCJCValue(dev, &ui_DummyValue);
-			//BEGIN JK 06.07.04: Management of sevrals boards
-			//ui_InterruptChannelValue[i_Count + 3]=ui_DummyValue;
+			/* BEGIN JK 06.07.04: Management of sevrals boards */
+			/* ui_InterruptChannelValue[i_Count + 3]=ui_DummyValue; */
 			s_BoardInfos[dev->minor].
 				ui_InterruptChannelValue[s_BoardInfos[dev->
 					minor].i_Count + 3] = ui_DummyValue;
-			//END JK 06.07.04: Management of sevrals boards
-		}		//if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE))
+			/* END JK 06.07.04: Management of sevrals boards */
+		}		/* if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)) */
 		else {
-			//BEGIN JK 06.07.04: Management of sevrals boards
-			//ui_InterruptChannelValue[i_Count + 3]=0;
+			/* BEGIN JK 06.07.04: Management of sevrals boards */
+			/* ui_InterruptChannelValue[i_Count + 3]=0; */
 			s_BoardInfos[dev->minor].
 				ui_InterruptChannelValue[s_BoardInfos[dev->
 					minor].i_Count + 3] = 0;
-			//END JK 06.07.04: Management of sevrals boards
-		}		//elseif((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1))
+			/* END JK 06.07.04: Management of sevrals boards */
+		}		/* elseif((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1)) */
 
-		//BEGIN JK 06.07.04: Management of sevrals boards
-		//if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE))
+		/* BEGIN JK 06.07.04: Management of sevrals boards */
+		/* if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE)) */
 		if ((s_BoardInfos[dev->minor].i_AutoCalibration == FALSE)
 			&& (s_BoardInfos[dev->minor].i_InterruptFlag == FALSE))
-			//END JK 06.07.04: Management of sevrals boards
+			/* END JK 06.07.04: Management of sevrals boards */
 		{
 			i_APCI3200_ReadCalibrationOffsetValue(dev,
 				&ui_DummyValue);
-			//BEGIN JK 06.07.04: Management of sevrals boards
-			//ui_InterruptChannelValue[i_Count + 1]=ui_DummyValue;
+			/* BEGIN JK 06.07.04: Management of sevrals boards */
+			/* ui_InterruptChannelValue[i_Count + 1]=ui_DummyValue; */
 			s_BoardInfos[dev->minor].
 				ui_InterruptChannelValue[s_BoardInfos[dev->
 					minor].i_Count + 1] = ui_DummyValue;
-			//END JK 06.07.04: Management of sevrals boards
+			/* END JK 06.07.04: Management of sevrals boards */
 			i_APCI3200_ReadCalibrationGainValue(dev,
 				&ui_DummyValue);
-			//BEGIN JK 06.07.04: Management of sevrals boards
-			//ui_InterruptChannelValue[i_Count + 2]=ui_DummyValue;
+			/* BEGIN JK 06.07.04: Management of sevrals boards */
+			/* ui_InterruptChannelValue[i_Count + 2]=ui_DummyValue; */
 			s_BoardInfos[dev->minor].
 				ui_InterruptChannelValue[s_BoardInfos[dev->
 					minor].i_Count + 2] = ui_DummyValue;
-			//END JK 06.07.04: Management of sevrals boards
-		}		//if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE))
+			/* END JK 06.07.04: Management of sevrals boards */
+		}		/* if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE)) */
 
-		//BEGIN JK 06.07.04: Management of sevrals boards
-		//if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)&& (i_CJCAvailable==1))
+		/* BEGIN JK 06.07.04: Management of sevrals boards */
+		/* if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)&& (i_CJCAvailable==1)) */
 		if ((s_BoardInfos[dev->minor].i_ADDIDATAType == 2)
 			&& (s_BoardInfos[dev->minor].i_InterruptFlag == FALSE)
 			&& (s_BoardInfos[dev->minor].i_CJCAvailable == 1))
-			//END JK 06.07.04: Management of sevrals boards
+			/* END JK 06.07.04: Management of sevrals boards */
 		{
 	  /**********************************************************/
 			/*Test if the Calibration channel must be read for the CJC */
@@ -1477,52 +1470,52 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi
 	  /**********************************/
 			/*Test if the polarity is the same */
 	  /**********************************/
-			//BEGIN JK 06.07.04: Management of sevrals boards
-			//if(i_CJCPolarity!=i_ADDIDATAPolarity)
+			/* BEGIN JK 06.07.04: Management of sevrals boards */
+			/* if(i_CJCPolarity!=i_ADDIDATAPolarity) */
 			if (s_BoardInfos[dev->minor].i_CJCPolarity !=
 				s_BoardInfos[dev->minor].i_ADDIDATAPolarity)
-				//END JK 06.07.04: Management of sevrals boards
+				/* END JK 06.07.04: Management of sevrals boards */
 			{
 				i_ConvertCJCCalibration = 1;
-			}	//if(i_CJCPolarity!=i_ADDIDATAPolarity)
+			}	/* if(i_CJCPolarity!=i_ADDIDATAPolarity) */
 			else {
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//if(i_CJCGain==i_ADDIDATAGain)
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* if(i_CJCGain==i_ADDIDATAGain) */
 				if (s_BoardInfos[dev->minor].i_CJCGain ==
 					s_BoardInfos[dev->minor].i_ADDIDATAGain)
-					//END JK 06.07.04: Management of sevrals boards
+					/* END JK 06.07.04: Management of sevrals boards */
 				{
 					i_ConvertCJCCalibration = 0;
-				}	//if(i_CJCGain==i_ADDIDATAGain)
+				}	/* if(i_CJCGain==i_ADDIDATAGain) */
 				else {
 					i_ConvertCJCCalibration = 1;
-				}	//elseif(i_CJCGain==i_ADDIDATAGain)
-			}	//elseif(i_CJCPolarity!=i_ADDIDATAPolarity)
+				}	/* elseif(i_CJCGain==i_ADDIDATAGain) */
+			}	/* elseif(i_CJCPolarity!=i_ADDIDATAPolarity) */
 			if (i_ConvertCJCCalibration == 1) {
 				i_APCI3200_ReadCJCCalOffset(dev,
 					&ui_DummyValue);
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//ui_InterruptChannelValue[i_Count+4]=ui_DummyValue;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* ui_InterruptChannelValue[i_Count+4]=ui_DummyValue; */
 				s_BoardInfos[dev->minor].
 					ui_InterruptChannelValue[s_BoardInfos
 					[dev->minor].i_Count + 4] =
 					ui_DummyValue;
-				//END JK 06.07.04: Management of sevrals boards
+				/* END JK 06.07.04: Management of sevrals boards */
 
 				i_APCI3200_ReadCJCCalGain(dev, &ui_DummyValue);
 
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//ui_InterruptChannelValue[i_Count+5]=ui_DummyValue;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* ui_InterruptChannelValue[i_Count+5]=ui_DummyValue; */
 				s_BoardInfos[dev->minor].
 					ui_InterruptChannelValue[s_BoardInfos
 					[dev->minor].i_Count + 5] =
 					ui_DummyValue;
-				//END JK 06.07.04: Management of sevrals boards
-			}	//if(i_ConvertCJCCalibration==1)
+				/* END JK 06.07.04: Management of sevrals boards */
+			}	/* if(i_ConvertCJCCalibration==1) */
 			else {
-				//BEGIN JK 06.07.04: Management of sevrals boards
-				//ui_InterruptChannelValue[i_Count+4]=0;
-				//ui_InterruptChannelValue[i_Count+5]=0;
+				/* BEGIN JK 06.07.04: Management of sevrals boards */
+				/* ui_InterruptChannelValue[i_Count+4]=0; */
+				/* ui_InterruptChannelValue[i_Count+5]=0; */
 
 				s_BoardInfos[dev->minor].
 					ui_InterruptChannelValue[s_BoardInfos
@@ -1530,36 +1523,36 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi
 				s_BoardInfos[dev->minor].
 					ui_InterruptChannelValue[s_BoardInfos
 					[dev->minor].i_Count + 5] = 0;
-				//END JK 06.07.04: Management of sevrals boards
-			}	//elseif(i_ConvertCJCCalibration==1)
-		}		//if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE))
+				/* END JK 06.07.04: Management of sevrals boards */
+			}	/* elseif(i_ConvertCJCCalibration==1) */
+		}		/* if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)) */
 
-		//BEGIN JK 06.07.04: Management of sevrals boards
-		//if(i_ScanType!=1)
+		/* BEGIN JK 06.07.04: Management of sevrals boards */
+		/* if(i_ScanType!=1) */
 		if (s_BoardInfos[dev->minor].i_ScanType != 1) {
-			//i_Count=0;
+			/* i_Count=0; */
 			s_BoardInfos[dev->minor].i_Count = 0;
-		}		//if(i_ScanType!=1)
+		}		/* if(i_ScanType!=1) */
 		else {
-			//i_Count=i_Count +6;
-			//Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-			//s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count +6;
+			/* i_Count=i_Count +6; */
+			/* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+			/* s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count +6; */
 			s_BoardInfos[dev->minor].i_Count =
 				s_BoardInfos[dev->minor].i_Count + 9;
-			//End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-		}		//else if(i_ScanType!=1)
+			/* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+		}		/* else if(i_ScanType!=1) */
 
-		//if((i_ScanType==1) &&(i_InterruptFlag==1))
+		/* if((i_ScanType==1) &&(i_InterruptFlag==1)) */
 		if ((s_BoardInfos[dev->minor].i_ScanType == 1)
 			&& (s_BoardInfos[dev->minor].i_InterruptFlag == 1)) {
-			//i_Count=i_Count-6;
-			//Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-			//s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count-6;
+			/* i_Count=i_Count-6; */
+			/* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+			/* s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count-6; */
 			s_BoardInfos[dev->minor].i_Count =
 				s_BoardInfos[dev->minor].i_Count - 9;
-			//End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+			/* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 		}
-		//if(i_ScanType==0)
+		/* if(i_ScanType==0) */
 		if (s_BoardInfos[dev->minor].i_ScanType == 0) {
 			/*
 			   data[0]= ui_InterruptChannelValue[0];
@@ -1591,41 +1584,41 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi
 				s_BoardInfos[dev->minor].
 				ui_InterruptChannelValue[5];
 
-			//Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-			//printk("\n 0 - i_APCI3200_GetChannelCalibrationValue data [6] = %lu, data [7] = %lu, data [8] = %lu", data [6], data [7], data [8]);
+			/* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+			/* printk("\n 0 - i_APCI3200_GetChannelCalibrationValue data [6] = %lu, data [7] = %lu, data [8] = %lu", data [6], data [7], data [8]); */
 			i_APCI3200_GetChannelCalibrationValue(dev,
 				s_BoardInfos[dev->minor].ui_Channel_num,
 				&data[6], &data[7], &data[8]);
-			//End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+			/* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 		}
 		break;
 	case 1:
 
 		for (i = 0; i < insn->n; i++) {
-			//data[i]=ui_InterruptChannelValue[i];
+			/* data[i]=ui_InterruptChannelValue[i]; */
 			data[i] =
 				s_BoardInfos[dev->minor].
 				ui_InterruptChannelValue[i];
 		}
 
-		//i_Count=0;
-		//i_Sum=0;
-		//if(i_ScanType==1)
+		/* i_Count=0; */
+		/* i_Sum=0; */
+		/* if(i_ScanType==1) */
 		s_BoardInfos[dev->minor].i_Count = 0;
 		s_BoardInfos[dev->minor].i_Sum = 0;
 		if (s_BoardInfos[dev->minor].i_ScanType == 1) {
-			//i_Initialised=0;
-			//i_InterruptFlag=0;
+			/* i_Initialised=0; */
+			/* i_InterruptFlag=0; */
 			s_BoardInfos[dev->minor].i_Initialised = 0;
 			s_BoardInfos[dev->minor].i_InterruptFlag = 0;
-			//END JK 06.07.04: Management of sevrals boards
+			/* END JK 06.07.04: Management of sevrals boards */
 		}
 		break;
 	default:
 		printk("\nThe parameters passed are in error\n");
 		i_APCI3200_Reset(dev);
 		return -EINVAL;
-	}			//switch(insn->unused[0])
+	}			/* switch(insn->unused[0]) */
 
 	return insn->n;
 }
@@ -1639,8 +1632,8 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi
   | Task              : Read  value  of the selected channel			         |
   +----------------------------------------------------------------------------+
   | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-  |                     UINT ui_NoOfChannel    : Channel No to read            |
-  |                     UINT *data              : Data Pointer to read status  |
+  |                     unsigned int ui_NoOfChannel    : Channel No to read            |
+  |                     unsigned int *data              : Data Pointer to read status  |
   +----------------------------------------------------------------------------+
   | Output Parameters :	--													 |
   |			          data[0]  : Digital Value read                   |
@@ -1651,49 +1644,49 @@ 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)
 {
-	UINT ui_EOC = 0;
-	UINT ui_ChannelNo = 0;
-	UINT ui_CommandRegister = 0;
+	unsigned int ui_EOC = 0;
+	unsigned int ui_ChannelNo = 0;
+	unsigned int ui_CommandRegister = 0;
 
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//ui_ChannelNo=i_ChannelNo;
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* ui_ChannelNo=i_ChannelNo; */
 	ui_ChannelNo = s_BoardInfos[dev->minor].i_ChannelNo;
 
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
   /*********************************/
 	/* Write the channel to configure */
   /*********************************/
-	//Begin JK 20.10.2004: Bad channel value is used when using differential mode
-	//outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4);
-	//outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4);
+	/* Begin JK 20.10.2004: Bad channel value is used when using differential mode */
+	/* outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); */
+	/* outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); */
 	outl(0 | s_BoardInfos[dev->minor].i_ChannelNo,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0x4);
-	//End JK 20.10.2004: Bad channel value is used when using differential mode
+	/* End JK 20.10.2004: Bad channel value is used when using differential mode */
 
   /*******************************/
 	/* Set the convert timing unit */
   /*******************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
 
-	//outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36);
+	/* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36);
 
   /**************************/
 	/* Set the convert timing */
   /**************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
 
-	//outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32);
+	/* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32);
 
@@ -1707,36 +1700,36 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev,
 	/*Test if the interrupt is enable */
   /*********************************/
 
-	//if (i_InterruptFlag == ADDIDATA_ENABLE)
+	/* if (i_InterruptFlag == ADDIDATA_ENABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) {
       /************************/
 		/* Enable the interrupt */
       /************************/
 		ui_CommandRegister = ui_CommandRegister | 0x00100000;
-	}			//if (i_InterruptFlag == ADDIDATA_ENABLE)
+	}			/* if (i_InterruptFlag == ADDIDATA_ENABLE) */
 
   /******************************/
 	/* Write the command register */
   /******************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
 
-	//outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8);
+	/* outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8); */
 	outl(ui_CommandRegister,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8);
 
   /*****************************/
 	/*Test if interrupt is enable */
   /*****************************/
-	//if (i_InterruptFlag == ADDIDATA_DISABLE)
+	/* if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) {
 		do {
 	  /*************************/
 			/*Read the EOC Status bit */
 	  /*************************/
 
-			//ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1;
+			/* ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; */
 			ui_EOC = inl(devpriv->iobase +
 				s_BoardInfos[dev->minor].i_Offset + 20) & 1;
 
@@ -1746,13 +1739,13 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev,
 		/* Read the digital value of the input */
       /***************************************/
 
-		//data[0] = inl (devpriv->iobase+i_Offset + 28);
+		/* data[0] = inl (devpriv->iobase+i_Offset + 28); */
 		data[0] =
 			inl(devpriv->iobase +
 			s_BoardInfos[dev->minor].i_Offset + 28);
-		//END JK 06.07.04: Management of sevrals boards
+		/* END JK 06.07.04: Management of sevrals boards */
 
-	}			// if (i_InterruptFlag == ADDIDATA_DISABLE)
+	}			/*  if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	return 0;
 }
 
@@ -1765,7 +1758,7 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev,
   | Task              : Read calibration offset  value  of the selected channel|
   +----------------------------------------------------------------------------+
   | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-  |                     UINT *data              : Data Pointer to read status  |
+  |                     unsigned int *data              : Data Pointer to read status  |
   +----------------------------------------------------------------------------+
   | Output Parameters :	--													 |
   |			          data[0]  : Calibration offset Value   |
@@ -1776,54 +1769,54 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev,
   |			                                                         |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * data)
+int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, unsigned int *data)
 {
-	UINT ui_Temp = 0, ui_EOC = 0;
-	UINT ui_CommandRegister = 0;
+	unsigned int ui_Temp = 0, ui_EOC = 0;
+	unsigned int ui_CommandRegister = 0;
 
-	//BEGIN JK 06.07.04: Management of sevrals boards
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* BEGIN JK 06.07.04: Management of sevrals boards */
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
   /*********************************/
 	/* Write the channel to configure */
   /*********************************/
-	//Begin JK 20.10.2004: This seems not necessary !
-	//outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4);
-	//outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4);
-	//End JK 20.10.2004: This seems not necessary !
+	/* Begin JK 20.10.2004: This seems not necessary ! */
+	/* outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); */
+	/* outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); */
+	/* End JK 20.10.2004: This seems not necessary ! */
 
   /*******************************/
 	/* Set the convert timing unit */
   /*******************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36);
+	/* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36);
   /**************************/
 	/* Set the convert timing */
   /**************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32);
+	/* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32);
   /*****************************/
 	/*Read the calibration offset */
   /*****************************/
-	//ui_Temp = inl(devpriv->iobase+i_Offset + 12);
+	/* ui_Temp = inl(devpriv->iobase+i_Offset + 12); */
 	ui_Temp = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12);
 
   /*********************************/
 	/*Configure the Offset Conversion */
   /*********************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl((ui_Temp | 0x00020000), devpriv->iobase+i_Offset + 12);
+	/* outl((ui_Temp | 0x00020000), devpriv->iobase+i_Offset + 12); */
 	outl((ui_Temp | 0x00020000),
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12);
   /*******************************/
@@ -1836,7 +1829,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat
 	/*Test if the interrupt is enable */
   /*********************************/
 
-	//if (i_InterruptFlag == ADDIDATA_ENABLE)
+	/* if (i_InterruptFlag == ADDIDATA_ENABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) {
 
       /**********************/
@@ -1845,7 +1838,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat
 
 		ui_CommandRegister = ui_CommandRegister | 0x00100000;
 
-	}			//if (i_InterruptFlag == ADDIDATA_ENABLE)
+	}			/* if (i_InterruptFlag == ADDIDATA_ENABLE) */
 
   /**********************/
 	/*Start the conversion */
@@ -1855,10 +1848,10 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat
   /***************************/
 	/*Write the command regiter */
   /***************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8);
+	/* outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8); */
 	outl(ui_CommandRegister,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8);
 
@@ -1866,7 +1859,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat
 	/*Test if interrupt is enable */
   /*****************************/
 
-	//if (i_InterruptFlag == ADDIDATA_DISABLE)
+	/* if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) {
 
 		do {
@@ -1874,7 +1867,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat
 			/*Read the EOC flag */
 	  /*******************/
 
-			//ui_EOC = inl (devpriv->iobase+i_Offset + 20) & 1;
+			/* ui_EOC = inl (devpriv->iobase+i_Offset + 20) & 1; */
 			ui_EOC = inl(devpriv->iobase +
 				s_BoardInfos[dev->minor].i_Offset + 20) & 1;
 
@@ -1884,11 +1877,11 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat
 		/*Read the digital value of the calibration Offset */
       /**************************************************/
 
-		//data[0] = inl(devpriv->iobase+i_Offset+ 28);
+		/* data[0] = inl(devpriv->iobase+i_Offset+ 28); */
 		data[0] =
 			inl(devpriv->iobase +
 			s_BoardInfos[dev->minor].i_Offset + 28);
-	}			//if (i_InterruptFlag == ADDIDATA_DISABLE)
+	}			/* if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	return 0;
 }
 
@@ -1901,7 +1894,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat
   | Task              : Read calibration gain  value  of the selected channel  |
   +----------------------------------------------------------------------------+
   | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-  |                     UINT *data              : Data Pointer to read status  |
+  |                     unsigned int *data              : Data Pointer to read status  |
   +----------------------------------------------------------------------------+
   | Output Parameters :	--													 |
   |			          data[0]  : Calibration gain Value Of Input     |
@@ -1912,21 +1905,21 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat
   |			                                                         |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data)
+int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int *data)
 {
-	UINT ui_EOC = 0;
-	INT ui_CommandRegister = 0;
+	unsigned int ui_EOC = 0;
+	int ui_CommandRegister = 0;
 
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
   /*********************************/
 	/* Write the channel to configure */
   /*********************************/
-	//Begin JK 20.10.2004: This seems not necessary !
-	//outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4);
-	//outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4);
-	//End JK 20.10.2004: This seems not necessary !
+	/* Begin JK 20.10.2004: This seems not necessary ! */
+	/* outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); */
+	/* outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); */
+	/* End JK 20.10.2004: This seems not necessary ! */
 
   /***************************/
 	/*Read the calibration gain */
@@ -1934,28 +1927,28 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data)
   /*******************************/
 	/* Set the convert timing unit */
   /*******************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36);
+	/* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36);
   /**************************/
 	/* Set the convert timing */
   /**************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32);
+	/* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32);
   /*******************************/
 	/*Configure the Gain Conversion */
   /*******************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(0x00040000 , devpriv->iobase+i_Offset + 12);
+	/* outl(0x00040000 , devpriv->iobase+i_Offset + 12); */
 	outl(0x00040000,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12);
 
@@ -1969,7 +1962,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data)
 	/*Test if the interrupt is enable */
   /*********************************/
 
-	//if (i_InterruptFlag == ADDIDATA_ENABLE)
+	/* if (i_InterruptFlag == ADDIDATA_ENABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) {
 
       /**********************/
@@ -1978,7 +1971,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data)
 
 		ui_CommandRegister = ui_CommandRegister | 0x00100000;
 
-	}			//if (i_InterruptFlag == ADDIDATA_ENABLE)
+	}			/* if (i_InterruptFlag == ADDIDATA_ENABLE) */
 
   /**********************/
 	/*Start the conversion */
@@ -1988,10 +1981,10 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data)
   /***************************/
 	/*Write the command regiter */
   /***************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8);
+	/* outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8); */
 	outl(ui_CommandRegister,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8);
 
@@ -1999,7 +1992,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data)
 	/*Test if interrupt is enable */
   /*****************************/
 
-	//if (i_InterruptFlag == ADDIDATA_DISABLE)
+	/* if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) {
 
 		do {
@@ -2008,7 +2001,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data)
 			/*Read the EOC flag */
 	  /*******************/
 
-			//ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1;
+			/* ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; */
 			ui_EOC = inl(devpriv->iobase +
 				s_BoardInfos[dev->minor].i_Offset + 20) & 1;
 
@@ -2018,12 +2011,12 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data)
 		/*Read the digital value of the calibration Gain */
       /************************************************/
 
-		//data[0] = inl(devpriv->iobase+i_Offset + 28);
+		/* data[0] = inl(devpriv->iobase+i_Offset + 28); */
 		data[0] =
 			inl(devpriv->iobase +
 			s_BoardInfos[dev->minor].i_Offset + 28);
 
-	}			//if (i_InterruptFlag == ADDIDATA_DISABLE)
+	}			/* if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	return 0;
 }
 
@@ -2036,7 +2029,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data)
   | Task              : Read CJC  value  of the selected channel               |
   +----------------------------------------------------------------------------+
   | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-  |                     UINT *data              : Data Pointer to read status  |
+  |                     unsigned int *data              : Data Pointer to read status  |
   +----------------------------------------------------------------------------+
   | Output Parameters :	--													 |
   |			          data[0]  : CJC Value                           |
@@ -2048,41 +2041,41 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data)
   +----------------------------------------------------------------------------+
 */
 
-int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data)
+int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data)
 {
-	UINT ui_EOC = 0;
-	INT ui_CommandRegister = 0;
+	unsigned int ui_EOC = 0;
+	int ui_CommandRegister = 0;
 
   /******************************/
 	/*Set the converting time unit */
   /******************************/
 
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
 
-	//outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36);
+	/* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36);
   /**************************/
 	/* Set the convert timing */
   /**************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
 
-	//outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32);
+	/* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32);
 
   /******************************/
 	/*Configure the CJC Conversion */
   /******************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
 
-	//outl( 0x00000400 , devpriv->iobase+i_Offset + 4);
+	/* outl( 0x00000400 , devpriv->iobase+i_Offset + 4); */
 	outl(0x00000400,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4);
   /*******************************/
@@ -2092,7 +2085,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data)
   /*********************************/
 	/*Test if the interrupt is enable */
   /*********************************/
-	//if (i_InterruptFlag == ADDIDATA_ENABLE)
+	/* if (i_InterruptFlag == ADDIDATA_ENABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) {
       /**********************/
 		/*Enable the interrupt */
@@ -2109,10 +2102,10 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data)
   /***************************/
 	/*Write the command regiter */
   /***************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8);
+	/* outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8); */
 	outl(ui_CommandRegister,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8);
 
@@ -2120,7 +2113,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data)
 	/*Test if interrupt is enable */
   /*****************************/
 
-	//if (i_InterruptFlag == ADDIDATA_DISABLE)
+	/* if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) {
 		do {
 
@@ -2128,7 +2121,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data)
 			/*Read the EOC flag */
 	  /*******************/
 
-			//ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1;
+			/* ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; */
 			ui_EOC = inl(devpriv->iobase +
 				s_BoardInfos[dev->minor].i_Offset + 20) & 1;
 
@@ -2138,12 +2131,12 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data)
 		/*Read the digital value of the CJC */
       /***********************************/
 
-		//data[0] = inl(devpriv->iobase+i_Offset + 28);
+		/* data[0] = inl(devpriv->iobase+i_Offset + 28); */
 		data[0] =
 			inl(devpriv->iobase +
 			s_BoardInfos[dev->minor].i_Offset + 28);
 
-	}			//if (i_InterruptFlag == ADDIDATA_DISABLE)
+	}			/* if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	return 0;
 }
 
@@ -2156,7 +2149,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data)
   | Task              : Read CJC calibration offset  value  of the selected channel
   +----------------------------------------------------------------------------+
   | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-  |                     UINT *data              : Data Pointer to read status  |
+  |                     unsigned int *data              : Data Pointer to read status  |
   +----------------------------------------------------------------------------+
   | Output Parameters :	--													 |
   |			          data[0]  : CJC calibration offset Value
@@ -2167,47 +2160,47 @@ 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)
 {
-	UINT ui_EOC = 0;
-	INT ui_CommandRegister = 0;
+	unsigned int ui_EOC = 0;
+	int ui_CommandRegister = 0;
   /*******************************************/
 	/*Read calibration offset value for the CJC */
   /*******************************************/
   /*******************************/
 	/* Set the convert timing unit */
   /*******************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36);
+	/* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36);
   /**************************/
 	/* Set the convert timing */
   /**************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32);
+	/* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32);
   /******************************/
 	/*Configure the CJC Conversion */
   /******************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(0x00000400 , devpriv->iobase+i_Offset + 4);
+	/* outl(0x00000400 , devpriv->iobase+i_Offset + 4); */
 	outl(0x00000400,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4);
   /*********************************/
 	/*Configure the Offset Conversion */
   /*********************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(0x00020000, devpriv->iobase+i_Offset + 12);
+	/* outl(0x00020000, devpriv->iobase+i_Offset + 12); */
 	outl(0x00020000,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12);
   /*******************************/
@@ -2218,7 +2211,7 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data)
 	/*Test if the interrupt is enable */
   /*********************************/
 
-	//if (i_InterruptFlag == ADDIDATA_ENABLE)
+	/* if (i_InterruptFlag == ADDIDATA_ENABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) {
       /**********************/
 		/*Enable the interrupt */
@@ -2234,19 +2227,19 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data)
   /***************************/
 	/*Write the command regiter */
   /***************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(ui_CommandRegister,devpriv->iobase+i_Offset + 8);
+	/* outl(ui_CommandRegister,devpriv->iobase+i_Offset + 8); */
 	outl(ui_CommandRegister,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8);
-	//if (i_InterruptFlag == ADDIDATA_DISABLE)
+	/* if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) {
 		do {
 	  /*******************/
 			/*Read the EOC flag */
 	  /*******************/
-			//ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1;
+			/* ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; */
 			ui_EOC = inl(devpriv->iobase +
 				s_BoardInfos[dev->minor].i_Offset + 20) & 1;
 		} while (ui_EOC != 1);
@@ -2254,11 +2247,11 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data)
       /**************************************************/
 		/*Read the digital value of the calibration Offset */
       /**************************************************/
-		//data[0] = inl(devpriv->iobase+i_Offset + 28);
+		/* data[0] = inl(devpriv->iobase+i_Offset + 28); */
 		data[0] =
 			inl(devpriv->iobase +
 			s_BoardInfos[dev->minor].i_Offset + 28);
-	}			//if (i_InterruptFlag == ADDIDATA_DISABLE)
+	}			/* if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	return 0;
 }
 
@@ -2271,8 +2264,8 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data)
   | Task              : Read CJC calibration gain value
   +----------------------------------------------------------------------------+
   | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-  |                     UINT ui_NoOfChannels    : No Of Channels To read       |
-  |                     UINT *data              : Data Pointer to read status  |
+  |                     unsigned int ui_NoOfChannels    : No Of Channels To read       |
+  |                     unsigned int *data              : Data Pointer to read status  |
   +----------------------------------------------------------------------------+
   | Output Parameters :	--													 |
   |			          data[0]  : CJC calibration gain value
@@ -2283,44 +2276,44 @@ 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)
 {
-	UINT ui_EOC = 0;
-	INT ui_CommandRegister = 0;
+	unsigned int ui_EOC = 0;
+	int ui_CommandRegister = 0;
   /*******************************/
 	/* Set the convert timing unit */
   /*******************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36);
+	/* outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTimeUnit,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36);
   /**************************/
 	/* Set the convert timing */
   /**************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32);
+	/* outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */
 	outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32);
   /******************************/
 	/*Configure the CJC Conversion */
   /******************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(0x00000400,devpriv->iobase+i_Offset + 4);
+	/* outl(0x00000400,devpriv->iobase+i_Offset + 4); */
 	outl(0x00000400,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4);
   /*******************************/
 	/*Configure the Gain Conversion */
   /*******************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(0x00040000,devpriv->iobase+i_Offset + 12);
+	/* outl(0x00040000,devpriv->iobase+i_Offset + 12); */
 	outl(0x00040000,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12);
 
@@ -2331,7 +2324,7 @@ int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data)
   /*********************************/
 	/*Test if the interrupt is enable */
   /*********************************/
-	//if (i_InterruptFlag == ADDIDATA_ENABLE)
+	/* if (i_InterruptFlag == ADDIDATA_ENABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) {
       /**********************/
 		/*Enable the interrupt */
@@ -2345,30 +2338,30 @@ int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data)
   /***************************/
 	/*Write the command regiter */
   /***************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(ui_CommandRegister ,devpriv->iobase+i_Offset + 8);
+	/* outl(ui_CommandRegister ,devpriv->iobase+i_Offset + 8); */
 	outl(ui_CommandRegister,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8);
-	//if (i_InterruptFlag == ADDIDATA_DISABLE)
+	/* if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) {
 		do {
 	  /*******************/
 			/*Read the EOC flag */
 	  /*******************/
-			//ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1;
+			/* ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; */
 			ui_EOC = inl(devpriv->iobase +
 				s_BoardInfos[dev->minor].i_Offset + 20) & 1;
 		} while (ui_EOC != 1);
       /************************************************/
 		/*Read the digital value of the calibration Gain */
       /************************************************/
-		//data[0] = inl (devpriv->iobase+i_Offset + 28);
+		/* data[0] = inl (devpriv->iobase+i_Offset + 28); */
 		data[0] =
 			inl(devpriv->iobase +
 			s_BoardInfos[dev->minor].i_Offset + 28);
-	}			//if (i_InterruptFlag == ADDIDATA_DISABLE)
+	}			/* if (i_InterruptFlag == ADDIDATA_DISABLE) */
 	return 0;
 }
 
@@ -2404,33 +2397,33 @@ 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)
 {
-	UINT ui_Configuration = 0;
-	INT i_Temp;		//,i_TimeUnit;
-	//if(i_Initialised==0)
+	unsigned int ui_Configuration = 0;
+	int i_Temp;		/* ,i_TimeUnit; */
+	/* if(i_Initialised==0) */
 
 	if (s_BoardInfos[dev->minor].i_Initialised == 0) {
 		i_APCI3200_Reset(dev);
 		return -EINVAL;
-	}			//if(i_Initialised==0);
+	}			/* if(i_Initialised==0); */
 	if (data[0] != 0 && data[0] != 1) {
 		printk("\nError in selection of functionality\n");
 		i_APCI3200_Reset(dev);
 		return -EINVAL;
-	}			//if(data[0]!=0 && data[0]!=1)
+	}			/* if(data[0]!=0 && data[0]!=1) */
 
-	if (data[0] == 1)	//Perform Short Circuit TEST
+	if (data[0] == 1)	/* Perform Short Circuit TEST */
 	{
       /**************************/
 		/*Set the short-cicuit bit */
       /**************************/
-		//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+		/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 		while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].
 						i_Offset + 12) >> 19) & 1) !=
 			1) ;
-		//outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4);
+		/* outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); */
 		outl((0x00001000 | s_BoardInfos[dev->minor].i_ChannelNo),
 			devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 			4);
@@ -2439,19 +2432,19 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev,
       /*************************/
 		/* i_TimeUnit= i_ADDIDATAConversionTimeUnit;
 		   i_ADDIDATAConversionTimeUnit= 1; */
-		//i_Temp= i_InterruptFlag ;
+		/* i_Temp= i_InterruptFlag ; */
 		i_Temp = s_BoardInfos[dev->minor].i_InterruptFlag;
-		//i_InterruptFlag = ADDIDATA_DISABLE;
+		/* i_InterruptFlag = ADDIDATA_DISABLE; */
 		s_BoardInfos[dev->minor].i_InterruptFlag = ADDIDATA_DISABLE;
 		i_APCI3200_Read1AnalogInputChannel(dev, s, insn, data);
-		//if(i_AutoCalibration == FALSE)
+		/* if(i_AutoCalibration == FALSE) */
 		if (s_BoardInfos[dev->minor].i_AutoCalibration == FALSE) {
-			//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+			/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 			while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].
 							i_Offset +
 							12) >> 19) & 1) != 1) ;
 
-			//outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4);
+			/* outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); */
 			outl((0x00001000 | s_BoardInfos[dev->minor].
 					i_ChannelNo),
 				devpriv->iobase +
@@ -2462,15 +2455,15 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev,
 			i_APCI3200_ReadCalibrationGainValue(dev, data);
 		}
 	} else {
-		//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+		/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 		while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].
 						i_Offset + 12) >> 19) & 1) !=
 			1) ;
-		//outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4);
+		/* outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4); */
 		outl((0x00000800 | s_BoardInfos[dev->minor].i_ChannelNo),
 			devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 			4);
-		//ui_Configuration = inl(devpriv->iobase+i_Offset + 0);
+		/* ui_Configuration = inl(devpriv->iobase+i_Offset + 0); */
 		ui_Configuration =
 			inl(devpriv->iobase +
 			s_BoardInfos[dev->minor].i_Offset + 0);
@@ -2479,18 +2472,18 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev,
       /*************************/
 		/* i_TimeUnit= i_ADDIDATAConversionTimeUnit;
 		   i_ADDIDATAConversionTimeUnit= 1; */
-		//i_Temp= i_InterruptFlag ;
+		/* i_Temp= i_InterruptFlag ; */
 		i_Temp = s_BoardInfos[dev->minor].i_InterruptFlag;
-		//i_InterruptFlag = ADDIDATA_DISABLE;
+		/* i_InterruptFlag = ADDIDATA_DISABLE; */
 		s_BoardInfos[dev->minor].i_InterruptFlag = ADDIDATA_DISABLE;
 		i_APCI3200_Read1AnalogInputChannel(dev, s, insn, data);
-		//if(i_AutoCalibration == FALSE)
+		/* if(i_AutoCalibration == FALSE) */
 		if (s_BoardInfos[dev->minor].i_AutoCalibration == FALSE) {
-			//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+			/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 			while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].
 							i_Offset +
 							12) >> 19) & 1) != 1) ;
-			//outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4);
+			/* outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4); */
 			outl((0x00000800 | s_BoardInfos[dev->minor].
 					i_ChannelNo),
 				devpriv->iobase +
@@ -2501,9 +2494,9 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev,
 			i_APCI3200_ReadCalibrationGainValue(dev, data);
 		}
 	}
-	//i_InterruptFlag=i_Temp ;
+	/* i_InterruptFlag=i_Temp ; */
 	s_BoardInfos[dev->minor].i_InterruptFlag = i_Temp;
-	//printk("\ni_InterruptFlag=%d\n",i_InterruptFlag);
+	/* printk("\ni_InterruptFlag=%d\n",i_InterruptFlag); */
 	return insn->n;
 }
 
@@ -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,23 +2553,23 @@ 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;
-	int tmp;		// divisor1,divisor2;
-	UINT ui_ConvertTime = 0;
-	UINT ui_ConvertTimeBase = 0;
-	UINT ui_DelayTime = 0;
-	UINT ui_DelayTimeBase = 0;
-	INT i_Triggermode = 0;
-	INT i_TriggerEdge = 0;
-	INT i_NbrOfChannel = 0;
-	INT i_Cpt = 0;
+	int tmp;		/*  divisor1,divisor2; */
+	unsigned int ui_ConvertTime = 0;
+	unsigned int ui_ConvertTimeBase = 0;
+	unsigned int ui_DelayTime = 0;
+	unsigned int ui_DelayTimeBase = 0;
+	int i_Triggermode = 0;
+	int i_TriggerEdge = 0;
+	int i_NbrOfChannel = 0;
+	int i_Cpt = 0;
 	double d_ConversionTimeForAllChannels = 0.0;
 	double d_SCANTimeNewUnit = 0.0;
-	// step 1: make sure trigger sources are trivially valid
+	/*  step 1: make sure trigger sources are trivially valid */
 
 	tmp = cmd->start_src;
 	cmd->start_src &= TRIG_NOW | TRIG_EXT;
@@ -2598,10 +2591,10 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 	cmd->stop_src &= TRIG_COUNT | TRIG_NONE;
 	if (!cmd->stop_src || tmp != cmd->stop_src)
 		err++;
-	//if(i_InterruptFlag==0)
+	/* if(i_InterruptFlag==0) */
 	if (s_BoardInfos[dev->minor].i_InterruptFlag == 0) {
 		err++;
-		//          printk("\nThe interrupt should be enabled\n");
+		/*           printk("\nThe interrupt should be enabled\n"); */
 	}
 	if (err) {
 		i_APCI3200_Reset(dev);
@@ -2643,9 +2636,9 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 		i_APCI3200_Reset(dev);
 		return 2;
 	}
-	//i_FirstChannel=cmd->chanlist[0];
+	/* i_FirstChannel=cmd->chanlist[0]; */
 	s_BoardInfos[dev->minor].i_FirstChannel = cmd->chanlist[0];
-	//i_LastChannel=cmd->chanlist[1];
+	/* i_LastChannel=cmd->chanlist[1]; */
 	s_BoardInfos[dev->minor].i_LastChannel = cmd->chanlist[1];
 
 	if (cmd->convert_src == TRIG_TIMER) {
@@ -2656,11 +2649,11 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 		{
 			printk("\nThe selection of conversion time reload value is in error\n");
 			err++;
-		}		// if (ui_ConvertTime!=20 && ui_ConvertTime!=40 && ui_ConvertTime!=80 && ui_ConvertTime!=160 )
+		}		/*  if (ui_ConvertTime!=20 && ui_ConvertTime!=40 && ui_ConvertTime!=80 && ui_ConvertTime!=160 ) */
 		if (ui_ConvertTimeBase != 2) {
 			printk("\nThe selection of conversion time unit  is in error\n");
 			err++;
-		}		//if(ui_ConvertTimeBase!=2)
+		}		/* if(ui_ConvertTimeBase!=2) */
 	} else {
 		ui_ConvertTime = 0;
 		ui_ConvertTimeBase = 0;
@@ -2668,7 +2661,7 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 	if (cmd->scan_begin_src == TRIG_FOLLOW) {
 		ui_DelayTime = 0;
 		ui_DelayTimeBase = 0;
-	}			//if(cmd->scan_begin_src==TRIG_FOLLOW)
+	}			/* if(cmd->scan_begin_src==TRIG_FOLLOW) */
 	else {
 		ui_DelayTime = cmd->scan_begin_arg & 0xFFFF;
 		ui_DelayTimeBase = cmd->scan_begin_arg >> 16;
@@ -2686,7 +2679,7 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 		}
 		fpu_begin();
 		d_SCANTimeNewUnit = (double)ui_DelayTime;
-		//i_NbrOfChannel= i_LastChannel-i_FirstChannel + 4;
+		/* i_NbrOfChannel= i_LastChannel-i_FirstChannel + 4; */
 		i_NbrOfChannel =
 			s_BoardInfos[dev->minor].i_LastChannel -
 			s_BoardInfos[dev->minor].i_FirstChannel + 4;
@@ -2736,7 +2729,7 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_
 			err++;
 		}
 		fpu_end();
-	}			//else if(cmd->scan_begin_src==TRIG_FOLLOW)
+	}			/* else if(cmd->scan_begin_src==TRIG_FOLLOW) */
 
 	if (err) {
 		i_APCI3200_Reset(dev);
@@ -2764,13 +2757,13 @@ 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)
 {
-	UINT ui_Configuration = 0;
-	//i_InterruptFlag=0;
-	//i_Initialised=0;
-	//i_Count=0;
-	//i_Sum=0;
+	unsigned int ui_Configuration = 0;
+	/* i_InterruptFlag=0; */
+	/* i_Initialised=0; */
+	/* i_Count=0; */
+	/* i_Sum=0; */
 	s_BoardInfos[dev->minor].i_InterruptFlag = 0;
 	s_BoardInfos[dev->minor].i_Initialised = 0;
 	s_BoardInfos[dev->minor].i_Count = 0;
@@ -2779,16 +2772,16 @@ int i_APCI3200_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_s
   /*******************/
 	/*Read the register */
   /*******************/
-	//ui_Configuration = inl(devpriv->iobase+i_Offset + 8);
+	/* ui_Configuration = inl(devpriv->iobase+i_Offset + 8); */
 	ui_Configuration =
 		inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8);
   /*****************************/
 	/*Reset the START and IRQ bit */
   /*****************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl((ui_Configuration & 0xFFE7FFFF),devpriv->iobase+i_Offset + 8);
+	/* outl((ui_Configuration & 0xFFE7FFFF),devpriv->iobase+i_Offset + 8); */
 	outl((ui_Configuration & 0xFFE7FFFF),
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8);
 	return 0;
@@ -2814,52 +2807,52 @@ 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;
-	UINT ui_Configuration = 0;
-	//INT  i_CurrentSource = 0;
-	UINT ui_Trigger = 0;
-	UINT ui_TriggerEdge = 0;
-	UINT ui_Triggermode = 0;
-	UINT ui_ScanMode = 0;
-	UINT ui_ConvertTime = 0;
-	UINT ui_ConvertTimeBase = 0;
-	UINT ui_DelayTime = 0;
-	UINT ui_DelayTimeBase = 0;
-	UINT ui_DelayMode = 0;
-	//i_FirstChannel=cmd->chanlist[0];
-	//i_LastChannel=cmd->chanlist[1];
+	unsigned int ui_Configuration = 0;
+	/* INT  i_CurrentSource = 0; */
+	unsigned int ui_Trigger = 0;
+	unsigned int ui_TriggerEdge = 0;
+	unsigned int ui_Triggermode = 0;
+	unsigned int ui_ScanMode = 0;
+	unsigned int ui_ConvertTime = 0;
+	unsigned int ui_ConvertTimeBase = 0;
+	unsigned int ui_DelayTime = 0;
+	unsigned int ui_DelayTimeBase = 0;
+	unsigned int ui_DelayMode = 0;
+	/* i_FirstChannel=cmd->chanlist[0]; */
+	/* i_LastChannel=cmd->chanlist[1]; */
 	s_BoardInfos[dev->minor].i_FirstChannel = cmd->chanlist[0];
 	s_BoardInfos[dev->minor].i_LastChannel = cmd->chanlist[1];
 	if (cmd->start_src == TRIG_EXT) {
 		ui_Trigger = 1;
 		ui_TriggerEdge = cmd->start_arg & 0xFFFF;
 		ui_Triggermode = cmd->start_arg >> 16;
-	}			//if(cmd->start_src==TRIG_EXT)
+	}			/* if(cmd->start_src==TRIG_EXT) */
 	else {
 		ui_Trigger = 0;
-	}			//elseif(cmd->start_src==TRIG_EXT)
+	}			/* elseif(cmd->start_src==TRIG_EXT) */
 
 	if (cmd->stop_src == TRIG_COUNT) {
 		ui_ScanMode = 0;
-	}			// if (cmd->stop_src==TRIG_COUNT)
+	}			/*  if (cmd->stop_src==TRIG_COUNT) */
 	else {
 		ui_ScanMode = 2;
-	}			//else if (cmd->stop_src==TRIG_COUNT)
+	}			/* else if (cmd->stop_src==TRIG_COUNT) */
 
 	if (cmd->scan_begin_src == TRIG_FOLLOW) {
 		ui_DelayTime = 0;
 		ui_DelayTimeBase = 0;
 		ui_DelayMode = 0;
-	}			//if(cmd->scan_begin_src==TRIG_FOLLOW)
+	}			/* if(cmd->scan_begin_src==TRIG_FOLLOW) */
 	else {
 		ui_DelayTime = cmd->scan_begin_arg & 0xFFFF;
 		ui_DelayTimeBase = cmd->scan_begin_arg >> 16;
 		ui_DelayMode = 1;
-	}			//else if(cmd->scan_begin_src==TRIG_FOLLOW)
-	//        printk("\nui_DelayTime=%u\n",ui_DelayTime);
-	//        printk("\nui_DelayTimeBase=%u\n",ui_DelayTimeBase);
+	}			/* else if(cmd->scan_begin_src==TRIG_FOLLOW) */
+	/*         printk("\nui_DelayTime=%u\n",ui_DelayTime); */
+	/*         printk("\nui_DelayTimeBase=%u\n",ui_DelayTimeBase); */
 	if (cmd->convert_src == TRIG_TIMER) {
 		ui_ConvertTime = cmd->convert_arg & 0xFFFF;
 		ui_ConvertTimeBase = cmd->convert_arg >> 16;
@@ -2868,34 +2861,34 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd
 		ui_ConvertTimeBase = 0;
 	}
 
-	// if(i_ADDIDATAType ==1 || ((i_ADDIDATAType==2)))
-	//   {
+	/*  if(i_ADDIDATAType ==1 || ((i_ADDIDATAType==2))) */
+	/*    { */
   /**************************************************/
 	/*Read the old configuration of the current source */
   /**************************************************/
-	//ui_Configuration = inl(devpriv->iobase+i_Offset + 12);
+	/* ui_Configuration = inl(devpriv->iobase+i_Offset + 12); */
 	ui_Configuration =
 		inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12);
   /***********************************************/
 	/*Write the configuration of the current source */
   /***********************************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl((ui_Configuration & 0xFFC00000 ), devpriv->iobase+i_Offset +12);
+	/* outl((ui_Configuration & 0xFFC00000 ), devpriv->iobase+i_Offset +12); */
 	outl((ui_Configuration & 0xFFC00000),
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12);
-	// }
+	/*  } */
 	ui_Configuration = 0;
-	//     printk("\nfirstchannel=%u\n",i_FirstChannel);
-	//     printk("\nlastchannel=%u\n",i_LastChannel);
-	//     printk("\nui_Trigger=%u\n",ui_Trigger);
-	//     printk("\nui_TriggerEdge=%u\n",ui_TriggerEdge);
-	//     printk("\nui_Triggermode=%u\n",ui_Triggermode);
-	//      printk("\nui_DelayMode=%u\n",ui_DelayMode);
-	//     printk("\nui_ScanMode=%u\n",ui_ScanMode);
-
-	//ui_Configuration = i_FirstChannel |(i_LastChannel << 8)| 0x00100000 |
+	/*      printk("\nfirstchannel=%u\n",i_FirstChannel); */
+	/*      printk("\nlastchannel=%u\n",i_LastChannel); */
+	/*      printk("\nui_Trigger=%u\n",ui_Trigger); */
+	/*      printk("\nui_TriggerEdge=%u\n",ui_TriggerEdge); */
+	/*      printk("\nui_Triggermode=%u\n",ui_Triggermode); */
+	/*       printk("\nui_DelayMode=%u\n",ui_DelayMode); */
+	/*      printk("\nui_ScanMode=%u\n",ui_ScanMode); */
+
+	/* ui_Configuration = i_FirstChannel |(i_LastChannel << 8)| 0x00100000 | */
 	ui_Configuration =
 		s_BoardInfos[dev->minor].i_FirstChannel | (s_BoardInfos[dev->
 			minor].
@@ -2906,80 +2899,80 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd
   /*************************/
 	/*Write the Configuration */
   /*************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl( ui_Configuration, devpriv->iobase+i_Offset + 0x8);
+	/* outl( ui_Configuration, devpriv->iobase+i_Offset + 0x8); */
 	outl(ui_Configuration,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0x8);
   /***********************/
 	/*Write the Delay Value */
   /***********************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(ui_DelayTime,devpriv->iobase+i_Offset + 40);
+	/* outl(ui_DelayTime,devpriv->iobase+i_Offset + 40); */
 	outl(ui_DelayTime,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 40);
   /***************************/
 	/*Write the Delay time base */
   /***************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(ui_DelayTimeBase,devpriv->iobase+i_Offset + 44);
+	/* outl(ui_DelayTimeBase,devpriv->iobase+i_Offset + 44); */
 	outl(ui_DelayTimeBase,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 44);
   /*********************************/
 	/*Write the conversion time value */
   /*********************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(ui_ConvertTime,devpriv->iobase+i_Offset + 32);
+	/* outl(ui_ConvertTime,devpriv->iobase+i_Offset + 32); */
 	outl(ui_ConvertTime,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32);
 
   /********************************/
 	/*Write the conversion time base */
   /********************************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl(ui_ConvertTimeBase,devpriv->iobase+i_Offset + 36);
+	/* outl(ui_ConvertTimeBase,devpriv->iobase+i_Offset + 36); */
 	outl(ui_ConvertTimeBase,
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 36);
   /*******************/
 	/*Read the register */
   /*******************/
-	//ui_Configuration = inl(devpriv->iobase+i_Offset + 4);
+	/* ui_Configuration = inl(devpriv->iobase+i_Offset + 4); */
 	ui_Configuration =
 		inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4);
   /******************/
 	/*Set the SCAN bit */
   /******************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
 
-	//outl(((ui_Configuration & 0x1E0FF) | 0x00002000),devpriv->iobase+i_Offset + 4);
+	/* outl(((ui_Configuration & 0x1E0FF) | 0x00002000),devpriv->iobase+i_Offset + 4); */
 	outl(((ui_Configuration & 0x1E0FF) | 0x00002000),
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4);
   /*******************/
 	/*Read the register */
   /*******************/
 	ui_Configuration = 0;
-	//ui_Configuration = inl(devpriv->iobase+i_Offset + 8);
+	/* ui_Configuration = inl(devpriv->iobase+i_Offset + 8); */
 	ui_Configuration =
 		inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8);
 
   /*******************/
 	/*Set the START bit */
   /*******************/
-	//while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1);
+	/* while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); */
 	while (((inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset +
 					12) >> 19) & 1) != 1) ;
-	//outl((ui_Configuration | 0x00080000),devpriv->iobase+i_Offset + 8);
+	/* outl((ui_Configuration | 0x00080000),devpriv->iobase+i_Offset + 8); */
 	outl((ui_Configuration | 0x00080000),
 		devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8);
 	return 0;
@@ -3001,14 +2994,14 @@ 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;
-	DWORD dw_Dummy;
-	//i_InterruptFlag=0;
-	//i_Initialised==0;
-	//i_Count=0;
-	//i_Sum=0;
+	int i_Temp;
+	unsigned int dw_Dummy;
+	/* i_InterruptFlag=0; */
+	/* i_Initialised==0; */
+	/* i_Count=0; */
+	/* i_Sum=0; */
 
 	s_BoardInfos[dev->minor].i_InterruptFlag = 0;
 	s_BoardInfos[dev->minor].i_Initialised = 0;
@@ -3018,17 +3011,17 @@ int i_APCI3200_Reset(struct comedi_device * dev)
 
 	outl(0x83838383, devpriv->i_IobaseAmcc + 0x60);
 
-	// Enable the interrupt for the controler
+	/*  Enable the interrupt for the controler */
 	dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38);
 	outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38);
-	outl(0, devpriv->i_IobaseAddon);	//Resets the output
+	outl(0, devpriv->i_IobaseAddon);	/* Resets the output */
   /***************/
 	/*Empty the buffer */
   /**************/
 	for (i_Temp = 0; i_Temp <= 95; i_Temp++) {
-		//ui_InterruptChannelValue[i_Temp]=0;
+		/* ui_InterruptChannelValue[i_Temp]=0; */
 		s_BoardInfos[dev->minor].ui_InterruptChannelValue[i_Temp] = 0;
-	}			//for(i_Temp=0;i_Temp<=95;i_Temp++)
+	}			/* for(i_Temp=0;i_Temp<=95;i_Temp++) */
   /*****************************/
 	/*Reset the START and IRQ bit */
   /*****************************/
@@ -3036,7 +3029,7 @@ int i_APCI3200_Reset(struct comedi_device * dev)
 		while (((inl(devpriv->iobase + i_Temp + 12) >> 19) & 1) != 1) ;
 		outl(0, devpriv->iobase + i_Temp + 8);
 		i_Temp = i_Temp + 64;
-	}			//for(i_Temp=0;i_Temp<=192;i_Temp+64)
+	}			/* for(i_Temp=0;i_Temp<=192;i_Temp+64) */
 	return 0;
 }
 
@@ -3060,26 +3053,26 @@ int i_APCI3200_Reset(struct comedi_device * dev)
 void v_APCI3200_Interrupt(int irq, void *d)
 {
 	struct comedi_device *dev = d;
-	UINT ui_StatusRegister = 0;
-	UINT ui_ChannelNumber = 0;
-	INT i_CalibrationFlag = 0;
-	INT i_CJCFlag = 0;
-	UINT ui_DummyValue = 0;
-	UINT ui_DigitalTemperature = 0;
-	UINT ui_DigitalInput = 0;
+	unsigned int ui_StatusRegister = 0;
+	unsigned int ui_ChannelNumber = 0;
+	int i_CalibrationFlag = 0;
+	int i_CJCFlag = 0;
+	unsigned int ui_DummyValue = 0;
+	unsigned int ui_DigitalTemperature = 0;
+	unsigned int ui_DigitalInput = 0;
 	int i_ConvertCJCCalibration;
 
-	//BEGIN JK TEST
+	/* BEGIN JK TEST */
 	int i_ReturnValue = 0;
-	//END JK TEST
+	/* END JK TEST */
 
-	//printk ("\n i_ScanType = %i i_ADDIDATAType = %i", s_BoardInfos [dev->minor].i_ScanType, s_BoardInfos [dev->minor].i_ADDIDATAType);
+	/* printk ("\n i_ScanType = %i i_ADDIDATAType = %i", s_BoardInfos [dev->minor].i_ScanType, s_BoardInfos [dev->minor].i_ADDIDATAType); */
 
-	//switch(i_ScanType)
+	/* switch(i_ScanType) */
 	switch (s_BoardInfos[dev->minor].i_ScanType) {
 	case 0:
 	case 1:
-		//switch(i_ADDIDATAType)
+		/* switch(i_ADDIDATAType) */
 		switch (s_BoardInfos[dev->minor].i_ADDIDATAType) {
 		case 0:
 		case 1:
@@ -3087,12 +3080,12 @@ void v_APCI3200_Interrupt(int irq, void *d)
 	  /************************************/
 			/*Read the interrupt status register */
 	  /************************************/
-			//ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16);
+			/* ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); */
 			ui_StatusRegister =
 				inl(devpriv->iobase +
 				s_BoardInfos[dev->minor].i_Offset + 16);
 			if ((ui_StatusRegister & 0x2) == 0x2) {
-				//i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17);
+				/* i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17); */
 				i_CalibrationFlag =
 					((inl(devpriv->iobase +
 							s_BoardInfos[dev->
@@ -3103,12 +3096,12 @@ void v_APCI3200_Interrupt(int irq, void *d)
 	      /*************************/
 				/*Read the channel number */
 	      /*************************/
-				//ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24);
+				/* ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); */
 
 	      /*************************************/
 				/*Read the digital analog input value */
 	      /*************************************/
-				//ui_DigitalInput = inl(devpriv->iobase+i_Offset + 28);
+				/* ui_DigitalInput = inl(devpriv->iobase+i_Offset + 28); */
 				ui_DigitalInput =
 					inl(devpriv->iobase +
 					s_BoardInfos[dev->minor].i_Offset + 28);
@@ -3117,13 +3110,13 @@ void v_APCI3200_Interrupt(int irq, void *d)
 				/* Test if the value read is the channel value */
 	      /***********************************************/
 				if (i_CalibrationFlag == 0) {
-					//ui_InterruptChannelValue[i_Count + 0] = ui_DigitalInput;
+					/* ui_InterruptChannelValue[i_Count + 0] = ui_DigitalInput; */
 					s_BoardInfos[dev->minor].
 						ui_InterruptChannelValue
 						[s_BoardInfos[dev->minor].
 						i_Count + 0] = ui_DigitalInput;
 
-					//Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+					/* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 					/*
 					   printk("\n 1 - i_APCI3200_GetChannelCalibrationValue (dev, s_BoardInfos %i", ui_ChannelNumber);
 					   i_APCI3200_GetChannelCalibrationValue (dev, s_BoardInfos [dev->minor].ui_Channel_num,
@@ -3131,14 +3124,14 @@ void v_APCI3200_Interrupt(int irq, void *d)
 					   &s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 7],
 					   &s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 8]);
 					 */
-					//End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+					/* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
 		  /******************************************************/
 					/*Start the conversion of the calibration offset value */
 		  /******************************************************/
 					i_APCI3200_ReadCalibrationOffsetValue
 						(dev, &ui_DummyValue);
-				}	//if (i_CalibrationFlag == 0)
+				}	/* if (i_CalibrationFlag == 0) */
 	      /**********************************************************/
 				/* Test if the value read is the calibration offset value */
 	      /**********************************************************/
@@ -3149,7 +3142,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 					/* Save the value */
 		  /******************/
 
-					//ui_InterruptChannelValue[i_Count + 1] = ui_DigitalInput;
+					/* ui_InterruptChannelValue[i_Count + 1] = ui_DigitalInput; */
 					s_BoardInfos[dev->minor].
 						ui_InterruptChannelValue
 						[s_BoardInfos[dev->minor].
@@ -3160,7 +3153,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 		  /******************************************************/
 					i_APCI3200_ReadCalibrationGainValue(dev,
 						&ui_DummyValue);
-				}	//if (i_CalibrationFlag == 1)
+				}	/* if (i_CalibrationFlag == 1) */
 	      /******************************************************/
 				/*Test if the value read is the calibration gain value */
 	      /******************************************************/
@@ -3170,48 +3163,48 @@ void v_APCI3200_Interrupt(int irq, void *d)
 		  /****************/
 					/*Save the value */
 		  /****************/
-					//ui_InterruptChannelValue[i_Count + 2] = ui_DigitalInput;
+					/* ui_InterruptChannelValue[i_Count + 2] = ui_DigitalInput; */
 					s_BoardInfos[dev->minor].
 						ui_InterruptChannelValue
 						[s_BoardInfos[dev->minor].
 						i_Count + 2] = ui_DigitalInput;
-					//if(i_ScanType==1)
+					/* if(i_ScanType==1) */
 					if (s_BoardInfos[dev->minor].
 						i_ScanType == 1) {
 
-						//i_InterruptFlag=0;
+						/* i_InterruptFlag=0; */
 						s_BoardInfos[dev->minor].
 							i_InterruptFlag = 0;
-						//i_Count=i_Count + 6;
-						//Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-						//s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 6;
+						/* i_Count=i_Count + 6; */
+						/* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+						/* s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 6; */
 						s_BoardInfos[dev->minor].
 							i_Count =
 							s_BoardInfos[dev->
 							minor].i_Count + 9;
-						//End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-					}	//if(i_ScanType==1)
+						/* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+					}	/* if(i_ScanType==1) */
 					else {
-						//i_Count=0;
+						/* i_Count=0; */
 						s_BoardInfos[dev->minor].
 							i_Count = 0;
-					}	//elseif(i_ScanType==1)
-					//if(i_ScanType!=1)
+					}	/* elseif(i_ScanType==1) */
+					/* if(i_ScanType!=1) */
 					if (s_BoardInfos[dev->minor].
 						i_ScanType != 1) {
-						i_ReturnValue = send_sig(SIGIO, devpriv->tsk_Current, 0);	// send signal to the sample
-					}	//if(i_ScanType!=1)
+						i_ReturnValue = send_sig(SIGIO, devpriv->tsk_Current, 0);	/*  send signal to the sample */
+					}	/* if(i_ScanType!=1) */
 					else {
-						//if(i_ChannelCount==i_Sum)
+						/* if(i_ChannelCount==i_Sum) */
 						if (s_BoardInfos[dev->minor].
 							i_ChannelCount ==
 							s_BoardInfos[dev->
 								minor].i_Sum) {
-							send_sig(SIGIO, devpriv->tsk_Current, 0);	// send signal to the sample
+							send_sig(SIGIO, devpriv->tsk_Current, 0);	/*  send signal to the sample */
 						}
-					}	//if(i_ScanType!=1)
-				}	//if (i_CalibrationFlag == 2)
-			}	// if ((ui_StatusRegister & 0x2) == 0x2)
+					}	/* if(i_ScanType!=1) */
+				}	/* if (i_CalibrationFlag == 2) */
+			}	/*  if ((ui_StatusRegister & 0x2) == 0x2) */
 
 			break;
 
@@ -3220,7 +3213,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 			/*Read the interrupt status register */
 	  /************************************/
 
-			//ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16);
+			/* ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); */
 			ui_StatusRegister =
 				inl(devpriv->iobase +
 				s_BoardInfos[dev->minor].i_Offset + 16);
@@ -3230,7 +3223,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 
 			if ((ui_StatusRegister & 0x2) == 0x2) {
 
-				//i_CJCFlag = ((inl(devpriv->iobase+i_Offset + 4) & 0x00000400) >> 10);
+				/* i_CJCFlag = ((inl(devpriv->iobase+i_Offset + 4) & 0x00000400) >> 10); */
 				i_CJCFlag =
 					((inl(devpriv->iobase +
 							s_BoardInfos[dev->
@@ -3238,7 +3231,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 							i_Offset +
 							4) & 0x00000400) >> 10);
 
-				//i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17);
+				/* i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17); */
 				i_CalibrationFlag =
 					((inl(devpriv->iobase +
 							s_BoardInfos[dev->
@@ -3251,19 +3244,19 @@ void v_APCI3200_Interrupt(int irq, void *d)
 				/*Read the channel number */
 	      /*************************/
 
-				//ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24);
+				/* ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); */
 				ui_ChannelNumber =
 					inl(devpriv->iobase +
 					s_BoardInfos[dev->minor].i_Offset + 24);
-				//Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+				/* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 				s_BoardInfos[dev->minor].ui_Channel_num =
 					ui_ChannelNumber;
-				//End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+				/* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
 	      /************************************/
 				/*Read the digital temperature value */
 	      /************************************/
-				//ui_DigitalTemperature = inl(devpriv->iobase+i_Offset + 28);
+				/* ui_DigitalTemperature = inl(devpriv->iobase+i_Offset + 28); */
 				ui_DigitalTemperature =
 					inl(devpriv->iobase +
 					s_BoardInfos[dev->minor].i_Offset + 28);
@@ -3274,7 +3267,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 
 				if ((i_CalibrationFlag == 0)
 					&& (i_CJCFlag == 0)) {
-					//ui_InterruptChannelValue[i_Count + 0]=ui_DigitalTemperature;
+					/* ui_InterruptChannelValue[i_Count + 0]=ui_DigitalTemperature; */
 					s_BoardInfos[dev->minor].
 						ui_InterruptChannelValue
 						[s_BoardInfos[dev->minor].
@@ -3287,7 +3280,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 					i_APCI3200_ReadCJCValue(dev,
 						&ui_DummyValue);
 
-				}	//if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0))
+				}	/* if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0)) */
 
 		 /*****************************************/
 				/*Test if the value read is the CJC value */
@@ -3295,7 +3288,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 
 				if ((i_CJCFlag == 1)
 					&& (i_CalibrationFlag == 0)) {
-					//ui_InterruptChannelValue[i_Count + 3]=ui_DigitalTemperature;
+					/* ui_InterruptChannelValue[i_Count + 3]=ui_DigitalTemperature; */
 					s_BoardInfos[dev->minor].
 						ui_InterruptChannelValue
 						[s_BoardInfos[dev->minor].
@@ -3307,7 +3300,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 		  /******************************************************/
 					i_APCI3200_ReadCalibrationOffsetValue
 						(dev, &ui_DummyValue);
-				}	// if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0))
+				}	/*  if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0)) */
 
 		 /********************************************************/
 				/*Test if the value read is the calibration offset value */
@@ -3315,7 +3308,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 
 				if ((i_CalibrationFlag == 1)
 					&& (i_CJCFlag == 0)) {
-					//ui_InterruptChannelValue[i_Count + 1]=ui_DigitalTemperature;
+					/* ui_InterruptChannelValue[i_Count + 1]=ui_DigitalTemperature; */
 					s_BoardInfos[dev->minor].
 						ui_InterruptChannelValue
 						[s_BoardInfos[dev->minor].
@@ -3328,7 +3321,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 					i_APCI3200_ReadCalibrationGainValue(dev,
 						&ui_DummyValue);
 
-				}	//if ((i_CalibrationFlag == 1) && (i_CJCFlag == 0))
+				}	/* if ((i_CalibrationFlag == 1) && (i_CJCFlag == 0)) */
 
 	      /******************************************************/
 				/*Test if the value read is the calibration gain value */
@@ -3336,7 +3329,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 
 				if ((i_CalibrationFlag == 2)
 					&& (i_CJCFlag == 0)) {
-					//ui_InterruptChannelValue[i_Count + 2]=ui_DigitalTemperature;
+					/* ui_InterruptChannelValue[i_Count + 2]=ui_DigitalTemperature; */
 					s_BoardInfos[dev->minor].
 						ui_InterruptChannelValue
 						[s_BoardInfos[dev->minor].
@@ -3349,15 +3342,15 @@ void v_APCI3200_Interrupt(int irq, void *d)
 
 					/*Test if the polarity is the same */
 		  /**********************************/
-					//if(i_CJCPolarity!=i_ADDIDATAPolarity)
+					/* if(i_CJCPolarity!=i_ADDIDATAPolarity) */
 					if (s_BoardInfos[dev->minor].
 						i_CJCPolarity !=
 						s_BoardInfos[dev->minor].
 						i_ADDIDATAPolarity) {
 						i_ConvertCJCCalibration = 1;
-					}	//if(i_CJCPolarity!=i_ADDIDATAPolarity)
+					}	/* if(i_CJCPolarity!=i_ADDIDATAPolarity) */
 					else {
-						//if(i_CJCGain==i_ADDIDATAGain)
+						/* if(i_CJCGain==i_ADDIDATAGain) */
 						if (s_BoardInfos[dev->minor].
 							i_CJCGain ==
 							s_BoardInfos[dev->
@@ -3365,12 +3358,12 @@ void v_APCI3200_Interrupt(int irq, void *d)
 							i_ADDIDATAGain) {
 							i_ConvertCJCCalibration
 								= 0;
-						}	//if(i_CJCGain==i_ADDIDATAGain)
+						}	/* if(i_CJCGain==i_ADDIDATAGain) */
 						else {
 							i_ConvertCJCCalibration
 								= 1;
-						}	//elseif(i_CJCGain==i_ADDIDATAGain)
-					}	//elseif(i_CJCPolarity!=i_ADDIDATAPolarity)
+						}	/* elseif(i_CJCGain==i_ADDIDATAGain) */
+					}	/* elseif(i_CJCPolarity!=i_ADDIDATAPolarity) */
 					if (i_ConvertCJCCalibration == 1) {
 		      /****************************************************************/
 						/*Start the conversion of the calibration gain value for the CJC */
@@ -3378,10 +3371,10 @@ void v_APCI3200_Interrupt(int irq, void *d)
 						i_APCI3200_ReadCJCCalOffset(dev,
 							&ui_DummyValue);
 
-					}	//if(i_ConvertCJCCalibration==1)
+					}	/* if(i_ConvertCJCCalibration==1) */
 					else {
-						//ui_InterruptChannelValue[i_Count + 4]=0;
-						//ui_InterruptChannelValue[i_Count + 5]=0;
+						/* ui_InterruptChannelValue[i_Count + 4]=0; */
+						/* ui_InterruptChannelValue[i_Count + 5]=0; */
 						s_BoardInfos[dev->minor].
 							ui_InterruptChannelValue
 							[s_BoardInfos[dev->
@@ -3392,8 +3385,8 @@ void v_APCI3200_Interrupt(int irq, void *d)
 							[s_BoardInfos[dev->
 								minor].i_Count +
 							5] = 0;
-					}	//elseif(i_ConvertCJCCalibration==1)
-				}	//else if ((i_CalibrationFlag == 2) && (i_CJCFlag == 0))
+					}	/* elseif(i_ConvertCJCCalibration==1) */
+				}	/* else if ((i_CalibrationFlag == 2) && (i_CJCFlag == 0)) */
 
 		 /********************************************************************/
 				/*Test if the value read is the calibration offset value for the CJC */
@@ -3401,7 +3394,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 
 				if ((i_CalibrationFlag == 1)
 					&& (i_CJCFlag == 1)) {
-					//ui_InterruptChannelValue[i_Count + 4]=ui_DigitalTemperature;
+					/* ui_InterruptChannelValue[i_Count + 4]=ui_DigitalTemperature; */
 					s_BoardInfos[dev->minor].
 						ui_InterruptChannelValue
 						[s_BoardInfos[dev->minor].
@@ -3414,7 +3407,7 @@ void v_APCI3200_Interrupt(int irq, void *d)
 					i_APCI3200_ReadCJCCalGain(dev,
 						&ui_DummyValue);
 
-				}	//if ((i_CalibrationFlag == 1) && (i_CJCFlag == 1))
+				}	/* if ((i_CalibrationFlag == 1) && (i_CJCFlag == 1)) */
 
 	      /******************************************************************/
 				/*Test if the value read is the calibration gain value for the CJC */
@@ -3422,61 +3415,61 @@ void v_APCI3200_Interrupt(int irq, void *d)
 
 				if ((i_CalibrationFlag == 2)
 					&& (i_CJCFlag == 1)) {
-					//ui_InterruptChannelValue[i_Count + 5]=ui_DigitalTemperature;
+					/* ui_InterruptChannelValue[i_Count + 5]=ui_DigitalTemperature; */
 					s_BoardInfos[dev->minor].
 						ui_InterruptChannelValue
 						[s_BoardInfos[dev->minor].
 						i_Count + 5] =
 						ui_DigitalTemperature;
 
-					//if(i_ScanType==1)
+					/* if(i_ScanType==1) */
 					if (s_BoardInfos[dev->minor].
 						i_ScanType == 1) {
 
-						//i_InterruptFlag=0;
+						/* i_InterruptFlag=0; */
 						s_BoardInfos[dev->minor].
 							i_InterruptFlag = 0;
-						//i_Count=i_Count + 6;
-						//Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-						//s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 6;
+						/* i_Count=i_Count + 6; */
+						/* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+						/* s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 6; */
 						s_BoardInfos[dev->minor].
 							i_Count =
 							s_BoardInfos[dev->
 							minor].i_Count + 9;
-						//End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-					}	//if(i_ScanType==1)
+						/* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+					}	/* if(i_ScanType==1) */
 					else {
-						//i_Count=0;
+						/* i_Count=0; */
 						s_BoardInfos[dev->minor].
 							i_Count = 0;
-					}	//elseif(i_ScanType==1)
+					}	/* elseif(i_ScanType==1) */
 
-					//if(i_ScanType!=1)
+					/* if(i_ScanType!=1) */
 					if (s_BoardInfos[dev->minor].
 						i_ScanType != 1) {
-						send_sig(SIGIO, devpriv->tsk_Current, 0);	// send signal to the sample
-					}	//if(i_ScanType!=1)
+						send_sig(SIGIO, devpriv->tsk_Current, 0);	/*  send signal to the sample */
+					}	/* if(i_ScanType!=1) */
 					else {
-						//if(i_ChannelCount==i_Sum)
+						/* if(i_ChannelCount==i_Sum) */
 						if (s_BoardInfos[dev->minor].
 							i_ChannelCount ==
 							s_BoardInfos[dev->
 								minor].i_Sum) {
-							send_sig(SIGIO, devpriv->tsk_Current, 0);	// send signal to the sample
+							send_sig(SIGIO, devpriv->tsk_Current, 0);	/*  send signal to the sample */
 
-						}	//if(i_ChannelCount==i_Sum)
-					}	//else if(i_ScanType!=1)
-				}	//if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1))
+						}	/* if(i_ChannelCount==i_Sum) */
+					}	/* else if(i_ScanType!=1) */
+				}	/* if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1)) */
 
-			}	//else if ((ui_StatusRegister & 0x2) == 0x2)
+			}	/* else if ((ui_StatusRegister & 0x2) == 0x2) */
 			break;
-		}		//switch(i_ADDIDATAType)
+		}		/* switch(i_ADDIDATAType) */
 		break;
 	case 2:
 	case 3:
 		i_APCI3200_InterruptHandleEos(dev);
 		break;
-	}			//switch(i_ScanType)
+	}			/* switch(i_ScanType) */
 	return;
 }
 
@@ -3499,22 +3492,22 @@ void v_APCI3200_Interrupt(int irq, void *d)
   |                    													     |
   +----------------------------------------------------------------------------+
 */
-int i_APCI3200_InterruptHandleEos(struct comedi_device * dev)
+int i_APCI3200_InterruptHandleEos(struct comedi_device *dev)
 {
-	UINT ui_StatusRegister = 0;
+	unsigned int ui_StatusRegister = 0;
 	struct comedi_subdevice *s = dev->subdevices + 0;
 
-	//BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-	//comedi_async *async = s->async;
-	//UINT *data;
-	//data=async->data+async->buf_int_ptr;//new samples added from here onwards
+	/* BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+	/* comedi_async *async = s->async; */
+	/* UINT *data; */
+	/* data=async->data+async->buf_int_ptr;//new samples added from here onwards */
 	int n = 0, i = 0;
-	//END JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
+	/* END JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
 
   /************************************/
 	/*Read the interrupt status register */
   /************************************/
-	//ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16);
+	/* ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); */
 	ui_StatusRegister =
 		inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 16);
 
@@ -3526,33 +3519,33 @@ int i_APCI3200_InterruptHandleEos(struct comedi_device * dev)
       /*************************/
 		/*Read the channel number */
       /*************************/
-		//ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24);
-		//BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-		//This value is not used
-		//ui_ChannelNumber = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 24);
+		/* ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); */
+		/* BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+		/* This value is not used */
+		/* ui_ChannelNumber = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 24); */
 		s->async->events = 0;
-		//END JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
+		/* END JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
 
       /*************************************/
 		/*Read the digital Analog Input value */
       /*************************************/
 
-		//data[i_Count] = inl(devpriv->iobase+i_Offset + 28);
-		//Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-		//data[s_BoardInfos [dev->minor].i_Count] = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28);
+		/* data[i_Count] = inl(devpriv->iobase+i_Offset + 28); */
+		/* Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+		/* data[s_BoardInfos [dev->minor].i_Count] = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); */
 		s_BoardInfos[dev->minor].ui_ScanValueArray[s_BoardInfos[dev->
 				minor].i_Count] =
 			inl(devpriv->iobase +
 			s_BoardInfos[dev->minor].i_Offset + 28);
-		//End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
+		/* End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
 
-		//if((i_Count == (i_LastChannel-i_FirstChannel+3)))
+		/* if((i_Count == (i_LastChannel-i_FirstChannel+3))) */
 		if ((s_BoardInfos[dev->minor].i_Count ==
 				(s_BoardInfos[dev->minor].i_LastChannel -
 					s_BoardInfos[dev->minor].
 					i_FirstChannel + 3))) {
 
-			//Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+			/* Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 			s_BoardInfos[dev->minor].i_Count++;
 
 			for (i = s_BoardInfos[dev->minor].i_FirstChannel;
@@ -3582,61 +3575,61 @@ int i_APCI3200_InterruptHandleEos(struct comedi_device * dev)
 							* 3) + 2]);
 			}
 
-			//End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+			/* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
-			//i_Count=-1;
+			/* i_Count=-1; */
 
 			s_BoardInfos[dev->minor].i_Count = -1;
 
-			//async->buf_int_count+=(i_LastChannel-i_FirstChannel+4)*sizeof(UINT);
-			//Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-			//async->buf_int_count+=(s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel+4)*sizeof(UINT);
-			//End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-			//async->buf_int_ptr+=(i_LastChannel-i_FirstChannel+4)*sizeof(UINT);
-			//Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-			//async->buf_int_ptr+=(s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel+4)*sizeof(UINT);
-			//comedi_eos(dev,s);
+			/* async->buf_int_count+=(i_LastChannel-i_FirstChannel+4)*sizeof(unsigned int); */
+			/* Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+			/* async->buf_int_count+=(s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel+4)*sizeof(unsigned int); */
+			/* End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+			/* async->buf_int_ptr+=(i_LastChannel-i_FirstChannel+4)*sizeof(unsigned int); */
+			/* Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+			/* async->buf_int_ptr+=(s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel+4)*sizeof(unsigned int); */
+			/* comedi_eos(dev,s); */
 
-			// Set the event type (Comedi Buffer End Of Scan)
+			/*  Set the event type (Comedi Buffer End Of Scan) */
 			s->async->events |= COMEDI_CB_EOS;
 
-			// Test if enougth memory is available and allocate it for 7 values
-			//n = comedi_buf_write_alloc(s->async, 7*sizeof(unsigned int));
+			/*  Test if enougth memory is available and allocate it for 7 values */
+			/* n = comedi_buf_write_alloc(s->async, 7*sizeof(unsigned int)); */
 			n = comedi_buf_write_alloc(s->async,
 				(7 + 12) * sizeof(unsigned int));
 
-			// If not enougth memory available, event is set to Comedi Buffer Errror
+			/*  If not enougth memory available, event is set to Comedi Buffer Errror */
 			if (n > ((7 + 12) * sizeof(unsigned int))) {
 				printk("\ncomedi_buf_write_alloc n = %i", n);
 				s->async->events |= COMEDI_CB_ERROR;
 			}
-			// Write all 7 scan values in the comedi buffer
+			/*  Write all 7 scan values in the comedi buffer */
 			comedi_buf_memcpy_to(s->async, 0,
 				(unsigned int *) s_BoardInfos[dev->minor].
 				ui_ScanValueArray, (7 + 12) * sizeof(unsigned int));
 
-			// Update comedi buffer pinters indexes
+			/*  Update comedi buffer pinters indexes */
 			comedi_buf_write_free(s->async,
 				(7 + 12) * sizeof(unsigned int));
 
-			// Send events
+			/*  Send events */
 			comedi_event(dev, s);
-			//End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-
-			//BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-			//
-			//if (s->async->buf_int_ptr>=s->async->data_len) //  for buffer rool over
-			//  {
-			//    /* buffer rollover */
-			//    s->async->buf_int_ptr=0;
-			//    comedi_eobuf(dev,s);
-			//  }
-			//End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
+			/* End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+
+			/* BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+			/*  */
+			/* if (s->async->buf_int_ptr>=s->async->data_len) //  for buffer rool over */
+			/*   { */
+			/*     /* buffer rollover */ */
+			/*     s->async->buf_int_ptr=0; */
+			/*     comedi_eobuf(dev,s); */
+			/*   } */
+			/* End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
 		}
-		//i_Count++;
+		/* i_Count++; */
 		s_BoardInfos[dev->minor].i_Count++;
 	}
-	//i_InterruptFlag=0;
+	/* i_InterruptFlag=0; */
 	s_BoardInfos[dev->minor].i_InterruptFlag = 0;
 	return 0;
 }

+ 90 - 86
drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h

@@ -15,26 +15,26 @@
  * any later version.
  */
 
-// Card Specific information
+/* Card Specific information */
 #define APCI3200_BOARD_VENDOR_ID                 0x15B8
-//#define APCI3200_ADDRESS_RANGE                   264
+/* #define APCI3200_ADDRESS_RANGE                   264 */
 
 int MODULE_NO;
 struct {
-	INT i_Gain;
-	INT i_Polarity;
-	INT i_OffsetRange;
-	INT i_Coupling;
-	INT i_SingleDiff;
-	INT i_AutoCalibration;
-	UINT ui_ReloadValue;
-	UINT ui_TimeUnitReloadVal;
-	INT i_Interrupt;
-	INT i_ModuleSelection;
+	int i_Gain;
+	int i_Polarity;
+	int i_OffsetRange;
+	int i_Coupling;
+	int i_SingleDiff;
+	int i_AutoCalibration;
+	unsigned int ui_ReloadValue;
+	unsigned int ui_TimeUnitReloadVal;
+	int i_Interrupt;
+	int i_ModuleSelection;
 } Config_Parameters_Module1, Config_Parameters_Module2,
     Config_Parameters_Module3, Config_Parameters_Module4;
 
-//ANALOG INPUT RANGE
+/* ANALOG INPUT RANGE */
 static const struct comedi_lrange range_apci3200_ai = { 8, {
 						     BIP_RANGE(10),
 						     BIP_RANGE(5),
@@ -55,7 +55,7 @@ static const struct comedi_lrange range_apci3300_ai = { 4, {
 						     }
 };
 
-//Analog Input related Defines
+/* Analog Input related Defines */
 #define APCI3200_AI_OFFSET_GAIN                  0
 #define APCI3200_AI_SC_TEST                      4
 #define APCI3200_AI_IRQ                          8
@@ -89,98 +89,102 @@ static const struct comedi_lrange range_apci3300_ai = { 4, {
 #define ADDIDATA_UNIPOLAR                        1
 #define ADDIDATA_BIPOLAR                         2
 
-//BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+/* BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 #define MAX_MODULE				4
-//END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
+/* END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
 
-typedef struct {
-	ULONG ul_NumberOfValue;
-	ULONG *pul_ResistanceValue;
-	ULONG *pul_TemperatureValue;
-} str_ADDIDATA_RTDStruct, *pstr_ADDIDATA_RTDStruct;
+struct str_ADDIDATA_RTDStruct {
+	unsigned int ul_NumberOfValue;
+	unsigned int *pul_ResistanceValue;
+	unsigned int *pul_TemperatureValue;
+};
+
+/* BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+struct str_Module {
 
-//BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-typedef struct {
-	// Begin JK 05/08/2003 change for Linux
+	/*  Begin JK 05/08/2003 change for Linux */
 	unsigned long ul_CurrentSourceCJC;
 	unsigned long ul_CurrentSource[5];
-	// End JK 05/08/2003 change for Linux
+	/*  End JK 05/08/2003 change for Linux */
 
-	// Begin CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1
-	unsigned long ul_GainFactor[8];	// Gain Factor
+	/*  Begin CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1 */
+	unsigned long ul_GainFactor[8];	/*  Gain Factor */
 	unsigned int w_GainValue[10];
-	// End CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1
-} str_Module;
-//END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-
-//BEGIN JK 06.07.04: Management of sevrals boards
-typedef struct {
-	INT i_CJCAvailable;
-	INT i_CJCPolarity;
-	INT i_CJCGain;
-	INT i_InterruptFlag;
-	INT i_ADDIDATAPolarity;
-	INT i_ADDIDATAGain;
-	INT i_AutoCalibration;
-	INT i_ADDIDATAConversionTime;
-	INT i_ADDIDATAConversionTimeUnit;
-	INT i_ADDIDATAType;
-	INT i_ChannelNo;
-	INT i_ChannelCount;
-	INT i_ScanType;
-	INT i_FirstChannel;
-	INT i_LastChannel;
-	INT i_Sum;
-	INT i_Offset;
-	UINT ui_Channel_num;
-	INT i_Count;
-	INT i_Initialised;
-	//UINT ui_InterruptChannelValue[96]; //Buffer
-	UINT ui_InterruptChannelValue[144];	//Buffer
-	BYTE b_StructInitialized;
-	//Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-	unsigned int ui_ScanValueArray[7 + 12];	// 7 is the maximal number of channels
-	//End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68
-
-	//Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-	INT i_ConnectionType;
-	INT i_NbrOfModule;
-	str_Module s_Module[MAX_MODULE];
-	//End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values
-} str_BoardInfos;
-//END JK 06.07.04: Management of sevrals boards
-
-// Hardware Layer  functions for Apci3200
-
-//AI
-
-INT i_APCI3200_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	/*  End CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1 */
+};
+
+/* END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+
+/* BEGIN JK 06.07.04: Management of sevrals boards */
+struct str_BoardInfos {
+
+	int i_CJCAvailable;
+	int i_CJCPolarity;
+	int i_CJCGain;
+	int i_InterruptFlag;
+	int i_ADDIDATAPolarity;
+	int i_ADDIDATAGain;
+	int i_AutoCalibration;
+	int i_ADDIDATAConversionTime;
+	int i_ADDIDATAConversionTimeUnit;
+	int i_ADDIDATAType;
+	int i_ChannelNo;
+	int i_ChannelCount;
+	int i_ScanType;
+	int i_FirstChannel;
+	int i_LastChannel;
+	int i_Sum;
+	int i_Offset;
+	unsigned int ui_Channel_num;
+	int i_Count;
+	int i_Initialised;
+	/* UINT ui_InterruptChannelValue[96]; //Buffer */
+	unsigned int ui_InterruptChannelValue[144];	/* Buffer */
+	unsigned char b_StructInitialized;
+	/* Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+	unsigned int ui_ScanValueArray[7 + 12];	/*  7 is the maximal number of channels */
+	/* End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */
+
+	/* Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+	int i_ConnectionType;
+	int i_NbrOfModule;
+	struct str_Module s_Module[MAX_MODULE];
+	/* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */
+};
+
+/* END JK 06.07.04: Management of sevrals boards */
+
+/* Hardware Layer  functions for Apci3200 */
+
+/* AI */
+
+int i_APCI3200_ConfigAnalogInput(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,
+int i_APCI3200_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
 			       struct comedi_insn *insn, unsigned int *data);
-INT i_APCI3200_InsnWriteReleaseAnalogInput(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_InsnBits_AnalogInput_Test(struct comedi_device *dev,
+int i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device *dev,
 					 struct comedi_subdevice *s,
 					 struct comedi_insn *insn, unsigned int *data);
-INT i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s);
-INT i_APCI3200_InterruptHandleEos(struct comedi_device *dev);
-INT i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s);
+int i_APCI3200_InterruptHandleEos(struct comedi_device *dev);
+int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				      struct comedi_cmd *cmd);
-INT i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s);
-INT i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s);
+int i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				struct comedi_insn *insn, unsigned int *data);
-//Interrupt
+/* Interrupt */
 void v_APCI3200_Interrupt(int irq, void *d);
 int i_APCI3200_InterruptHandleEos(struct comedi_device *dev);
-//Reset functions
-INT i_APCI3200_Reset(struct comedi_device *dev);
+/* Reset functions */
+int i_APCI3200_Reset(struct comedi_device *dev);
 
 int i_APCI3200_ReadCJCCalOffset(struct comedi_device *dev, unsigned int *data);
 int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data);
-int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, UINT *data);
-int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, UINT *data);
+int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int *data);
+int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, unsigned int *data);
 int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev,
 				       struct comedi_subdevice *s, struct comedi_insn *insn,
 				       unsigned int *data);

+ 113 - 112
drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c

@@ -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.
 
@@ -62,8 +62,8 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To read       |
-|                     UINT *data              : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To read       |
+|                     unsigned int *data              : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -73,26 +73,26 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 */
 
-INT i_APCI3501_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3501_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Temp;
-	UINT ui_NoOfChannel;
+	unsigned int ui_Temp;
+	unsigned int ui_NoOfChannel;
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	ui_Temp = data[0];
 	*data = inl(devpriv->iobase + APCI3501_DIGITAL_IP);
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			//if  (ui_Temp==0)
+	}			/* if  (ui_Temp==0) */
 	else {
 		if (ui_Temp == 1) {
 
 			*data = *data & 0x3;
-		}		//if  (ui_Temp==1)
+		}		/* if  (ui_Temp==1) */
 		else {
 			printk("\nSpecified channel not supported \n");
-		}		//elseif  (ui_Temp==1)
-	}			//elseif  (ui_Temp==0)
+		}		/* elseif  (ui_Temp==1) */
+	}			/* elseif  (ui_Temp==0) */
 	return insn->n;
 }
 
@@ -105,7 +105,7 @@ INT i_APCI3501_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdev
 | Task              : Configures The Digital Output Subdevice.               |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 |					  data[1]            : 1 Enable  VCC  Interrupt  |
@@ -121,21 +121,21 @@ INT i_APCI3501_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdev
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-int i_APCI3501_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 
 	if ((data[0] != 0) && (data[0] != 1)) {
 		comedi_error(dev,
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 		return -EINVAL;
-	}			//if  ( (data[0]!=0) && (data[0]!=1) )
+	}			/* if  ( (data[0]!=0) && (data[0]!=1) ) */
 	if (data[0]) {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
-	}			// if  (data[0])
+	}			/*  if  (data[0]) */
 	else {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
-	}			//else if  (data[0])
+	}			/* else if  (data[0]) */
 	return insn->n;
 }
 
@@ -161,33 +161,33 @@ int i_APCI3501_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3501_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Temp, ui_Temp1;
-	UINT ui_NoOfChannel = CR_CHAN(insn->chanspec);	// get the channel
+	unsigned int ui_Temp, ui_Temp1;
+	unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec);	/*  get the channel */
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp = inl(devpriv->iobase + APCI3501_DIGITAL_OP);
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	else {
 		ui_Temp = 0;
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outl(data[0], devpriv->iobase + APCI3501_DIGITAL_OP);
-		}		//if(data[1]==0)
+		}		/* if(data[1]==0) */
 		else {
 			if (data[1] == 1) {
 				data[0] = (data[0] << (2 * data[2])) | ui_Temp;
 				outl(data[0],
 					devpriv->iobase + APCI3501_DIGITAL_OP);
-			}	// if(data[1]==1)
+			}	/*  if(data[1]==1) */
 			else {
 				printk("\nSpecified channel not supported\n");
-			}	//else if(data[1]==1)
-		}		//elseif(data[1]==0)
-	}			//if(data[3]==0)
+			}	/* else if(data[1]==1) */
+		}		/* elseif(data[1]==0) */
+	}			/* if(data[3]==0) */
 	else {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
@@ -201,7 +201,7 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 				data[0] = data[0] & ui_Temp;
 				outl(data[0],
 					devpriv->iobase + APCI3501_DIGITAL_OP);
-			}	//if(data[1]==0)
+			}	/* if(data[1]==0) */
 			else {
 				if (data[1] == 1) {
 					data[0] = ~data[0] & 0x3;
@@ -215,17 +215,17 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					outl(data[0],
 						devpriv->iobase +
 						APCI3501_DIGITAL_OP);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 					printk("\nSpecified channel not supported\n");
-				}	//else if(data[1]==1)
-			}	//elseif(data[1]==0)
-		}		//if(data[3]==1);
+				}	/* else if(data[1]==1) */
+			}	/* elseif(data[1]==0) */
+		}		/* if(data[3]==1); */
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
-		}		//if else data[3]==1)
-	}			//if else data[3]==0)
+		}		/* if else data[3]==1) */
+	}			/* if else data[3]==0) */
 	return insn->n;
 }
 
@@ -238,8 +238,8 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
-|                     UINT ui_NoOfChannels    : No Of Channels To read       |
-|                     UINT *data              : Data Pointer to read status  |
+|                     unsigned int ui_NoOfChannels    : No Of Channels To read       |
+|                     unsigned int *data              : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 +----------------------------------------------------------------------------+
@@ -248,27 +248,27 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI3501_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3501_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	UINT ui_Temp;
-	UINT ui_NoOfChannel;
+	unsigned int ui_Temp;
+	unsigned int ui_NoOfChannel;
 
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	ui_Temp = data[0];
 	*data = inl(devpriv->iobase + APCI3501_DIGITAL_OP);
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			// if  (ui_Temp==0)
+	}			/*  if  (ui_Temp==0) */
 	else {
 		if (ui_Temp == 1) {
 			*data = *data & 0x3;
 
-		}		// if  (ui_Temp==1)
+		}		/*  if  (ui_Temp==1) */
 		else {
 			printk("\nSpecified channel not supported \n");
-		}		// else if (ui_Temp==1)
-	}			// else if  (ui_Temp==0)
+		}		/*  else if (ui_Temp==1) */
+	}			/*  else if  (ui_Temp==0) */
 	return insn->n;
 }
 
@@ -298,8 +298,8 @@ INT i_APCI3501_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI3501_ConfigAnalogOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	outl(data[0],
 		devpriv->iobase + APCI3501_ANALOG_OUTPUT +
@@ -336,10 +336,10 @@ INT i_APCI3501_ConfigAnalogOutput(struct comedi_device * dev, struct comedi_subd
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+int i_APCI3501_WriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	ULONG ul_Command1 = 0, ul_Channel_no, ul_Polarity, ul_DAC_Ready = 0;;
+	unsigned int ul_Command1 = 0, ul_Channel_no, ul_Polarity, ul_DAC_Ready = 0;;
 
 	ul_Channel_no = CR_CHAN(insn->chanspec);
 
@@ -349,18 +349,18 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde
 			printk("\nIn WriteAnalogOutput :: Not Valid Data\n");
 		}
 
-	}			// end if(devpriv->b_InterruptMode==MODE1)
+	}			/*  end if(devpriv->b_InterruptMode==MODE1) */
 	else {
 		ul_Polarity = 0;
 		if ((*data < 0) || (*data > 8192)) {
 			printk("\nIn WriteAnalogOutput :: Not Valid Data\n");
 		}
 
-	}			// end else
+	}			/*  end else */
 
 	if ((ul_Channel_no < 0) || (ul_Channel_no > 7)) {
 		printk("\nIn WriteAnalogOutput :: Not Valid Channel\n");
-	}			// end if((ul_Channel_no<0)||(ul_Channel_no>7))
+	}			/*  end if((ul_Channel_no<0)||(ul_Channel_no>7)) */
 
 	ul_DAC_Ready = inl(devpriv->iobase + APCI3501_ANALOG_OUTPUT);
 
@@ -370,11 +370,11 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde
 	}
 
 	if (ul_DAC_Ready) {
-// Output the Value on the output channels.
+/* Output the Value on the output channels. */
 		ul_Command1 =
-			(ULONG) ((ULONG) (ul_Channel_no & 0xFF) |
-			(ULONG) ((*data << 0x8) & 0x7FFFFF00L) |
-			(ULONG) (ul_Polarity));
+			(unsigned int) ((unsigned int) (ul_Channel_no & 0xFF) |
+			(unsigned int) ((*data << 0x8) & 0x7FFFFF00L) |
+			(unsigned int) (ul_Polarity));
 		outl(ul_Command1,
 			devpriv->iobase + APCI3501_ANALOG_OUTPUT +
 			APCI3501_AO_PROG);
@@ -392,7 +392,7 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde
 | Task              : Configures The Timer , Counter or Watchdog             |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 |					  data[0]            : 0 Configure As Timer      |
@@ -410,78 +410,78 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde
 |			                                                         |
 +----------------------------------------------------------------------------+
 */
-INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	ULONG ul_Command1 = 0;
+	unsigned int ul_Command1 = 0;
 	devpriv->tsk_Current = current;
 	if (data[0] == ADDIDATA_WATCHDOG) {
 
 		devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG;
-		//Disable the watchdog
-		outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);	//disable Wa
+		/* Disable the watchdog */
+		outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);	/* disable Wa */
 
 		if (data[1] == 1) {
-			//Enable TIMER int & DISABLE ALL THE OTHER int SOURCES
+			/* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */
 			outl(0x02,
 				devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 		} else {
-			outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);	//disable Timer interrupt
+			outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);	/* disable Timer interrupt */
 		}
 
-		//Loading the Timebase value
+		/* Loading the Timebase value */
 		outl(data[2],
 			devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_TIMEBASE);
 
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outl(data[3],
 			devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_RELOAD_VALUE);
-		//Set the mode
-		ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG) | 0xFFF819E0UL;	//e2->e0
+		/* Set the mode */
+		ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG) | 0xFFF819E0UL;	/* e2->e0 */
 		outl(ul_Command1,
 			devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_PROG);
-	}			//end if(data[0]==ADDIDATA_WATCHDOG)
+	}			/* end if(data[0]==ADDIDATA_WATCHDOG) */
 
 	else if (data[0] == ADDIDATA_TIMER) {
-		//First Stop The Timer
+		/* First Stop The Timer */
 		ul_Command1 =
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_PROG);
 		ul_Command1 = ul_Command1 & 0xFFFFF9FEUL;
-		outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);	//Stop The Timer
+		outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);	/* Stop The Timer */
 		devpriv->b_TimerSelectMode = ADDIDATA_TIMER;
 		if (data[1] == 1) {
-			//Enable TIMER int & DISABLE ALL THE OTHER int SOURCES
+			/* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */
 			outl(0x02,
 				devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 		} else {
-			outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);	//disable Timer interrupt
+			outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);	/* disable Timer interrupt */
 		}
 
-		// Loading Timebase
+		/*  Loading Timebase */
 		outl(data[2],
 			devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_TIMEBASE);
 
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outl(data[3],
 			devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_RELOAD_VALUE);
 
-		// printk ("\nTimer Address :: %x\n", (devpriv->iobase+APCI3501_WATCHDOG));
+		/*  printk ("\nTimer Address :: %x\n", (devpriv->iobase+APCI3501_WATCHDOG)); */
 		ul_Command1 =
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_PROG);
 		ul_Command1 =
 			(ul_Command1 & 0xFFF719E2UL) | 2UL << 13UL | 0x10UL;
-		outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);	//mode 2
+		outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);	/* mode 2 */
 
-	}			//end if(data[0]==ADDIDATA_TIMER)
+	}			/* end if(data[0]==ADDIDATA_TIMER) */
 
 	return insn->n;
 }
@@ -495,7 +495,7 @@ INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 | Task              : Start / Stop The Selected Timer , Counter or Watchdog  |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 |					  data[0]            : 0 Timer                   |
@@ -511,10 +511,10 @@ INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	ULONG ul_Command1 = 0;
+	unsigned int ul_Command1 = 0;
 	int i_Temp;
 	if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
 
@@ -523,15 +523,15 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
-			//Enable the Watchdog
+			/* Enable the Watchdog */
 			outl(ul_Command1,
 				devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 		}
 
-		else if (data[1] == 0)	//Stop The Watchdog
+		else if (data[1] == 0)	/* Stop The Watchdog */
 		{
-			//Stop The Watchdog
+			/* Stop The Watchdog */
 			ul_Command1 =
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
@@ -547,8 +547,8 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 			outl(ul_Command1,
 				devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
-		}		//if(data[1]==2)
-	}			// end if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG)
+		}		/* if(data[1]==2) */
+	}			/*  end if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */
 
 	if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
 		if (data[1] == 1) {
@@ -557,12 +557,12 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
-			//Enable the Timer
+			/* Enable the Timer */
 			outl(ul_Command1,
 				devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 		} else if (data[1] == 0) {
-			//Stop The Timer
+			/* Stop The Timer */
 			ul_Command1 =
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
@@ -573,7 +573,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 		}
 
 		else if (data[1] == 2) {
-			//Trigger the Timer
+			/* Trigger the Timer */
 			ul_Command1 =
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
@@ -583,7 +583,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 				APCI3501_TCW_PROG);
 		}
 
-	}			// end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER)
+	}			/*  end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */
 	i_Temp = inl(devpriv->iobase + APCI3501_WATCHDOG +
 		APCI3501_TCW_TRIG_STATUS) & 0x1;
 	return insn->n;
@@ -598,7 +598,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 | Task              : Read The Selected Timer , Counter or Watchdog          |
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                                                            |
 |					  data[0]            : 0 Timer                   |
@@ -613,8 +613,8 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 
 	if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
@@ -622,14 +622,14 @@ int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device * dev,
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_TRIG_STATUS) & 0x1;
 		data[1] = inl(devpriv->iobase + APCI3501_WATCHDOG);
-	}			// end if  (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG)
+	}			/*  end if  (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */
 
 	else if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
 		data[0] =
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_TRIG_STATUS) & 0x1;
 		data[1] = inl(devpriv->iobase + APCI3501_WATCHDOG);
-	}			// end if  (devpriv->b_TimerSelectMode==ADDIDATA_TIMER)
+	}			/*  end if  (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */
 
 	else if ((devpriv->b_TimerSelectMode != ADDIDATA_TIMER)
 		&& (devpriv->b_TimerSelectMode != ADDIDATA_WATCHDOG)) {
@@ -654,10 +654,10 @@ int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3501_Reset(struct comedi_device * dev)
+int i_APCI3501_Reset(struct comedi_device *dev)
 {
 	int i_Count = 0, i_temp = 0;
-	ULONG ul_Command1 = 0, ul_Polarity, ul_DAC_Ready = 0;
+	unsigned int ul_Command1 = 0, ul_Polarity, ul_DAC_Ready = 0;
 	outl(0x0, devpriv->iobase + APCI3501_DIGITAL_OP);
 	outl(1, devpriv->iobase + APCI3501_ANALOG_OUTPUT +
 		APCI3501_AO_VOLT_MODE);
@@ -674,11 +674,11 @@ int i_APCI3501_Reset(struct comedi_device * dev)
 		}
 
 		if (ul_DAC_Ready) {
-			// Output the Value on the output channels.
+			/*  Output the Value on the output channels. */
 			ul_Command1 =
-				(ULONG) ((ULONG) (i_Count & 0xFF) |
-				(ULONG) ((i_temp << 0x8) & 0x7FFFFF00L) |
-				(ULONG) (ul_Polarity));
+				(unsigned int) ((unsigned int) (i_Count & 0xFF) |
+				(unsigned int) ((i_temp << 0x8) & 0x7FFFFF00L) |
+				(unsigned int) (ul_Polarity));
 			outl(ul_Command1,
 				devpriv->iobase + APCI3501_ANALOG_OUTPUT +
 				APCI3501_AO_PROG);
@@ -711,7 +711,7 @@ void v_APCI3501_Interrupt(int irq, void *d)
 	struct comedi_device *dev = d;
 	unsigned int ui_Timer_AOWatchdog;
 	unsigned long ul_Command1;
-	// Disable Interrupt
+	/*  Disable Interrupt */
 	ul_Command1 =
 		inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);
 
@@ -728,8 +728,9 @@ void v_APCI3501_Interrupt(int irq, void *d)
 		return;
 	}
 
-	// Enable Interrupt
-	//Send a signal to from kernel to user space
+/*
+* Enable Interrupt Send a signal to from kernel to user space
+*/
 	send_sig(SIGIO, devpriv->tsk_Current, 0);
 	ul_Command1 =
 		inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);

+ 24 - 20
drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h

@@ -15,7 +15,7 @@
  * any later version.
  */
 
-// Card Specific information
+/* Card Specific information */
 #define APCI3501_BOARD_VENDOR_ID                 0x15B8
 #define APCI3501_ADDRESS_RANGE                   255
 
@@ -23,7 +23,7 @@
 #define APCI3501_DIGITAL_OP                       0x40
 #define APCI3501_ANALOG_OUTPUT                    0x00
 
-//Analog Output related Defines
+/* Analog Output related Defines */
 #define APCI3501_AO_VOLT_MODE                     0
 #define APCI3501_AO_PROG                          4
 #define APCI3501_AO_TRIG_SCS                      8
@@ -31,14 +31,14 @@
 #define BIPOLAR                                   1
 #define MODE0                                     0
 #define MODE1                                     1
-// ANALOG OUTPUT RANGE
+/* ANALOG OUTPUT RANGE */
 struct comedi_lrange range_apci3501_ao = { 2, {
 					BIP_RANGE(10),
 					UNI_RANGE(10)
 					}
 };
 
-//Watchdog Related Defines
+/* Watchdog Related Defines */
 
 #define APCI3501_WATCHDOG                         0x20
 #define APCI3501_TCW_SYNC_ENABLEDISABLE           0
@@ -52,32 +52,36 @@ struct comedi_lrange range_apci3501_ao = { 2, {
 #define ADDIDATA_TIMER                            0
 #define ADDIDATA_WATCHDOG                         2
 
-// Hardware Layer  functions for Apci3501
+/* Hardware Layer  functions for Apci3501 */
 
-//AO
-INT i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+/* AO */
+int i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				  struct comedi_insn *insn, unsigned int *data);
-INT i_APCI3501_WriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI3501_WriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 
-//DI
-// for di read
-//INT i_APCI3501_ReadDigitalInput(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data);
+/*
+* DI for di read INT i_APCI3501_ReadDigitalInput(struct
+* comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn
+* *insn,unsigned int *data);
+*/
 
-INT i_APCI3501_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI3501_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				struct comedi_insn *insn, unsigned int *data);
 
-//DO
+/* DO */
 int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
-INT i_APCI3501_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI3501_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				  struct comedi_insn *insn, unsigned int *data);
-INT i_APCI3501_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
+int i_APCI3501_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 
-// TIMER
-// timer value is passed as u seconds
-INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev,
+/* TIMER
+ * timer value is passed as u seconds
+ */
+
+int i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev,
 					  struct comedi_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);
 int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
@@ -87,8 +91,8 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
 int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device *dev,
 					struct comedi_subdevice *s,
 					struct comedi_insn *insn, unsigned int *data);
-//Interrupt
+/* Interrupt */
 void v_APCI3501_Interrupt(int irq, void *d);
 
-//Reset functions
+/* Reset functions */
 int i_APCI3501_Reset(struct comedi_device *dev);

+ 136 - 138
drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c

@@ -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.
 
@@ -54,7 +54,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT   i_APCI3XXX_TestConversionStarted                 |
+| Function Name     : int   i_APCI3XXX_TestConversionStarted                 |
 |                          (struct comedi_device    *dev)                           |
 +----------------------------------------------------------------------------+
 | Task                Test if any conversion started                         |
@@ -68,18 +68,18 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_TestConversionStarted(struct comedi_device * dev)
+int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev)
 {
-	if ((readl((void *)(devpriv->dw_AiBase + 8)) & 0x80000UL) == 0x80000UL) {
-		return (1);
-	} else {
-		return (0);
-	}
+	if ((readl((void *)(devpriv->dw_AiBase + 8)) & 0x80000UL) == 0x80000UL)
+		return 1;
+	else
+		return 0;
+
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT   i_APCI3XXX_AnalogInputConfigOperatingMode        |
+| Function Name     : int   i_APCI3XXX_AnalogInputConfigOperatingMode        |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -87,9 +87,9 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device * dev)
 +----------------------------------------------------------------------------+
 | Task           Converting mode and convert time selection                  |
 +----------------------------------------------------------------------------+
-| Input Parameters  : b_SingleDiff  = (BYTE)  data[1];                       |
-|                     b_TimeBase    = (BYTE)  data[2]; (0: ns, 1:micros 2:ms)|
-|                    dw_ReloadValue = (DWORD) data[3];                       |
+| Input Parameters  : b_SingleDiff  = (unsigned char)  data[1];                       |
+|                     b_TimeBase    = (unsigned char)  data[2]; (0: ns, 1:micros 2:ms)|
+|                    dw_ReloadValue = (unsigned int) data[3];                       |
 |                     ........                                               |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -105,14 +105,14 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device * dev)
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_TimeBase = 0;
-	BYTE b_SingleDiff = 0;
-	DWORD dw_ReloadValue = 0;
-	DWORD dw_TestReloadValue = 0;
+	int i_ReturnValue = insn->n;
+	unsigned char b_TimeBase = 0;
+	unsigned char b_SingleDiff = 0;
+	unsigned int dw_ReloadValue = 0;
+	unsigned int dw_TestReloadValue = 0;
 
 	/************************/
 	/* Test the buffer size */
@@ -123,19 +123,19 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
 		/* Get the Singel/Diff flag */
 	   /****************************/
 
-		b_SingleDiff = (BYTE) data[1];
+		b_SingleDiff = (unsigned char) data[1];
 
 	   /****************************/
 		/* Get the time base unitiy */
 	   /****************************/
 
-		b_TimeBase = (BYTE) data[2];
+		b_TimeBase = (unsigned char) data[2];
 
 	   /*************************************/
 		/* Get the convert time reload value */
 	   /*************************************/
 
-		dw_ReloadValue = (DWORD) data[3];
+		dw_ReloadValue = (unsigned int) data[3];
 
 	   /**********************/
 		/* Test the time base */
@@ -186,7 +186,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
 								devpriv->
 									ui_EocEosConversionTime
 									=
-									(UINT)
+									(unsigned int)
 									dw_ReloadValue;
 								devpriv->
 									b_EocEosConversionTimeBase
@@ -204,7 +204,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
 								/* Set the convert timing unit */
 			      /*******************************/
 
-								writel((DWORD)
+								writel((unsigned int)
 									b_TimeBase,
 									(void *)
 									(devpriv->
@@ -268,12 +268,12 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
 		i_ReturnValue = -101;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT   i_APCI3XXX_InsnConfigAnalogInput                 |
+| Function Name     : int   i_APCI3XXX_InsnConfigAnalogInput                 |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -281,9 +281,9 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 | Task           Converting mode and convert time selection                  |
 +----------------------------------------------------------------------------+
-| Input Parameters  : b_ConvertMode = (BYTE)  data[0];                       |
-|                     b_TimeBase    = (BYTE)  data[1]; (0: ns, 1:micros 2:ms)|
-|                    dw_ReloadValue = (DWORD) data[2];                       |
+| Input Parameters  : b_ConvertMode = (unsigned char)  data[0];                       |
+|                     b_TimeBase    = (unsigned char)  data[1]; (0: ns, 1:micros 2:ms)|
+|                    dw_ReloadValue = (unsigned int) data[2];                       |
 |                     ........                                               |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
@@ -295,17 +295,17 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
+	int i_ReturnValue = insn->n;
 
 	/************************/
 	/* Test the buffer size */
 	/************************/
 
 	if (insn->n >= 1) {
-		switch ((BYTE) data[0]) {
+		switch ((unsigned char) data[0]) {
 		case APCI3XXX_CONFIGURATION:
 			i_ReturnValue =
 				i_APCI3XXX_AnalogInputConfigOperatingMode(dev,
@@ -326,12 +326,12 @@ int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT   i_APCI3XXX_InsnReadAnalogInput                   |
+| Function Name     : int   i_APCI3XXX_InsnReadAnalogInput                   |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -355,16 +355,16 @@ int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_Configuration = (BYTE) CR_RANGE(insn->chanspec);
-	BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec);
-	DWORD dw_Temp = 0;
-	DWORD dw_Configuration = 0;
-	DWORD dw_AcquisitionCpt = 0;
-	BYTE b_Interrupt = 0;
+	int i_ReturnValue = insn->n;
+	unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec);
+	unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
+	unsigned int dw_Temp = 0;
+	unsigned int dw_Configuration = 0;
+	unsigned int dw_AcquisitionCpt = 0;
+	unsigned char b_Interrupt = 0;
 
 	/*************************************/
 	/* Test if operating mode configured */
@@ -449,8 +449,8 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev,
 
 					dw_Configuration =
 						(b_Configuration & 3) |
-						((DWORD) (b_Configuration >> 2)
-						<< 6) | ((DWORD) devpriv->
+						((unsigned int) (b_Configuration >> 2)
+						<< 6) | ((unsigned int) devpriv->
 						b_SingelDiff << 7);
 
 		    /***************************/
@@ -468,7 +468,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev,
 					writel(dw_Temp | 0x100UL,
 						(void *)(devpriv->dw_AiBase +
 							4));
-					writel((DWORD) b_Channel,
+					writel((unsigned int) b_Channel,
 						(void *)(devpriv->dw_AiBase +
 							0));
 
@@ -535,8 +535,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev,
 								dw_Temp =
 									dw_Temp
 									& 1;
-							}
-							while (dw_Temp != 1);
+							} while (dw_Temp != 1);
 
 			  /*************************/
 							/* Read the analog value */
@@ -585,7 +584,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev,
 		printk("Operating mode not configured\n");
 		i_ReturnValue = -1;
 	}
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -607,15 +606,15 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev,
 void v_APCI3XXX_Interrupt(int irq, void *d)
 {
 	struct comedi_device *dev = d;
-	BYTE b_CopyCpt = 0;
-	DWORD dw_Status = 0;
+	unsigned char b_CopyCpt = 0;
+	unsigned int dw_Status = 0;
 
 	/***************************/
 	/* Test if interrupt occur */
 	/***************************/
 
-	if (((dw_Status = readl((void *)(devpriv->dw_AiBase + 16))) & 0x2UL) ==
-		0x2UL) {
+	dw_Status = readl((void *)(devpriv->dw_AiBase + 16));
+	if ( (dw_Status & 0x2UL) == 0x2UL) {
 	   /***********************/
 		/* Reset the interrupt */
 	   /***********************/
@@ -635,7 +634,7 @@ void v_APCI3XXX_Interrupt(int irq, void *d)
 				b_CopyCpt < devpriv->ui_AiNbrofChannels;
 				b_CopyCpt++) {
 				devpriv->ui_AiReadData[b_CopyCpt] =
-					(UINT) readl((void *)(devpriv->
+					(unsigned int) readl((void *)(devpriv->
 						dw_AiBase + 28));
 			}
 
@@ -662,7 +661,7 @@ void v_APCI3XXX_Interrupt(int irq, void *d)
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT   i_APCI3XXX_InsnWriteAnalogOutput                 |
+| Function Name     : int   i_APCI3XXX_InsnWriteAnalogOutput                 |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -684,13 +683,13 @@ void v_APCI3XXX_Interrupt(int irq, void *d)
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	BYTE b_Range = (BYTE) CR_RANGE(insn->chanspec);
-	BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec);
-	DWORD dw_Status = 0;
-	INT i_ReturnValue = insn->n;
+	unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec);
+	unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
+	unsigned int dw_Status = 0;
+	int i_ReturnValue = insn->n;
 
 	/************************/
 	/* Test the buffer size */
@@ -729,8 +728,7 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev,
 					dw_Status =
 						readl((void *)(devpriv->
 							dw_AiBase + 96));
-				}
-				while ((dw_Status & 0x100) != 0x100);
+				} while ((dw_Status & 0x100) != 0x100);
 			} else {
 		 /***************************/
 				/* Channel not initialised */
@@ -757,7 +755,7 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -768,7 +766,7 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT   i_APCI3XXX_InsnConfigInitTTLIO                   |
+| Function Name     : int   i_APCI3XXX_InsnConfigInitTTLIO                   |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -778,8 +776,8 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev,
 |                for you call any other function witch access of TTL.        |
 |                APCI3XXX_TTL_INIT_DIRECTION_PORT2(user inputs for direction)|
 +----------------------------------------------------------------------------+
-| Input Parameters  : b_InitType    = (BYTE) data[0];                        |
-|                     b_Port2Mode   = (BYTE) data[1];                        |
+| Input Parameters  : b_InitType    = (unsigned char) data[0];                        |
+|                     b_Port2Mode   = (unsigned char) data[1];                        |
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
@@ -791,11 +789,11 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_Command = 0;
+	int i_ReturnValue = insn->n;
+	unsigned char b_Command = 0;
 
 	/************************/
 	/* Test the buffer size */
@@ -806,7 +804,7 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev,
 		/* Get the command */
 		/* **************** */
 
-		b_Command = (BYTE) data[0];
+		b_Command = (unsigned char) data[0];
 
 	   /********************/
 		/* Test the command */
@@ -888,7 +886,7 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev,
 		}
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -899,7 +897,7 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT     i_APCI3XXX_InsnBitsTTLIO                       |
+| Function Name     : int     i_APCI3XXX_InsnBitsTTLIO                       |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -919,14 +917,14 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_ChannelCpt = 0;
-	DWORD dw_ChannelMask = 0;
-	DWORD dw_BitMask = 0;
-	DWORD dw_Status = 0;
+	int i_ReturnValue = insn->n;
+	unsigned char b_ChannelCpt = 0;
+	unsigned int dw_ChannelMask = 0;
+	unsigned int dw_BitMask = 0;
+	unsigned int dw_Status = 0;
 
 	/************************/
 	/* Test the buffer size */
@@ -1051,12 +1049,12 @@ int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device * dev,
 		i_ReturnValue = -101;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT i_APCI3XXX_InsnReadTTLIO                           |
+| Function Name     : int i_APCI3XXX_InsnReadTTLIO                           |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -1074,11 +1072,11 @@ int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec);
-	INT i_ReturnValue = insn->n;
+	unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
+	int i_ReturnValue = insn->n;
 	unsigned int *pls_ReadData = data;
 
 	/************************/
@@ -1157,7 +1155,7 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev,
 		i_ReturnValue = -101;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -1168,7 +1166,7 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev,
 
 /*
 +----------------------------------------------------------------------------+
-| Function Name     : INT     i_APCI3XXX_InsnWriteTTLIO                      |
+| Function Name     : int     i_APCI3XXX_InsnWriteTTLIO                      |
 |                          (struct comedi_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
@@ -1187,20 +1185,20 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec);
-	BYTE b_State = 0;
-	DWORD dw_Status = 0;
+	int i_ReturnValue = insn->n;
+	unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
+	unsigned char b_State = 0;
+	unsigned int dw_Status = 0;
 
 	/************************/
 	/* Test the buffer size */
 	/************************/
 
 	if (insn->n >= 1) {
-		b_State = (BYTE) data[0];
+		b_State = (unsigned char) data[0];
 
 	   /***********************/
 		/* Test if read port 0 */
@@ -1269,7 +1267,7 @@ int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device * dev,
 		i_ReturnValue = -101;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -1298,12 +1296,12 @@ int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec);
-	DWORD dw_Temp = 0;
+	int i_ReturnValue = insn->n;
+	unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
+	unsigned int dw_Temp = 0;
 
 	/***************************/
 	/* Test the channel number */
@@ -1334,7 +1332,7 @@ int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device * dev,
 		i_ReturnValue = -3;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -1356,11 +1354,11 @@ int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device * dev,
 |                    -101 : Data size error                                  |
 +----------------------------------------------------------------------------+
 */
-int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	DWORD dw_Temp = 0;
+	int i_ReturnValue = insn->n;
+	unsigned int dw_Temp = 0;
 
 	/************************/
 	/* Test the buffer size */
@@ -1378,7 +1376,7 @@ int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -1409,14 +1407,14 @@ int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device * dev,
 |                    -101 : Data size error                                  |
 +----------------------------------------------------------------------------+
 */
-int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_ChannelCpt = 0;
-	DWORD dw_ChannelMask = 0;
-	DWORD dw_BitMask = 0;
-	DWORD dw_Status = 0;
+	int i_ReturnValue = insn->n;
+	unsigned char b_ChannelCpt = 0;
+	unsigned int dw_ChannelMask = 0;
+	unsigned int dw_BitMask = 0;
+	unsigned int dw_Status = 0;
 
 	/************************/
 	/* Test the buffer size */
@@ -1481,7 +1479,7 @@ int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -1505,13 +1503,13 @@ int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_Channel = CR_CHAN(insn->chanspec);
-	BYTE b_State = 0;
-	DWORD dw_Status = 0;
+	int i_ReturnValue = insn->n;
+	unsigned char b_Channel = CR_CHAN(insn->chanspec);
+	unsigned char b_State = 0;
+	unsigned int dw_Status = 0;
 
 	/************************/
 	/* Test the buffer size */
@@ -1527,7 +1525,7 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev,
 			/* Get the command */
 	      /*******************/
 
-			b_State = (BYTE) data[0];
+			b_State = (unsigned char) data[0];
 
 	      /********************************/
 			/* Read the digital output port */
@@ -1557,7 +1555,7 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -1580,12 +1578,12 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	INT i_ReturnValue = insn->n;
-	BYTE b_Channel = CR_CHAN(insn->chanspec);
-	DWORD dw_Status = 0;
+	int i_ReturnValue = insn->n;
+	unsigned char b_Channel = CR_CHAN(insn->chanspec);
+	unsigned int dw_Status = 0;
 
 	/************************/
 	/* Test the buffer size */
@@ -1622,7 +1620,7 @@ int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 	}
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 
 /*
@@ -1638,7 +1636,7 @@ int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 */
 
-int i_APCI3XXX_Reset(struct comedi_device * dev)
+int i_APCI3XXX_Reset(struct comedi_device *dev)
 {
 	unsigned char b_Cpt = 0;
 

+ 1 - 1
drivers/staging/comedi/drivers/addi_apci_035.c

@@ -1,5 +1,5 @@
 #define CONFIG_APCI_035 1
 
-#define ADDIDATA_WATCHDOG 2	// Or shold it be something else
+#define ADDIDATA_WATCHDOG 2	/*  Or shold it be something else */
 
 #include "addi-data/addi_common.c"

+ 87 - 90
drivers/staging/comedi/drivers/adl_pci6208.c

@@ -61,35 +61,35 @@ struct pci6208_board {
 	const char *name;
 	unsigned short dev_id;	/* `lspci` will show you this */
 	int ao_chans;
-	//int ao_bits;
+	/* int ao_bits; */
 };
 
 static const struct pci6208_board pci6208_boards[] = {
 	/*{
-	   name :  "pci6208v",
-	   dev_id       :  0x6208,      //not sure
-	   ao_chans:  8
-	   //,  ao_bits :  16
+	.name = "pci6208v",
+	.dev_id = 0x6208,      // not sure
+	.ao_chans = 8
+	   // ,	.ao_bits = 16
 	   },
 	   {
-	   name :  "pci6216v",
-	   dev_id       :  0x6208,      //not sure
-	   ao_chans:  16
-	   //,  ao_bits :  16
+	.name = "pci6216v",
+	.dev_id = 0x6208,      // not sure
+	.ao_chans = 16
+	   // ,	.ao_bits = 16
 	   }, */
 	{
-	      name:	"pci6208a",
-	      dev_id:	0x6208,
-	      ao_chans:8
-			//,     ao_bits :  16
+	.name = "pci6208a",
+	.dev_id = 0x6208,
+	.ao_chans = 8
+			/* ,	.ao_bits = 16 */
 		}
 };
 
 /* This is used by modprobe to translate PCI IDs to drivers.  Should
  * only be used for PCI and ISA-PnP devices */
 static DEFINE_PCI_DEVICE_TABLE(pci6208_pci_table) = {
-	//{ PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-	//{ PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	/* { PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, */
+	/* { PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, */
 	{PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 	{0}
 };
@@ -107,35 +107,32 @@ struct pci6208_private {
 
 #define devpriv ((struct pci6208_private *)dev->private)
 
-static int pci6208_attach(struct comedi_device * dev, struct comedi_devconfig * it);
-static int pci6208_detach(struct comedi_device * dev);
-
-#define pci6208_board_nbr \
-	(sizeof(pci6208_boards) / sizeof(struct pci6208_board))
+static int pci6208_attach(struct comedi_device *dev, struct comedi_devconfig *it);
+static int pci6208_detach(struct comedi_device *dev);
 
 static struct comedi_driver driver_pci6208 = {
-      driver_name:PCI6208_DRIVER_NAME,
-      module:THIS_MODULE,
-      attach:pci6208_attach,
-      detach:pci6208_detach,
+	.driver_name = PCI6208_DRIVER_NAME,
+	.module = THIS_MODULE,
+	.attach = pci6208_attach,
+	.detach = pci6208_detach,
 };
 
 COMEDI_PCI_INITCLEANUP(driver_pci6208, pci6208_pci_table);
 
-static int pci6208_find_device(struct comedi_device * dev, int bus, int slot);
+static int pci6208_find_device(struct comedi_device *dev, int bus, int slot);
 static int
 pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr,
 	int dev_minor);
 
 /*read/write functions*/
-static int pci6208_ao_winsn(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data);
-static int pci6208_ao_rinsn(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data);
-//static int pci6208_dio_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s,
-//      struct comedi_insn *insn,unsigned int *data);
-//static int pci6208_dio_insn_config(struct comedi_device *dev,struct comedi_subdevice *s,
-//      struct comedi_insn *insn,unsigned int *data);
+static int pci6208_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data);
+static int pci6208_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data);
+/* static int pci6208_dio_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, */
+/* struct comedi_insn *insn,unsigned int *data); */
+/* static int pci6208_dio_insn_config(struct comedi_device *dev,struct comedi_subdevice *s, */
+/* struct comedi_insn *insn,unsigned int *data); */
 
 /*
  * Attach is called by the Comedi core to configure the driver
@@ -143,7 +140,7 @@ static int pci6208_ao_rinsn(struct comedi_device * dev, struct comedi_subdevice
  * in the driver structure, dev->board_ptr contains that
  * address.
  */
-static int pci6208_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int pci6208_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct comedi_subdevice *s;
 	int retval;
@@ -176,22 +173,22 @@ static int pci6208_attach(struct comedi_device * dev, struct comedi_devconfig *
 	s = dev->subdevices + 0;
 	/* analog output subdevice */
 	s->type = COMEDI_SUBD_AO;
-	s->subdev_flags = SDF_WRITABLE;	//anything else to add here??
+	s->subdev_flags = SDF_WRITABLE;	/* anything else to add here?? */
 	s->n_chan = thisboard->ao_chans;
-	s->maxdata = 0xffff;	//16-bit DAC
-	s->range_table = &range_bipolar10;	//this needs to be checked.
+	s->maxdata = 0xffff;	/* 16-bit DAC */
+	s->range_table = &range_bipolar10;	/* this needs to be checked. */
 	s->insn_write = pci6208_ao_winsn;
 	s->insn_read = pci6208_ao_rinsn;
 
-	//s=dev->subdevices+1;
+	/* s=dev->subdevices+1; */
 	/* digital i/o subdevice */
-	//s->type=COMEDI_SUBD_DIO;
-	//s->subdev_flags=SDF_READABLE|SDF_WRITABLE;
-	//s->n_chan=16;
-	//s->maxdata=1;
-	//s->range_table=&range_digital;
-	//s->insn_bits = pci6208_dio_insn_bits;
-	//s->insn_config = pci6208_dio_insn_config;
+	/* s->type=COMEDI_SUBD_DIO; */
+	/* s->subdev_flags=SDF_READABLE|SDF_WRITABLE; */
+	/* s->n_chan=16; */
+	/* s->maxdata=1; */
+	/* s->range_table=&range_digital; */
+	/* s->insn_bits = pci6208_dio_insn_bits; */
+	/* s->insn_config = pci6208_dio_insn_config; */
 
 	printk("attached\n");
 
@@ -206,7 +203,7 @@ static int pci6208_attach(struct comedi_device * dev, struct comedi_devconfig *
  * allocated by _attach().  dev->private and dev->subdevices are
  * deallocated automatically by the core.
  */
-static int pci6208_detach(struct comedi_device * dev)
+static int pci6208_detach(struct comedi_device *dev)
 {
 	printk("comedi%d: pci6208: remove\n", dev->minor);
 
@@ -220,8 +217,8 @@ static int pci6208_detach(struct comedi_device * dev)
 	return 0;
 }
 
-static int pci6208_ao_winsn(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci6208_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int i = 0, Data_Read;
 	unsigned short chan = CR_CHAN(insn->chanspec);
@@ -245,8 +242,8 @@ static int pci6208_ao_winsn(struct comedi_device * dev, struct comedi_subdevice
 
 /* AO subdevices should have a read insn as well as a write insn.
  * Usually this means copying a value stored in devpriv. */
-static int pci6208_ao_rinsn(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci6208_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int i;
 	int chan = CR_CHAN(insn->chanspec);
@@ -262,51 +259,51 @@ static int pci6208_ao_rinsn(struct comedi_device * dev, struct comedi_subdevice
  * useful to applications if you implement the insn_bits interface.
  * This allows packed reading/writing of the DIO channels.  The
  * comedi core can convert between insn_bits and insn_read/write */
-//static int pci6208_dio_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s,
-//      struct comedi_insn *insn,unsigned int *data)
-//{
-//      if(insn->n!=2)return -EINVAL;
+/* static int pci6208_dio_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, */
+/* struct comedi_insn *insn,unsigned int *data) */
+/* { */
+/* if(insn->n!=2)return -EINVAL; */
 
 	/* The insn data is a mask in data[0] and the new data
 	 * in data[1], each channel cooresponding to a bit. */
-//      if(data[0]){
-//              s->state &= ~data[0];
-//              s->state |= data[0]&data[1];
+/* if(data[0]){ */
+/* s->state &= ~data[0]; */
+/* s->state |= data[0]&data[1]; */
 		/* Write out the new digital output lines */
-		//outw(s->state,dev->iobase + SKEL_DIO);
-//      }
+		/* outw(s->state,dev->iobase + SKEL_DIO); */
+/* } */
 
 	/* on return, data[1] contains the value of the digital
 	 * input and output lines. */
-	//data[1]=inw(dev->iobase + SKEL_DIO);
+	/* data[1]=inw(dev->iobase + SKEL_DIO); */
 	/* or we could just return the software copy of the output values if
 	 * it was a purely digital output subdevice */
-	//data[1]=s->state;
+	/* data[1]=s->state; */
 
-//      return 2;
-//}
+/* return 2; */
+/* } */
 
-//static int pci6208_dio_insn_config(struct comedi_device *dev,struct comedi_subdevice *s,
-//      struct comedi_insn *insn,unsigned int *data)
-//{
-//      int chan=CR_CHAN(insn->chanspec);
+/* static int pci6208_dio_insn_config(struct comedi_device *dev,struct comedi_subdevice *s, */
+/* struct comedi_insn *insn,unsigned int *data) */
+/* { */
+/* int chan=CR_CHAN(insn->chanspec); */
 
 	/* The input or output configuration of each digital line is
 	 * configured by a special insn_config instruction.  chanspec
 	 * contains the channel to be changed, and data[0] contains the
 	 * value COMEDI_INPUT or COMEDI_OUTPUT. */
 
-//      if(data[0]==COMEDI_OUTPUT){
-//              s->io_bits |= 1<<chan;
-//      }else{
-//              s->io_bits &= ~(1<<chan);
-//      }
-	//outw(s->io_bits,dev->iobase + SKEL_DIO_CONFIG);
+/* if(data[0]==COMEDI_OUTPUT){ */
+/* s->io_bits |= 1<<chan; */
+/* }else{ */
+/* s->io_bits &= ~(1<<chan); */
+/* } */
+	/* outw(s->io_bits,dev->iobase + SKEL_DIO_CONFIG); */
 
-//      return 1;
-//}
+/* return 1; */
+/* } */
 
-static int pci6208_find_device(struct comedi_device * dev, int bus, int slot)
+static int pci6208_find_device(struct comedi_device *dev, int bus, int slot)
 {
 	struct pci_dev *pci_dev;
 	int i;
@@ -315,11 +312,11 @@ static int pci6208_find_device(struct comedi_device * dev, int bus, int slot)
 		pci_dev != NULL;
 		pci_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) {
 		if (pci_dev->vendor == PCI_VENDOR_ID_ADLINK) {
-			for (i = 0; i < pci6208_board_nbr; i++) {
+			for (i = 0; i < ARRAY_SIZE(pci6208_boards); i++) {
 				if (pci6208_boards[i].dev_id == pci_dev->device) {
-					// was a particular bus/slot requested?
+					/*  was a particular bus/slot requested? */
 					if ((bus != 0) || (slot != 0)) {
-						// are we on the wrong bus/slot?
+						/*  are we on the wrong bus/slot? */
 						if (pci_dev->bus->number
 							!= bus ||
 							PCI_SLOT(pci_dev->devfn)
@@ -346,10 +343,10 @@ static int pci6208_find_device(struct comedi_device * dev, int bus, int slot)
 		PCI_SLOT(pci_dev->devfn),
 		PCI_FUNC(pci_dev->devfn), pci_dev->irq);
 
-	// TODO: Warn about non-tested boards.
-	//switch(board->device_id)
-	//{
-	//};
+	/*  TODO: Warn about non-tested boards. */
+	/* switch(board->device_id) */
+	/* { */
+	/* }; */
 
 	devpriv->pci_dev = pci_dev;
 
@@ -362,19 +359,19 @@ pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr,
 {
 	unsigned long io_base, io_range, lcr_io_base, lcr_io_range;
 
-	// Enable PCI device and request regions
+	/*  Enable PCI device and request regions */
 	if (comedi_pci_enable(pci_dev, PCI6208_DRIVER_NAME) < 0) {
 		printk("comedi%d: Failed to enable PCI device and request regions\n", dev_minor);
 		return -EIO;
 	}
-	// Read local configuration register base address [PCI_BASE_ADDRESS #1].
+	/*  Read local configuration register base address [PCI_BASE_ADDRESS #1]. */
 	lcr_io_base = pci_resource_start(pci_dev, 1);
 	lcr_io_range = pci_resource_len(pci_dev, 1);
 
 	printk("comedi%d: local config registers at address 0x%4lx [0x%4lx]\n",
 		dev_minor, lcr_io_base, lcr_io_range);
 
-	// Read PCI6208 register base address [PCI_BASE_ADDRESS #2].
+	/*  Read PCI6208 register base address [PCI_BASE_ADDRESS #2]. */
 	io_base = pci_resource_start(pci_dev, 2);
 	io_range = pci_resource_end(pci_dev, 2) - io_base + 1;
 
@@ -382,10 +379,10 @@ pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr,
 		dev_minor, io_base, io_range);
 
 	*io_base_ptr = io_base;
-	//devpriv->io_range = io_range;
-	//devpriv->is_valid=0;
-	//devpriv->lcr_io_base=lcr_io_base;
-	//devpriv->lcr_io_range=lcr_io_range;
+	/* devpriv->io_range = io_range; */
+	/* devpriv->is_valid=0; */
+	/* devpriv->lcr_io_base=lcr_io_base; */
+	/* devpriv->lcr_io_range=lcr_io_range; */
 
 	return 0;
 }

+ 11 - 11
drivers/staging/comedi/drivers/adl_pci7296.c

@@ -39,7 +39,7 @@ Configuration Options:
 
 #include "comedi_pci.h"
 #include "8255.h"
-// #include "8253.h"
+/* #include "8253.h" */
 
 #define PORT1A 0
 #define PORT2A 4
@@ -64,16 +64,16 @@ struct adl_pci7296_private {
 
 #define devpriv ((struct adl_pci7296_private *)dev->private)
 
-static int adl_pci7296_attach(struct comedi_device * dev, struct comedi_devconfig * it);
-static int adl_pci7296_detach(struct comedi_device * dev);
+static int adl_pci7296_attach(struct comedi_device *dev, struct comedi_devconfig *it);
+static int adl_pci7296_detach(struct comedi_device *dev);
 static struct comedi_driver driver_adl_pci7296 = {
-      driver_name:"adl_pci7296",
-      module:THIS_MODULE,
-      attach:adl_pci7296_attach,
-      detach:adl_pci7296_detach,
+	.driver_name = "adl_pci7296",
+	.module = THIS_MODULE,
+	.attach = adl_pci7296_attach,
+	.detach = adl_pci7296_detach,
 };
 
-static int adl_pci7296_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int adl_pci7296_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct pci_dev *pcidev;
 	struct comedi_subdevice *s;
@@ -115,7 +115,7 @@ static int adl_pci7296_attach(struct comedi_device * dev, struct comedi_devconfi
 			dev->iobase = pci_resource_start(pcidev, 2);
 			printk("comedi: base addr %4lx\n", dev->iobase);
 
-			// four 8255 digital io subdevices
+			/*  four 8255 digital io subdevices */
 			s = dev->subdevices + 0;
 			subdev_8255_init(dev, s, NULL,
 				(unsigned long)(dev->iobase));
@@ -149,7 +149,7 @@ static int adl_pci7296_attach(struct comedi_device * dev, struct comedi_devconfi
 	return -EIO;
 }
 
-static int adl_pci7296_detach(struct comedi_device * dev)
+static int adl_pci7296_detach(struct comedi_device *dev)
 {
 	printk("comedi%d: pci7432: remove\n", dev->minor);
 
@@ -159,7 +159,7 @@ static int adl_pci7296_detach(struct comedi_device * dev)
 		}
 		pci_dev_put(devpriv->pci_dev);
 	}
-	// detach four 8255 digital io subdevices
+	/*  detach four 8255 digital io subdevices */
 	if (dev->subdevices) {
 		subdev_8255_cleanup(dev, dev->subdevices + 0);
 		subdev_8255_cleanup(dev, dev->subdevices + 1);

+ 16 - 16
drivers/staging/comedi/drivers/adl_pci7432.c

@@ -58,26 +58,26 @@ struct adl_pci7432_private {
 
 #define devpriv ((struct adl_pci7432_private *)dev->private)
 
-static int adl_pci7432_attach(struct comedi_device * dev, struct comedi_devconfig * it);
-static int adl_pci7432_detach(struct comedi_device * dev);
+static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig *it);
+static int adl_pci7432_detach(struct comedi_device *dev);
 static struct comedi_driver driver_adl_pci7432 = {
-      driver_name:"adl_pci7432",
-      module:THIS_MODULE,
-      attach:adl_pci7432_attach,
-      detach:adl_pci7432_detach,
+	.driver_name = "adl_pci7432",
+	.module = THIS_MODULE,
+	.attach = adl_pci7432_attach,
+	.detach = adl_pci7432_detach,
 };
 
 /* Digital IO */
 
-static int adl_pci7432_di_insn_bits(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data);
+static int adl_pci7432_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data);
 
-static int adl_pci7432_do_insn_bits(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data);
+static int adl_pci7432_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data);
 
 /*            */
 
-static int adl_pci7432_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct pci_dev *pcidev;
 	struct comedi_subdevice *s;
@@ -150,7 +150,7 @@ static int adl_pci7432_attach(struct comedi_device * dev, struct comedi_devconfi
 	return -EIO;
 }
 
-static int adl_pci7432_detach(struct comedi_device * dev)
+static int adl_pci7432_detach(struct comedi_device *dev)
 {
 	printk("comedi%d: pci7432: remove\n", dev->minor);
 
@@ -164,8 +164,8 @@ static int adl_pci7432_detach(struct comedi_device * dev)
 	return 0;
 }
 
-static int adl_pci7432_do_insn_bits(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int adl_pci7432_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	printk("comedi: pci7432_do_insn_bits called\n");
 	printk("comedi: data0: %8x data1: %8x\n", data[0], data[1]);
@@ -184,8 +184,8 @@ static int adl_pci7432_do_insn_bits(struct comedi_device * dev, struct comedi_su
 	return 2;
 }
 
-static int adl_pci7432_di_insn_bits(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int adl_pci7432_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	printk("comedi: pci7432_di_insn_bits called\n");
 	printk("comedi: data0: %8x data1: %8x\n", data[0], data[1]);

+ 86 - 239
drivers/staging/comedi/drivers/adl_pci8164.c

@@ -70,40 +70,40 @@ struct adl_pci8164_private {
 
 #define devpriv ((struct adl_pci8164_private *)dev->private)
 
-static int adl_pci8164_attach(struct comedi_device * dev, struct comedi_devconfig * it);
-static int adl_pci8164_detach(struct comedi_device * dev);
+static int adl_pci8164_attach(struct comedi_device *dev, struct comedi_devconfig *it);
+static int adl_pci8164_detach(struct comedi_device *dev);
 static struct comedi_driver driver_adl_pci8164 = {
-      driver_name:"adl_pci8164",
-      module:THIS_MODULE,
-      attach:adl_pci8164_attach,
-      detach:adl_pci8164_detach,
+	.driver_name = "adl_pci8164",
+	.module = THIS_MODULE,
+	.attach = adl_pci8164_attach,
+	.detach = adl_pci8164_detach,
 };
 
-static int adl_pci8164_insn_read_msts(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data);
+static int adl_pci8164_insn_read_msts(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data);
 
-static int adl_pci8164_insn_read_ssts(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data);
+static int adl_pci8164_insn_read_ssts(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data);
 
-static int adl_pci8164_insn_read_buf0(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data);
+static int adl_pci8164_insn_read_buf0(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data);
 
-static int adl_pci8164_insn_read_buf1(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data);
+static int adl_pci8164_insn_read_buf1(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data);
 
-static int adl_pci8164_insn_write_cmd(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data);
+static int adl_pci8164_insn_write_cmd(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data);
 
-static int adl_pci8164_insn_write_otp(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data);
+static int adl_pci8164_insn_write_otp(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data);
 
-static int adl_pci8164_insn_write_buf0(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data);
+static int adl_pci8164_insn_write_buf0(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
 
-static int adl_pci8164_insn_write_buf1(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data);
+static int adl_pci8164_insn_write_buf1(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
 
-static int adl_pci8164_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int adl_pci8164_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct pci_dev *pcidev;
 	struct comedi_subdevice *s;
@@ -149,7 +149,7 @@ static int adl_pci8164_attach(struct comedi_device * dev, struct comedi_devconfi
 			s->n_chan = 4;
 			s->maxdata = 0xffff;
 			s->len_chanlist = 4;
-			//s->range_table = &range_axis;
+			/* s->range_table = &range_axis; */
 			s->insn_read = adl_pci8164_insn_read_msts;
 			s->insn_write = adl_pci8164_insn_write_cmd;
 
@@ -159,7 +159,7 @@ static int adl_pci8164_attach(struct comedi_device * dev, struct comedi_devconfi
 			s->n_chan = 4;
 			s->maxdata = 0xffff;
 			s->len_chanlist = 4;
-			//s->range_table = &range_axis;
+			/* s->range_table = &range_axis; */
 			s->insn_read = adl_pci8164_insn_read_ssts;
 			s->insn_write = adl_pci8164_insn_write_otp;
 
@@ -169,7 +169,7 @@ static int adl_pci8164_attach(struct comedi_device * dev, struct comedi_devconfi
 			s->n_chan = 4;
 			s->maxdata = 0xffff;
 			s->len_chanlist = 4;
-			//s->range_table = &range_axis;
+			/* s->range_table = &range_axis; */
 			s->insn_read = adl_pci8164_insn_read_buf0;
 			s->insn_write = adl_pci8164_insn_write_buf0;
 
@@ -179,7 +179,7 @@ static int adl_pci8164_attach(struct comedi_device * dev, struct comedi_devconfi
 			s->n_chan = 4;
 			s->maxdata = 0xffff;
 			s->len_chanlist = 4;
-			//s->range_table = &range_axis;
+			/* s->range_table = &range_axis; */
 			s->insn_read = adl_pci8164_insn_read_buf1;
 			s->insn_write = adl_pci8164_insn_write_buf1;
 
@@ -194,7 +194,7 @@ static int adl_pci8164_attach(struct comedi_device * dev, struct comedi_devconfi
 	return -EIO;
 }
 
-static int adl_pci8164_detach(struct comedi_device * dev)
+static int adl_pci8164_detach(struct comedi_device *dev)
 {
 	printk("comedi%d: pci8164: remove\n", dev->minor);
 
@@ -208,8 +208,16 @@ static int adl_pci8164_detach(struct comedi_device * dev)
 	return 0;
 }
 
-static int adl_pci8164_insn_read_msts(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+/*
+ all the read commands are the same except for the addition a constant
+ * const to the data for inw()
+ */
+static void adl_pci8164_insn_read(struct comedi_device *dev,
+				  struct comedi_subdevice *s,
+				  struct comedi_insn *insn,
+				  unsigned int *data,
+				  char *action,
+				  unsigned short offset)
 {
 	int axis, axis_reg;
 	char *axisname;
@@ -238,127 +246,51 @@ static int adl_pci8164_insn_read_msts(struct comedi_device * dev, struct comedi_
 		axisname = "X";
 	}
 
-	data[0] = inw(dev->iobase + axis_reg + PCI8164_MSTS);
-	printk("comedi: pci8164 MSTS read -> %04X:%04X on axis %s\n", data[0],
+	data[0] = inw(dev->iobase + axis_reg + offset);
+	printk("comedi: pci8164 %s read -> %04X:%04X on axis %s\n", action, data[0],
 		data[1], axisname);
+}
 
+static int adl_pci8164_insn_read_msts(struct comedi_device *dev,
+				      struct comedi_subdevice *s,
+				      struct comedi_insn *insn,
+				      unsigned int *data)
+{
+	adl_pci8164_insn_read(dev, s, insn, data, "MSTS", PCI8164_MSTS);
 	return 2;
 }
 
-static int adl_pci8164_insn_read_ssts(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int adl_pci8164_insn_read_ssts(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	int axis, axis_reg;
-	char *axisname;
-
-	axis = CR_CHAN(insn->chanspec);
-
-	switch (axis) {
-	case 0:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-		break;
-	case 1:
-		axis_reg = PCI8164_AXIS_Y;
-		axisname = "Y";
-		break;
-	case 2:
-		axis_reg = PCI8164_AXIS_Z;
-		axisname = "Z";
-		break;
-	case 3:
-		axis_reg = PCI8164_AXIS_U;
-		axisname = "U";
-		break;
-	default:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-	}
-
-	data[0] = inw(dev->iobase + axis_reg + PCI8164_SSTS);
-	printk("comedi: pci8164 SSTS read -> %04X:%04X on axis %s\n", data[0],
-		data[1], axisname);
-
+	adl_pci8164_insn_read(dev, s, insn, data, "SSTS", PCI8164_SSTS);
 	return 2;
 }
 
-static int adl_pci8164_insn_read_buf0(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int adl_pci8164_insn_read_buf0(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	int axis, axis_reg;
-	char *axisname;
-
-	axis = CR_CHAN(insn->chanspec);
-
-	switch (axis) {
-	case 0:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-		break;
-	case 1:
-		axis_reg = PCI8164_AXIS_Y;
-		axisname = "Y";
-		break;
-	case 2:
-		axis_reg = PCI8164_AXIS_Z;
-		axisname = "Z";
-		break;
-	case 3:
-		axis_reg = PCI8164_AXIS_U;
-		axisname = "U";
-		break;
-	default:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-	}
-
-	data[0] = inw(dev->iobase + axis_reg + PCI8164_BUF0);
-	printk("comedi: pci8164 BUF0 read -> %04X:%04X on axis %s\n", data[0],
-		data[1], axisname);
-
+	adl_pci8164_insn_read(dev, s, insn, data, "BUF0", PCI8164_BUF0);
 	return 2;
 }
 
-static int adl_pci8164_insn_read_buf1(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int adl_pci8164_insn_read_buf1(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	int axis, axis_reg;
-
-	char *axisname;
-
-	axis = CR_CHAN(insn->chanspec);
-
-	switch (axis) {
-	case 0:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-		break;
-	case 1:
-		axis_reg = PCI8164_AXIS_Y;
-		axisname = "Y";
-		break;
-	case 2:
-		axis_reg = PCI8164_AXIS_Z;
-		axisname = "Z";
-		break;
-	case 3:
-		axis_reg = PCI8164_AXIS_U;
-		axisname = "U";
-		break;
-	default:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-	}
-
-	data[0] = inw(dev->iobase + axis_reg + PCI8164_BUF1);
-	printk("comedi: pci8164 BUF1 read -> %04X:%04X on axis %s\n", data[0],
-		data[1], axisname);
-
+	adl_pci8164_insn_read(dev, s, insn, data, "BUF1", PCI8164_BUF1);
 	return 2;
 }
 
-static int adl_pci8164_insn_write_cmd(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+/*
+ all the write commands are the same except for the addition a constant
+ * const to the data for outw()
+ */
+static void adl_pci8164_insn_out(struct comedi_device *dev,
+					struct comedi_subdevice *s,
+					struct comedi_insn *insn,
+					unsigned int *data,
+					char *action,
+					unsigned short offset)
 {
 	unsigned int axis, axis_reg;
 
@@ -388,124 +320,39 @@ static int adl_pci8164_insn_write_cmd(struct comedi_device * dev, struct comedi_
 		axisname = "X";
 	}
 
-	outw(data[0], dev->iobase + axis_reg + PCI8164_CMD);
-	printk("comedi: pci8164 CMD write -> %04X:%04X on axis %s\n", data[0],
-		data[1], axisname);
-
-	return 2;
-}
-
-static int adl_pci8164_insn_write_otp(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
-{
-	int axis, axis_reg;
-
-	char *axisname;
+	outw(data[0], dev->iobase + axis_reg + offset);
 
-	axis = CR_CHAN(insn->chanspec);
+	printk("comedi: pci8164 %s write -> %04X:%04X on axis %s\n", action,
+	       data[0], data[1], axisname);
 
-	switch (axis) {
-	case 0:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-		break;
-	case 1:
-		axis_reg = PCI8164_AXIS_Y;
-		axisname = "Y";
-		break;
-	case 2:
-		axis_reg = PCI8164_AXIS_Z;
-		axisname = "Z";
-		break;
-	case 3:
-		axis_reg = PCI8164_AXIS_U;
-		axisname = "U";
-		break;
-	default:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-	}
+}
 
-	outw(data[0], dev->iobase + axis_reg + PCI8164_OTP);
-	printk("comedi: pci8164 OTP write -> %04X:%04X on axis %s\n", data[0],
-		data[1], axisname);
 
+static int adl_pci8164_insn_write_cmd(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
+{
+	adl_pci8164_insn_out(dev, s, insn, data, "CMD", PCI8164_CMD);
 	return 2;
 }
 
-static int adl_pci8164_insn_write_buf0(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+static int adl_pci8164_insn_write_otp(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
-	int axis, axis_reg;
-
-	char *axisname;
-
-	axis = CR_CHAN(insn->chanspec);
-
-	switch (axis) {
-	case 0:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-		break;
-	case 1:
-		axis_reg = PCI8164_AXIS_Y;
-		axisname = "Y";
-		break;
-	case 2:
-		axis_reg = PCI8164_AXIS_Z;
-		axisname = "Z";
-		break;
-	case 3:
-		axis_reg = PCI8164_AXIS_U;
-		axisname = "U";
-		break;
-	default:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-	}
-
-	outw(data[0], dev->iobase + axis_reg + PCI8164_BUF0);
-	printk("comedi: pci8164 BUF0 write -> %04X:%04X on axis %s\n", data[0],
-		data[1], axisname);
-
+	adl_pci8164_insn_out(dev, s, insn, data, "OTP", PCI8164_OTP);
 	return 2;
 }
 
-static int adl_pci8164_insn_write_buf1(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+static int adl_pci8164_insn_write_buf0(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
-	int axis, axis_reg;
-
-	char *axisname;
-
-	axis = CR_CHAN(insn->chanspec);
-
-	switch (axis) {
-	case 0:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-		break;
-	case 1:
-		axis_reg = PCI8164_AXIS_Y;
-		axisname = "Y";
-		break;
-	case 2:
-		axis_reg = PCI8164_AXIS_Z;
-		axisname = "Z";
-		break;
-	case 3:
-		axis_reg = PCI8164_AXIS_U;
-		axisname = "U";
-		break;
-	default:
-		axis_reg = PCI8164_AXIS_X;
-		axisname = "X";
-	}
-
-	outw(data[0], dev->iobase + axis_reg + PCI8164_BUF1);
-	printk("comedi: pci8164 BUF1 write -> %04X:%04X on axis %s\n", data[0],
-		data[1], axisname);
+	adl_pci8164_insn_out(dev, s, insn, data, "BUF0", PCI8164_BUF0);
+	return 2;
+}
 
+static int adl_pci8164_insn_write_buf1(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
+{
+	adl_pci8164_insn_out(dev, s, insn, data, "BUF1", PCI8164_BUF1);
 	return 2;
 }
 

+ 68 - 67
drivers/staging/comedi/drivers/adl_pci9111.c

@@ -77,6 +77,7 @@ Configuration options:
 #include "../comedidev.h"
 
 #include <linux/delay.h>
+#include <linux/interrupt.h>
 
 #include "8253.h"
 #include "comedi_pci.h"
@@ -186,24 +187,24 @@ Configuration options:
   (inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK)&0x0F)
 
 #define pci9111_trigger_and_autoscan_set(flags) \
-  outb(flags,PCI9111_IO_BASE+PCI9111_REGISTER_TRIGGER_MODE_CONTROL)
+  outb(flags, PCI9111_IO_BASE+PCI9111_REGISTER_TRIGGER_MODE_CONTROL)
 
 #define pci9111_interrupt_and_fifo_get() \
   ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK) >> 4) &0x03)
 
 #define pci9111_interrupt_and_fifo_set(flags) \
-  outb(flags,PCI9111_IO_BASE+PCI9111_REGISTER_INTERRUPT_CONTROL)
+  outb(flags, PCI9111_IO_BASE+PCI9111_REGISTER_INTERRUPT_CONTROL)
 
 #define pci9111_interrupt_clear() \
-  outb(0,PCI9111_IO_BASE+PCI9111_REGISTER_INTERRUPT_CLEAR)
+  outb(0, PCI9111_IO_BASE+PCI9111_REGISTER_INTERRUPT_CLEAR)
 
 #define pci9111_software_trigger() \
-  outb(0,PCI9111_IO_BASE+PCI9111_REGISTER_SOFTWARE_TRIGGER)
+  outb(0, PCI9111_IO_BASE+PCI9111_REGISTER_SOFTWARE_TRIGGER)
 
 #define pci9111_fifo_reset() \
-  outb(PCI9111_FFEN_SET_FIFO_ENABLE,PCI9111_IO_BASE+PCI9111_REGISTER_INTERRUPT_CONTROL); \
-  outb(PCI9111_FFEN_SET_FIFO_DISABLE,PCI9111_IO_BASE+PCI9111_REGISTER_INTERRUPT_CONTROL); \
-  outb(PCI9111_FFEN_SET_FIFO_ENABLE,PCI9111_IO_BASE+PCI9111_REGISTER_INTERRUPT_CONTROL)
+  outb(PCI9111_FFEN_SET_FIFO_ENABLE, PCI9111_IO_BASE+PCI9111_REGISTER_INTERRUPT_CONTROL); \
+  outb(PCI9111_FFEN_SET_FIFO_DISABLE, PCI9111_IO_BASE+PCI9111_REGISTER_INTERRUPT_CONTROL); \
+  outb(PCI9111_FFEN_SET_FIFO_ENABLE, PCI9111_IO_BASE+PCI9111_REGISTER_INTERRUPT_CONTROL)
 
 #define pci9111_is_fifo_full() \
   ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_RANGE_STATUS_READBACK)& \
@@ -218,13 +219,13 @@ Configuration options:
     PCI9111_FIFO_EMPTY_MASK)==0)
 
 #define pci9111_ai_channel_set(channel) \
-  outb((channel)&PCI9111_CHANNEL_MASK,PCI9111_IO_BASE+PCI9111_REGISTER_AD_CHANNEL_CONTROL)
+  outb((channel)&PCI9111_CHANNEL_MASK, PCI9111_IO_BASE+PCI9111_REGISTER_AD_CHANNEL_CONTROL)
 
 #define pci9111_ai_channel_get() \
   inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_CHANNEL_READBACK)&PCI9111_CHANNEL_MASK
 
 #define pci9111_ai_range_set(range) \
-  outb((range)&PCI9111_RANGE_MASK,PCI9111_IO_BASE+PCI9111_REGISTER_INPUT_SIGNAL_RANGE)
+  outb((range)&PCI9111_RANGE_MASK, PCI9111_IO_BASE+PCI9111_REGISTER_INPUT_SIGNAL_RANGE)
 
 #define pci9111_ai_range_get() \
   inb(PCI9111_IO_BASE+PCI9111_REGISTER_RANGE_STATUS_READBACK)&PCI9111_RANGE_MASK
@@ -238,34 +239,34 @@ Configuration options:
   ^ PCI9111_HR_AI_RESOLUTION_2_CMP_BIT
 
 #define pci9111_ao_set_data(data) \
-  outw(data&PCI9111_AO_RESOLUTION_MASK,PCI9111_IO_BASE+PCI9111_REGISTER_DA_OUTPUT)
+  outw(data&PCI9111_AO_RESOLUTION_MASK, PCI9111_IO_BASE+PCI9111_REGISTER_DA_OUTPUT)
 
 #define pci9111_di_get_bits() \
   inw(PCI9111_IO_BASE+PCI9111_REGISTER_DIGITAL_IO)
 
 #define pci9111_do_set_bits(bits) \
-  outw(bits,PCI9111_IO_BASE+PCI9111_REGISTER_DIGITAL_IO)
+  outw(bits, PCI9111_IO_BASE+PCI9111_REGISTER_DIGITAL_IO)
 
 #define pci9111_8254_control_set(flags) \
-  outb(flags,PCI9111_IO_BASE+PCI9111_REGISTER_8254_CONTROL)
+  outb(flags, PCI9111_IO_BASE+PCI9111_REGISTER_8254_CONTROL)
 
 #define pci9111_8254_counter_0_set(data) \
   outb(data & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_0); \
-  outb( (data >> 8) & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_0)
+  outb((data >> 8) & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_0)
 
 #define pci9111_8254_counter_1_set(data) \
   outb(data & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_1); \
-  outb( (data >> 8) & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_1)
+  outb((data >> 8) & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_1)
 
 #define pci9111_8254_counter_2_set(data) \
   outb(data & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_2); \
-  outb( (data >> 8) & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_2)
+  outb((data >> 8) & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_2)
 
 /*  Function prototypes */
 
-static int pci9111_attach(struct comedi_device * dev, struct comedi_devconfig * it);
-static int pci9111_detach(struct comedi_device * dev);
-static void pci9111_ai_munge(struct comedi_device * dev, struct comedi_subdevice * s,
+static int pci9111_attach(struct comedi_device *dev, struct comedi_devconfig *it);
+static int pci9111_detach(struct comedi_device *dev);
+static void pci9111_ai_munge(struct comedi_device *dev, struct comedi_subdevice *s,
 	void *data, unsigned int num_bytes, unsigned int start_chan_index);
 
 static const struct comedi_lrange pci9111_hr_ai_range = {
@@ -308,27 +309,27 @@ struct pci9111_board {
 
 static const struct pci9111_board pci9111_boards[] = {
 	{
-	      name:	"pci9111_hr",
-	      device_id:PCI9111_HR_DEVICE_ID,
-	      ai_channel_nbr:PCI9111_AI_CHANNEL_NBR,
-	      ao_channel_nbr:PCI9111_AO_CHANNEL_NBR,
-	      ai_resolution:PCI9111_HR_AI_RESOLUTION,
-	      ai_resolution_mask:PCI9111_HR_AI_RESOLUTION_MASK,
-	      ao_resolution:PCI9111_AO_RESOLUTION,
-	      ao_resolution_mask:PCI9111_AO_RESOLUTION_MASK,
-	      ai_range_list:&pci9111_hr_ai_range,
-	      ao_range_list:&range_bipolar10,
-      ai_acquisition_period_min_ns:PCI9111_AI_ACQUISITION_PERIOD_MIN_NS}
+	.name = "pci9111_hr",
+	.device_id = PCI9111_HR_DEVICE_ID,
+	.ai_channel_nbr = PCI9111_AI_CHANNEL_NBR,
+	.ao_channel_nbr = PCI9111_AO_CHANNEL_NBR,
+	.ai_resolution = PCI9111_HR_AI_RESOLUTION,
+	.ai_resolution_mask = PCI9111_HR_AI_RESOLUTION_MASK,
+	.ao_resolution = PCI9111_AO_RESOLUTION,
+	.ao_resolution_mask = PCI9111_AO_RESOLUTION_MASK,
+	.ai_range_list = &pci9111_hr_ai_range,
+	.ao_range_list = &range_bipolar10,
+	.ai_acquisition_period_min_ns = PCI9111_AI_ACQUISITION_PERIOD_MIN_NS}
 };
 
 #define pci9111_board_nbr \
   (sizeof(pci9111_boards)/sizeof(struct pci9111_board))
 
 static struct comedi_driver pci9111_driver = {
-      driver_name:PCI9111_DRIVER_NAME,
-      module:THIS_MODULE,
-      attach:pci9111_attach,
-      detach:pci9111_detach,
+	.driver_name = PCI9111_DRIVER_NAME,
+	.module = THIS_MODULE,
+	.attach = pci9111_attach,
+	.detach = pci9111_detach,
 };
 
 COMEDI_PCI_INITCLEANUP(pci9111_driver, pci9111_pci_table);
@@ -405,7 +406,7 @@ static void plx9050_interrupt_control(unsigned long io_base,
 
 /*  8254 timer */
 
-static void pci9111_timer_set(struct comedi_device * dev)
+static void pci9111_timer_set(struct comedi_device *dev)
 {
 	pci9111_8254_control_set(PCI9111_8254_COUNTER_0 |
 		PCI9111_8254_READ_LOAD_LSB_MSB |
@@ -419,7 +420,7 @@ static void pci9111_timer_set(struct comedi_device * dev)
 		PCI9111_8254_READ_LOAD_LSB_MSB |
 		PCI9111_8254_MODE_2 | PCI9111_8254_BINARY_COUNTER);
 
-	comedi_udelay(1);
+	udelay(1);
 
 	pci9111_8254_counter_2_set(dev_private->timer_divisor_2);
 	pci9111_8254_counter_1_set(dev_private->timer_divisor_1);
@@ -431,7 +432,7 @@ enum pci9111_trigger_sources {
 	external
 };
 
-static void pci9111_trigger_source_set(struct comedi_device * dev,
+static void pci9111_trigger_source_set(struct comedi_device *dev,
 	enum pci9111_trigger_sources source)
 {
 	int flags;
@@ -455,7 +456,7 @@ static void pci9111_trigger_source_set(struct comedi_device * dev,
 	pci9111_trigger_and_autoscan_set(flags);
 }
 
-static void pci9111_pretrigger_set(struct comedi_device * dev, bool pretrigger)
+static void pci9111_pretrigger_set(struct comedi_device *dev, bool pretrigger)
 {
 	int flags;
 
@@ -467,7 +468,7 @@ static void pci9111_pretrigger_set(struct comedi_device * dev, bool pretrigger)
 	pci9111_trigger_and_autoscan_set(flags);
 }
 
-static void pci9111_autoscan_set(struct comedi_device * dev, bool autoscan)
+static void pci9111_autoscan_set(struct comedi_device *dev, bool autoscan)
 {
 	int flags;
 
@@ -489,7 +490,7 @@ enum pci9111_ISC1_sources {
 	irq_on_external_trigger
 };
 
-static void pci9111_interrupt_source_set(struct comedi_device * dev,
+static void pci9111_interrupt_source_set(struct comedi_device *dev,
 	enum pci9111_ISC0_sources irq_0_source, enum pci9111_ISC1_sources irq_1_source)
 {
 	int flags;
@@ -513,7 +514,7 @@ static void pci9111_interrupt_source_set(struct comedi_device * dev,
 
 #undef AI_DO_CMD_DEBUG
 
-static int pci9111_ai_cancel(struct comedi_device * dev, struct comedi_subdevice * s)
+static int pci9111_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
 {
 	/*  Disable interrupts */
 
@@ -535,14 +536,14 @@ static int pci9111_ai_cancel(struct comedi_device * dev, struct comedi_subdevice
 
 /*  Test analog input command */
 
-#define pci9111_check_trigger_src(src,flags) \
+#define pci9111_check_trigger_src(src, flags) \
   tmp = src; \
   src &= flags; \
   if (!src || tmp != src) error++
 
 static int
-pci9111_ai_do_cmd_test(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_cmd * cmd)
+pci9111_ai_do_cmd_test(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
 	int tmp;
 	int error = 0;
@@ -740,7 +741,7 @@ pci9111_ai_do_cmd_test(struct comedi_device * dev,
 
 /*  Analog input command */
 
-static int pci9111_ai_do_cmd(struct comedi_device * dev, struct comedi_subdevice * subdevice)
+static int pci9111_ai_do_cmd(struct comedi_device *dev, struct comedi_subdevice *subdevice)
 {
 	struct comedi_cmd *async_cmd = &subdevice->async->cmd;
 
@@ -858,7 +859,7 @@ static int pci9111_ai_do_cmd(struct comedi_device * dev, struct comedi_subdevice
 	return 0;
 }
 
-static void pci9111_ai_munge(struct comedi_device * dev, struct comedi_subdevice * s,
+static void pci9111_ai_munge(struct comedi_device *dev, struct comedi_subdevice *s,
 	void *data, unsigned int num_bytes, unsigned int start_chan_index)
 {
 	unsigned int i, num_samples = num_bytes / sizeof(short);
@@ -884,7 +885,7 @@ static void pci9111_ai_munge(struct comedi_device * dev, struct comedi_subdevice
 
 #undef INTERRUPT_DEBUG
 
-static irqreturn_t pci9111_interrupt(int irq, void *p_device PT_REGS_ARG)
+static irqreturn_t pci9111_interrupt(int irq, void *p_device)
 {
 	struct comedi_device *dev = p_device;
 	struct comedi_subdevice *subdevice = dev->read_subdev;
@@ -900,7 +901,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device PT_REGS_ARG)
 
 	async = subdevice->async;
 
-	comedi_spin_lock_irqsave(&dev->spinlock, irq_flags);
+	spin_lock_irqsave(&dev->spinlock, irq_flags);
 
 	/*  Check if we are source of interrupt */
 	intcsr = inb(dev_private->lcr_io_base +
@@ -918,7 +919,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device PT_REGS_ARG)
 						PLX9050_LINTI2_STATUS))))) {
 		/*  Not the source of the interrupt. */
 		/*  (N.B. not using PLX9050_SOFTWARE_INTERRUPT) */
-		comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags);
+		spin_unlock_irqrestore(&dev->spinlock, irq_flags);
 		return IRQ_NONE;
 	}
 
@@ -927,7 +928,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device PT_REGS_ARG)
 		/*  Interrupt comes from fifo_half-full signal */
 
 		if (pci9111_is_fifo_full()) {
-			comedi_spin_unlock_irqrestore(&dev->spinlock,
+			spin_unlock_irqrestore(&dev->spinlock,
 				irq_flags);
 			comedi_error(dev, PCI9111_DRIVER_NAME " fifo overflow");
 			pci9111_interrupt_clear();
@@ -1027,7 +1028,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device PT_REGS_ARG)
 
 	pci9111_interrupt_clear();
 
-	comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags);
+	spin_unlock_irqrestore(&dev->spinlock, irq_flags);
 
 	comedi_event(dev, subdevice);
 
@@ -1042,8 +1043,8 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device PT_REGS_ARG)
 
 #undef AI_INSN_DEBUG
 
-static int pci9111_ai_insn_read(struct comedi_device * dev,
-	struct comedi_subdevice * subdevice, struct comedi_insn * insn, unsigned int * data)
+static int pci9111_ai_insn_read(struct comedi_device *dev,
+	struct comedi_subdevice *subdevice, struct comedi_insn *insn, unsigned int *data)
 {
 	int resolution =
 		((struct pci9111_board *) dev->board_ptr)->ai_resolution;
@@ -1100,8 +1101,8 @@ static int pci9111_ai_insn_read(struct comedi_device * dev,
 /*  Analog instant output */
 
 static int
-pci9111_ao_insn_write(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+pci9111_ao_insn_write(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 	int i;
 
@@ -1115,8 +1116,8 @@ pci9111_ao_insn_write(struct comedi_device * dev,
 
 /*  Analog output readback */
 
-static int pci9111_ao_insn_read(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+static int pci9111_ao_insn_read(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 	int i;
 
@@ -1133,8 +1134,8 @@ static int pci9111_ao_insn_read(struct comedi_device * dev,
 
 /*  Digital inputs */
 
-static int pci9111_di_insn_bits(struct comedi_device * dev,
-	struct comedi_subdevice * subdevice, struct comedi_insn * insn, unsigned int * data)
+static int pci9111_di_insn_bits(struct comedi_device *dev,
+	struct comedi_subdevice *subdevice, struct comedi_insn *insn, unsigned int *data)
 {
 	unsigned int bits;
 
@@ -1146,8 +1147,8 @@ static int pci9111_di_insn_bits(struct comedi_device * dev,
 
 /*  Digital outputs */
 
-static int pci9111_do_insn_bits(struct comedi_device * dev,
-	struct comedi_subdevice * subdevice, struct comedi_insn * insn, unsigned int * data)
+static int pci9111_do_insn_bits(struct comedi_device *dev,
+	struct comedi_subdevice *subdevice, struct comedi_insn *insn, unsigned int *data)
 {
 	unsigned int bits;
 
@@ -1175,7 +1176,7 @@ static int pci9111_do_insn_bits(struct comedi_device * dev,
 
 /*  Reset device */
 
-static int pci9111_reset(struct comedi_device * dev)
+static int pci9111_reset(struct comedi_device *dev)
 {
 	/*  Set trigger source to software */
 
@@ -1200,7 +1201,7 @@ static int pci9111_reset(struct comedi_device * dev)
 /*       - Register PCI device */
 /*       - Declare device driver capability */
 
-static int pci9111_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int pci9111_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct comedi_subdevice *subdevice;
 	unsigned long io_base, io_range, lcr_io_base, lcr_io_range;
@@ -1297,8 +1298,7 @@ static int pci9111_attach(struct comedi_device * dev, struct comedi_devconfig *
 
 	dev->irq = 0;
 	if (pci_device->irq > 0) {
-		if (comedi_request_irq(pci_device->irq,
-				pci9111_interrupt,
+		if (request_irq(pci_device->irq, pci9111_interrupt,
 				IRQF_SHARED, PCI9111_DRIVER_NAME, dev) != 0) {
 			printk("comedi%d: unable to allocate irq  %u\n",
 				dev->minor, pci_device->irq);
@@ -1309,7 +1309,8 @@ static int pci9111_attach(struct comedi_device * dev, struct comedi_devconfig *
 
 	/*  TODO: Add external multiplexer setup (according to option[2]). */
 
-	if ((error = alloc_subdevices(dev, 4)) < 0)
+	error = alloc_subdevices(dev, 4);
+	if (error < 0)
 		return error;
 
 	subdevice = dev->subdevices + 0;
@@ -1365,7 +1366,7 @@ static int pci9111_attach(struct comedi_device * dev, struct comedi_devconfig *
 
 /*  Detach */
 
-static int pci9111_detach(struct comedi_device * dev)
+static int pci9111_detach(struct comedi_device *dev)
 {
 	/*  Reset device */
 
@@ -1377,7 +1378,7 @@ static int pci9111_detach(struct comedi_device * dev)
 	/*  Release previously allocated irq */
 
 	if (dev->irq != 0) {
-		comedi_free_irq(dev->irq, dev);
+		free_irq(dev->irq, dev);
 	}
 
 	if (dev_private != 0 && dev_private->pci_device != 0) {

+ 326 - 322
drivers/staging/comedi/drivers/adl_pci9118.c

@@ -66,6 +66,7 @@ Configuration options:
 #include "../pci_ids.h"
 
 #include <linux/delay.h>
+#include <linux/interrupt.h>
 
 #include "amcc_s5933.h"
 #include "8253.h"
@@ -79,7 +80,7 @@ Configuration options:
 
 #undef DPRINTK
 #ifdef PCI9118_EXTDEBUG
-#define DPRINTK(fmt, args...) rt_printk(fmt, ## args)
+#define DPRINTK(fmt, args...) printk(fmt, ## args)
 #else
 #define DPRINTK(fmt, args...)
 #endif
@@ -107,7 +108,7 @@ Configuration options:
 #define PCI9118_INTSRC	0x38	/* R:   interrupt reason register */
 #define PCI9118_INTCTRL	0x38	/* W:   interrupt control register */
 
-// bits from A/D control register (PCI9118_ADCNTRL)
+/* bits from A/D control register (PCI9118_ADCNTRL) */
 #define AdControl_UniP	0x80	/* 1=bipolar, 0=unipolar */
 #define AdControl_Diff	0x40	/* 1=differential, 0= single end inputs */
 #define AdControl_SoftG	0x20	/* 1=8254 counter works, 0=counter stops */
@@ -117,7 +118,7 @@ Configuration options:
 #define AdControl_Int	0x02	/* 1=enable INT, 0=disable */
 #define AdControl_Dma	0x01	/* 1=enable DMA, 0=disable */
 
-// bits from A/D function register (PCI9118_ADFUNC)
+/* bits from A/D function register (PCI9118_ADFUNC) */
 #define AdFunction_PDTrg	0x80	/* 1=positive, 0=negative digital trigger (only positive is correct) */
 #define AdFunction_PETrg	0x40	/* 1=positive, 0=negative external trigger (only positive is correct) */
 #define AdFunction_BSSH		0x20	/* 1=with sample&hold, 0=without */
@@ -127,7 +128,7 @@ Configuration options:
 #define AdFunction_AM		0x02	/* 1=about trigger mode, 0=not about trigger */
 #define AdFunction_Start	0x01	/* 1=trigger start, 0=trigger stop */
 
-// bits from A/D status register (PCI9118_ADSTAT)
+/* bits from A/D status register (PCI9118_ADSTAT) */
 #define AdStatus_nFull	0x100	/* 0=FIFO full (fatal), 1=not full */
 #define AdStatus_nHfull	0x080	/* 0=FIFO half full, 1=FIFO not half full */
 #define AdStatus_nEpty	0x040	/* 0=FIFO empty, 1=FIFO not empty */
@@ -138,8 +139,8 @@ Configuration options:
 #define AdStatus_ADOR	0x002	/* 1=A/D overrun (fatal) */
 #define AdStatus_ADrdy	0x001	/* 1=A/D already ready, 0=not ready */
 
-// bits for interrupt reason and control (PCI9118_INTSRC, PCI9118_INTCTRL)
-// 1=interrupt occur, enable source,  0=interrupt not occur, disable source
+/* bits for interrupt reason and control (PCI9118_INTSRC, PCI9118_INTCTRL) */
+/* 1=interrupt occur, enable source,  0=interrupt not occur, disable source */
 #define Int_Timer	0x08	/* timer interrupt */
 #define Int_About	0x04	/* about trigger complete */
 #define Int_Hfull	0x02	/* A/D FIFO hlaf full */
@@ -178,27 +179,27 @@ static const struct comedi_lrange range_pci9118hg = { 8, {
 
 #define PCI9118_BIPOLAR_RANGES	4	/* used for test on mixture of BIP/UNI ranges */
 
-static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig * it);
-static int pci9118_detach(struct comedi_device * dev);
+static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it);
+static int pci9118_detach(struct comedi_device *dev);
 
 struct boardtype {
-	const char *name;	// board name
-	int vendor_id;		// PCI vendor a device ID of card
+	const char *name;	/*  board name */
+	int vendor_id;		/*  PCI vendor a device ID of card */
 	int device_id;
-	int iorange_amcc;	// iorange for own S5933 region
-	int iorange_9118;	// pass thru card region size
-	int n_aichan;		// num of A/D chans
-	int n_aichand;		// num of A/D chans in diff mode
-	int mux_aichan;		// num of A/D chans with external multiplexor
-	int n_aichanlist;	// len of chanlist
-	int n_aochan;		// num of D/A chans
-	int ai_maxdata;		// resolution of A/D
-	int ao_maxdata;		// resolution of D/A
-	const struct comedi_lrange *rangelist_ai;	// rangelist for A/D
-	const struct comedi_lrange *rangelist_ao;	// rangelist for D/A
-	unsigned int ai_ns_min;	// max sample speed of card v ns
-	unsigned int ai_pacer_min;	// minimal pacer value (c1*c2 or c1 in burst)
-	int half_fifo_size;	// size of FIFO/2
+	int iorange_amcc;	/*  iorange for own S5933 region */
+	int iorange_9118;	/*  pass thru card region size */
+	int n_aichan;		/*  num of A/D chans */
+	int n_aichand;		/*  num of A/D chans in diff mode */
+	int mux_aichan;		/*  num of A/D chans with external multiplexor */
+	int n_aichanlist;	/*  len of chanlist */
+	int n_aochan;		/*  num of D/A chans */
+	int ai_maxdata;		/*  resolution of A/D */
+	int ao_maxdata;		/*  resolution of D/A */
+	const struct comedi_lrange *rangelist_ai;	/*  rangelist for A/D */
+	const struct comedi_lrange *rangelist_ao;	/*  rangelist for D/A */
+	unsigned int ai_ns_min;	/*  max sample speed of card v ns */
+	unsigned int ai_pacer_min;	/*  minimal pacer value (c1*c2 or c1 in burst) */
+	int half_fifo_size;	/*  size of FIFO/2 */
 
 };
 
@@ -230,75 +231,75 @@ static const struct boardtype boardtypes[] = {
 #define n_boardtypes (sizeof(boardtypes)/sizeof(struct boardtype))
 
 static struct comedi_driver driver_pci9118 = {
-      driver_name:"adl_pci9118",
-      module:THIS_MODULE,
-      attach:pci9118_attach,
-      detach:pci9118_detach,
-      num_names:n_boardtypes,
-      board_name:&boardtypes[0].name,
-      offset:sizeof(struct boardtype),
+	.driver_name = "adl_pci9118",
+	.module = THIS_MODULE,
+	.attach = pci9118_attach,
+	.detach = pci9118_detach,
+	.num_names = n_boardtypes,
+	.board_name = &boardtypes[0].name,
+	.offset = sizeof(struct boardtype),
 };
 
 COMEDI_PCI_INITCLEANUP(driver_pci9118, pci9118_pci_table);
 
 struct pci9118_private {
-	unsigned long iobase_a;	// base+size for AMCC chip
-	unsigned int master;	// master capable
-	struct pci_dev *pcidev;	// ptr to actual pcidev
-	unsigned int usemux;	// we want to use external multiplexor!
+	unsigned long iobase_a;	/*  base+size for AMCC chip */
+	unsigned int master;	/*  master capable */
+	struct pci_dev *pcidev;	/*  ptr to actual pcidev */
+	unsigned int usemux;	/*  we want to use external multiplexor! */
 #ifdef PCI9118_PARANOIDCHECK
-	unsigned short chanlist[PCI9118_CHANLEN + 1];	// list of scaned channel
-	unsigned char chanlistlen;	// number of scanlist
+	unsigned short chanlist[PCI9118_CHANLEN + 1];	/*  list of scaned channel */
+	unsigned char chanlistlen;	/*  number of scanlist */
 #endif
-	unsigned char AdControlReg;	// A/D control register
-	unsigned char IntControlReg;	// Interrupt control register
-	unsigned char AdFunctionReg;	// A/D function register
-	char valid;		// driver is ok
-	char ai_neverending;	// we do unlimited AI
-	unsigned int i8254_osc_base;	// frequence of onboard oscilator
-	unsigned int ai_do;	// what do AI? 0=nothing, 1 to 4 mode
-	unsigned int ai_act_scan;	// how many scans we finished
-	unsigned int ai_buf_ptr;	// data buffer ptr in samples
-	unsigned int ai_n_chan;	// how many channels is measured
-	unsigned int ai_n_scanlen;	// len of actual scanlist
-	unsigned int ai_n_realscanlen;	// what we must transfer for one outgoing scan include front/back adds
-	unsigned int ai_act_dmapos;	// position in actual real stream
-	unsigned int ai_add_front;	// how many channels we must add before scan to satisfy S&H?
-	unsigned int ai_add_back;	// how many channels we must add before scan to satisfy DMA?
-	unsigned int *ai_chanlist;	// actaul chanlist
+	unsigned char AdControlReg;	/*  A/D control register */
+	unsigned char IntControlReg;	/*  Interrupt control register */
+	unsigned char AdFunctionReg;	/*  A/D function register */
+	char valid;		/*  driver is ok */
+	char ai_neverending;	/*  we do unlimited AI */
+	unsigned int i8254_osc_base;	/*  frequence of onboard oscilator */
+	unsigned int ai_do;	/*  what do AI? 0=nothing, 1 to 4 mode */
+	unsigned int ai_act_scan;	/*  how many scans we finished */
+	unsigned int ai_buf_ptr;	/*  data buffer ptr in samples */
+	unsigned int ai_n_chan;	/*  how many channels is measured */
+	unsigned int ai_n_scanlen;	/*  len of actual scanlist */
+	unsigned int ai_n_realscanlen;	/*  what we must transfer for one outgoing scan include front/back adds */
+	unsigned int ai_act_dmapos;	/*  position in actual real stream */
+	unsigned int ai_add_front;	/*  how many channels we must add before scan to satisfy S&H? */
+	unsigned int ai_add_back;	/*  how many channels we must add before scan to satisfy DMA? */
+	unsigned int *ai_chanlist;	/*  actaul chanlist */
 	unsigned int ai_timer1;
 	unsigned int ai_timer2;
 	unsigned int ai_flags;
-	char ai12_startstop;	// measure can start/stop on external trigger
-	unsigned int ai_divisor1, ai_divisor2;	// divisors for start of measure on external start
+	char ai12_startstop;	/*  measure can start/stop on external trigger */
+	unsigned int ai_divisor1, ai_divisor2;	/*  divisors for start of measure on external start */
 	unsigned int ai_data_len;
 	short *ai_data;
-	short ao_data[2];	// data output buffer
-	unsigned int ai_scans;	// number of scans to do
-	char dma_doublebuf;	// we can use double buffring
-	unsigned int dma_actbuf;	// which buffer is used now
-	short *dmabuf_virt[2];	// pointers to begin of DMA buffer
-	unsigned long dmabuf_hw[2];	// hw address of DMA buff
-	unsigned int dmabuf_size[2];	// size of dma buffer in bytes
-	unsigned int dmabuf_use_size[2];	// which size we may now used for transfer
-	unsigned int dmabuf_used_size[2];	// which size was trully used
+	short ao_data[2];	/*  data output buffer */
+	unsigned int ai_scans;	/*  number of scans to do */
+	char dma_doublebuf;	/*  we can use double buffring */
+	unsigned int dma_actbuf;	/*  which buffer is used now */
+	short *dmabuf_virt[2];	/*  pointers to begin of DMA buffer */
+	unsigned long dmabuf_hw[2];	/*  hw address of DMA buff */
+	unsigned int dmabuf_size[2];	/*  size of dma buffer in bytes */
+	unsigned int dmabuf_use_size[2];	/*  which size we may now used for transfer */
+	unsigned int dmabuf_used_size[2];	/*  which size was trully used */
 	unsigned int dmabuf_panic_size[2];
-	unsigned int dmabuf_samples[2];	// size in samples
-	int dmabuf_pages[2];	// number of pages in buffer
-	unsigned char cnt0_users;	// bit field of 8254 CNT0 users (0-unused, 1-AO, 2-DI, 3-DO)
-	unsigned char exttrg_users;	// bit field of external trigger users (0-AI, 1-AO, 2-DI, 3-DO)
-	unsigned int cnt0_divisor;	// actual CNT0 divisor
-	void (*int_ai_func) (struct comedi_device *, struct comedi_subdevice *, unsigned short, unsigned int, unsigned short);	// ptr to actual interrupt AI function
-	unsigned char ai16bits;	// =1 16 bit card
-	unsigned char usedma;	// =1 use DMA transfer and not INT
-	unsigned char useeoshandle;	// =1 change WAKE_EOS DMA transfer to fit on every second
-	unsigned char usessh;	// =1 turn on S&H support
-	int softsshdelay;	// >0 use software S&H, numer is requested delay in ns
-	unsigned char softsshsample;	// polarity of S&H signal in sample state
-	unsigned char softsshhold;	// polarity of S&H signal in hold state
-	unsigned int ai_maskerr;	// which warning was printed
-	unsigned int ai_maskharderr;	// on which error bits stops
-	unsigned int ai_inttrig_start;	// TRIG_INT for start
+	unsigned int dmabuf_samples[2];	/*  size in samples */
+	int dmabuf_pages[2];	/*  number of pages in buffer */
+	unsigned char cnt0_users;	/*  bit field of 8254 CNT0 users (0-unused, 1-AO, 2-DI, 3-DO) */
+	unsigned char exttrg_users;	/*  bit field of external trigger users (0-AI, 1-AO, 2-DI, 3-DO) */
+	unsigned int cnt0_divisor;	/*  actual CNT0 divisor */
+	void (*int_ai_func) (struct comedi_device *, struct comedi_subdevice *, unsigned short, unsigned int, unsigned short);	/*  ptr to actual interrupt AI function */
+	unsigned char ai16bits;	/*  =1 16 bit card */
+	unsigned char usedma;	/*  =1 use DMA transfer and not INT */
+	unsigned char useeoshandle;	/*  =1 change WAKE_EOS DMA transfer to fit on every second */
+	unsigned char usessh;	/*  =1 turn on S&H support */
+	int softsshdelay;	/*  >0 use software S&H, numer is requested delay in ns */
+	unsigned char softsshsample;	/*  polarity of S&H signal in sample state */
+	unsigned char softsshhold;	/*  polarity of S&H signal in hold state */
+	unsigned int ai_maskerr;	/*  which warning was printed */
+	unsigned int ai_maskharderr;	/*  on which error bits stops */
+	unsigned int ai_inttrig_start;	/*  TRIG_INT for start */
 };
 
 #define devpriv ((struct pci9118_private *)dev->private)
@@ -308,53 +309,53 @@ struct pci9118_private {
 ==============================================================================
 */
 
-static int check_channel_list(struct comedi_device * dev, struct comedi_subdevice * s,
+static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s,
 	int n_chan, unsigned int *chanlist, int frontadd, int backadd);
-static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevice * s,
+static int setup_channel_list(struct comedi_device *dev, struct comedi_subdevice *s,
 	int n_chan, unsigned int *chanlist, int rot, int frontadd, int backadd,
 	int usedma, char eoshandle);
-static void start_pacer(struct comedi_device * dev, int mode, unsigned int divisor1,
+static void start_pacer(struct comedi_device *dev, int mode, unsigned int divisor1,
 	unsigned int divisor2);
-static int pci9118_reset(struct comedi_device * dev);
-static int pci9118_exttrg_add(struct comedi_device * dev, unsigned char source);
-static int pci9118_exttrg_del(struct comedi_device * dev, unsigned char source);
-static int pci9118_ai_cancel(struct comedi_device * dev, struct comedi_subdevice * s);
-static void pci9118_calc_divisors(char mode, struct comedi_device * dev,
-	struct comedi_subdevice * s, unsigned int *tim1, unsigned int *tim2,
+static int pci9118_reset(struct comedi_device *dev);
+static int pci9118_exttrg_add(struct comedi_device *dev, unsigned char source);
+static int pci9118_exttrg_del(struct comedi_device *dev, unsigned char source);
+static int pci9118_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s);
+static void pci9118_calc_divisors(char mode, struct comedi_device *dev,
+	struct comedi_subdevice *s, unsigned int *tim1, unsigned int *tim2,
 	unsigned int flags, int chans, unsigned int *div1, unsigned int *div2,
 	char usessh, unsigned int chnsshfront);
 
 /*
 ==============================================================================
 */
-static int pci9118_insn_read_ai(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci9118_insn_read_ai(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 
 	int n, timeout;
 
 	devpriv->AdControlReg = AdControl_Int & 0xff;
 	devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg;
-	outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);	// positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop
+	outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);	/*  positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */
 
 	if (!setup_channel_list(dev, s, 1, &insn->chanspec, 0, 0, 0, 0, 0))
 		return -EINVAL;
 
-	outl(0, dev->iobase + PCI9118_DELFIFO);	// flush FIFO
+	outl(0, dev->iobase + PCI9118_DELFIFO);	/*  flush FIFO */
 
 	for (n = 0; n < insn->n; n++) {
 		outw(0, dev->iobase + PCI9118_SOFTTRG);	/* start conversion */
-		comedi_udelay(2);
+		udelay(2);
 		timeout = 100;
 		while (timeout--) {
 			if (inl(dev->iobase + PCI9118_ADSTAT) & AdStatus_ADrdy)
 				goto conv_finish;
-			comedi_udelay(1);
+			udelay(1);
 		}
 
 		comedi_error(dev, "A/D insn timeout");
 		data[n] = 0;
-		outl(0, dev->iobase + PCI9118_DELFIFO);	// flush FIFO
+		outl(0, dev->iobase + PCI9118_DELFIFO);	/*  flush FIFO */
 		return -ETIME;
 
 	      conv_finish:
@@ -369,7 +370,7 @@ static int pci9118_insn_read_ai(struct comedi_device * dev, struct comedi_subdev
 		}
 	}
 
-	outl(0, dev->iobase + PCI9118_DELFIFO);	// flush FIFO
+	outl(0, dev->iobase + PCI9118_DELFIFO);	/*  flush FIFO */
 	return n;
 
 }
@@ -377,8 +378,8 @@ static int pci9118_insn_read_ai(struct comedi_device * dev, struct comedi_subdev
 /*
 ==============================================================================
 */
-static int pci9118_insn_write_ao(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci9118_insn_write_ao(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int n, chanreg, ch;
 
@@ -400,8 +401,8 @@ static int pci9118_insn_write_ao(struct comedi_device * dev, struct comedi_subde
 /*
 ==============================================================================
 */
-static int pci9118_insn_read_ao(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci9118_insn_read_ao(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int n, chan;
 
@@ -415,8 +416,8 @@ static int pci9118_insn_read_ao(struct comedi_device * dev, struct comedi_subdev
 /*
 ==============================================================================
 */
-static int pci9118_insn_bits_di(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci9118_insn_bits_di(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	data[1] = inl(dev->iobase + PCI9118_DI) & 0xf;
 
@@ -426,8 +427,8 @@ static int pci9118_insn_bits_di(struct comedi_device * dev, struct comedi_subdev
 /*
 ==============================================================================
 */
-static int pci9118_insn_bits_do(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci9118_insn_bits_do(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	if (data[0]) {
 		s->state &= ~data[0];
@@ -442,7 +443,7 @@ static int pci9118_insn_bits_do(struct comedi_device * dev, struct comedi_subdev
 /*
 ==============================================================================
 */
-static void interrupt_pci9118_ai_mode4_switch(struct comedi_device * dev)
+static void interrupt_pci9118_ai_mode4_switch(struct comedi_device *dev)
 {
 	devpriv->AdFunctionReg =
 		AdFunction_PDTrg | AdFunction_PETrg | AdFunction_AM;
@@ -456,8 +457,8 @@ static void interrupt_pci9118_ai_mode4_switch(struct comedi_device * dev)
 	outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);
 }
 
-static unsigned int defragment_dma_buffer(struct comedi_device * dev,
-	struct comedi_subdevice * s, short * dma_buffer, unsigned int num_samples)
+static unsigned int defragment_dma_buffer(struct comedi_device *dev,
+	struct comedi_subdevice *s, short *dma_buffer, unsigned int num_samples)
 {
 	unsigned int i = 0, j = 0;
 	unsigned int start_pos = devpriv->ai_add_front,
@@ -480,8 +481,8 @@ static unsigned int defragment_dma_buffer(struct comedi_device * dev,
 /*
 ==============================================================================
 */
-static unsigned int move_block_from_dma(struct comedi_device * dev,
-	struct comedi_subdevice * s, short * dma_buffer, unsigned int num_samples)
+static unsigned int move_block_from_dma(struct comedi_device *dev,
+	struct comedi_subdevice *s, short *dma_buffer, unsigned int num_samples)
 {
 	unsigned int num_bytes;
 
@@ -501,8 +502,8 @@ static unsigned int move_block_from_dma(struct comedi_device * dev,
 /*
 ==============================================================================
 */
-static char pci9118_decode_error_status(struct comedi_device * dev,
-	struct comedi_subdevice * s, unsigned char m)
+static char pci9118_decode_error_status(struct comedi_device *dev,
+	struct comedi_subdevice *s, unsigned char m)
 {
 	if (m & 0x100) {
 		comedi_error(dev, "A/D FIFO Full status (Fatal Error!)");
@@ -531,7 +532,7 @@ static char pci9118_decode_error_status(struct comedi_device * dev,
 	return 0;
 }
 
-static void pci9118_ai_munge(struct comedi_device * dev, struct comedi_subdevice * s,
+static void pci9118_ai_munge(struct comedi_device *dev, struct comedi_subdevice *s,
 	void *data, unsigned int num_bytes, unsigned int start_chan_index)
 {
 	unsigned int i, num_samples = num_bytes / sizeof(short);
@@ -551,8 +552,8 @@ static void pci9118_ai_munge(struct comedi_device * dev, struct comedi_subdevice
 /*
 ==============================================================================
 */
-static void interrupt_pci9118_ai_onesample(struct comedi_device * dev,
-	struct comedi_subdevice * s, unsigned short int_adstat, unsigned int int_amcc,
+static void interrupt_pci9118_ai_onesample(struct comedi_device *dev,
+	struct comedi_subdevice *s, unsigned short int_adstat, unsigned int int_amcc,
 	unsigned short int_daq)
 {
 	register short sampl;
@@ -567,8 +568,8 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device * dev,
 
 #ifdef PCI9118_PARANOIDCHECK
 	if (devpriv->ai16bits == 0) {
-		if ((sampl & 0x000f) != devpriv->chanlist[s->async->cur_chan]) {	// data dropout!
-			rt_printk
+		if ((sampl & 0x000f) != devpriv->chanlist[s->async->cur_chan]) {	/*  data dropout! */
+			printk
 				("comedi: A/D  SAMPL - data dropout: received channel %d, expected %d!\n",
 				sampl & 0x000f,
 				devpriv->chanlist[s->async->cur_chan]);
@@ -598,7 +599,7 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device * dev,
 /*
 ==============================================================================
 */
-static void interrupt_pci9118_ai_dma(struct comedi_device * dev, struct comedi_subdevice * s,
+static void interrupt_pci9118_ai_dma(struct comedi_device *dev, struct comedi_subdevice *s,
 	unsigned short int_adstat, unsigned int int_amcc,
 	unsigned short int_daq)
 {
@@ -621,14 +622,14 @@ static void interrupt_pci9118_ai_dma(struct comedi_device * dev, struct comedi_s
 	}
 
 	if (int_adstat & devpriv->ai_maskerr)
-//      if (int_adstat & 0x106)
+/* if (int_adstat & 0x106) */
 		if (pci9118_decode_error_status(dev, s, int_adstat))
 			return;
 
-	samplesinbuf = devpriv->dmabuf_use_size[devpriv->dma_actbuf] >> 1;	// number of received real samples
-//      DPRINTK("dma_actbuf=%d\n",devpriv->dma_actbuf);
+	samplesinbuf = devpriv->dmabuf_use_size[devpriv->dma_actbuf] >> 1;	/*  number of received real samples */
+/* DPRINTK("dma_actbuf=%d\n",devpriv->dma_actbuf); */
 
-	if (devpriv->dma_doublebuf) {	// switch DMA buffers if is used double buffering
+	if (devpriv->dma_doublebuf) {	/*  switch DMA buffers if is used double buffering */
 		next_dma_buf = 1 - devpriv->dma_actbuf;
 		outl(devpriv->dmabuf_hw[next_dma_buf],
 			devpriv->iobase_a + AMCC_OP_REG_MWAR);
@@ -641,15 +642,15 @@ static void interrupt_pci9118_ai_dma(struct comedi_device * dev, struct comedi_s
 	}
 
 	if (samplesinbuf) {
-		m = devpriv->ai_data_len >> 1;	// how many samples is to end of buffer
-//              DPRINTK("samps=%d m=%d %d %d\n",samplesinbuf,m,s->async->buf_int_count,s->async->buf_int_ptr);
+		m = devpriv->ai_data_len >> 1;	/*  how many samples is to end of buffer */
+/* DPRINTK("samps=%d m=%d %d %d\n",samplesinbuf,m,s->async->buf_int_count,s->async->buf_int_ptr); */
 		sampls = m;
 		move_block_from_dma(dev, s,
 			devpriv->dmabuf_virt[devpriv->dma_actbuf],
 			samplesinbuf);
-		m = m - sampls;	// m= how many samples was transfered
+		m = m - sampls;	/*  m= how many samples was transfered */
 	}
-//      DPRINTK("YYY\n");
+/* DPRINTK("YYY\n"); */
 
 	if (!devpriv->ai_neverending)
 		if (devpriv->ai_act_scan >= devpriv->ai_scans) {	/* all data sampled */
@@ -657,9 +658,9 @@ static void interrupt_pci9118_ai_dma(struct comedi_device * dev, struct comedi_s
 			s->async->events |= COMEDI_CB_EOA;
 		}
 
-	if (devpriv->dma_doublebuf) {	// switch dma buffers
+	if (devpriv->dma_doublebuf) {	/*  switch dma buffers */
 		devpriv->dma_actbuf = 1 - devpriv->dma_actbuf;
-	} else {		// restart DMA if is not used double buffering
+	} else {		/*  restart DMA if is not used double buffering */
 		outl(devpriv->dmabuf_hw[0],
 			devpriv->iobase_a + AMCC_OP_REG_MWAR);
 		outl(devpriv->dmabuf_use_size[0],
@@ -674,36 +675,36 @@ static void interrupt_pci9118_ai_dma(struct comedi_device * dev, struct comedi_s
 /*
 ==============================================================================
 */
-static irqreturn_t interrupt_pci9118(int irq, void *d PT_REGS_ARG)
+static irqreturn_t interrupt_pci9118(int irq, void *d)
 {
 	struct comedi_device *dev = d;
 	unsigned int int_daq = 0, int_amcc, int_adstat;
 
 	if (!dev->attached)
-		return IRQ_NONE;	// not fully initialized
+		return IRQ_NONE;	/*  not fully initialized */
 
-	int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf;	// get IRQ reasons from card
-	int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR);	// get INT register from AMCC chip
+	int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf;	/*  get IRQ reasons from card */
+	int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR);	/*  get INT register from AMCC chip */
 
-//      DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n", int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR), inl(devpriv->iobase_a+AMCC_OP_REG_MWTC), inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do);
+/* DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n", int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR), inl(devpriv->iobase_a+AMCC_OP_REG_MWTC), inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do); */
 
 	if ((!int_daq) && (!(int_amcc & ANY_S593X_INT)))
-		return IRQ_NONE;	// interrupt from other source
+		return IRQ_NONE;	/*  interrupt from other source */
 
-	outl(int_amcc | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR);	// shutdown IRQ reasons in AMCC
+	outl(int_amcc | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR);	/*  shutdown IRQ reasons in AMCC */
 
-	int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff;	// get STATUS register
+	int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff;	/*  get STATUS register */
 
 	if (devpriv->ai_do) {
 		if (devpriv->ai12_startstop)
-			if ((int_adstat & AdStatus_DTH) && (int_daq & Int_DTrg)) {	// start stop of measure
+			if ((int_adstat & AdStatus_DTH) && (int_daq & Int_DTrg)) {	/*  start stop of measure */
 				if (devpriv->ai12_startstop & START_AI_EXT) {
 					devpriv->ai12_startstop &=
 						~START_AI_EXT;
 					if (!(devpriv->ai12_startstop &
 							STOP_AI_EXT))
-						pci9118_exttrg_del(dev, EXTTRG_AI);	// deactivate EXT trigger
-					start_pacer(dev, devpriv->ai_do, devpriv->ai_divisor1, devpriv->ai_divisor2);	// start pacer
+						pci9118_exttrg_del(dev, EXTTRG_AI);	/*  deactivate EXT trigger */
+					start_pacer(dev, devpriv->ai_do, devpriv->ai_divisor1, devpriv->ai_divisor2);	/*  start pacer */
 					outl(devpriv->AdControlReg,
 						dev->iobase + PCI9118_ADCNTRL);
 				} else {
@@ -711,8 +712,8 @@ static irqreturn_t interrupt_pci9118(int irq, void *d PT_REGS_ARG)
 						ai12_startstop & STOP_AI_EXT) {
 						devpriv->ai12_startstop &=
 							~STOP_AI_EXT;
-						pci9118_exttrg_del(dev, EXTTRG_AI);	// deactivate EXT trigger
-						devpriv->ai_neverending = 0;	//well, on next interrupt from DMA/EOC measure will stop
+						pci9118_exttrg_del(dev, EXTTRG_AI);	/*  deactivate EXT trigger */
+						devpriv->ai_neverending = 0;	/* well, on next interrupt from DMA/EOC measure will stop */
 					}
 				}
 			}
@@ -727,7 +728,7 @@ static irqreturn_t interrupt_pci9118(int irq, void *d PT_REGS_ARG)
 /*
 ==============================================================================
 */
-static int pci9118_ai_inttrig(struct comedi_device * dev, struct comedi_subdevice * s,
+static int pci9118_ai_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
 	unsigned int trignum)
 {
 	if (trignum != devpriv->ai_inttrig_start)
@@ -751,8 +752,8 @@ static int pci9118_ai_inttrig(struct comedi_device * dev, struct comedi_subdevic
 /*
 ==============================================================================
 */
-static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_cmd * cmd)
+static int pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_cmd *cmd)
 {
 	int err = 0;
 	int tmp, divisor1, divisor2;
@@ -949,11 +950,11 @@ static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic
 
 	if (cmd->scan_begin_src == TRIG_TIMER) {
 		tmp = cmd->scan_begin_arg;
-//              rt_printk("S1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg);
+/* printk("S1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */
 		i8253_cascade_ns_to_timer(devpriv->i8254_osc_base, &divisor1,
 			&divisor2, &cmd->scan_begin_arg,
 			cmd->flags & TRIG_ROUND_MASK);
-//              rt_printk("S2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg);
+/* printk("S2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */
 		if (cmd->scan_begin_arg < this_board->ai_ns_min)
 			cmd->scan_begin_arg = this_board->ai_ns_min;
 		if (tmp != cmd->scan_begin_arg)
@@ -965,7 +966,7 @@ static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic
 		i8253_cascade_ns_to_timer(devpriv->i8254_osc_base, &divisor1,
 			&divisor2, &cmd->convert_arg,
 			cmd->flags & TRIG_ROUND_MASK);
-//              rt_printk("s1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg);
+/* printk("s1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */
 		if (cmd->convert_arg < this_board->ai_ns_min)
 			cmd->convert_arg = this_board->ai_ns_min;
 		if (tmp != cmd->convert_arg)
@@ -979,7 +980,7 @@ static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic
 					cmd->scan_begin_arg =
 						this_board->ai_ns_min *
 						(cmd->scan_end_arg + 2);
-//              rt_printk("s2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg);
+/* printk("s2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */
 					err++;
 				}
 			} else {
@@ -988,7 +989,7 @@ static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic
 					cmd->scan_begin_arg =
 						cmd->convert_arg *
 						cmd->chanlist_len;
-//              rt_printk("s3 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg);
+/* printk("s3 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */
 					err++;
 				}
 			}
@@ -1001,7 +1002,7 @@ static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic
 	if (cmd->chanlist)
 		if (!check_channel_list(dev, s, cmd->chanlist_len,
 				cmd->chanlist, 0, 0))
-			return 5;	// incorrect channels list
+			return 5;	/*  incorrect channels list */
 
 	return 0;
 }
@@ -1009,7 +1010,7 @@ static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic
 /*
 ==============================================================================
 */
-static int Compute_and_setup_dma(struct comedi_device * dev)
+static int Compute_and_setup_dma(struct comedi_device *dev)
 {
 	unsigned int dmalen0, dmalen1, i;
 
@@ -1018,32 +1019,32 @@ static int Compute_and_setup_dma(struct comedi_device * dev)
 	dmalen1 = devpriv->dmabuf_size[1];
 	DPRINTK("1 dmalen0=%d dmalen1=%d ai_data_len=%d\n", dmalen0, dmalen1,
 		devpriv->ai_data_len);
-	// isn't output buff smaller that our DMA buff?
+	/*  isn't output buff smaller that our DMA buff? */
 	if (dmalen0 > (devpriv->ai_data_len)) {
-		dmalen0 = devpriv->ai_data_len & ~3L;	// allign to 32bit down
+		dmalen0 = devpriv->ai_data_len & ~3L;	/*  allign to 32bit down */
 	}
 	if (dmalen1 > (devpriv->ai_data_len)) {
-		dmalen1 = devpriv->ai_data_len & ~3L;	// allign to 32bit down
+		dmalen1 = devpriv->ai_data_len & ~3L;	/*  allign to 32bit down */
 	}
 	DPRINTK("2 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1);
 
-	// we want wake up every scan?
+	/*  we want wake up every scan? */
 	if (devpriv->ai_flags & TRIG_WAKE_EOS) {
 		if (dmalen0 < (devpriv->ai_n_realscanlen << 1)) {
-			// uff, too short DMA buffer, disable EOS support!
+			/*  uff, too short DMA buffer, disable EOS support! */
 			devpriv->ai_flags &= (~TRIG_WAKE_EOS);
-			rt_printk
+			printk
 				("comedi%d: WAR: DMA0 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n",
 				dev->minor, dmalen0,
 				devpriv->ai_n_realscanlen << 1);
 		} else {
-			// short first DMA buffer to one scan
+			/*  short first DMA buffer to one scan */
 			dmalen0 = devpriv->ai_n_realscanlen << 1;
 			DPRINTK("21 dmalen0=%d ai_n_realscanlen=%d useeoshandle=%d\n", dmalen0, devpriv->ai_n_realscanlen, devpriv->useeoshandle);
 			if (devpriv->useeoshandle)
 				dmalen0 += 2;
 			if (dmalen0 < 4) {
-				rt_printk
+				printk
 					("comedi%d: ERR: DMA0 buf len bug? (%d<4)\n",
 					dev->minor, dmalen0);
 				dmalen0 = 4;
@@ -1052,20 +1053,20 @@ static int Compute_and_setup_dma(struct comedi_device * dev)
 	}
 	if (devpriv->ai_flags & TRIG_WAKE_EOS) {
 		if (dmalen1 < (devpriv->ai_n_realscanlen << 1)) {
-			// uff, too short DMA buffer, disable EOS support!
+			/*  uff, too short DMA buffer, disable EOS support! */
 			devpriv->ai_flags &= (~TRIG_WAKE_EOS);
-			rt_printk
+			printk
 				("comedi%d: WAR: DMA1 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n",
 				dev->minor, dmalen1,
 				devpriv->ai_n_realscanlen << 1);
 		} else {
-			// short second DMA buffer to one scan
+			/*  short second DMA buffer to one scan */
 			dmalen1 = devpriv->ai_n_realscanlen << 1;
 			DPRINTK("22 dmalen1=%d ai_n_realscanlen=%d useeoshandle=%d\n", dmalen1, devpriv->ai_n_realscanlen, devpriv->useeoshandle);
 			if (devpriv->useeoshandle)
 				dmalen1 -= 2;
 			if (dmalen1 < 4) {
-				rt_printk
+				printk
 					("comedi%d: ERR: DMA1 buf len bug? (%d<4)\n",
 					dev->minor, dmalen1);
 				dmalen1 = 4;
@@ -1074,26 +1075,26 @@ static int Compute_and_setup_dma(struct comedi_device * dev)
 	}
 
 	DPRINTK("3 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1);
-	// transfer without TRIG_WAKE_EOS
+	/*  transfer without TRIG_WAKE_EOS */
 	if (!(devpriv->ai_flags & TRIG_WAKE_EOS)) {
-		// if it's possible then allign DMA buffers to length of scan
+		/*  if it's possible then allign DMA buffers to length of scan */
 		i = dmalen0;
 		dmalen0 =
 			(dmalen0 / (devpriv->ai_n_realscanlen << 1)) *
 			(devpriv->ai_n_realscanlen << 1);
 		dmalen0 &= ~3L;
 		if (!dmalen0)
-			dmalen0 = i;	// uff. very long scan?
+			dmalen0 = i;	/*  uff. very long scan? */
 		i = dmalen1;
 		dmalen1 =
 			(dmalen1 / (devpriv->ai_n_realscanlen << 1)) *
 			(devpriv->ai_n_realscanlen << 1);
 		dmalen1 &= ~3L;
 		if (!dmalen1)
-			dmalen1 = i;	// uff. very long scan?
-		// if measure isn't neverending then test, if it whole fits into one or two DMA buffers
+			dmalen1 = i;	/*  uff. very long scan? */
+		/*  if measure isn't neverending then test, if it whole fits into one or two DMA buffers */
 		if (!devpriv->ai_neverending) {
-			// fits whole measure into one DMA buffer?
+			/*  fits whole measure into one DMA buffer? */
 			if (dmalen0 >
 				((devpriv->ai_n_realscanlen << 1) *
 					devpriv->ai_scans)) {
@@ -1104,7 +1105,7 @@ static int Compute_and_setup_dma(struct comedi_device * dev)
 				DPRINTK("3.1 dmalen0=%d dmalen1=%d \n", dmalen0,
 					dmalen1);
 				dmalen0 &= ~3L;
-			} else {	// fits whole measure into two DMA buffer?
+			} else {	/*  fits whole measure into two DMA buffer? */
 				if (dmalen1 >
 					((devpriv->ai_n_realscanlen << 1) *
 						devpriv->ai_scans - dmalen0))
@@ -1121,7 +1122,7 @@ static int Compute_and_setup_dma(struct comedi_device * dev)
 
 	DPRINTK("4 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1);
 
-	// these DMA buffer size we'll be used
+	/*  these DMA buffer size we'll be used */
 	devpriv->dma_actbuf = 0;
 	devpriv->dmabuf_use_size[0] = dmalen0;
 	devpriv->dmabuf_use_size[1] = dmalen1;
@@ -1143,18 +1144,18 @@ static int Compute_and_setup_dma(struct comedi_device * dev)
 	}
 #endif
 
-	outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR);	// stop DMA
+	outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR);	/*  stop DMA */
 	outl(devpriv->dmabuf_hw[0], devpriv->iobase_a + AMCC_OP_REG_MWAR);
 	outl(devpriv->dmabuf_use_size[0], devpriv->iobase_a + AMCC_OP_REG_MWTC);
-	// init DMA transfer
+	/*  init DMA transfer */
 	outl(0x00000000 | AINT_WRITE_COMPL,
 		devpriv->iobase_a + AMCC_OP_REG_INTCSR);
-//      outl(0x02000000|AINT_WRITE_COMPL, devpriv->iobase_a+AMCC_OP_REG_INTCSR);
+/* outl(0x02000000|AINT_WRITE_COMPL, devpriv->iobase_a+AMCC_OP_REG_INTCSR); */
 
 	outl(inl(devpriv->iobase_a +
 			AMCC_OP_REG_MCSR) | RESET_A2P_FLAGS | A2P_HI_PRIORITY |
 		EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_MCSR);
-	outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_INTCSR);	// allow bus mastering
+	outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_INTCSR);	/*  allow bus mastering */
 
 	DPRINTK("adl_pci9118 EDBG: END: Compute_and_setup_dma()\n");
 	return 0;
@@ -1163,7 +1164,7 @@ static int Compute_and_setup_dma(struct comedi_device * dev)
 /*
 ==============================================================================
 */
-static int pci9118_ai_docmd_sampl(struct comedi_device * dev, struct comedi_subdevice * s)
+static int pci9118_ai_docmd_sampl(struct comedi_device *dev, struct comedi_subdevice *s)
 {
 	DPRINTK("adl_pci9118 EDBG: BGN: pci9118_ai_docmd_sampl(%d,) [%d]\n",
 		dev->minor, devpriv->ai_do);
@@ -1186,17 +1187,17 @@ static int pci9118_ai_docmd_sampl(struct comedi_device * dev, struct comedi_subd
 		return -EIO;
 	};
 
-	devpriv->int_ai_func = interrupt_pci9118_ai_onesample;	//transfer function
+	devpriv->int_ai_func = interrupt_pci9118_ai_onesample;	/* transfer function */
 
 	if (devpriv->ai12_startstop)
-		pci9118_exttrg_add(dev, EXTTRG_AI);	// activate EXT trigger
+		pci9118_exttrg_add(dev, EXTTRG_AI);	/*  activate EXT trigger */
 
 	if ((devpriv->ai_do == 1) || (devpriv->ai_do == 2))
 		devpriv->IntControlReg |= Int_Timer;
 
 	devpriv->AdControlReg |= AdControl_Int;
 
-	outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR);	// allow INT in AMCC
+	outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR);	/*  allow INT in AMCC */
 
 	if (!(devpriv->ai12_startstop & (START_AI_EXT | START_AI_INT))) {
 		outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);
@@ -1216,7 +1217,7 @@ static int pci9118_ai_docmd_sampl(struct comedi_device * dev, struct comedi_subd
 /*
 ==============================================================================
 */
-static int pci9118_ai_docmd_dma(struct comedi_device * dev, struct comedi_subdevice * s)
+static int pci9118_ai_docmd_dma(struct comedi_device *dev, struct comedi_subdevice *s)
 {
 	DPRINTK("adl_pci9118 EDBG: BGN: pci9118_ai_docmd_dma(%d,) [%d,%d]\n",
 		dev->minor, devpriv->ai_do, devpriv->usedma);
@@ -1261,10 +1262,10 @@ static int pci9118_ai_docmd_dma(struct comedi_device * dev, struct comedi_subdev
 	};
 
 	if (devpriv->ai12_startstop) {
-		pci9118_exttrg_add(dev, EXTTRG_AI);	// activate EXT trigger
+		pci9118_exttrg_add(dev, EXTTRG_AI);	/*  activate EXT trigger */
 	}
 
-	devpriv->int_ai_func = interrupt_pci9118_ai_dma;	//transfer function
+	devpriv->int_ai_func = interrupt_pci9118_ai_dma;	/* transfer function */
 
 	outl(0x02000000 | AINT_WRITE_COMPL,
 		devpriv->iobase_a + AMCC_OP_REG_INTCSR);
@@ -1287,7 +1288,7 @@ static int pci9118_ai_docmd_dma(struct comedi_device * dev, struct comedi_subdev
 /*
 ==============================================================================
 */
-static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s)
+static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 {
 	struct comedi_cmd *cmd = &s->async->cmd;
 	unsigned int addchans = 0;
@@ -1307,7 +1308,7 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
 	devpriv->ai_add_back = 0;
 	devpriv->ai_maskerr = 0x10e;
 
-	// prepare for start/stop conditions
+	/*  prepare for start/stop conditions */
 	if (cmd->start_src == TRIG_EXT)
 		devpriv->ai12_startstop |= START_AI_EXT;
 	if (cmd->stop_src == TRIG_EXT) {
@@ -1334,19 +1335,19 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
 		devpriv->ai_scans = 0;
 	}
 
-	// use sample&hold signal?
+	/*  use sample&hold signal? */
 	if (cmd->convert_src == TRIG_NOW) {
 		devpriv->usessh = 1;
-	}			// yes
+	}			/*  yes */
 	else {
 		devpriv->usessh = 0;
-	}			// no
+	}			/*  no */
 
 	DPRINTK("1 neverending=%d scans=%u usessh=%d ai_startstop=0x%2x\n",
 		devpriv->ai_neverending, devpriv->ai_scans, devpriv->usessh,
 		devpriv->ai12_startstop);
 
-	// use additional sample at end of every scan to satisty DMA 32 bit transfer?
+	/*  use additional sample at end of every scan to satisty DMA 32 bit transfer? */
 	devpriv->ai_add_front = 0;
 	devpriv->ai_add_back = 0;
 	devpriv->useeoshandle = 0;
@@ -1358,27 +1359,27 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
 				devpriv->ai_add_back = 1;
 			}
 			if (cmd->convert_src == TRIG_TIMER) {
-				devpriv->usedma = 0;	// use INT transfer if scanlist have only one channel
+				devpriv->usedma = 0;	/*  use INT transfer if scanlist have only one channel */
 			}
 		}
 		if ((cmd->flags & TRIG_WAKE_EOS) &&
 			(devpriv->ai_n_scanlen & 1) &&
 			(devpriv->ai_n_scanlen > 1)) {
 			if (cmd->scan_begin_src == TRIG_FOLLOW) {
-				//vpriv->useeoshandle=1; // change DMA transfer block to fit EOS on every second call
-				devpriv->usedma = 0;	// XXX maybe can be corrected to use 16 bit DMA
-			} else {	// well, we must insert one sample to end of EOS to meet 32 bit transfer
+				/* vpriv->useeoshandle=1; // change DMA transfer block to fit EOS on every second call */
+				devpriv->usedma = 0;	/*  XXX maybe can be corrected to use 16 bit DMA */
+			} else {	/*  well, we must insert one sample to end of EOS to meet 32 bit transfer */
 				devpriv->ai_add_back = 1;
 			}
 		}
-	} else {		// interrupt transfer don't need any correction
+	} else {		/*  interrupt transfer don't need any correction */
 		devpriv->usedma = 0;
 	}
 
-	// we need software S&H signal? It add  two samples before every scan as minimum
+	/*  we need software S&H signal? It add  two samples before every scan as minimum */
 	if (devpriv->usessh && devpriv->softsshdelay) {
 		devpriv->ai_add_front = 2;
-		if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) {	// move it to front
+		if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) {	/*  move it to front */
 			devpriv->ai_add_front++;
 			devpriv->ai_add_back = 0;
 		}
@@ -1387,17 +1388,17 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
 		addchans = devpriv->softsshdelay / cmd->convert_arg;
 		if (devpriv->softsshdelay % cmd->convert_arg)
 			addchans++;
-		if (addchans > (devpriv->ai_add_front - 1)) {	// uff, still short :-(
+		if (addchans > (devpriv->ai_add_front - 1)) {	/*  uff, still short :-( */
 			devpriv->ai_add_front = addchans + 1;
 			if (devpriv->usedma == 1)
 				if ((devpriv->ai_add_front +
 						devpriv->ai_n_chan +
 						devpriv->ai_add_back) & 1)
-					devpriv->ai_add_front++;	// round up to 32 bit
+					devpriv->ai_add_front++;	/*  round up to 32 bit */
 		}
-	}			// well, we now know what must be all added
+	}			/*  well, we now know what must be all added */
 
-	devpriv->ai_n_realscanlen =	// what we must take from card in real to have ai_n_scanlen on output?
+	devpriv->ai_n_realscanlen =	/*  what we must take from card in real to have ai_n_scanlen on output? */
 		(devpriv->ai_add_front + devpriv->ai_n_chan +
 		devpriv->ai_add_back) * (devpriv->ai_n_scanlen /
 		devpriv->ai_n_chan);
@@ -1408,7 +1409,7 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
 		devpriv->ai_n_chan, devpriv->ai_add_back,
 		devpriv->ai_n_scanlen);
 
-	// check and setup channel list
+	/*  check and setup channel list */
 	if (!check_channel_list(dev, s, devpriv->ai_n_chan,
 			devpriv->ai_chanlist, devpriv->ai_add_front,
 			devpriv->ai_add_back))
@@ -1419,9 +1420,9 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
 			devpriv->useeoshandle))
 		return -EINVAL;
 
-	// compute timers settings
-	// simplest way, fr=4Mhz/(tim1*tim2), channel manipulation without timers effect
-	if (((cmd->scan_begin_src == TRIG_FOLLOW) || (cmd->scan_begin_src == TRIG_EXT) || (cmd->scan_begin_src == TRIG_INT)) && (cmd->convert_src == TRIG_TIMER)) {	// both timer is used for one time
+	/*  compute timers settings */
+	/*  simplest way, fr=4Mhz/(tim1*tim2), channel manipulation without timers effect */
+	if (((cmd->scan_begin_src == TRIG_FOLLOW) || (cmd->scan_begin_src == TRIG_EXT) || (cmd->scan_begin_src == TRIG_INT)) && (cmd->convert_src == TRIG_TIMER)) {	/*  both timer is used for one time */
 		if (cmd->scan_begin_src == TRIG_EXT) {
 			devpriv->ai_do = 4;
 		} else {
@@ -1435,7 +1436,7 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
 		devpriv->ai_timer2 = cmd->convert_arg;
 	}
 
-	if ((cmd->scan_begin_src == TRIG_TIMER) && ((cmd->convert_src == TRIG_TIMER) || (cmd->convert_src == TRIG_NOW))) {	// double timed action
+	if ((cmd->scan_begin_src == TRIG_TIMER) && ((cmd->convert_src == TRIG_TIMER) || (cmd->convert_src == TRIG_NOW))) {	/*  double timed action */
 		if (!devpriv->usedma) {
 			comedi_error(dev,
 				"cmd->scan_begin_src=TRIG_TIMER works only with bus mastering!");
@@ -1457,15 +1458,15 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
 		devpriv->ai_do = 3;
 	}
 
-	start_pacer(dev, -1, 0, 0);	// stop pacer
+	start_pacer(dev, -1, 0, 0);	/*  stop pacer */
 
-	devpriv->AdControlReg = 0;	// bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable DMA
+	devpriv->AdControlReg = 0;	/*  bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable DMA */
 	outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);
-	devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg;	// positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop
+	devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg;	/*  positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */
 	outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);
-	comedi_udelay(1);
-	outl(0, dev->iobase + PCI9118_DELFIFO);	// flush FIFO
-	inl(dev->iobase + PCI9118_ADSTAT);	// flush A/D and INT status register
+	udelay(1);
+	outl(0, dev->iobase + PCI9118_DELFIFO);	/*  flush FIFO */
+	inl(dev->iobase + PCI9118_ADSTAT);	/*  flush A/D and INT status register */
 	inl(dev->iobase + PCI9118_INTSRC);
 
 	devpriv->ai_act_scan = 0;
@@ -1473,11 +1474,10 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
 	s->async->cur_chan = 0;
 	devpriv->ai_buf_ptr = 0;
 
-	if (devpriv->usedma) {
+	if (devpriv->usedma)
 		ret = pci9118_ai_docmd_dma(dev, s);
-	} else {
+	else
 		ret = pci9118_ai_docmd_sampl(dev, s);
-	}
 
 	DPRINTK("adl_pci9118 EDBG: END: pci9118_ai_cmd()\n");
 	return ret;
@@ -1486,7 +1486,7 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
 /*
 ==============================================================================
 */
-static int check_channel_list(struct comedi_device * dev, struct comedi_subdevice * s,
+static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s,
 	int n_chan, unsigned int *chanlist, int frontadd, int backadd)
 {
 	unsigned int i, differencial = 0, bipolar = 0;
@@ -1497,7 +1497,7 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic
 		return 0;
 	}
 	if ((frontadd + n_chan + backadd) > s->len_chanlist) {
-		rt_printk
+		printk
 			("comedi%d: range/channel list is too long for actual configuration (%d>%d)!",
 			dev->minor, n_chan,
 			s->len_chanlist - frontadd - backadd);
@@ -1505,11 +1505,11 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic
 	}
 
 	if (CR_AREF(chanlist[0]) == AREF_DIFF)
-		differencial = 1;	// all input must be diff
+		differencial = 1;	/*  all input must be diff */
 	if (CR_RANGE(chanlist[0]) < PCI9118_BIPOLAR_RANGES)
-		bipolar = 1;	// all input must be bipolar
+		bipolar = 1;	/*  all input must be bipolar */
 	if (n_chan > 1)
-		for (i = 1; i < n_chan; i++) {	// check S.E/diff
+		for (i = 1; i < n_chan; i++) {	/*  check S.E/diff */
 			if ((CR_AREF(chanlist[i]) == AREF_DIFF) !=
 				(differencial)) {
 				comedi_error(dev,
@@ -1537,7 +1537,7 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic
 /*
 ==============================================================================
 */
-static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevice * s,
+static int setup_channel_list(struct comedi_device *dev, struct comedi_subdevice *s,
 	int n_chan, unsigned int *chanlist, int rot, int frontadd, int backadd,
 	int usedma, char useeos)
 {
@@ -1552,27 +1552,27 @@ static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevic
 	}
 
 	if (CR_AREF(chanlist[0]) == AREF_DIFF)
-		differencial = 1;	// all input must be diff
+		differencial = 1;	/*  all input must be diff */
 	if (CR_RANGE(chanlist[0]) < PCI9118_BIPOLAR_RANGES)
-		bipolar = 1;	// all input must be bipolar
+		bipolar = 1;	/*  all input must be bipolar */
 
-	// All is ok, so we can setup channel/range list
+	/*  All is ok, so we can setup channel/range list */
 
 	if (!bipolar) {
-		devpriv->AdControlReg |= AdControl_UniP;	// set unibipolar
+		devpriv->AdControlReg |= AdControl_UniP;	/*  set unibipolar */
 	} else {
-		devpriv->AdControlReg &= ((~AdControl_UniP) & 0xff);	// enable bipolar
+		devpriv->AdControlReg &= ((~AdControl_UniP) & 0xff);	/*  enable bipolar */
 	}
 
 	if (differencial) {
-		devpriv->AdControlReg |= AdControl_Diff;	// enable diff inputs
+		devpriv->AdControlReg |= AdControl_Diff;	/*  enable diff inputs */
 	} else {
-		devpriv->AdControlReg &= ((~AdControl_Diff) & 0xff);	// set single ended inputs
+		devpriv->AdControlReg &= ((~AdControl_Diff) & 0xff);	/*  set single ended inputs */
 	}
 
-	outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);	// setup mode
+	outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);	/*  setup mode */
 
-	outl(2, dev->iobase + PCI9118_SCANMOD);	// gods know why this sequence!
+	outl(2, dev->iobase + PCI9118_SCANMOD);	/*  gods know why this sequence! */
 	outl(0, dev->iobase + PCI9118_SCANMOD);
 	outl(1, dev->iobase + PCI9118_SCANMOD);
 
@@ -1582,12 +1582,12 @@ static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevic
 		devpriv->chanlist[i] = 0x55aa;
 #endif
 
-	if (frontadd) {		// insert channels for S&H
+	if (frontadd) {		/*  insert channels for S&H */
 		ssh = devpriv->softsshsample;
 		DPRINTK("FA: %04x: ", ssh);
-		for (i = 0; i < frontadd; i++) {	// store range list to card
-			scanquad = CR_CHAN(chanlist[0]);	// get channel number;
-			gain = CR_RANGE(chanlist[0]);	// get gain number
+		for (i = 0; i < frontadd; i++) {	/*  store range list to card */
+			scanquad = CR_CHAN(chanlist[0]);	/*  get channel number; */
+			gain = CR_RANGE(chanlist[0]);	/*  get gain number */
 			scanquad |= ((gain & 0x03) << 8);
 			outl(scanquad | ssh, dev->iobase + PCI9118_GAIN);
 			DPRINTK("%02x ", scanquad | ssh);
@@ -1597,23 +1597,23 @@ static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevic
 	}
 
 	DPRINTK("SL: ", ssh);
-	for (i = 0; i < n_chan; i++) {	// store range list to card
-		scanquad = CR_CHAN(chanlist[i]);	// get channel number;
+	for (i = 0; i < n_chan; i++) {	/*  store range list to card */
+		scanquad = CR_CHAN(chanlist[i]);	/*  get channel number; */
 #ifdef PCI9118_PARANOIDCHECK
 		devpriv->chanlist[i ^ usedma] = (scanquad & 0xf) << rot;
 #endif
-		gain = CR_RANGE(chanlist[i]);	// get gain number
+		gain = CR_RANGE(chanlist[i]);	/*  get gain number */
 		scanquad |= ((gain & 0x03) << 8);
 		outl(scanquad | ssh, dev->iobase + PCI9118_GAIN);
 		DPRINTK("%02x ", scanquad | ssh);
 	}
 	DPRINTK("\n ");
 
-	if (backadd) {		// insert channels for fit onto 32bit DMA
+	if (backadd) {		/*  insert channels for fit onto 32bit DMA */
 		DPRINTK("BA: %04x: ", ssh);
-		for (i = 0; i < backadd; i++) {	// store range list to card
-			scanquad = CR_CHAN(chanlist[0]);	// get channel number;
-			gain = CR_RANGE(chanlist[0]);	// get gain number
+		for (i = 0; i < backadd; i++) {	/*  store range list to card */
+			scanquad = CR_CHAN(chanlist[0]);	/*  get channel number; */
+			gain = CR_RANGE(chanlist[0]);	/*  get gain number */
 			scanquad |= ((gain & 0x03) << 8);
 			outl(scanquad | ssh, dev->iobase + PCI9118_GAIN);
 			DPRINTK("%02x ", scanquad | ssh);
@@ -1621,13 +1621,13 @@ static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevic
 		DPRINTK("\n ");
 	}
 #ifdef PCI9118_PARANOIDCHECK
-	devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma];	// for 32bit oerations
+	devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma];	/*  for 32bit oerations */
 	if (useeos) {
-		for (i = 1; i < n_chan; i++) {	// store range list to card
+		for (i = 1; i < n_chan; i++) {	/*  store range list to card */
 			devpriv->chanlist[(n_chan + i) ^ usedma] =
 				(CR_CHAN(chanlist[i]) & 0xf) << rot;
 		}
-		devpriv->chanlist[(2 * n_chan) ^ usedma] = devpriv->chanlist[0 ^ usedma];	// for 32bit oerations
+		devpriv->chanlist[(2 * n_chan) ^ usedma] = devpriv->chanlist[0 ^ usedma];	/*  for 32bit oerations */
 		useeos = 2;
 	} else {
 		useeos = 1;
@@ -1640,19 +1640,19 @@ static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevic
 	DPRINTK("\n ");
 #endif
 #endif
-	outl(0, dev->iobase + PCI9118_SCANMOD);	// close scan queue
-//      comedi_udelay(100);                             // important delay, or first sample will be cripled
+	outl(0, dev->iobase + PCI9118_SCANMOD);	/*  close scan queue */
+/* udelay(100);                               important delay, or first sample will be cripled */
 
 	DPRINTK("adl_pci9118 EDBG: END: setup_channel_list()\n");
-	return 1;		// we can serve this with scan logic
+	return 1;		/*  we can serve this with scan logic */
 }
 
 /*
 ==============================================================================
   calculate 8254 divisors if they are used for dual timing
 */
-static void pci9118_calc_divisors(char mode, struct comedi_device * dev,
-	struct comedi_subdevice * s, unsigned int *tim1, unsigned int *tim2,
+static void pci9118_calc_divisors(char mode, struct comedi_device *dev,
+	struct comedi_subdevice *s, unsigned int *tim1, unsigned int *tim2,
 	unsigned int flags, int chans, unsigned int *div1, unsigned int *div2,
 	char usessh, unsigned int chnsshfront)
 {
@@ -1672,17 +1672,17 @@ static void pci9118_calc_divisors(char mode, struct comedi_device * dev,
 			*tim2 = this_board->ai_ns_min;
 		DPRINTK("1 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2,
 			*tim1, *tim2);
-		*div1 = *tim2 / devpriv->i8254_osc_base;	// convert timer (burst)
+		*div1 = *tim2 / devpriv->i8254_osc_base;	/*  convert timer (burst) */
 		DPRINTK("2 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2,
 			*tim1, *tim2);
 		if (*div1 < this_board->ai_pacer_min)
 			*div1 = this_board->ai_pacer_min;
 		DPRINTK("3 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2,
 			*tim1, *tim2);
-		*div2 = *tim1 / devpriv->i8254_osc_base;	// scan timer
+		*div2 = *tim1 / devpriv->i8254_osc_base;	/*  scan timer */
 		DPRINTK("4 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2,
 			*tim1, *tim2);
-		*div2 = *div2 / *div1;	// major timer is c1*c2
+		*div2 = *div2 / *div1;	/*  major timer is c1*c2 */
 		DPRINTK("5 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2,
 			*tim1, *tim2);
 		if (*div2 < chans)
@@ -1690,9 +1690,9 @@ static void pci9118_calc_divisors(char mode, struct comedi_device * dev,
 		DPRINTK("6 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2,
 			*tim1, *tim2);
 
-		*tim2 = *div1 * devpriv->i8254_osc_base;	// real convert timer
+		*tim2 = *div1 * devpriv->i8254_osc_base;	/*  real convert timer */
 
-		if (usessh & (chnsshfront == 0))	// use BSSH signal
+		if (usessh & (chnsshfront == 0))	/*  use BSSH signal */
 			if (*div2 < (chans + 2))
 				*div2 = chans + 2;
 
@@ -1710,13 +1710,13 @@ static void pci9118_calc_divisors(char mode, struct comedi_device * dev,
 /*
 ==============================================================================
 */
-static void start_pacer(struct comedi_device * dev, int mode, unsigned int divisor1,
+static void start_pacer(struct comedi_device *dev, int mode, unsigned int divisor1,
 	unsigned int divisor2)
 {
 	outl(0x74, dev->iobase + PCI9118_CNTCTRL);
 	outl(0xb4, dev->iobase + PCI9118_CNTCTRL);
-//      outl(0x30, dev->iobase + PCI9118_CNTCTRL);
-	comedi_udelay(1);
+/* outl(0x30, dev->iobase + PCI9118_CNTCTRL); */
+	udelay(1);
 
 	if ((mode == 1) || (mode == 2) || (mode == 4)) {
 		outl(divisor2 & 0xff, dev->iobase + PCI9118_CNT2);
@@ -1729,29 +1729,29 @@ static void start_pacer(struct comedi_device * dev, int mode, unsigned int divis
 /*
 ==============================================================================
 */
-static int pci9118_exttrg_add(struct comedi_device * dev, unsigned char source)
+static int pci9118_exttrg_add(struct comedi_device *dev, unsigned char source)
 {
 	if (source > 3)
-		return -1;	// incorrect source
+		return -1;	/*  incorrect source */
 	devpriv->exttrg_users |= (1 << source);
 	devpriv->IntControlReg |= Int_DTrg;
 	outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);
-	outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR);	// allow INT in AMCC
+	outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR);	/*  allow INT in AMCC */
 	return 0;
 }
 
 /*
 ==============================================================================
 */
-static int pci9118_exttrg_del(struct comedi_device * dev, unsigned char source)
+static int pci9118_exttrg_del(struct comedi_device *dev, unsigned char source)
 {
 	if (source > 3)
-		return -1;	// incorrect source
+		return -1;	/*  incorrect source */
 	devpriv->exttrg_users &= ~(1 << source);
-	if (!devpriv->exttrg_users) {	// shutdown ext trg intterrupts
+	if (!devpriv->exttrg_users) {	/*  shutdown ext trg intterrupts */
 		devpriv->IntControlReg &= ~Int_DTrg;
-		if (!devpriv->IntControlReg)	// all IRQ disabled
-			outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) & (~0x00001f00), devpriv->iobase_a + AMCC_OP_REG_INTCSR);	// disable int in AMCC
+		if (!devpriv->IntControlReg)	/*  all IRQ disabled */
+			outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) & (~0x00001f00), devpriv->iobase_a + AMCC_OP_REG_INTCSR);	/*  disable int in AMCC */
 		outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);
 	}
 	return 0;
@@ -1760,20 +1760,20 @@ static int pci9118_exttrg_del(struct comedi_device * dev, unsigned char source)
 /*
 ==============================================================================
 */
-static int pci9118_ai_cancel(struct comedi_device * dev, struct comedi_subdevice * s)
+static int pci9118_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
 {
 	if (devpriv->usedma)
-		outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR);	// stop DMA
+		outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR);	/*  stop DMA */
 	pci9118_exttrg_del(dev, EXTTRG_AI);
-	start_pacer(dev, 0, 0, 0);	// stop 8254 counters
+	start_pacer(dev, 0, 0, 0);	/*  stop 8254 counters */
 	devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg;
-	outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);	// positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop
+	outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);	/*  positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */
 	devpriv->AdControlReg = 0x00;
-	outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);	// bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA
+	outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);	/*  bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */
 	outl(0, dev->iobase + PCI9118_BURST);
 	outl(1, dev->iobase + PCI9118_SCANMOD);
-	outl(2, dev->iobase + PCI9118_SCANMOD);	// reset scan queue
-	outl(0, dev->iobase + PCI9118_DELFIFO);	// flush FIFO
+	outl(2, dev->iobase + PCI9118_SCANMOD);	/*  reset scan queue */
+	outl(0, dev->iobase + PCI9118_DELFIFO);	/*  flush FIFO */
 
 	devpriv->ai_do = 0;
 	devpriv->usedma = 0;
@@ -1787,7 +1787,7 @@ static int pci9118_ai_cancel(struct comedi_device * dev, struct comedi_subdevice
 	devpriv->dma_actbuf = 0;
 
 	if (!devpriv->IntControlReg)
-		outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR);	// allow INT in AMCC
+		outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR);	/*  allow INT in AMCC */
 
 	return 0;
 }
@@ -1795,36 +1795,36 @@ static int pci9118_ai_cancel(struct comedi_device * dev, struct comedi_subdevice
 /*
 ==============================================================================
 */
-static int pci9118_reset(struct comedi_device * dev)
+static int pci9118_reset(struct comedi_device *dev)
 {
 	devpriv->IntControlReg = 0;
 	devpriv->exttrg_users = 0;
 	inl(dev->iobase + PCI9118_INTCTRL);
-	outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);	// disable interrupts source
+	outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);	/*  disable interrupts source */
 	outl(0x30, dev->iobase + PCI9118_CNTCTRL);
-//        outl(0xb4, dev->iobase + PCI9118_CNTCTRL);
-	start_pacer(dev, 0, 0, 0);	// stop 8254 counters
+/* outl(0xb4, dev->iobase + PCI9118_CNTCTRL); */
+	start_pacer(dev, 0, 0, 0);	/*  stop 8254 counters */
 	devpriv->AdControlReg = 0;
-	outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);	// bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA
+	outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);	/*  bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */
 	outl(0, dev->iobase + PCI9118_BURST);
 	outl(1, dev->iobase + PCI9118_SCANMOD);
-	outl(2, dev->iobase + PCI9118_SCANMOD);	// reset scan queue
+	outl(2, dev->iobase + PCI9118_SCANMOD);	/*  reset scan queue */
 	devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg;
-	outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);	// positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop
+	outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);	/*  positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */
 
 	devpriv->ao_data[0] = 2047;
 	devpriv->ao_data[1] = 2047;
-	outl(devpriv->ao_data[0], dev->iobase + PCI9118_DA1);	// reset A/D outs to 0V
+	outl(devpriv->ao_data[0], dev->iobase + PCI9118_DA1);	/*  reset A/D outs to 0V */
 	outl(devpriv->ao_data[1], dev->iobase + PCI9118_DA2);
-	outl(0, dev->iobase + PCI9118_DO);	// reset digi outs to L
-	comedi_udelay(10);
+	outl(0, dev->iobase + PCI9118_DO);	/*  reset digi outs to L */
+	udelay(10);
 	inl(dev->iobase + PCI9118_AD_DATA);
-	outl(0, dev->iobase + PCI9118_DELFIFO);	// flush FIFO
-	outl(0, dev->iobase + PCI9118_INTSRC);	// remove INT requests
-	inl(dev->iobase + PCI9118_ADSTAT);	// flush A/D status register
-	inl(dev->iobase + PCI9118_INTSRC);	// flush INT requests
+	outl(0, dev->iobase + PCI9118_DELFIFO);	/*  flush FIFO */
+	outl(0, dev->iobase + PCI9118_INTSRC);	/*  remove INT requests */
+	inl(dev->iobase + PCI9118_ADSTAT);	/*  flush A/D status register */
+	inl(dev->iobase + PCI9118_INTSRC);	/*  flush INT requests */
 	devpriv->AdControlReg = 0;
-	outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);	// bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA
+	outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);	/*  bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */
 
 	devpriv->cnt0_users = 0;
 	devpriv->exttrg_users = 0;
@@ -1835,7 +1835,7 @@ static int pci9118_reset(struct comedi_device * dev)
 /*
 ==============================================================================
 */
-static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct comedi_subdevice *s;
 	int ret, pages, i;
@@ -1848,19 +1848,20 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig *
 	unsigned char pci_bus, pci_slot, pci_func;
 	u16 u16w;
 
-	rt_printk("comedi%d: adl_pci9118: board=%s", dev->minor,
+	printk("comedi%d: adl_pci9118: board=%s", dev->minor,
 		this_board->name);
 
 	opt_bus = it->options[0];
 	opt_slot = it->options[1];
 	if (it->options[3] & 1) {
-		master = 0;	// user don't want use bus master
+		master = 0;	/*  user don't want use bus master */
 	} else {
 		master = 1;
 	}
 
-	if ((ret = alloc_private(dev, sizeof(struct pci9118_private))) < 0) {
-		rt_printk(" - Allocation failed!\n");
+	ret = alloc_private(dev, sizeof(struct pci9118_private));
+	if (ret < 0) {
+		printk(" - Allocation failed!\n");
 		return -ENOMEM;
 	}
 
@@ -1889,10 +1890,10 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig *
 
 	if (!pcidev) {
 		if (opt_bus || opt_slot) {
-			rt_printk(" - Card at b:s %d:%d %s\n",
+			printk(" - Card at b:s %d:%d %s\n",
 				opt_bus, opt_slot, errstr);
 		} else {
-			rt_printk(" - Card %s\n", errstr);
+			printk(" - Card %s\n", errstr);
 		}
 		return -EIO;
 	}
@@ -1908,7 +1909,7 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig *
 	iobase_a = pci_resource_start(pcidev, 0);
 	iobase_9 = pci_resource_start(pcidev, 2);
 
-	rt_printk(", b:s:f=%d:%d:%d, io=0x%4lx, 0x%4lx", pci_bus, pci_slot,
+	printk(", b:s:f=%d:%d:%d, io=0x%4lx, 0x%4lx", pci_bus, pci_slot,
 		pci_func, iobase_9, iobase_a);
 
 	dev->iobase = iobase_9;
@@ -1920,30 +1921,32 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig *
 	pci9118_reset(dev);
 
 	if (it->options[3] & 2)
-		irq = 0;	// user don't want use IRQ
+		irq = 0;	/*  user don't want use IRQ */
 	if (irq > 0) {
-		if (comedi_request_irq(irq, interrupt_pci9118, IRQF_SHARED,
+		if (request_irq(irq, interrupt_pci9118, IRQF_SHARED,
 				"ADLink PCI-9118", dev)) {
-			rt_printk(", unable to allocate IRQ %d, DISABLING IT",
+			printk(", unable to allocate IRQ %d, DISABLING IT",
 				irq);
 			irq = 0;	/* Can't use IRQ */
 		} else {
-			rt_printk(", irq=%u", irq);
+			printk(", irq=%u", irq);
 		}
 	} else {
-		rt_printk(", IRQ disabled");
+		printk(", IRQ disabled");
 	}
 
 	dev->irq = irq;
 
-	if (master) {		// alloc DMA buffers
+	if (master) {		/*  alloc DMA buffers */
 		devpriv->dma_doublebuf = 0;
 		for (i = 0; i < 2; i++) {
-			for (pages = 4; pages >= 0; pages--)
-				if ((devpriv->dmabuf_virt[i] = (short *)
-						__get_free_pages(GFP_KERNEL,
-							pages)))
+			for (pages = 4; pages >= 0; pages--) {
+				devpriv->dmabuf_virt[i] =
+					(short *) __get_free_pages(GFP_KERNEL,
+								   pages);
+				if (devpriv->dmabuf_virt[i])
 					break;
+			}
 			if (devpriv->dmabuf_virt[i]) {
 				devpriv->dmabuf_pages[i] = pages;
 				devpriv->dmabuf_size[i] = PAGE_SIZE * pages;
@@ -1955,7 +1958,7 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig *
 			}
 		}
 		if (!devpriv->dmabuf_virt[0]) {
-			rt_printk(", Can't allocate DMA buffer, DMA disabled!");
+			printk(", Can't allocate DMA buffer, DMA disabled!");
 			master = 0;
 		}
 
@@ -1964,26 +1967,26 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig *
 
 	}
 
-	if ((devpriv->master = master)) {
-		rt_printk(", bus master");
-	} else {
-		rt_printk(", no bus master");
-	}
+	devpriv->master = master;
+	if (devpriv->master)
+		printk(", bus master");
+	else
+		printk(", no bus master");
 
 	devpriv->usemux = 0;
 	if (it->options[2] > 0) {
 		devpriv->usemux = it->options[2];
 		if (devpriv->usemux > 256)
-			devpriv->usemux = 256;	// max 256 channels!
+			devpriv->usemux = 256;	/*  max 256 channels! */
 		if (it->options[4] > 0)
 			if (devpriv->usemux > 128) {
-				devpriv->usemux = 128;	// max 128 channels with softare S&H!
+				devpriv->usemux = 128;	/*  max 128 channels with softare S&H! */
 			}
-		rt_printk(", ext. mux %d channels", devpriv->usemux);
+		printk(", ext. mux %d channels", devpriv->usemux);
 	}
 
 	devpriv->softsshdelay = it->options[4];
-	if (devpriv->softsshdelay < 0) {	// select sample&hold signal polarity
+	if (devpriv->softsshdelay < 0) {	/*  select sample&hold signal polarity */
 		devpriv->softsshdelay = -devpriv->softsshdelay;
 		devpriv->softsshsample = 0x80;
 		devpriv->softsshhold = 0x00;
@@ -1992,12 +1995,13 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig *
 		devpriv->softsshhold = 0x80;
 	}
 
-	rt_printk(".\n");
+	printk(".\n");
 
 	pci_read_config_word(devpriv->pcidev, PCI_COMMAND, &u16w);
-	pci_write_config_word(devpriv->pcidev, PCI_COMMAND, u16w | 64);	// Enable parity check for parity error
+	pci_write_config_word(devpriv->pcidev, PCI_COMMAND, u16w | 64);	/*  Enable parity check for parity error */
 
-	if ((ret = alloc_subdevices(dev, 4)) < 0)
+	ret = alloc_subdevices(dev, 4);
+	if (ret < 0)
 		return ret;
 
 	s = dev->subdevices + 0;
@@ -2052,9 +2056,9 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig *
 	s->insn_bits = pci9118_insn_bits_do;
 
 	devpriv->valid = 1;
-	devpriv->i8254_osc_base = 250;	// 250ns=4MHz
-	devpriv->ai_maskharderr = 0x10a;	// default measure crash condition
-	if (it->options[5])	// disable some requested
+	devpriv->i8254_osc_base = 250;	/*  250ns=4MHz */
+	devpriv->ai_maskharderr = 0x10a;	/*  default measure crash condition */
+	if (it->options[5])	/*  disable some requested */
 		devpriv->ai_maskharderr &= ~it->options[5];
 
 	switch (this_board->ai_maxdata) {
@@ -2071,13 +2075,13 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig *
 /*
 ==============================================================================
 */
-static int pci9118_detach(struct comedi_device * dev)
+static int pci9118_detach(struct comedi_device *dev)
 {
 	if (dev->private) {
 		if (devpriv->valid)
 			pci9118_reset(dev);
 		if (dev->irq)
-			comedi_free_irq(dev->irq, dev);
+			free_irq(dev->irq, dev);
 		if (devpriv->pcidev) {
 			if (dev->iobase) {
 				comedi_pci_disable(devpriv->pcidev);

+ 41 - 41
drivers/staging/comedi/drivers/adq12b.c

@@ -81,7 +81,7 @@ If you do not specify any options, they will default to
 
 #include "../comedidev.h"
 
-// address scheme (page 2.17 of the manual)
+/* address scheme (page 2.17 of the manual) */
 #define ADQ12B_SIZE     16
 
 #define ADQ12B_CTREG    0x00
@@ -94,24 +94,24 @@ If you do not specify any options, they will default to
 #define ADQ12B_CONT2    0x0e
 #define ADQ12B_COWORD   0x0f
 
-// mask of the bit at STINR to check end of conversion
+/* mask of the bit at STINR to check end of conversion */
 #define ADQ12B_EOC     0x20
 
 #define TIMEOUT        20
 
-// available ranges through the PGA gains
+/* available ranges through the PGA gains */
 static const struct comedi_lrange range_adq12b_ai_bipolar = { 4, {
-        BIP_RANGE( 5 ),
-        BIP_RANGE( 2 ),
-        BIP_RANGE( 1 ),
-        BIP_RANGE( 0.5 )
+        BIP_RANGE(5),
+        BIP_RANGE(2),
+        BIP_RANGE(1),
+        BIP_RANGE(0.5)
 }};
 
 static const struct comedi_lrange range_adq12b_ai_unipolar = { 4, {
-        UNI_RANGE( 5 ),
-        UNI_RANGE( 2 ),
-        UNI_RANGE( 1 ),
-        UNI_RANGE( 0.5 )
+        UNI_RANGE(5),
+        UNI_RANGE(2),
+        UNI_RANGE(1),
+        UNI_RANGE(0.5)
 }};
 
 
@@ -127,20 +127,20 @@ struct adq12b_board {
 
 static const struct adq12b_board adq12b_boards[] = {
         {
-        name:           "adq12b",
-        ai_se_chans:    16,
-        ai_diff_chans:  8,
-        ai_bits:        12,
-        di_chans:       5,
-        do_chans:       8
+	.name = "adq12b",
+	.ai_se_chans = 16,
+	.ai_diff_chans = 8,
+	.ai_bits = 12,
+	.di_chans = 5,
+	.do_chans = 8
         }
-// potentially, more adq-based deviced will be added
+/* potentially, more adq-based deviced will be added */
 /*,
-        name:           "adq12b",
-        ai_chans:       16,  // this is just for reference, hardcoded again later
-        ai_bits:        12,
-        di_chans:       8,
-        do_chans:       5
+	.name = "adq12b",
+	.ai_chans = 16,  // this is just for reference, hardcoded again later
+	.ai_bits = 12,
+	.di_chans = 8,
+	.do_chans = 5
         }*/
 };
 
@@ -162,7 +162,7 @@ struct adq12b_private {
  * the board, and also about the kernel module that contains
  * the device code.
  */
-static int adq12b_attach(struct comedi_device *dev,struct comedi_devconfig *it);
+static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it);
 static int adq12b_detach(struct comedi_device *dev);
 static struct comedi_driver driver_adq12b={
         driver_name:    "adq12b",
@@ -171,12 +171,12 @@ static struct comedi_driver driver_adq12b={
         detach:         adq12b_detach,
         board_name:     &adq12b_boards[0].name,
         offset:         sizeof(struct adq12b_board),
-        num_names:      sizeof(adq12b_boards) / sizeof(struct adq12b_board),
+        num_names:      ARRAY_SIZE(adq12b_boards),
 };
 
-static int adq12b_ai_rinsn(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data);
-static int adq12b_di_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data);
-static int adq12b_do_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data);
+static int adq12b_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
+static int adq12b_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
+static int adq12b_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
 
 /*
  * Attach is called by the Comedi core to configure the driver
@@ -184,7 +184,7 @@ static int adq12b_do_insn_bits(struct comedi_device *dev,struct comedi_subdevice
  * in the driver structure, dev->board_ptr contains that
  * address.
  */
-static int adq12b_attach(struct comedi_device *dev,struct comedi_devconfig *it)
+static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
         struct comedi_subdevice *s;
         unsigned long iobase;
@@ -194,7 +194,7 @@ static int adq12b_attach(struct comedi_device *dev,struct comedi_devconfig *it)
         unipolar = it->options[1];
         differential = it->options[2];
 
-        printk("comedi%d: adq12b called with options base=0x%03lx, %s and %s\n",dev->minor, iobase, (unipolar==1)?"unipolar":"bipolar", (differential==1)?"differential":"single-ended");
+        printk("comedi%d: adq12b called with options base=0x%03lx, %s and %s\n", dev->minor, iobase, (unipolar==1)?"unipolar":"bipolar", (differential==1) ? "differential" : "single-ended");
 
         /* if no address was specified, try the default 0x300 */
         if (iobase == 0) {
@@ -219,7 +219,7 @@ static int adq12b_attach(struct comedi_device *dev,struct comedi_devconfig *it)
  * Allocate the private structure area.  alloc_private() is a
  * convenient macro defined in comedidev.h.
  */
-        if(alloc_private(dev, sizeof(struct adq12b_private)) < 0)
+        if (alloc_private (dev, sizeof (struct adq12b_private)) < 0)
           return -ENOMEM;
 
 /* fill in devpriv structure */
@@ -236,7 +236,7 @@ static int adq12b_attach(struct comedi_device *dev,struct comedi_devconfig *it)
  * Allocate the subdevice structures.  alloc_subdevice() is a
  * convenient macro defined in comedidev.h.
  */
-        if(alloc_subdevices(dev, 3)<0)
+        if (alloc_subdevices (dev, 3)<0)
            return -ENOMEM;
 
         s = dev->subdevices+0;
@@ -304,7 +304,7 @@ static int adq12b_detach(struct comedi_device *dev)
 
         kfree(devpriv);
 
-        printk("comedi%d: adq12b: removed\n",dev->minor);
+        printk("comedi%d: adq12b: removed\n", dev->minor);
 
         return 0;
 }
@@ -314,7 +314,7 @@ static int adq12b_detach(struct comedi_device *dev)
  * mode.
  */
 
-static int adq12b_ai_rinsn(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)
+static int adq12b_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
         int n, i;
         int range, channel;
@@ -325,29 +325,29 @@ static int adq12b_ai_rinsn(struct comedi_device *dev,struct comedi_subdevice *s,
         channel = CR_CHAN(insn->chanspec);
         if (channel != devpriv->last_channel || range != devpriv->last_range) {
           outb((range << 4) | channel, dev->iobase + ADQ12B_CTREG);
-          comedi_udelay(50);   /* wait for the mux to settle */
+          udelay(50);   /* wait for the mux to settle */
         }
 
         /* trigger conversion */
         status = inb(dev->iobase + ADQ12B_ADLOW);
 
         /* convert n samples */
-        for(n=0; n < insn->n; n++){
+        for (n=0; n < insn->n; n++){
 
           /* wait for end of convertion */
 	  i = 0;
           do {
-//            comedi_udelay(1);
+/* udelay(1); */
 	    status = inb(dev->iobase + ADQ12B_STINR);
             status = status & ADQ12B_EOC;
           } while (status == 0 && ++i < TIMEOUT);
-//          } while (++i < 10);
+/* } while (++i < 10); */
 
           /* read data */
           hi = inb(dev->iobase + ADQ12B_ADHIG);
           lo = inb(dev->iobase + ADQ12B_ADLOW);
 
-          //rt_printk("debug: chan=%d range=%d status=%d hi=%d lo=%d\n", channel, range, status,  hi, lo);
+          /* printk("debug: chan=%d range=%d status=%d hi=%d lo=%d\n", channel, range, status,  hi, lo); */
           data[n] = (hi << 8) | lo;
 
         }
@@ -357,7 +357,7 @@ static int adq12b_ai_rinsn(struct comedi_device *dev,struct comedi_subdevice *s,
 }
 
 
-static int adq12b_di_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, 	struct comedi_insn *insn,unsigned int *data)
+static int adq12b_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, 	struct comedi_insn *insn, unsigned int *data)
 {
 
         /* only bits 0-4 have information about digital inputs */
@@ -367,7 +367,7 @@ static int adq12b_di_insn_bits(struct comedi_device *dev,struct comedi_subdevice
 }
 
 
-static int adq12b_do_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, 	struct comedi_insn *insn,unsigned int *data)
+static int adq12b_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, 	struct comedi_insn *insn, unsigned int *data)
 {
         int channel;
 

+ 176 - 172
drivers/staging/comedi/drivers/adv_pci1710.c

@@ -41,6 +41,8 @@ Configuration options:
           device will be used.
 */
 
+#include <linux/interrupt.h>
+
 #include "../comedidev.h"
 
 #include "comedi_pci.h"
@@ -56,12 +58,12 @@ Configuration options:
 
 #undef DPRINTK
 #ifdef PCI171X_EXTDEBUG
-#define DPRINTK(fmt, args...) rt_printk(fmt, ## args)
+#define DPRINTK(fmt, args...) printk(fmt, ## args)
 #else
 #define DPRINTK(fmt, args...)
 #endif
 
-// hardware types of the cards
+/* hardware types of the cards */
 #define TYPE_PCI171X	0
 #define TYPE_PCI1713	2
 #define TYPE_PCI1720	3
@@ -87,12 +89,12 @@ Configuration options:
 #define PCI171x_CNT2	28	/* R/W: 8254 couter 2 */
 #define PCI171x_CNTCTRL	30	/* W:   8254 counter control */
 
-// upper bits from status register (PCI171x_STATUS) (lower is same woth control reg)
+/* upper bits from status register (PCI171x_STATUS) (lower is same woth control reg) */
 #define	Status_FE	0x0100	/* 1=FIFO is empty */
 #define Status_FH	0x0200	/* 1=FIFO is half full */
 #define Status_FF	0x0400	/* 1=FIFO is full, fatal error */
 #define Status_IRQ	0x0800	/* 1=IRQ occured */
-// bits from control register (PCI171x_CONTROL)
+/* bits from control register (PCI171x_CONTROL) */
 #define Control_CNT0	0x0040	/* 1=CNT0 have external source, 0=have internal 100kHz source */
 #define Control_ONEFH	0x0020	/* 1=IRQ on FIFO is half full, 0=every sample */
 #define Control_IRQEN	0x0010	/* 1=enable IRQ */
@@ -100,7 +102,7 @@ Configuration options:
 #define Control_EXT	0x0004	/* 1=external trigger source */
 #define Control_PACER	0x0002	/* 1=enable internal 8254 trigger source */
 #define Control_SW	0x0001	/* 1=enable software trigger source */
-// bits from counter control register (PCI171x_CNTCTRL)
+/* bits from counter control register (PCI171x_CNTCTRL) */
 #define Counter_BCD     0x0001	/* 0 = binary counter, 1 = BCD counter */
 #define Counter_M0      0x0002	/* M0-M2 select modes 0-5 */
 #define Counter_M1      0x0004	/* 000 = mode 0, 010 = mode 2 ... */
@@ -118,7 +120,7 @@ Configuration options:
 #define PCI1720_SYNCOUT	 9	/* W:   D/A synchronized output register */
 #define PCI1720_SYNCONT	15	/* R/W: D/A synchronized control */
 
-// D/A synchronized control (PCI1720_SYNCONT)
+/* D/A synchronized control (PCI1720_SYNCONT) */
 #define Syncont_SC0	 1	/* set synchronous output mode */
 
 static const struct comedi_lrange range_pci1710_3 = { 9, {
@@ -182,28 +184,28 @@ static const struct comedi_lrange range_pci171x_da = { 2, {
 	}
 };
 
-static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig * it);
-static int pci1710_detach(struct comedi_device * dev);
+static int pci1710_attach(struct comedi_device *dev, struct comedi_devconfig *it);
+static int pci1710_detach(struct comedi_device *dev);
 
 struct boardtype {
-	const char *name;	// board name
+	const char *name;	/*  board name */
 	int device_id;
-	int iorange;		// I/O range len
-	char have_irq;		// 1=card support IRQ
-	char cardtype;		// 0=1710& co. 2=1713, ...
-	int n_aichan;		// num of A/D chans
-	int n_aichand;		// num of A/D chans in diff mode
-	int n_aochan;		// num of D/A chans
-	int n_dichan;		// num of DI chans
-	int n_dochan;		// num of DO chans
-	int n_counter;		// num of counters
-	int ai_maxdata;		// resolution of A/D
-	int ao_maxdata;		// resolution of D/A
-	const struct comedi_lrange *rangelist_ai;	// rangelist for A/D
-	const char *rangecode_ai;	// range codes for programming
-	const struct comedi_lrange *rangelist_ao;	// rangelist for D/A
-	unsigned int ai_ns_min;	// max sample speed of card v ns
-	unsigned int fifo_half_size;	// size of FIFO/2
+	int iorange;		/*  I/O range len */
+	char have_irq;		/*  1=card support IRQ */
+	char cardtype;		/*  0=1710& co. 2=1713, ... */
+	int n_aichan;		/*  num of A/D chans */
+	int n_aichand;		/*  num of A/D chans in diff mode */
+	int n_aochan;		/*  num of D/A chans */
+	int n_dichan;		/*  num of DI chans */
+	int n_dochan;		/*  num of DO chans */
+	int n_counter;		/*  num of counters */
+	int ai_maxdata;		/*  resolution of A/D */
+	int ao_maxdata;		/*  resolution of D/A */
+	const struct comedi_lrange *rangelist_ai;	/*  rangelist for A/D */
+	const char *rangecode_ai;	/*  range codes for programming */
+	const struct comedi_lrange *rangelist_ao;	/*  rangelist for D/A */
+	unsigned int ai_ns_min;	/*  max sample speed of card v ns */
+	unsigned int fifo_half_size;	/*  size of FIFO/2 */
 };
 
 static DEFINE_PCI_DEVICE_TABLE(pci1710_pci_table) = {
@@ -250,7 +252,7 @@ static const struct boardtype boardtypes[] = {
 		16, 0, 0, 16, 16, 0, 0x0fff, 0x0000,
 		&range_pci17x1, range_codes_pci17x1, NULL,
 		10000, 512},
-	// dummy entry corresponding to driver name
+	/*  dummy entry corresponding to driver name */
 	{.name = DRV_NAME},
 };
 
@@ -267,34 +269,34 @@ static struct comedi_driver driver_pci1710 = {
 };
 
 struct pci1710_private {
-	struct pci_dev *pcidev;	// ptr to PCI device
-	char valid;		// card is usable
-	char neverending_ai;	// we do unlimited AI
-	unsigned int CntrlReg;	// Control register
-	unsigned int i8254_osc_base;	// frequence of onboard oscilator
-	unsigned int ai_do;	// what do AI? 0=nothing, 1 to 4 mode
-	unsigned int ai_act_scan;	// how many scans we finished
-	unsigned int ai_act_chan;	// actual position in actual scan
-	unsigned int ai_buf_ptr;	// data buffer ptr in samples
-	unsigned char ai_eos;	// 1=EOS wake up
+	struct pci_dev *pcidev;	/*  ptr to PCI device */
+	char valid;		/*  card is usable */
+	char neverending_ai;	/*  we do unlimited AI */
+	unsigned int CntrlReg;	/*  Control register */
+	unsigned int i8254_osc_base;	/*  frequence of onboard oscilator */
+	unsigned int ai_do;	/*  what do AI? 0=nothing, 1 to 4 mode */
+	unsigned int ai_act_scan;	/*  how many scans we finished */
+	unsigned int ai_act_chan;	/*  actual position in actual scan */
+	unsigned int ai_buf_ptr;	/*  data buffer ptr in samples */
+	unsigned char ai_eos;	/*  1=EOS wake up */
 	unsigned char ai_et;
 	unsigned int ai_et_CntrlReg;
 	unsigned int ai_et_MuxVal;
 	unsigned int ai_et_div1, ai_et_div2;
-	unsigned int act_chanlist[32];	// list of scaned channel
-	unsigned char act_chanlist_len;	// len of scanlist
-	unsigned char act_chanlist_pos;	// actual position in MUX list
-	unsigned char da_ranges;	// copy of D/A outpit range register
-	unsigned int ai_scans;	// len of scanlist
-	unsigned int ai_n_chan;	// how many channels is measured
-	unsigned int *ai_chanlist;	// actaul chanlist
-	unsigned int ai_flags;	// flaglist
-	unsigned int ai_data_len;	// len of data buffer
-	short *ai_data;	// data buffer
-	unsigned int ai_timer1;	// timers
+	unsigned int act_chanlist[32];	/*  list of scaned channel */
+	unsigned char act_chanlist_len;	/*  len of scanlist */
+	unsigned char act_chanlist_pos;	/*  actual position in MUX list */
+	unsigned char da_ranges;	/*  copy of D/A outpit range register */
+	unsigned int ai_scans;	/*  len of scanlist */
+	unsigned int ai_n_chan;	/*  how many channels is measured */
+	unsigned int *ai_chanlist;	/*  actaul chanlist */
+	unsigned int ai_flags;	/*  flaglist */
+	unsigned int ai_data_len;	/*  len of data buffer */
+	short *ai_data;	/*  data buffer */
+	unsigned int ai_timer1;	/*  timers */
 	unsigned int ai_timer2;
-	short ao_data[4];	// data output buffer
-	unsigned int cnt0_write_wait;	// after a write, wait for update of the internal state
+	short ao_data[4];	/*  data output buffer */
+	unsigned int cnt0_write_wait;	/*  after a write, wait for update of the internal state */
 };
 
 #define devpriv ((struct pci1710_private *)dev->private)
@@ -304,16 +306,16 @@ struct pci1710_private {
 ==============================================================================
 */
 
-static int check_channel_list(struct comedi_device * dev, struct comedi_subdevice * s,
+static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s,
 	unsigned int *chanlist, unsigned int n_chan);
-static void setup_channel_list(struct comedi_device * dev, struct comedi_subdevice * s,
+static void setup_channel_list(struct comedi_device *dev, struct comedi_subdevice *s,
 	unsigned int *chanlist, unsigned int n_chan, unsigned int seglen);
-static void start_pacer(struct comedi_device * dev, int mode, unsigned int divisor1,
+static void start_pacer(struct comedi_device *dev, int mode, unsigned int divisor1,
 	unsigned int divisor2);
-static int pci1710_reset(struct comedi_device * dev);
-static int pci171x_ai_cancel(struct comedi_device * dev, struct comedi_subdevice * s);
+static int pci1710_reset(struct comedi_device *dev);
+static int pci171x_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s);
 
-static const unsigned int muxonechan[] = { 0x0000, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, 0x0606, 0x0707,	// used for gain list programming
+static const unsigned int muxonechan[] = { 0x0000, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, 0x0606, 0x0707,	/*  used for gain list programming */
 	0x0808, 0x0909, 0x0a0a, 0x0b0b, 0x0c0c, 0x0d0d, 0x0e0e, 0x0f0f,
 	0x1010, 0x1111, 0x1212, 0x1313, 0x1414, 0x1515, 0x1616, 0x1717,
 	0x1818, 0x1919, 0x1a1a, 0x1b1b, 0x1c1c, 0x1d1d, 0x1e1e, 0x1f1f
@@ -322,8 +324,8 @@ static const unsigned int muxonechan[] = { 0x0000, 0x0101, 0x0202, 0x0303, 0x040
 /*
 ==============================================================================
 */
-static int pci171x_insn_read_ai(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci171x_insn_read_ai(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int n, timeout;
 #ifdef PCI171x_PARANOIDCHECK
@@ -332,7 +334,7 @@ static int pci171x_insn_read_ai(struct comedi_device * dev, struct comedi_subdev
 
 	DPRINTK("adv_pci1710 EDBG: BGN: pci171x_insn_read_ai(...)\n");
 	devpriv->CntrlReg &= Control_CNT0;
-	devpriv->CntrlReg |= Control_SW;	// set software trigger
+	devpriv->CntrlReg |= Control_SW;	/*  set software trigger */
 	outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
 	outb(0, dev->iobase + PCI171x_CLRFIFO);
 	outb(0, dev->iobase + PCI171x_CLRINT);
@@ -346,7 +348,7 @@ static int pci171x_insn_read_ai(struct comedi_device * dev, struct comedi_subdev
 		outw(0, dev->iobase + PCI171x_SOFTTRG);	/* start conversion */
 		DPRINTK("adv_pci1710 B n=%d ST=%4x\n", n,
 			inw(dev->iobase + PCI171x_STATUS));
-		//comedi_udelay(1);
+		/* udelay(1); */
 		DPRINTK("adv_pci1710 C n=%d ST=%4x\n", n,
 			inw(dev->iobase + PCI171x_STATUS));
 		timeout = 100;
@@ -390,8 +392,8 @@ static int pci171x_insn_read_ai(struct comedi_device * dev, struct comedi_subdev
 /*
 ==============================================================================
 */
-static int pci171x_insn_write_ao(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci171x_insn_write_ao(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int n, chan, range, ofs;
 
@@ -421,8 +423,8 @@ static int pci171x_insn_write_ao(struct comedi_device * dev, struct comedi_subde
 /*
 ==============================================================================
 */
-static int pci171x_insn_read_ao(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci171x_insn_read_ao(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int n, chan;
 
@@ -436,8 +438,8 @@ static int pci171x_insn_read_ao(struct comedi_device * dev, struct comedi_subdev
 /*
 ==============================================================================
 */
-static int pci171x_insn_bits_di(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci171x_insn_bits_di(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	data[1] = inw(dev->iobase + PCI171x_DI);
 
@@ -447,8 +449,8 @@ static int pci171x_insn_bits_di(struct comedi_device * dev, struct comedi_subdev
 /*
 ==============================================================================
 */
-static int pci171x_insn_bits_do(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci171x_insn_bits_do(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	if (data[0]) {
 		s->state &= ~data[0];
@@ -463,8 +465,8 @@ static int pci171x_insn_bits_do(struct comedi_device * dev, struct comedi_subdev
 /*
 ==============================================================================
 */
-static int pci171x_insn_counter_read(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci171x_insn_counter_read(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	unsigned int msb, lsb, ccntrl;
 	int i;
@@ -485,8 +487,8 @@ static int pci171x_insn_counter_read(struct comedi_device * dev, struct comedi_s
 /*
 ==============================================================================
 */
-static int pci171x_insn_counter_write(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci171x_insn_counter_write(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	uint msb, lsb, ccntrl, status;
 
@@ -512,8 +514,8 @@ static int pci171x_insn_counter_write(struct comedi_device * dev, struct comedi_
 /*
 ==============================================================================
 */
-static int pci171x_insn_counter_config(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+static int pci171x_insn_counter_config(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 #ifdef unused
 	/* This doesn't work like a normal Comedi counter config */
@@ -548,8 +550,8 @@ static int pci171x_insn_counter_config(struct comedi_device * dev,
 /*
 ==============================================================================
 */
-static int pci1720_insn_write_ao(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci1720_insn_write_ao(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int n, rangereg, chan;
 
@@ -563,7 +565,7 @@ static int pci1720_insn_write_ao(struct comedi_device * dev, struct comedi_subde
 
 	for (n = 0; n < insn->n; n++) {
 		outw(data[n], dev->iobase + PCI1720_DA0 + (chan << 1));
-		outb(0, dev->iobase + PCI1720_SYNCOUT);	// update outputs
+		outb(0, dev->iobase + PCI1720_SYNCOUT);	/*  update outputs */
 	}
 
 	devpriv->ao_data[chan] = data[n];
@@ -586,14 +588,14 @@ static void interrupt_pci1710_every_sample(void *d)
 	DPRINTK("adv_pci1710 EDBG: BGN: interrupt_pci1710_every_sample(...)\n");
 	m = inw(dev->iobase + PCI171x_STATUS);
 	if (m & Status_FE) {
-		rt_printk("comedi%d: A/D FIFO empty (%4x)\n", dev->minor, m);
+		printk("comedi%d: A/D FIFO empty (%4x)\n", dev->minor, m);
 		pci171x_ai_cancel(dev, s);
 		s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
 		comedi_event(dev, s);
 		return;
 	}
 	if (m & Status_FF) {
-		rt_printk
+		printk
 			("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n",
 			dev->minor, m);
 		pci171x_ai_cancel(dev, s);
@@ -602,7 +604,7 @@ static void interrupt_pci1710_every_sample(void *d)
 		return;
 	}
 
-	outb(0, dev->iobase + PCI171x_CLRINT);	// clear our INT request
+	outb(0, dev->iobase + PCI171x_CLRINT);	/*  clear our INT request */
 
 	DPRINTK("FOR ");
 	for (; !(inw(dev->iobase + PCI171x_STATUS) & Status_FE);) {
@@ -612,7 +614,7 @@ static void interrupt_pci1710_every_sample(void *d)
 		if (this_board->cardtype != TYPE_PCI1713)
 			if ((sampl & 0xf000) !=
 				devpriv->act_chanlist[s->async->cur_chan]) {
-				rt_printk
+				printk
 					("comedi: A/D data dropout: received data from channel %d, expected %d!\n",
 					(sampl & 0xf000) >> 12,
 					(devpriv->act_chanlist[s->async->
@@ -637,11 +639,11 @@ static void interrupt_pci1710_every_sample(void *d)
 			s->async->cur_chan = 0;
 		}
 
-		if (s->async->cur_chan == 0) {	// one scan done
+		if (s->async->cur_chan == 0) {	/*  one scan done */
 			devpriv->ai_act_scan++;
 			DPRINTK("adv_pci1710 EDBG: EOS1 bic %d bip %d buc %d bup %d\n", s->async->buf_int_count, s->async->buf_int_ptr, s->async->buf_user_count, s->async->buf_user_ptr);
 			DPRINTK("adv_pci1710 EDBG: EOS2\n");
-			if ((!devpriv->neverending_ai) && (devpriv->ai_act_scan >= devpriv->ai_scans)) {	// all data sampled
+			if ((!devpriv->neverending_ai) && (devpriv->ai_act_scan >= devpriv->ai_scans)) {	/*  all data sampled */
 				pci171x_ai_cancel(dev, s);
 				s->async->events |= COMEDI_CB_EOA;
 				comedi_event(dev, s);
@@ -650,7 +652,7 @@ static void interrupt_pci1710_every_sample(void *d)
 		}
 	}
 
-	outb(0, dev->iobase + PCI171x_CLRINT);	// clear our INT request
+	outb(0, dev->iobase + PCI171x_CLRINT);	/*  clear our INT request */
 	DPRINTK("adv_pci1710 EDBG: END: interrupt_pci1710_every_sample(...)\n");
 
 	comedi_event(dev, s);
@@ -659,7 +661,7 @@ static void interrupt_pci1710_every_sample(void *d)
 /*
 ==============================================================================
 */
-static int move_block_from_fifo(struct comedi_device * dev, struct comedi_subdevice * s,
+static int move_block_from_fifo(struct comedi_device *dev, struct comedi_subdevice *s,
 	int n, int turn)
 {
 	int i, j;
@@ -674,7 +676,7 @@ static int move_block_from_fifo(struct comedi_device * dev, struct comedi_subdev
 		sampl = inw(dev->iobase + PCI171x_AD_DATA);
 		if (this_board->cardtype != TYPE_PCI1713)
 			if ((sampl & 0xf000) != devpriv->act_chanlist[j]) {
-				rt_printk
+				printk
 					("comedi%d: A/D  FIFO data dropout: received data from channel %d, expected %d! (%d/%d/%d/%d/%d/%4x)\n",
 					dev->minor, (sampl & 0xf000) >> 12,
 					(devpriv->
@@ -714,7 +716,7 @@ static void interrupt_pci1710_half_fifo(void *d)
 	DPRINTK("adv_pci1710 EDBG: BGN: interrupt_pci1710_half_fifo(...)\n");
 	m = inw(dev->iobase + PCI171x_STATUS);
 	if (!(m & Status_FH)) {
-		rt_printk("comedi%d: A/D FIFO not half full! (%4x)\n",
+		printk("comedi%d: A/D FIFO not half full! (%4x)\n",
 			dev->minor, m);
 		pci171x_ai_cancel(dev, s);
 		s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
@@ -722,7 +724,7 @@ static void interrupt_pci1710_half_fifo(void *d)
 		return;
 	}
 	if (m & Status_FF) {
-		rt_printk
+		printk
 			("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n",
 			dev->minor, m);
 		pci171x_ai_cancel(dev, s);
@@ -751,7 +753,7 @@ static void interrupt_pci1710_half_fifo(void *d)
 			comedi_event(dev, s);
 			return;
 		}
-	outb(0, dev->iobase + PCI171x_CLRINT);	// clear our INT request
+	outb(0, dev->iobase + PCI171x_CLRINT);	/*  clear our INT request */
 	DPRINTK("adv_pci1710 EDBG: END: interrupt_pci1710_half_fifo(...)\n");
 
 	comedi_event(dev, s);
@@ -760,36 +762,36 @@ static void interrupt_pci1710_half_fifo(void *d)
 /*
 ==============================================================================
 */
-static irqreturn_t interrupt_service_pci1710(int irq, void *d PT_REGS_ARG)
+static irqreturn_t interrupt_service_pci1710(int irq, void *d)
 {
 	struct comedi_device *dev = d;
 
 	DPRINTK("adv_pci1710 EDBG: BGN: interrupt_service_pci1710(%d,...)\n",
 		irq);
-	if (!dev->attached)	// is device attached?
-		return IRQ_NONE;	// no, exit
+	if (!dev->attached)	/*  is device attached? */
+		return IRQ_NONE;	/*  no, exit */
 
-	if (!(inw(dev->iobase + PCI171x_STATUS) & Status_IRQ))	// is this interrupt from our board?
-		return IRQ_NONE;	// no, exit
+	if (!(inw(dev->iobase + PCI171x_STATUS) & Status_IRQ))	/*  is this interrupt from our board? */
+		return IRQ_NONE;	/*  no, exit */
 
 	DPRINTK("adv_pci1710 EDBG: interrupt_service_pci1710() ST: %4x\n",
 		inw(dev->iobase + PCI171x_STATUS));
 
-	if (devpriv->ai_et) {	// Switch from initial TRIG_EXT to TRIG_xxx.
+	if (devpriv->ai_et) {	/*  Switch from initial TRIG_EXT to TRIG_xxx. */
 		devpriv->ai_et = 0;
 		devpriv->CntrlReg &= Control_CNT0;
-		devpriv->CntrlReg |= Control_SW;	// set software trigger
+		devpriv->CntrlReg |= Control_SW;	/*  set software trigger */
 		outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
 		devpriv->CntrlReg = devpriv->ai_et_CntrlReg;
 		outb(0, dev->iobase + PCI171x_CLRFIFO);
 		outb(0, dev->iobase + PCI171x_CLRINT);
 		outw(devpriv->ai_et_MuxVal, dev->iobase + PCI171x_MUX);
 		outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
-		// start pacer
+		/*  start pacer */
 		start_pacer(dev, 1, devpriv->ai_et_div1, devpriv->ai_et_div2);
 		return IRQ_HANDLED;
 	}
-	if (devpriv->ai_eos) {	// We use FIFO half full INT or not?
+	if (devpriv->ai_eos) {	/*  We use FIFO half full INT or not? */
 		interrupt_pci1710_every_sample(d);
 	} else {
 		interrupt_pci1710_half_fifo(d);
@@ -801,15 +803,15 @@ static irqreturn_t interrupt_service_pci1710(int irq, void *d PT_REGS_ARG)
 /*
 ==============================================================================
 */
-static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device * dev,
-	struct comedi_subdevice * s)
+static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device *dev,
+	struct comedi_subdevice *s)
 {
 	unsigned int divisor1, divisor2;
 	unsigned int seglen;
 
 	DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_docmd_and_mode(%d,...)\n",
 		mode);
-	start_pacer(dev, -1, 0, 0);	// stop pacer
+	start_pacer(dev, -1, 0, 0);	/*  stop pacer */
 
 	seglen = check_channel_list(dev, s, devpriv->ai_chanlist,
 		devpriv->ai_n_chan);
@@ -829,7 +831,7 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device * dev,
 	devpriv->neverending_ai = 0;
 
 	devpriv->CntrlReg &= Control_CNT0;
-	if ((devpriv->ai_flags & TRIG_WAKE_EOS)) {	// don't we want wake up every scan?            devpriv->ai_eos=1;
+	if ((devpriv->ai_flags & TRIG_WAKE_EOS)) {	/*  don't we want wake up every scan?            devpriv->ai_eos=1; */
 		devpriv->ai_eos = 1;
 	} else {
 		devpriv->CntrlReg |= Control_ONEFH;
@@ -838,7 +840,7 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device * dev,
 
 	if ((devpriv->ai_scans == 0) || (devpriv->ai_scans == -1)) {
 		devpriv->neverending_ai = 1;
-	}			//well, user want neverending
+	}			/* well, user want neverending */
 	else {
 		devpriv->neverending_ai = 0;
 	}
@@ -863,7 +865,7 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device * dev,
 		DPRINTK("adv_pci1710 EDBG: OSC base=%u div1=%u div2=%u timer=%u\n", devpriv->i8254_osc_base, divisor1, divisor2, devpriv->ai_timer1);
 		outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
 		if (mode != 2) {
-			// start pacer
+			/*  start pacer */
 			start_pacer(dev, mode, divisor1, divisor2);
 		} else {
 			devpriv->ai_et_div1 = divisor1;
@@ -884,15 +886,15 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device * dev,
 /*
 ==============================================================================
 */
-static void pci171x_cmdtest_out(int e, struct comedi_cmd * cmd)
+static void pci171x_cmdtest_out(int e, struct comedi_cmd *cmd)
 {
-	rt_printk("adv_pci1710 e=%d startsrc=%x scansrc=%x convsrc=%x\n", e,
+	printk("adv_pci1710 e=%d startsrc=%x scansrc=%x convsrc=%x\n", e,
 		cmd->start_src, cmd->scan_begin_src, cmd->convert_src);
-	rt_printk("adv_pci1710 e=%d startarg=%d scanarg=%d convarg=%d\n", e,
+	printk("adv_pci1710 e=%d startarg=%d scanarg=%d convarg=%d\n", e,
 		cmd->start_arg, cmd->scan_begin_arg, cmd->convert_arg);
-	rt_printk("adv_pci1710 e=%d stopsrc=%x scanend=%x\n", e, cmd->stop_src,
+	printk("adv_pci1710 e=%d stopsrc=%x scanend=%x\n", e, cmd->stop_src,
 		cmd->scan_end_src);
-	rt_printk("adv_pci1710 e=%d stoparg=%d scanendarg=%d chanlistlen=%d\n",
+	printk("adv_pci1710 e=%d stoparg=%d scanendarg=%d chanlistlen=%d\n",
 		e, cmd->stop_arg, cmd->scan_end_arg, cmd->chanlist_len);
 }
 #endif
@@ -900,8 +902,8 @@ static void pci171x_cmdtest_out(int e, struct comedi_cmd * cmd)
 /*
 ==============================================================================
 */
-static int pci171x_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_cmd * cmd)
+static int pci171x_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_cmd *cmd)
 {
 	int err = 0;
 	int tmp, divisor1, divisor2;
@@ -1055,7 +1057,7 @@ static int pci171x_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic
 	if (cmd->chanlist) {
 		if (!check_channel_list(dev, s, cmd->chanlist,
 				cmd->chanlist_len))
-			return 5;	// incorrect channels list
+			return 5;	/*  incorrect channels list */
 	}
 
 	DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_cmdtest(...) ret=0\n");
@@ -1065,7 +1067,7 @@ static int pci171x_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic
 /*
 ==============================================================================
 */
-static int pci171x_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s)
+static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 {
 	struct comedi_cmd *cmd = &s->async->cmd;
 
@@ -1084,13 +1086,13 @@ static int pci171x_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
 		devpriv->ai_scans = 0;
 	}
 
-	if (cmd->scan_begin_src == TRIG_FOLLOW) {	// mode 1, 2, 3
-		if (cmd->convert_src == TRIG_TIMER) {	// mode 1 and 2
+	if (cmd->scan_begin_src == TRIG_FOLLOW) {	/*  mode 1, 2, 3 */
+		if (cmd->convert_src == TRIG_TIMER) {	/*  mode 1 and 2 */
 			devpriv->ai_timer1 = cmd->convert_arg;
 			return pci171x_ai_docmd_and_mode(cmd->start_src ==
 				TRIG_EXT ? 2 : 1, dev, s);
 		}
-		if (cmd->convert_src == TRIG_EXT) {	// mode 3
+		if (cmd->convert_src == TRIG_EXT) {	/*  mode 3 */
 			return pci171x_ai_docmd_and_mode(3, dev, s);
 		}
 	}
@@ -1104,7 +1106,7 @@ static int pci171x_ai_cmd(struct comedi_device * dev, struct comedi_subdevice *
  If it's ok, then program scan/gain logic.
  This works for all cards.
 */
-static int check_channel_list(struct comedi_device * dev, struct comedi_subdevice * s,
+static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s,
 	unsigned int *chanlist, unsigned int n_chan)
 {
 	unsigned int chansegment[32];
@@ -1118,12 +1120,12 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic
 	}
 
 	if (n_chan > 1) {
-		chansegment[0] = chanlist[0];	// first channel is everytime ok
-		for (i = 1, seglen = 1; i < n_chan; i++, seglen++) {	// build part of chanlist
-			// rt_printk("%d. %d %d\n",i,CR_CHAN(chanlist[i]),CR_RANGE(chanlist[i]));
+		chansegment[0] = chanlist[0];	/*  first channel is everytime ok */
+		for (i = 1, seglen = 1; i < n_chan; i++, seglen++) {	/*  build part of chanlist */
+			/*  printk("%d. %d %d\n",i,CR_CHAN(chanlist[i]),CR_RANGE(chanlist[i])); */
 			if (chanlist[0] == chanlist[i])
-				break;	// we detect loop, this must by finish
-			if (CR_CHAN(chanlist[i]) & 1)	// odd channel cann't by differencial
+				break;	/*  we detect loop, this must by finish */
+			if (CR_CHAN(chanlist[i]) & 1)	/*  odd channel cann't by differencial */
 				if (CR_AREF(chanlist[i]) == AREF_DIFF) {
 					comedi_error(dev,
 						"Odd channel can't be differential input!\n");
@@ -1133,20 +1135,20 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic
 				(CR_CHAN(chansegment[i - 1]) + 1) % s->n_chan;
 			if (CR_AREF(chansegment[i - 1]) == AREF_DIFF)
 				nowmustbechan = (nowmustbechan + 1) % s->n_chan;
-			if (nowmustbechan != CR_CHAN(chanlist[i])) {	// channel list isn't continous :-(
-				rt_printk
+			if (nowmustbechan != CR_CHAN(chanlist[i])) {	/*  channel list isn't continous :-( */
+				printk
 					("channel list must be continous! chanlist[%i]=%d but must be %d or %d!\n",
 					i, CR_CHAN(chanlist[i]), nowmustbechan,
 					CR_CHAN(chanlist[0]));
 				return 0;
 			}
-			chansegment[i] = chanlist[i];	// well, this is next correct channel in list
+			chansegment[i] = chanlist[i];	/*  well, this is next correct channel in list */
 		}
 
-		for (i = 0, segpos = 0; i < n_chan; i++) {	// check whole chanlist
-			//rt_printk("%d %d=%d %d\n",CR_CHAN(chansegment[i%seglen]),CR_RANGE(chansegment[i%seglen]),CR_CHAN(chanlist[i]),CR_RANGE(chanlist[i]));
+		for (i = 0, segpos = 0; i < n_chan; i++) {	/*  check whole chanlist */
+			/* printk("%d %d=%d %d\n",CR_CHAN(chansegment[i%seglen]),CR_RANGE(chansegment[i%seglen]),CR_CHAN(chanlist[i]),CR_RANGE(chanlist[i])); */
 			if (chanlist[i] != chansegment[i % seglen]) {
-				rt_printk
+				printk
 					("bad channel, reference or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n",
 					i, CR_CHAN(chansegment[i]),
 					CR_RANGE(chansegment[i]),
@@ -1154,7 +1156,7 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic
 					CR_CHAN(chanlist[i % seglen]),
 					CR_RANGE(chanlist[i % seglen]),
 					CR_AREF(chansegment[i % seglen]));
-				return 0;	// chan/gain list is strange
+				return 0;	/*  chan/gain list is strange */
 			}
 		}
 	} else {
@@ -1163,7 +1165,7 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic
 	return seglen;
 }
 
-static void setup_channel_list(struct comedi_device * dev, struct comedi_subdevice * s,
+static void setup_channel_list(struct comedi_device *dev, struct comedi_subdevice *s,
 	unsigned int *chanlist, unsigned int n_chan, unsigned int seglen)
 {
 	unsigned int i, range, chanprog;
@@ -1174,7 +1176,7 @@ static void setup_channel_list(struct comedi_device * dev, struct comedi_subdevi
 	devpriv->act_chanlist_pos = 0;
 
 	DPRINTK("SegLen: %d\n", seglen);
-	for (i = 0; i < seglen; i++) {	// store range list to card
+	for (i = 0; i < seglen; i++) {	/*  store range list to card */
 		chanprog = muxonechan[CR_CHAN(chanlist[i])];
 		outw(chanprog, dev->iobase + PCI171x_MUX);	/* select channel */
 		range = this_board->rangecode_ai[CR_RANGE(chanlist[i])];
@@ -1200,7 +1202,7 @@ static void setup_channel_list(struct comedi_device * dev, struct comedi_subdevi
 /*
 ==============================================================================
 */
-static void start_pacer(struct comedi_device * dev, int mode, unsigned int divisor1,
+static void start_pacer(struct comedi_device *dev, int mode, unsigned int divisor1,
 	unsigned int divisor2)
 {
 	DPRINTK("adv_pci1710 EDBG: BGN: start_pacer(%d,%u,%u)\n", mode,
@@ -1220,7 +1222,7 @@ static void start_pacer(struct comedi_device * dev, int mode, unsigned int divis
 /*
 ==============================================================================
 */
-static int pci171x_ai_cancel(struct comedi_device * dev, struct comedi_subdevice * s)
+static int pci171x_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
 {
 	DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_cancel(...)\n");
 
@@ -1229,7 +1231,7 @@ static int pci171x_ai_cancel(struct comedi_device * dev, struct comedi_subdevice
 		devpriv->CntrlReg &= Control_CNT0;
 		devpriv->CntrlReg |= Control_SW;
 
-		outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);	// reset any operations
+		outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);	/*  reset any operations */
 		start_pacer(dev, -1, 0, 0);
 		outb(0, dev->iobase + PCI171x_CLRFIFO);
 		outb(0, dev->iobase + PCI171x_CLRINT);
@@ -1249,28 +1251,28 @@ static int pci171x_ai_cancel(struct comedi_device * dev, struct comedi_subdevice
 /*
 ==============================================================================
 */
-static int pci171x_reset(struct comedi_device * dev)
+static int pci171x_reset(struct comedi_device *dev)
 {
 	DPRINTK("adv_pci1710 EDBG: BGN: pci171x_reset(...)\n");
 	outw(0x30, dev->iobase + PCI171x_CNTCTRL);
-	devpriv->CntrlReg = Control_SW | Control_CNT0;	// Software trigger, CNT0=external
-	outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);	// reset any operations
-	outb(0, dev->iobase + PCI171x_CLRFIFO);	// clear FIFO
-	outb(0, dev->iobase + PCI171x_CLRINT);	// clear INT request
-	start_pacer(dev, -1, 0, 0);	// stop 8254
+	devpriv->CntrlReg = Control_SW | Control_CNT0;	/*  Software trigger, CNT0=external */
+	outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);	/*  reset any operations */
+	outb(0, dev->iobase + PCI171x_CLRFIFO);	/*  clear FIFO */
+	outb(0, dev->iobase + PCI171x_CLRINT);	/*  clear INT request */
+	start_pacer(dev, -1, 0, 0);	/*  stop 8254 */
 	devpriv->da_ranges = 0;
 	if (this_board->n_aochan) {
-		outb(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);	// set DACs to 0..5V
-		outw(0, dev->iobase + PCI171x_DA1);	// set DA outputs to 0V
+		outb(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);	/*  set DACs to 0..5V */
+		outw(0, dev->iobase + PCI171x_DA1);	/*  set DA outputs to 0V */
 		devpriv->ao_data[0] = 0x0000;
 		if (this_board->n_aochan > 1) {
 			outw(0, dev->iobase + PCI171x_DA2);
 			devpriv->ao_data[1] = 0x0000;
 		}
 	}
-	outw(0, dev->iobase + PCI171x_DO);	// digital outputs to 0
-	outb(0, dev->iobase + PCI171x_CLRFIFO);	// clear FIFO
-	outb(0, dev->iobase + PCI171x_CLRINT);	// clear INT request
+	outw(0, dev->iobase + PCI171x_DO);	/*  digital outputs to 0 */
+	outb(0, dev->iobase + PCI171x_CLRFIFO);	/*  clear FIFO */
+	outb(0, dev->iobase + PCI171x_CLRINT);	/*  clear INT request */
 
 	DPRINTK("adv_pci1710 EDBG: END: pci171x_reset(...)\n");
 	return 0;
@@ -1279,17 +1281,17 @@ static int pci171x_reset(struct comedi_device * dev)
 /*
 ==============================================================================
 */
-static int pci1720_reset(struct comedi_device * dev)
+static int pci1720_reset(struct comedi_device *dev)
 {
 	DPRINTK("adv_pci1710 EDBG: BGN: pci1720_reset(...)\n");
-	outb(Syncont_SC0, dev->iobase + PCI1720_SYNCONT);	// set synchronous output mode
+	outb(Syncont_SC0, dev->iobase + PCI1720_SYNCONT);	/*  set synchronous output mode */
 	devpriv->da_ranges = 0xAA;
-	outb(devpriv->da_ranges, dev->iobase + PCI1720_RANGE);	// set all ranges to +/-5V
-	outw(0x0800, dev->iobase + PCI1720_DA0);	// set outputs to 0V
+	outb(devpriv->da_ranges, dev->iobase + PCI1720_RANGE);	/*  set all ranges to +/-5V */
+	outw(0x0800, dev->iobase + PCI1720_DA0);	/*  set outputs to 0V */
 	outw(0x0800, dev->iobase + PCI1720_DA1);
 	outw(0x0800, dev->iobase + PCI1720_DA2);
 	outw(0x0800, dev->iobase + PCI1720_DA3);
-	outb(0, dev->iobase + PCI1720_SYNCOUT);	// update outputs
+	outb(0, dev->iobase + PCI1720_SYNCOUT);	/*  update outputs */
 	devpriv->ao_data[0] = 0x0800;
 	devpriv->ao_data[1] = 0x0800;
 	devpriv->ao_data[2] = 0x0800;
@@ -1301,7 +1303,7 @@ static int pci1720_reset(struct comedi_device * dev)
 /*
 ==============================================================================
 */
-static int pci1710_reset(struct comedi_device * dev)
+static int pci1710_reset(struct comedi_device *dev)
 {
 	DPRINTK("adv_pci1710 EDBG: BGN: pci1710_reset(...)\n");
 	switch (this_board->cardtype) {
@@ -1316,7 +1318,7 @@ static int pci1710_reset(struct comedi_device * dev)
 /*
 ==============================================================================
 */
-static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int pci1710_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct comedi_subdevice *s;
 	int ret, subdev, n_subdevices;
@@ -1329,13 +1331,14 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 	int i;
 	int board_index;
 
-	rt_printk("comedi%d: adv_pci1710: ", dev->minor);
+	printk("comedi%d: adv_pci1710: ", dev->minor);
 
 	opt_bus = it->options[0];
 	opt_slot = it->options[1];
 
-	if ((ret = alloc_private(dev, sizeof(struct pci1710_private))) < 0) {
-		rt_printk(" - Allocation failed!\n");
+	ret = alloc_private(dev, sizeof(struct pci1710_private));
+	if (ret < 0) {
+		printk(" - Allocation failed!\n");
 		return -ENOMEM;
 	}
 
@@ -1345,20 +1348,20 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 	board_index = this_board - boardtypes;
 	while (NULL != (pcidev = pci_get_device(PCI_VENDOR_ID_ADVANTECH,
 		PCI_ANY_ID, pcidev))) {
-		if(strcmp(this_board->name, DRV_NAME) == 0)
+		if (strcmp (this_board->name, DRV_NAME) == 0)
 		{
-			for(i = 0; i < n_boardtypes; ++i)
+			for (i = 0; i < n_boardtypes; ++i)
 			{
-				if(pcidev->device == boardtypes[i].device_id)
+				if (pcidev->device == boardtypes[i].device_id)
 				{
 					board_index = i;
 					break;
 				}
 			}
-			if(i == n_boardtypes) continue;
+			if (i == n_boardtypes) continue;
 		}else
 		{
-			if(pcidev->device != boardtypes[board_index].device_id) continue;
+			if (pcidev->device != boardtypes[board_index].device_id) continue;
 		}
 
 		/* Found matching vendor/device. */
@@ -1376,17 +1379,17 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 			errstr = "failed to enable PCI device and request regions!";
 			continue;
 		}
-		// fixup board_ptr in case we were using the dummy entry with the driver name
+		/*  fixup board_ptr in case we were using the dummy entry with the driver name */
 		dev->board_ptr = &boardtypes[board_index];
 		break;
 	}
 
 	if (!pcidev) {
 		if (opt_bus || opt_slot) {
-			rt_printk(" - Card at b:s %d:%d %s\n",
+			printk(" - Card at b:s %d:%d %s\n",
 				opt_bus, opt_slot, errstr);
 		} else {
-			rt_printk(" - Card %s\n", errstr);
+			printk(" - Card %s\n", errstr);
 		}
 		return -EIO;
 	}
@@ -1397,7 +1400,7 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 	irq = pcidev->irq;
 	iobase = pci_resource_start(pcidev, 2);
 
-	rt_printk(", b:s:f=%d:%d:%d, io=0x%4lx", pci_bus, pci_slot, pci_func,
+	printk(", b:s:f=%d:%d:%d, io=0x%4lx", pci_bus, pci_slot, pci_func,
 		iobase);
 
 	dev->iobase = iobase;
@@ -1417,8 +1420,9 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 	if (this_board->n_counter)
 		n_subdevices++;
 
-	if ((ret = alloc_subdevices(dev, n_subdevices)) < 0) {
-		rt_printk(" - Allocation failed!\n");
+	ret = alloc_subdevices(dev, n_subdevices);
+	if (ret < 0) {
+		printk(" - Allocation failed!\n");
 		return ret;
 	}
 
@@ -1426,18 +1430,18 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 
 	if (this_board->have_irq) {
 		if (irq) {
-			if (comedi_request_irq(irq, interrupt_service_pci1710,
+			if (request_irq(irq, interrupt_service_pci1710,
 					IRQF_SHARED, "Advantech PCI-1710",
 					dev)) {
-				rt_printk
+				printk
 					(", unable to allocate IRQ %d, DISABLING IT",
 					irq);
 				irq = 0;	/* Can't use IRQ */
 			} else {
-				rt_printk(", irq=%u", irq);
+				printk(", irq=%u", irq);
 			}
 		} else {
-			rt_printk(", IRQ disabled");
+			printk(", IRQ disabled");
 		}
 	} else {
 		irq = 0;
@@ -1467,7 +1471,7 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 			s->do_cmdtest = pci171x_ai_cmdtest;
 			s->do_cmd = pci171x_ai_cmd;
 		}
-		devpriv->i8254_osc_base = 100;	// 100ns=10MHz
+		devpriv->i8254_osc_base = 100;	/*  100ns=10MHz */
 		subdev++;
 	}
 
@@ -1540,14 +1544,14 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 /*
 ==============================================================================
 */
-static int pci1710_detach(struct comedi_device * dev)
+static int pci1710_detach(struct comedi_device *dev)
 {
 
 	if (dev->private) {
 		if (devpriv->valid)
 			pci1710_reset(dev);
 		if (dev->irq)
-			comedi_free_irq(dev->irq, dev);
+			free_irq(dev->irq, dev);
 		if (devpriv->pcidev) {
 			if (dev->iobase) {
 				comedi_pci_disable(devpriv->pcidev);

+ 62 - 60
drivers/staging/comedi/drivers/adv_pci1723.c

@@ -54,7 +54,7 @@ configures all channels in the same group.
 
 #define ADVANTECH_VENDOR        0x13fe	/* Advantech PCI vendor ID */
 
-// hardware types of the cards
+/* hardware types of the cards */
 #define TYPE_PCI1723 0
 
 #define IORANGE_1723  0x2A
@@ -92,7 +92,7 @@ configures all channels in the same group.
 
 #define PCI1723_SELECT_CALIBRATION 0x28	/* Select the calibration Ref_V */
 
-//static unsigned short pci_list_builded=0;     /*=1 list of card is know */
+/* static unsigned short pci_list_builded=0;      =1 list of card is know */
 
 static const struct comedi_lrange range_pci1723 = { 1, {
 			BIP_RANGE(10)
@@ -104,27 +104,27 @@ static const struct comedi_lrange range_pci1723 = { 1, {
  */
 struct pci1723_board {
 	const char *name;
-	int vendor_id;		// PCI vendor a device ID of card
+	int vendor_id;		/*  PCI vendor a device ID of card */
 	int device_id;
 	int iorange;
 	char cardtype;
-	int n_aochan;		// num of D/A chans
-	int n_diochan;		// num of DIO chans
-	int ao_maxdata;		// resolution of D/A
-	const struct comedi_lrange *rangelist_ao;	// rangelist for D/A
+	int n_aochan;		/*  num of D/A chans */
+	int n_diochan;		/*  num of DIO chans */
+	int ao_maxdata;		/*  resolution of D/A */
+	const struct comedi_lrange *rangelist_ao;	/*  rangelist for D/A */
 };
 
 static const struct pci1723_board boardtypes[] = {
 	{
-	      name:	"pci1723",
-	      vendor_id:ADVANTECH_VENDOR,
-	      device_id:0x1723,
-	      iorange:	IORANGE_1723,
-	      cardtype:TYPE_PCI1723,
-	      n_aochan:8,
-	      n_diochan:16,
-	      ao_maxdata:0xffff,
-	      rangelist_ao:&range_pci1723,
+	.name = "pci1723",
+	.vendor_id = ADVANTECH_VENDOR,
+	.device_id = 0x1723,
+	.iorange = IORANGE_1723,
+	.cardtype = TYPE_PCI1723,
+	.n_aochan = 8,
+	.n_diochan = 16,
+	.ao_maxdata = 0xffff,
+	.rangelist_ao = &range_pci1723,
 		},
 };
 
@@ -143,26 +143,26 @@ MODULE_DEVICE_TABLE(pci, pci1723_pci_table);
  * the board, and also about the kernel module that contains
  * the device code.
  */
-static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig * it);
-static int pci1723_detach(struct comedi_device * dev);
+static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it);
+static int pci1723_detach(struct comedi_device *dev);
 
 #define n_boardtypes (sizeof(boardtypes)/sizeof(struct pci1723_board))
 
 static struct comedi_driver driver_pci1723 = {
-      driver_name:"adv_pci1723",
-      module:THIS_MODULE,
-      attach:pci1723_attach,
-      detach:pci1723_detach,
+	.driver_name = "adv_pci1723",
+	.module = THIS_MODULE,
+	.attach = pci1723_attach,
+	.detach = pci1723_detach,
 };
 
 /* this structure is for data unique to this hardware driver. */
 struct pci1723_private {
-	int valid;		//card is usable;
+	int valid;		/* card is usable; */
 
 	struct pci_dev *pcidev;
-	unsigned char da_range[8];	// D/A output range for each channel
+	unsigned char da_range[8];	/*  D/A output range for each channel */
 
-	short ao_data[8];	// data output buffer
+	short ao_data[8];	/*  data output buffer */
 };
 
 /*the following macro to make it easy to
@@ -175,35 +175,35 @@ struct pci1723_private {
 /*
  *   the pci1723 card reset;
  */
-static int pci1723_reset(struct comedi_device * dev)
+static int pci1723_reset(struct comedi_device *dev)
 {
 	int i;
 	DPRINTK("adv_pci1723 EDBG: BGN: pci1723_reset(...)\n");
 
-	outw(0x01, dev->iobase + PCI1723_SYN_SET);	// set synchronous output mode
+	outw(0x01, dev->iobase + PCI1723_SYN_SET);	/*  set synchronous output mode */
 
 	for (i = 0; i < 8; i++) {
-		// set all outputs to 0V
+		/*  set all outputs to 0V */
 		devpriv->ao_data[i] = 0x8000;
 		outw(devpriv->ao_data[i], dev->iobase + PCI1723_DA(i));
-		// set all ranges to +/- 10V
+		/*  set all ranges to +/- 10V */
 		devpriv->da_range[i] = 0;
 		outw(((devpriv->da_range[i] << 4) | i),
 			PCI1723_RANGE_CALIBRATION_MODE);
 	}
 
-	outw(0, dev->iobase + PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE);	// update ranges
-	outw(0, dev->iobase + PCI1723_SYN_STROBE);	// update outputs
+	outw(0, dev->iobase + PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE);	/*  update ranges */
+	outw(0, dev->iobase + PCI1723_SYN_STROBE);	/*  update outputs */
 
-	// set asynchronous output mode
+	/*  set asynchronous output mode */
 	outw(0, dev->iobase + PCI1723_SYN_SET);
 
 	DPRINTK("adv_pci1723 EDBG: END: pci1723_reset(...)\n");
 	return 0;
 }
 
-static int pci1723_insn_read_ao(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci1723_insn_read_ao(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int n, chan;
 
@@ -218,8 +218,8 @@ static int pci1723_insn_read_ao(struct comedi_device * dev, struct comedi_subdev
 /*
   analog data output;
 */
-static int pci1723_ao_write_winsn(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci1723_ao_write_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int n, chan;
 	chan = CR_CHAN(insn->chanspec);
@@ -238,8 +238,8 @@ static int pci1723_ao_write_winsn(struct comedi_device * dev, struct comedi_subd
 /*
   digital i/o config/query
 */
-static int pci1723_dio_insn_config(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci1723_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	unsigned int mask;
 	unsigned int bits;
@@ -265,12 +265,12 @@ static int pci1723_dio_insn_config(struct comedi_device * dev, struct comedi_sub
 		return -EINVAL;
 	}
 
-	// update hardware DIO mode
-	dio_mode = 0x0000;	// low byte output, high byte output
+	/*  update hardware DIO mode */
+	dio_mode = 0x0000;	/*  low byte output, high byte output */
 	if ((s->io_bits & 0x00FF) == 0)
-		dio_mode |= 0x0001;	// low byte input
+		dio_mode |= 0x0001;	/*  low byte input */
 	if ((s->io_bits & 0xFF00) == 0)
-		dio_mode |= 0x0002;	// high byte input
+		dio_mode |= 0x0002;	/*  high byte input */
 	outw(dio_mode, dev->iobase + PCI1723_DIGITAL_IO_PORT_SET);
 	return 1;
 }
@@ -278,8 +278,8 @@ static int pci1723_dio_insn_config(struct comedi_device * dev, struct comedi_sub
 /*
   digital i/o bits read/write
 */
-static int pci1723_dio_insn_bits(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci1723_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	if (data[0]) {
 		s->state &= ~data[0];
@@ -294,7 +294,7 @@ static int pci1723_dio_insn_bits(struct comedi_device * dev, struct comedi_subde
  * Attach is called by the Comedi core to configure the driver
  * for a pci1723 board.
  */
-static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct comedi_subdevice *s;
 	int ret, subdev, n_subdevices;
@@ -304,14 +304,15 @@ static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig *
 	int opt_bus, opt_slot;
 	const char *errstr;
 
-	rt_printk("comedi%d: adv_pci1723: board=%s", dev->minor,
+	printk("comedi%d: adv_pci1723: board=%s", dev->minor,
 		this_board->name);
 
 	opt_bus = it->options[0];
 	opt_slot = it->options[1];
 
-	if ((ret = alloc_private(dev, sizeof(struct pci1723_private))) < 0) {
-		rt_printk(" - Allocation failed!\n");
+	ret = alloc_private(dev, sizeof(struct pci1723_private));
+	if (ret < 0) {
+		printk(" - Allocation failed!\n");
 		return -ENOMEM;
 	}
 
@@ -341,10 +342,10 @@ static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig *
 
 	if (!pcidev) {
 		if (opt_bus || opt_slot) {
-			rt_printk(" - Card at b:s %d:%d %s\n",
+			printk(" - Card at b:s %d:%d %s\n",
 				opt_bus, opt_slot, errstr);
 		} else {
-			rt_printk(" - Card %s\n", errstr);
+			printk(" - Card %s\n", errstr);
 		}
 		return -EIO;
 	}
@@ -354,7 +355,7 @@ static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig *
 	pci_func = PCI_FUNC(pcidev->devfn);
 	iobase = pci_resource_start(pcidev, 2);
 
-	rt_printk(", b:s:f=%d:%d:%d, io=0x%4x", pci_bus, pci_slot, pci_func,
+	printk(", b:s:f=%d:%d:%d, io=0x%4x", pci_bus, pci_slot, pci_func,
 		iobase);
 
 	dev->iobase = iobase;
@@ -369,8 +370,9 @@ static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig *
 	if (this_board->n_diochan)
 		n_subdevices++;
 
-	if ((ret = alloc_subdevices(dev, n_subdevices)) < 0) {
-		rt_printk(" - Allocation failed!\n");
+	ret = alloc_subdevices(dev, n_subdevices);
+	if (ret < 0) {
+		printk(" - Allocation failed!\n");
 		return ret;
 	}
 
@@ -389,22 +391,22 @@ static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig *
 		s->insn_write = pci1723_ao_write_winsn;
 		s->insn_read = pci1723_insn_read_ao;
 
-		// read DIO config
+		/*  read DIO config */
 		switch (inw(dev->iobase + PCI1723_DIGITAL_IO_PORT_MODE) & 0x03) {
-		case 0x00:	// low byte output, high byte output
+		case 0x00:	/*  low byte output, high byte output */
 			s->io_bits = 0xFFFF;
 			break;
-		case 0x01:	// low byte input, high byte output
+		case 0x01:	/*  low byte input, high byte output */
 			s->io_bits = 0xFF00;
 			break;
-		case 0x02:	// low byte output, high byte input
+		case 0x02:	/*  low byte output, high byte input */
 			s->io_bits = 0x00FF;
 			break;
-		case 0x03:	// low byte input, high byte input
+		case 0x03:	/*  low byte input, high byte input */
 			s->io_bits = 0x0000;
 			break;
 		}
-		// read DIO port state
+		/*  read DIO port state */
 		s->state = inw(dev->iobase + PCI1723_READ_DIGITAL_INPUT_DATA);
 
 		subdev++;
@@ -439,7 +441,7 @@ static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig *
  * allocated by _attach().  dev->private and dev->subdevices are
  * deallocated automatically by the core.
  */
-static int pci1723_detach(struct comedi_device * dev)
+static int pci1723_detach(struct comedi_device *dev)
 {
 	printk("comedi%d: pci1723: remove\n", dev->minor);
 

+ 60 - 52
drivers/staging/comedi/drivers/adv_pci_dio.c

@@ -40,7 +40,7 @@ Configuration options:
 
 #undef DPRINTK
 #ifdef PCI_DIO_EXTDEBUG
-#define DPRINTK(fmt, args...) rt_printk(fmt, ## args)
+#define DPRINTK(fmt, args...) printk(fmt, ## args)
 #else
 #define DPRINTK(fmt, args...)
 #endif
@@ -183,8 +183,8 @@ enum hw_io_access {
 
 #define OMBCMD_RETRY	0x03	/* 3 times try request before error */
 
-static int pci_dio_attach(struct comedi_device * dev, struct comedi_devconfig * it);
-static int pci_dio_detach(struct comedi_device * dev);
+static int pci_dio_attach(struct comedi_device *dev, struct comedi_devconfig *it);
+static int pci_dio_detach(struct comedi_device *dev);
 
 struct diosubd_data {
 	int chans;		/*  num of chans */
@@ -323,10 +323,10 @@ static const struct dio_boardtype boardtypes[] = {
 #define n_boardtypes (sizeof(boardtypes)/sizeof(struct dio_boardtype))
 
 static struct comedi_driver driver_pci_dio = {
-      driver_name:"adv_pci_dio",
-      module:THIS_MODULE,
-      attach:pci_dio_attach,
-      detach:pci_dio_detach
+	.driver_name = "adv_pci_dio",
+	.module = THIS_MODULE,
+	.attach = pci_dio_attach,
+	.detach = pci_dio_detach
 };
 
 struct pci_dio_private {
@@ -357,8 +357,8 @@ static struct pci_dio_private *pci_priv = NULL;	/* list of allocated cards */
 /*
 ==============================================================================
 */
-static int pci_dio_insn_bits_di_b(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci_dio_insn_bits_di_b(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	const struct diosubd_data *d = (const struct diosubd_data *)s->private;
 	int i;
@@ -374,8 +374,8 @@ static int pci_dio_insn_bits_di_b(struct comedi_device * dev, struct comedi_subd
 /*
 ==============================================================================
 */
-static int pci_dio_insn_bits_di_w(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci_dio_insn_bits_di_w(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	const struct diosubd_data *d = (const struct diosubd_data *)s->private;
 	int i;
@@ -390,8 +390,8 @@ static int pci_dio_insn_bits_di_w(struct comedi_device * dev, struct comedi_subd
 /*
 ==============================================================================
 */
-static int pci_dio_insn_bits_do_b(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci_dio_insn_bits_do_b(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	const struct diosubd_data *d = (const struct diosubd_data *)s->private;
 	int i;
@@ -411,8 +411,8 @@ static int pci_dio_insn_bits_do_b(struct comedi_device * dev, struct comedi_subd
 /*
 ==============================================================================
 */
-static int pci_dio_insn_bits_do_w(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci_dio_insn_bits_do_w(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	const struct diosubd_data *d = (const struct diosubd_data *)s->private;
 	int i;
@@ -432,7 +432,7 @@ static int pci_dio_insn_bits_do_w(struct comedi_device * dev, struct comedi_subd
 /*
 ==============================================================================
 */
-static int pci1760_unchecked_mbxrequest(struct comedi_device * dev,
+static int pci1760_unchecked_mbxrequest(struct comedi_device *dev,
 	unsigned char *omb, unsigned char *imb, int repeats)
 {
 	int cnt, tout, ok = 0;
@@ -443,14 +443,15 @@ static int pci1760_unchecked_mbxrequest(struct comedi_device * dev,
 		outb(omb[2], dev->iobase + OMB2);
 		outb(omb[3], dev->iobase + OMB3);
 		for (tout = 0; tout < 251; tout++) {
-			if ((imb[2] = inb(dev->iobase + IMB2)) == omb[2]) {
+			imb[2] = inb(dev->iobase + IMB2);
+			if (imb[2] == omb[2]) {
 				imb[0] = inb(dev->iobase + IMB0);
 				imb[1] = inb(dev->iobase + IMB1);
 				imb[3] = inb(dev->iobase + IMB3);
 				ok = 1;
 				break;
 			}
-			comedi_udelay(1);
+			udelay(1);
 		}
 		if (ok)
 			return 0;
@@ -460,7 +461,7 @@ static int pci1760_unchecked_mbxrequest(struct comedi_device * dev,
 	return -ETIME;
 }
 
-static int pci1760_clear_imb2(struct comedi_device * dev)
+static int pci1760_clear_imb2(struct comedi_device *dev)
 {
 	unsigned char omb[4] = { 0x0, 0x0, CMD_ClearIMB2, 0x0 };
 	unsigned char imb[4];
@@ -470,7 +471,7 @@ static int pci1760_clear_imb2(struct comedi_device * dev)
 	return pci1760_unchecked_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
 }
 
-static int pci1760_mbxrequest(struct comedi_device * dev,
+static int pci1760_mbxrequest(struct comedi_device *dev,
 	unsigned char *omb, unsigned char *imb)
 {
 	if (omb[2] == CMD_ClearIMB2) {
@@ -490,8 +491,8 @@ static int pci1760_mbxrequest(struct comedi_device * dev,
 /*
 ==============================================================================
 */
-static int pci1760_insn_bits_di(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci1760_insn_bits_di(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	data[1] = inb(dev->iobase + IMB3);
 
@@ -501,8 +502,8 @@ static int pci1760_insn_bits_di(struct comedi_device * dev, struct comedi_subdev
 /*
 ==============================================================================
 */
-static int pci1760_insn_bits_do(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci1760_insn_bits_do(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int ret;
 	unsigned char omb[4] = {
@@ -517,7 +518,8 @@ static int pci1760_insn_bits_do(struct comedi_device * dev, struct comedi_subdev
 		s->state &= ~data[0];
 		s->state |= (data[0] & data[1]);
 		omb[0] = s->state;
-		if (!(ret = pci1760_mbxrequest(dev, omb, imb)))
+		ret = pci1760_mbxrequest(dev, omb, imb);
+		if (!ret)
 			return ret;
 	}
 	data[1] = s->state;
@@ -528,8 +530,8 @@ static int pci1760_insn_bits_do(struct comedi_device * dev, struct comedi_subdev
 /*
 ==============================================================================
 */
-static int pci1760_insn_cnt_read(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci1760_insn_cnt_read(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int ret, n;
 	unsigned char omb[4] = {
@@ -541,7 +543,8 @@ static int pci1760_insn_cnt_read(struct comedi_device * dev, struct comedi_subde
 	unsigned char imb[4];
 
 	for (n = 0; n < insn->n; n++) {
-		if (!(ret = pci1760_mbxrequest(dev, omb, imb)))
+		ret = pci1760_mbxrequest(dev, omb, imb);
+		if (!ret)
 			return ret;
 		data[n] = (imb[1] << 8) + imb[0];
 	}
@@ -552,8 +555,8 @@ static int pci1760_insn_cnt_read(struct comedi_device * dev, struct comedi_subde
 /*
 ==============================================================================
 */
-static int pci1760_insn_cnt_write(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int pci1760_insn_cnt_write(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int ret;
 	unsigned char chan = CR_CHAN(insn->chanspec) & 0x07;
@@ -567,20 +570,23 @@ static int pci1760_insn_cnt_write(struct comedi_device * dev, struct comedi_subd
 	unsigned char imb[4];
 
 	if (devpriv->CntResValue[chan] != (data[0] & 0xffff)) {	/*  Set reset value if different */
-		if (!(ret = pci1760_mbxrequest(dev, omb, imb)))
+		ret =  pci1760_mbxrequest(dev, omb, imb);
+		if (!ret)
 			return ret;
 		devpriv->CntResValue[chan] = data[0] & 0xffff;
 	}
 
 	omb[0] = bitmask;	/*  reset counter to it reset value */
 	omb[2] = CMD_ResetIDICounters;
-	if (!(ret = pci1760_mbxrequest(dev, omb, imb)))
+	ret = pci1760_mbxrequest(dev, omb, imb);
+	if (!ret)
 		return ret;
 
 	if (!(bitmask & devpriv->IDICntEnable)) {	/*  start counter if it don't run */
 		omb[0] = bitmask;
 		omb[2] = CMD_EnableIDICounters;
-		if (!(ret = pci1760_mbxrequest(dev, omb, imb)))
+		ret = pci1760_mbxrequest(dev, omb, imb);
+		if (!ret)
 			return ret;
 		devpriv->IDICntEnable |= bitmask;
 	}
@@ -590,7 +596,7 @@ static int pci1760_insn_cnt_write(struct comedi_device * dev, struct comedi_subd
 /*
 ==============================================================================
 */
-static int pci1760_reset(struct comedi_device * dev)
+static int pci1760_reset(struct comedi_device *dev)
 {
 	int i;
 	unsigned char omb[4] = { 0x00, 0x00, 0x00, 0x00 };
@@ -667,7 +673,7 @@ static int pci1760_reset(struct comedi_device * dev)
 /*
 ==============================================================================
 */
-static int pci_dio_reset(struct comedi_device * dev)
+static int pci_dio_reset(struct comedi_device *dev)
 {
 	DPRINTK("adv_pci_dio EDBG: BGN: pci171x_reset(...)\n");
 
@@ -750,7 +756,7 @@ static int pci_dio_reset(struct comedi_device * dev)
 /*
 ==============================================================================
 */
-static int pci1760_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int pci1760_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct comedi_subdevice *s;
 	int subdev = 0;
@@ -802,8 +808,8 @@ static int pci1760_attach(struct comedi_device * dev, struct comedi_devconfig *
 /*
 ==============================================================================
 */
-static int pci_dio_add_di(struct comedi_device * dev, struct comedi_subdevice * s,
-	const struct diosubd_data * d, int subdev)
+static int pci_dio_add_di(struct comedi_device *dev, struct comedi_subdevice *s,
+	const struct diosubd_data *d, int subdev)
 {
 	s->type = COMEDI_SUBD_DI;
 	s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON | d->specflags;
@@ -829,8 +835,8 @@ static int pci_dio_add_di(struct comedi_device * dev, struct comedi_subdevice *
 /*
 ==============================================================================
 */
-static int pci_dio_add_do(struct comedi_device * dev, struct comedi_subdevice * s,
-	const struct diosubd_data * d, int subdev)
+static int pci_dio_add_do(struct comedi_device *dev, struct comedi_subdevice *s,
+	const struct diosubd_data *d, int subdev)
 {
 	s->type = COMEDI_SUBD_DO;
 	s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
@@ -857,7 +863,7 @@ static int pci_dio_add_do(struct comedi_device * dev, struct comedi_subdevice *
 /*
 ==============================================================================
 */
-static int CheckAndAllocCard(struct comedi_device * dev, struct comedi_devconfig * it,
+static int CheckAndAllocCard(struct comedi_device *dev, struct comedi_devconfig *it,
 	struct pci_dev *pcidev)
 {
 	struct pci_dio_private *pr, *prev;
@@ -883,17 +889,18 @@ static int CheckAndAllocCard(struct comedi_device * dev, struct comedi_devconfig
 /*
 ==============================================================================
 */
-static int pci_dio_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int pci_dio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	struct comedi_subdevice *s;
 	int ret, subdev, n_subdevices, i, j;
 	unsigned long iobase;
 	struct pci_dev *pcidev;
 
-	rt_printk("comedi%d: adv_pci_dio: ", dev->minor);
+	printk("comedi%d: adv_pci_dio: ", dev->minor);
 
-	if ((ret = alloc_private(dev, sizeof(struct pci_dio_private))) < 0) {
-		rt_printk(", Error: Cann't allocate private memory!\n");
+	ret = alloc_private(dev, sizeof(struct pci_dio_private));
+	if (ret < 0) {
+		printk(", Error: Cann't allocate private memory!\n");
 		return -ENOMEM;
 	}
 
@@ -925,18 +932,18 @@ static int pci_dio_attach(struct comedi_device * dev, struct comedi_devconfig *
 	}
 
 	if (!dev->board_ptr) {
-		rt_printk
+		printk
 			(", Error: Requested type of the card was not found!\n");
 		return -EIO;
 	}
 
 	if (comedi_pci_enable(pcidev, driver_pci_dio.driver_name)) {
-		rt_printk
+		printk
 			(", Error: Can't enable PCI device and request regions!\n");
 		return -EIO;
 	}
 	iobase = pci_resource_start(pcidev, this_board->main_pci_region);
-	rt_printk(", b:s:f=%d:%d:%d, io=0x%4lx",
+	printk(", b:s:f=%d:%d:%d, io=0x%4lx",
 		pcidev->bus->number, PCI_SLOT(pcidev->devfn),
 		PCI_FUNC(pcidev->devfn), iobase);
 
@@ -959,12 +966,13 @@ static int pci_dio_attach(struct comedi_device * dev, struct comedi_devconfig *
 			n_subdevices++;
 	}
 
-	if ((ret = alloc_subdevices(dev, n_subdevices)) < 0) {
-		rt_printk(", Error: Cann't allocate subdevice memory!\n");
+	ret = alloc_subdevices(dev, n_subdevices);
+	if (ret < 0) {
+		printk(", Error: Cann't allocate subdevice memory!\n");
 		return ret;
 	}
 
-	rt_printk(".\n");
+	printk(".\n");
 
 	subdev = 0;
 
@@ -1011,7 +1019,7 @@ static int pci_dio_attach(struct comedi_device * dev, struct comedi_devconfig *
 /*
 ==============================================================================
 */
-static int pci_dio_detach(struct comedi_device * dev)
+static int pci_dio_detach(struct comedi_device *dev)
 {
 	int i, j;
 	struct comedi_subdevice *s;

+ 23 - 23
drivers/staging/comedi/drivers/aio_aio12_8.c

@@ -77,7 +77,7 @@ struct aio12_8_boardtype {
 
 static const struct aio12_8_boardtype board_types[] = {
 	{
-      name:	"aio_aio12_8"},
+	.name = "aio_aio12_8"},
 };
 
 #define	thisboard	((const struct aio12_8_boardtype  *) dev->board_ptr)
@@ -88,29 +88,29 @@ struct aio12_8_private {
 
 #define devpriv	((struct aio12_8_private *) dev->private)
 
-static int aio_aio12_8_ai_read(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int aio_aio12_8_ai_read(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int n;
 	unsigned char control =
 		ADC_MODE_NORMAL |
 		(CR_RANGE(insn->chanspec) << 3) | CR_CHAN(insn->chanspec);
 
-	//read status to clear EOC latch
+	/* read status to clear EOC latch */
 	inb(dev->iobase + AIO12_8_STATUS);
 
 	for (n = 0; n < insn->n; n++) {
 		int timeout = 5;
 
-		// Setup and start conversion
+		/*  Setup and start conversion */
 		outb(control, dev->iobase + AIO12_8_ADC);
 
-		// Wait for conversion to complete
+		/*  Wait for conversion to complete */
 		while (timeout &&
 			!(inb(dev->iobase + AIO12_8_STATUS) & STATUS_ADC_EOC)) {
 			timeout--;
 			printk("timeout %d\n", timeout);
-			comedi_udelay(1);
+			udelay(1);
 		}
 		if (timeout == 0) {
 			comedi_error(dev, "ADC timeout");
@@ -122,8 +122,8 @@ static int aio_aio12_8_ai_read(struct comedi_device * dev, struct comedi_subdevi
 	return n;
 }
 
-static int aio_aio12_8_ao_read(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int aio_aio12_8_ao_read(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int i;
 	int val = devpriv->ao_readback[CR_CHAN(insn->chanspec)];
@@ -133,19 +133,19 @@ static int aio_aio12_8_ao_read(struct comedi_device * dev, struct comedi_subdevi
 	return insn->n;
 }
 
-static int aio_aio12_8_ao_write(struct comedi_device * dev, struct comedi_subdevice * s,
-	struct comedi_insn * insn, unsigned int * data)
+static int aio_aio12_8_ao_write(struct comedi_device *dev, struct comedi_subdevice *s,
+	struct comedi_insn *insn, unsigned int *data)
 {
 	int i;
 	int chan = CR_CHAN(insn->chanspec);
 	unsigned long port = dev->iobase + AIO12_8_DAC_0 + (2 * chan);
 
-	//enable DACs
+	/* enable DACs */
 	outb(0x01, dev->iobase + DAC_ENABLE);
 
 	for (i = 0; i < insn->n; i++) {
-		outb(data[i] & 0xFF, port);	// LSB
-		outb((data[i] >> 8) & 0x0F, port + 1);	// MSB
+		outb(data[i] & 0xFF, port);	/*  LSB */
+		outb((data[i] >> 8) & 0x0F, port + 1);	/*  MSB */
 		devpriv->ao_readback[chan] = data[i];
 	}
 	return insn->n;
@@ -161,7 +161,7 @@ static const struct comedi_lrange range_aio_aio12_8 = {
 		}
 };
 
-static int aio_aio12_8_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int aio_aio12_8_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	int iobase;
 	struct comedi_subdevice *s;
@@ -205,7 +205,7 @@ static int aio_aio12_8_attach(struct comedi_device * dev, struct comedi_devconfi
 	return 0;
 }
 
-static int aio_aio12_8_detach(struct comedi_device * dev)
+static int aio_aio12_8_detach(struct comedi_device *dev)
 {
 	subdev_8255_cleanup(dev, &dev->subdevices[2]);
 	if (dev->iobase)
@@ -214,13 +214,13 @@ static int aio_aio12_8_detach(struct comedi_device * dev)
 }
 
 static struct comedi_driver driver_aio_aio12_8 = {
-      driver_name:"aio_aio12_8",
-      module:THIS_MODULE,
-      attach:aio_aio12_8_attach,
-      detach:aio_aio12_8_detach,
-      board_name:&board_types[0].name,
-      num_names:1,
-      offset:sizeof(struct aio12_8_boardtype),
+	.driver_name = "aio_aio12_8",
+	.module = THIS_MODULE,
+	.attach = aio_aio12_8_attach,
+	.detach = aio_aio12_8_detach,
+	.board_name = &board_types[0].name,
+	.num_names = 1,
+	.offset = sizeof(struct aio12_8_boardtype),
 };
 
 COMEDI_INITCLEANUP(driver_aio_aio12_8);

+ 22 - 22
drivers/staging/comedi/drivers/aio_iiro_16.c

@@ -52,9 +52,9 @@ struct aio_iiro_16_board {
 
 static const struct aio_iiro_16_board aio_iiro_16_boards[] = {
 	{
-	      name:	"aio_iiro_16",
-	      di:	16,
-      do_:	16},
+	.name = "aio_iiro_16",
+	.di = 16,
+	.do_ = 16},
 };
 
 #define	thisboard	((const struct aio_iiro_16_board *) dev->board_ptr)
@@ -67,27 +67,27 @@ struct aio_iiro_16_private {
 
 #define	devpriv	((struct aio_iiro_16_private *) dev->private)
 
-static int aio_iiro_16_attach(struct comedi_device * dev, struct comedi_devconfig * it);
+static int aio_iiro_16_attach(struct comedi_device *dev, struct comedi_devconfig *it);
 
-static int aio_iiro_16_detach(struct comedi_device * dev);
+static int aio_iiro_16_detach(struct comedi_device *dev);
 
 static struct comedi_driver driver_aio_iiro_16 = {
-      driver_name:"aio_iiro_16",
-      module:THIS_MODULE,
-      attach:aio_iiro_16_attach,
-      detach:aio_iiro_16_detach,
-      board_name:&aio_iiro_16_boards[0].name,
-      offset:sizeof(struct aio_iiro_16_board),
-      num_names:sizeof(aio_iiro_16_boards) / sizeof(struct aio_iiro_16_board),
+	.driver_name = "aio_iiro_16",
+	.module = THIS_MODULE,
+	.attach = aio_iiro_16_attach,
+	.detach = aio_iiro_16_detach,
+	.board_name = &aio_iiro_16_boards[0].name,
+	.offset = sizeof(struct aio_iiro_16_board),
+	.num_names = ARRAY_SIZE(aio_iiro_16_boards),
 };
 
-static int aio_iiro_16_dio_insn_bits_read(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data);
+static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
 
-static int aio_iiro_16_dio_insn_bits_write(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data);
+static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
 
-static int aio_iiro_16_attach(struct comedi_device * dev, struct comedi_devconfig * it)
+static int aio_iiro_16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
 	int iobase;
 	struct comedi_subdevice *s;
@@ -132,7 +132,7 @@ static int aio_iiro_16_attach(struct comedi_device * dev, struct comedi_devconfi
 	return 1;
 }
 
-static int aio_iiro_16_detach(struct comedi_device * dev)
+static int aio_iiro_16_detach(struct comedi_device *dev)
 {
 	printk("comedi%d: aio_iiro_16: remove\n", dev->minor);
 
@@ -142,8 +142,8 @@ static int aio_iiro_16_detach(struct comedi_device * dev)
 	return 0;
 }
 
-static int aio_iiro_16_dio_insn_bits_write(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 	if (insn->n != 2)
 		return -EINVAL;
@@ -161,8 +161,8 @@ static int aio_iiro_16_dio_insn_bits_write(struct comedi_device * dev,
 	return 2;
 }
 
-static int aio_iiro_16_dio_insn_bits_read(struct comedi_device * dev,
-	struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data)
+static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev,
+	struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
 {
 	if (insn->n != 2)
 		return -EINVAL;

+ 8 - 8
drivers/staging/comedi/drivers/am9513.h

@@ -46,33 +46,33 @@
 
 #ifdef Am9513_8BITBUS
 
-#define Am9513_write_register(reg,val)				\
+#define Am9513_write_register(reg, val)				\
 	do{							\
 		Am9513_output_control(reg);			\
 		Am9513_output_data(val>>8);			\
 		Am9513_output_data(val&0xff);			\
-	}while(0)
+	}while (0)
 
-#define Am9513_read_register(reg,val)				\
+#define Am9513_read_register(reg, val)				\
 	do{							\
 		Am9513_output_control(reg);			\
 		val=Am9513_input_data()<<8;			\
 		val|=Am9513_input_data();			\
-	}while(0)
+	}while (0)
 
 #else /* Am9513_16BITBUS */
 
-#define Am9513_write_register(reg,val)				\
+#define Am9513_write_register(reg, val)				\
 	do{							\
 		Am9513_output_control(reg);			\
 		Am9513_output_data(val);			\
-	}while(0)
+	}while (0)
 
-#define Am9513_read_register(reg,val)				\
+#define Am9513_read_register(reg, val)				\
 	do{							\
 		Am9513_output_control(reg);			\
 		val=Am9513_input_data();			\
-	}while(0)
+	}while (0)
 
 #endif
 

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác