Quellcode durchsuchen

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 vor 16 Jahren
Ursprung
Commit
fb20871a54
100 geänderte Dateien mit 6561 neuen und 6194 gelöschten Zeilen
  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. 200 200
      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. 205 205
      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. 234 234
      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. 200 200
      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. 258 227
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
  81. 75 67
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h
  82. 370 377
      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. 215 215
      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
 P:	Greg Kroah-Hartman
 M:	gregkh@suse.de
 M:	gregkh@suse.de
 T:	quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
 T:	quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
+L:	devel@driverdev.osuosl.org
 S:	Maintained
 S:	Maintained
 F:	drivers/staging/
 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/rtl8187se/Kconfig"
 
 
+source "drivers/staging/rtl8192su/Kconfig"
+
 source "drivers/staging/rspiusb/Kconfig"
 source "drivers/staging/rspiusb/Kconfig"
 
 
 source "drivers/staging/mimio/Kconfig"
 source "drivers/staging/mimio/Kconfig"
@@ -113,11 +115,19 @@ source "drivers/staging/heci/Kconfig"
 
 
 source "drivers/staging/line6/Kconfig"
 source "drivers/staging/line6/Kconfig"
 
 
-source "drivers/staging/serqt_usb/Kconfig"
-
 source "drivers/gpu/drm/radeon/Kconfig"
 source "drivers/gpu/drm/radeon/Kconfig"
 
 
 source "drivers/staging/octeon/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_EXCLUDE_BUILD
 endif # STAGING
 endif # STAGING

+ 6 - 1
drivers/staging/Makefile

@@ -25,6 +25,7 @@ obj-$(CONFIG_ASUS_OLED)		+= asus_oled/
 obj-$(CONFIG_PANEL)		+= panel/
 obj-$(CONFIG_PANEL)		+= panel/
 obj-$(CONFIG_ALTERA_PCIE_CHDMA)	+= altpciechdma/
 obj-$(CONFIG_ALTERA_PCIE_CHDMA)	+= altpciechdma/
 obj-$(CONFIG_RTL8187SE)		+= rtl8187se/
 obj-$(CONFIG_RTL8187SE)		+= rtl8187se/
+obj-$(CONFIG_RTL8192SU)		+= rtl8192su/
 obj-$(CONFIG_USB_RSPI)		+= rspiusb/
 obj-$(CONFIG_USB_RSPI)		+= rspiusb/
 obj-$(CONFIG_INPUT_MIMIO)	+= mimio/
 obj-$(CONFIG_INPUT_MIMIO)	+= mimio/
 obj-$(CONFIG_TRANZPORT)		+= frontier/
 obj-$(CONFIG_TRANZPORT)		+= frontier/
@@ -39,5 +40,9 @@ obj-$(CONFIG_IDE_PHISON)	+= phison/
 obj-$(CONFIG_PLAN9AUTH)		+= p9auth/
 obj-$(CONFIG_PLAN9AUTH)		+= p9auth/
 obj-$(CONFIG_HECI)		+= heci/
 obj-$(CONFIG_HECI)		+= heci/
 obj-$(CONFIG_LINE6_USB)		+= line6/
 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_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;
 	u16 fctl;
 	int hdrlen;
 	int hdrlen;
-	DECLARE_MAC_BUF(mac);
 
 
 	fctl = le16_to_cpu(hdr->frame_control);
 	fctl = le16_to_cpu(hdr->frame_control);
 	switch (fctl & IEEE80211_FCTL_FTYPE) {
 	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",
 		printk("FC=0x%04x DUR=0x%04x",
 		       fctl, le16_to_cpu(hdr->duration_id));
 		       fctl, le16_to_cpu(hdr->duration_id));
 	if (hdrlen >= 10)
 	if (hdrlen >= 10)
-		printk(" A1=%s", print_mac(mac, hdr->addr1));
+		printk(" A1=%pM", hdr->addr1);
 	if (hdrlen >= 16)
 	if (hdrlen >= 16)
-		printk(" A2=%s", print_mac(mac, hdr->addr2));
+		printk(" A2=%pM", hdr->addr2);
 	if (hdrlen >= 24)
 	if (hdrlen >= 24)
-		printk(" A3=%s", print_mac(mac, hdr->addr3));
+		printk(" A3=%pM", hdr->addr3);
 	if (hdrlen >= 30)
 	if (hdrlen >= 30)
-		printk(" A4=%s", print_mac(mac, hdr->addr4));
+		printk(" A4=%pM", hdr->addr4);
 	printk("\n");
 	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;
 			*reason |= AGNX_STAT_TXM;
 		}
 		}
 	}
 	}
-/*	if (*reason & AGNX_STAT_X) {
+#if 0
+	if (*reason & AGNX_STAT_X) {
 		reg = ioread32(ctl + AGNX_INT_STAT);
 		reg = ioread32(ctl + AGNX_INT_STAT);
 		iowrite32(reg, ctl + AGNX_INT_STAT);
 		iowrite32(reg, ctl + AGNX_INT_STAT);
-		/* FIXME reinit interrupt mask *\/
+		/* FIXME reinit interrupt mask */
 		reg = 0xc390bf9 & ~IRQ_TX_BEACON;
 		reg = 0xc390bf9 & ~IRQ_TX_BEACON;
 		reg &= ~IRQ_TX_DISABLE;
 		reg &= ~IRQ_TX_DISABLE;
 		iowrite32(reg, ctl + AGNX_INT_MASK);
 		iowrite32(reg, ctl + AGNX_INT_MASK);
 		iowrite32(0x800, ctl + AGNX_CIR_BLKCTL);
 		iowrite32(0x800, ctl + AGNX_CIR_BLKCTL);
-	} */
+	}
+#endif
 } /* agnx_interrupt_ack */
 } /* agnx_interrupt_ack */
 
 
 static irqreturn_t agnx_interrupt_handler(int irq, void *dev_id)
 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);
 	*((u32 *)(priv->mac_addr + 2)) = cpu_to_le32(reg);
 
 
 	if (!is_valid_ether_addr(priv->mac_addr)) {
 	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");
 		printk(KERN_WARNING PFX "Invalid hwaddr! Using random hwaddr\n");
 		random_ether_addr(priv->mac_addr);
 		random_ether_addr(priv->mac_addr);
 	}
 	}
@@ -220,7 +221,7 @@ static void agnx_periodic_work_handler(struct work_struct *work)
 	/* TODO Recalibrate*/
 	/* TODO Recalibrate*/
 /*	calibrate_oscillator(priv); */
 /*	calibrate_oscillator(priv); */
 /*	antenna_calibrate(priv); */
 /*	antenna_calibrate(priv); */
-/*	agnx_send_packet(priv, 997); /
+/*	agnx_send_packet(priv, 997); */
 	/* FIXME */
 	/* FIXME */
 /* 	if (debug == 3) */
 /* 	if (debug == 3) */
 /*                 delay = msecs_to_jiffies(AGNX_PERIODIC_DELAY); */
 /*                 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 ieee80211_hw *dev;
 	struct agnx_priv *priv;
 	struct agnx_priv *priv;
-	u32 mem_addr0, mem_len0;
-	u32 mem_addr1, mem_len1;
 	int err;
 	int err;
-	DECLARE_MAC_BUF(mac);
 
 
 	err = pci_enable_device(pdev);
 	err = pci_enable_device(pdev);
 	if (err) {
 	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;
 		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");
 	err = pci_request_regions(pdev, "agnx-pci");
 	if (err) {
 	if (err) {
-		printk(KERN_ERR PFX "Can't obtain PCI resource\n");
+		dev_err(&pdev->dev, "can't reserve PCI resources\n");
 		return err;
 		return err;
 	}
 	}
 
 
 	if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) ||
 	if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) ||
 	    pci_set_consistent_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;
 		goto err_free_reg;
 	}
 	}
 
 
 	pci_set_master(pdev);
 	pci_set_master(pdev);
-	printk(KERN_DEBUG PFX "pdev->irq is %d\n", pdev->irq);
 
 
 	dev = ieee80211_alloc_hw(sizeof(*priv), &agnx_ops);
 	dev = ieee80211_alloc_hw(sizeof(*priv), &agnx_ops);
 	if (!dev) {
 	if (!dev) {
-		printk(KERN_ERR PFX "ieee80211 alloc failed\n");
+		dev_err(&pdev->dev, "ieee80211 alloc failed\n");
 		err = -ENOMEM;
 		err = -ENOMEM;
 		goto err_free_reg;
 		goto err_free_reg;
 	}
 	}
-	/* init priv  */
 	priv = dev->priv;
 	priv = dev->priv;
 	memset(priv, 0, sizeof(*priv));
 	memset(priv, 0, sizeof(*priv));
 	priv->mode = NL80211_IFTYPE_MONITOR;
 	priv->mode = NL80211_IFTYPE_MONITOR;
@@ -504,17 +493,17 @@ static int __devinit agnx_pci_probe(struct pci_dev *pdev,
 	spin_lock_init(&priv->lock);
 	spin_lock_init(&priv->lock);
 	priv->init_status = AGNX_UNINIT;
 	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) {
 	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;
 		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) {
 	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;
 		goto err_iounmap2;
 	}
 	}
 
 
@@ -555,15 +544,15 @@ static int __devinit agnx_pci_probe(struct pci_dev *pdev,
 
 
 	err = ieee80211_register_hw(dev);
 	err = ieee80211_register_hw(dev);
 	if (err) {
 	if (err) {
-		printk(KERN_ERR PFX "Can't register hardware\n");
+		dev_err(&pdev->dev, "can't register hardware\n");
 		goto err_iounmap;
 		goto err_iounmap;
 	}
 	}
 
 
 	agnx_hw_reset(priv);
 	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;
 	return 0;
 
 
  err_iounmap:
  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);
 	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;
 	void __iomem *ctl = priv->ctl;
 	u32 reg;
 	u32 reg;
@@ -954,7 +954,7 @@ int agnx_set_ssid(struct agnx_priv *priv, u8 *ssid, size_t ssid_len)
 	return 0;
 	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);
 	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);
 void agnx_hw_init(struct agnx_priv *priv);
 int agnx_hw_reset(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);
 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 enable_power_saving(struct agnx_priv *priv);
 void disable_power_saving(struct agnx_priv *priv);
 void disable_power_saving(struct agnx_priv *priv);
 void calibrate_antenna_period(unsigned long data);
 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);
 	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;
 	void __iomem *ctl = priv->ctl;
 	u32 reghi, reglo;
 	u32 reghi, reglo;

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

@@ -201,7 +201,7 @@ struct agnx_beacon_hdr {
 	/* 802.11(abg) beacon */
 	/* 802.11(abg) beacon */
 } __attribute__((__packed__));
 } __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_dump(struct agnx_priv *priv, u8 sta_id);
 void hash_read(struct agnx_priv *priv, u32 reghi, u32 reglo, 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);
 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));
 	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.
  * 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++;
 	j++;
 	return j;
 	return j;
 }
 }
+#endif
 
 
 /* compare buffers */
 /* compare buffers */
 static inline int compare(u32 *p, u32 *q, int len)
 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");
 		printk(KERN_DEBUG "Could not allocate coherent DMA buffer.\n");
 		goto fail;
 		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 */
 	/* fill first half of buffer with its virtual address as data */
 	for (i = 0; i < 4 * PAGE_SIZE; i += 4)
 	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;
 		goto err_ape;
 	}
 	}
 	ape->pci_dev = dev;
 	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 "probe() ape = 0x%p\n", ape);
 
 
 	printk(KERN_DEBUG "sizeof(struct ape_chdma_table) = %d.\n",
 	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;
 		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 */
 	/* enable device */
 	rc = pci_enable_device(dev);
 	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;
 	rc = 0;
 	printk(KERN_DEBUG "probe() successful.\n");
 	printk(KERN_DEBUG "probe() successful.\n");
 	goto end;
 	goto end;
+#if ALTPCIECHDMA_CDEV
 err_cdev:
 err_cdev:
 	/* unmap the BARs */
 	/* unmap the BARs */
 	unmap_bars(ape, dev);
 	unmap_bars(ape, dev);
+#endif
 err_map:
 err_map:
 	/* free allocated irq */
 	/* free allocated irq */
 	if (ape->irq_line >= 0)
 	if (ape->irq_line >= 0)
@@ -930,7 +934,7 @@ err_irq:
 		pci_release_regions(dev);
 		pci_release_regions(dev);
 err_mask:
 err_mask:
 err_regions:
 err_regions:
-err_rev:
+/*err_rev:*/
 /* clean up everything before device enable() */
 /* clean up everything before device enable() */
 err_enable:
 err_enable:
 	if (ape->table_virt)
 	if (ape->table_virt)
@@ -946,19 +950,11 @@ end:
 
 
 static void __devexit remove(struct pci_dev *dev)
 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);
 	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 */
 	/* remove character device */
 #if ALTPCIECHDMA_CDEV
 #if ALTPCIECHDMA_CDEV
 	sg_exit(ape);
 	sg_exit(ape);
@@ -1151,7 +1147,7 @@ static struct pci_driver pci_driver = {
 	.name = DRV_NAME,
 	.name = DRV_NAME,
 	.id_table = ids,
 	.id_table = ids,
 	.probe = probe,
 	.probe = probe,
-	.remove = remove,
+	.remove = __devexit_p(remove),
 	/* resume, suspend are optional */
 	/* resume, suspend are optional */
 };
 };
 
 

+ 9 - 1
drivers/staging/android/Kconfig

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

+ 1 - 0
drivers/staging/android/Makefile

@@ -1,5 +1,6 @@
 obj-$(CONFIG_ANDROID_BINDER_IPC)	+= binder.o
 obj-$(CONFIG_ANDROID_BINDER_IPC)	+= binder.o
 obj-$(CONFIG_ANDROID_LOGGER)		+= logger.o
 obj-$(CONFIG_ANDROID_LOGGER)		+= logger.o
 obj-$(CONFIG_ANDROID_RAM_CONSOLE)	+= ram_console.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_TIMED_GPIO)	+= timed_gpio.o
 obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER)	+= lowmemorykiller.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 HLIST_HEAD(binder_deferred_list);
 static DEFINE_MUTEX(binder_deferred_lock);
 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 */
 /* This is only defined in include/asm-arm/sizes.h */
 #ifndef SZ_1K
 #ifndef SZ_1K
@@ -81,12 +81,15 @@ enum {
 static uint32_t binder_debug_mask = BINDER_DEBUG_USER_ERROR |
 static uint32_t binder_debug_mask = BINDER_DEBUG_USER_ERROR |
 	BINDER_DEBUG_FAILED_TRANSACTION | BINDER_DEBUG_DEAD_TRANSACTION;
 	BINDER_DEBUG_FAILED_TRANSACTION | BINDER_DEBUG_DEAD_TRANSACTION;
 module_param_named(debug_mask, binder_debug_mask, uint, S_IWUSR | S_IRUGO);
 module_param_named(debug_mask, binder_debug_mask, uint, S_IWUSR | S_IRUGO);
+
 static int binder_debug_no_lock;
 static int binder_debug_no_lock;
 module_param_named(proc_no_lock, binder_debug_no_lock, bool, S_IWUSR | S_IRUGO);
 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 DECLARE_WAIT_QUEUE_HEAD(binder_user_error_wait);
 static int binder_stop_on_user_error;
 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;
 	int ret;
 	ret = param_set_int(val, kp);
 	ret = param_set_int(val, kp);
@@ -185,13 +188,13 @@ struct binder_node {
 	int local_strong_refs;
 	int local_strong_refs;
 	void __user *ptr;
 	void __user *ptr;
 	void __user *cookie;
 	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;
 	struct list_head async_todo;
 };
 };
 
 
@@ -221,10 +224,10 @@ struct binder_buffer {
 	struct list_head entry; /* free and allocated entries by addesss */
 	struct list_head entry; /* free and allocated entries by addesss */
 	struct rb_node rb_node; /* free entry by size or allocated entry */
 	struct rb_node rb_node; /* free entry by size or allocated entry */
 				/* by address */
 				/* 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;
 	struct binder_transaction *transaction;
 
 
@@ -306,8 +309,8 @@ struct binder_transaction {
 	struct binder_proc *to_proc;
 	struct binder_proc *to_proc;
 	struct binder_thread *to_thread;
 	struct binder_thread *to_thread;
 	struct binder_transaction *to_parent;
 	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;
 	struct binder_buffer *buffer;
 	unsigned int	code;
 	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);
 	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))
 	if (list_is_last(&buffer->entry, &proc->buffers))
 		return proc->buffer + proc->buffer_size - (void *)buffer->data;
 		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;
 			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 **p = &proc->free_buffers.rb_node;
 	struct rb_node *parent = NULL;
 	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);
 	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 **p = &proc->allocated_buffers.rb_node;
 	struct rb_node *parent = NULL;
 	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);
 	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 rb_node *n = proc->allocated_buffers.rb_node;
 	struct binder_buffer *buffer;
 	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,
 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;
 	void *page_addr;
 	unsigned long user_page_addr;
 	unsigned long user_page_addr;
@@ -664,7 +668,8 @@ err_no_vma:
 }
 }
 
 
 static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
 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 rb_node *n = proc->free_buffers.rb_node;
 	struct binder_buffer *buffer;
 	struct binder_buffer *buffer;
@@ -692,8 +697,9 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
 	if (is_async &&
 	if (is_async &&
 	    proc->free_async_space < size + sizeof(struct binder_buffer)) {
 	    proc->free_async_space < size + sizeof(struct binder_buffer)) {
 		if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
 		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;
 		return NULL;
 	}
 	}
 
 
@@ -777,8 +783,8 @@ static void *buffer_end_page(struct binder_buffer *buffer)
 	return (void *)(((uintptr_t)(buffer + 1) - 1) & PAGE_MASK);
 	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;
 	struct binder_buffer *prev, *next = NULL;
 	int free_page_end = 1;
 	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;
 	size_t size, buffer_size;
 
 
@@ -877,8 +883,8 @@ static void binder_free_buf(
 	binder_insert_free_buffer(proc, buffer);
 	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 rb_node *n = proc->nodes.rb_node;
 	struct binder_node *node;
 	struct binder_node *node;
@@ -896,8 +902,9 @@ binder_get_node(struct binder_proc *proc, void __user *ptr)
 	return NULL;
 	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 **p = &proc->nodes.rb_node;
 	struct rb_node *parent = NULL;
 	struct rb_node *parent = NULL;
@@ -935,9 +942,8 @@ binder_new_node(struct binder_proc *proc, void __user *ptr, void __user *cookie)
 	return node;
 	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 (strong) {
 		if (internal) {
 		if (internal) {
@@ -971,8 +977,7 @@ binder_inc_node(struct binder_node *node, int strong, int internal,
 	return 0;
 	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 (strong) {
 		if (internal)
 		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 rb_node *n = proc->refs_by_desc.rb_node;
 	struct binder_ref *ref;
 	struct binder_ref *ref;
@@ -1033,8 +1038,8 @@ binder_get_ref(struct binder_proc *proc, uint32_t desc)
 	return NULL;
 	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 *n;
 	struct rb_node **p = &proc->refs_by_node.rb_node;
 	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;
 	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)
 	if (binder_debug_mask & BINDER_DEBUG_INTERNAL_REFS)
 		printk(KERN_INFO "binder: %d delete ref %d desc %d for "
 		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]++;
 	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;
 	int ret;
 	if (strong) {
 	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 (strong) {
 		if (ref->strong == 0) {
 		if (ref->strong == 0) {
@@ -1182,9 +1184,8 @@ binder_dec_ref(struct binder_ref *ref, int strong)
 	return 0;
 	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) {
 	if (target_thread) {
 		BUG_ON(target_thread->transaction_stack != t);
 		BUG_ON(target_thread->transaction_stack != t);
@@ -1200,8 +1201,8 @@ binder_pop_transaction(
 	binder_stats.obj_deleted[BINDER_STAT_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;
 	struct binder_thread *target_thread;
 	BUG_ON(t->flags & TF_ONE_WAY);
 	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_transaction *t;
 	struct binder_work *tcomplete;
 	struct binder_work *tcomplete;
@@ -1661,8 +1662,9 @@ err_no_context_mgr_node:
 		thread->return_error = return_error;
 		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;
 	size_t *offp, *off_end;
 	int debug_id = buffer->debug_id;
 	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;
 	uint32_t cmd;
 	void __user *ptr = buffer + *consumed;
 	void __user *ptr = buffer + *consumed;
@@ -2104,7 +2105,8 @@ binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
 		} break;
 		} break;
 
 
 		default:
 		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;
 			return -EINVAL;
 		}
 		}
 		*consumed = ptr - buffer;
 		*consumed = ptr - buffer;
@@ -2112,8 +2114,8 @@ binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
 	return 0;
 	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)) {
 	if (_IOC_NR(cmd) < ARRAY_SIZE(binder_stats.br)) {
 		binder_stats.br[_IOC_NR(cmd)]++;
 		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 ||
 	return !list_empty(&thread->todo) || thread->return_error != BR_OK ||
 		(thread->looper & BINDER_LOOPER_STATE_NEED_RETURN);
 		(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 *ptr = buffer + *consumed;
 	void __user *end = buffer + size;
 	void __user *end = buffer + size;
@@ -2152,7 +2155,8 @@ binder_thread_read(struct binder_proc *proc, struct binder_thread *thread,
 	}
 	}
 
 
 retry:
 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_error != BR_OK && ptr < end) {
 		if (thread->return_error2 != BR_OK) {
 		if (thread->return_error2 != BR_OK) {
@@ -2182,7 +2186,8 @@ retry:
 				"for process work before calling BC_REGISTER_"
 				"for process work before calling BC_REGISTER_"
 				"LOOPER or BC_ENTER_LOOPER (state %x)\n",
 				"LOOPER or BC_ENTER_LOOPER (state %x)\n",
 				proc->pid, thread->pid, thread->looper);
 				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);
 		binder_set_nice(proc->default_priority);
 		if (non_block) {
 		if (non_block) {
@@ -2304,8 +2309,10 @@ retry:
 		case BINDER_WORK_DEAD_BINDER:
 		case BINDER_WORK_DEAD_BINDER:
 		case BINDER_WORK_DEAD_BINDER_AND_CLEAR:
 		case BINDER_WORK_DEAD_BINDER_AND_CLEAR:
 		case BINDER_WORK_CLEAR_DEATH_NOTIFICATION: {
 		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;
 			uint32_t cmd;
+
+			death = container_of(w, struct binder_ref_death, work);
 			if (w->type == BINDER_WORK_CLEAR_DEATH_NOTIFICATION)
 			if (w->type == BINDER_WORK_CLEAR_DEATH_NOTIFICATION)
 				cmd = BR_CLEAR_DEATH_NOTIFICATION_DONE;
 				cmd = BR_CLEAR_DEATH_NOTIFICATION_DONE;
 			else
 			else
@@ -2362,15 +2369,19 @@ retry:
 
 
 		if (t->from) {
 		if (t->from) {
 			struct task_struct *sender = t->from->proc->tsk;
 			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 {
 		} else {
 			tr.sender_pid = 0;
 			tr.sender_pid = 0;
 		}
 		}
 
 
 		tr.data_size = t->buffer->data_size;
 		tr.data_size = t->buffer->data_size;
 		tr.offsets_size = t->buffer->offsets_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))
 		if (put_user(cmd, (uint32_t __user *)ptr))
 			return -EFAULT;
 			return -EFAULT;
@@ -2384,7 +2395,8 @@ retry:
 			printk(KERN_INFO "binder: %d:%d %s %d %d:%d, cmd %d"
 			printk(KERN_INFO "binder: %d:%d %s %d %d:%d, cmd %d"
 				"size %zd-%zd ptr %p-%p\n",
 				"size %zd-%zd ptr %p-%p\n",
 			       proc->pid, thread->pid,
 			       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->debug_id, t->from ? t->from->proc->pid : 0,
 			       t->from ? t->from->pid : 0, cmd,
 			       t->from ? t->from->pid : 0, cmd,
 			       t->buffer->data_size, t->buffer->offsets_size,
 			       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);
 		list_del_init(&w->entry);
 		switch (w->type) {
 		switch (w->type) {
 		case BINDER_WORK_TRANSACTION: {
 		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))
 			if (t->buffer->target_node && !(t->flags & TF_ONE_WAY))
 				binder_send_failed_reply(t, BR_DEAD_REPLY);
 				binder_send_failed_reply(t, BR_DEAD_REPLY);
 		} break;
 		} break;
@@ -2480,7 +2494,8 @@ static struct binder_thread *binder_get_thread(struct binder_proc *proc)
 	return thread;
 	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 *t;
 	struct binder_transaction *send_reply = NULL;
 	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) {
 	while (t) {
 		active_transactions++;
 		active_transactions++;
 		if (binder_debug_mask & BINDER_DEBUG_DEAD_TRANSACTION)
 		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) {
 		if (t->to_thread == thread) {
 			t->to_proc = NULL;
 			t->to_proc = NULL;
 			t->to_thread = 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;
 	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_proc *proc = filp->private_data;
 	struct binder_thread *thread = NULL;
 	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->files = get_files_struct(current);
 	proc->vma = vma;
 	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;
 	return 0;
 
 
 err_alloc_small_buf_failed:
 err_alloc_small_buf_failed:
@@ -2790,7 +2809,8 @@ err_alloc_pages_failed:
 err_get_vm_area_failed:
 err_get_vm_area_failed:
 err_already_mapped:
 err_already_mapped:
 err_bad_arg:
 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;
 	return ret;
 }
 }
 
 
@@ -2799,7 +2819,8 @@ static int binder_open(struct inode *nodp, struct file *filp)
 	struct binder_proc *proc;
 	struct binder_proc *proc;
 
 
 	if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
 	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);
 	proc = kzalloc(sizeof(*proc), GFP_KERNEL);
 	if (proc == NULL)
 	if (proc == NULL)
@@ -2821,7 +2842,9 @@ static int binder_open(struct inode *nodp, struct file *filp)
 		char strbuf[11];
 		char strbuf[11];
 		snprintf(strbuf, sizeof(strbuf), "%u", proc->pid);
 		snprintf(strbuf, sizeof(strbuf), "%u", proc->pid);
 		remove_proc_entry(strbuf, binder_proc_dir_entry_proc);
 		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;
 	return 0;
@@ -2925,12 +2948,15 @@ static void binder_deferred_release(struct binder_proc *proc)
 				}
 				}
 			}
 			}
 			if (binder_debug_mask & BINDER_DEBUG_DEAD_BINDER)
 			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;
 	outgoing_refs = 0;
 	while ((n = rb_first(&proc->refs_by_desc))) {
 	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++;
 		outgoing_refs++;
 		binder_delete_ref(ref);
 		binder_delete_ref(ref);
 	}
 	}
@@ -2938,12 +2964,15 @@ static void binder_deferred_release(struct binder_proc *proc)
 	buffers = 0;
 	buffers = 0;
 
 
 	while ((n = rb_first(&proc->allocated_buffers))) {
 	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;
 		t = buffer->transaction;
 		if (t) {
 		if (t) {
 			t->buffer = NULL;
 			t->buffer = NULL;
 			buffer->transaction = 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();*/
 			/*BUG();*/
 		}
 		}
 		binder_free_buf(proc, buffer);
 		binder_free_buf(proc, buffer);
@@ -2957,8 +2986,13 @@ static void binder_deferred_release(struct binder_proc *proc)
 		int i;
 		int i;
 		for (i = 0; i < proc->buffer_size / PAGE_SIZE; i++) {
 		for (i = 0; i < proc->buffer_size / PAGE_SIZE; i++) {
 			if (proc->pages[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]);
 				__free_page(proc->pages[i]);
 				page_count++;
 				page_count++;
 			}
 			}
@@ -2970,8 +3004,12 @@ static void binder_deferred_release(struct binder_proc *proc)
 	put_task_struct(proc->tsk);
 	put_task_struct(proc->tsk);
 
 
 	if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
 	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);
 	kfree(proc);
 }
 }
@@ -2998,9 +3036,11 @@ static void binder_deferred_func(struct work_struct *work)
 		mutex_unlock(&binder_deferred_lock);
 		mutex_unlock(&binder_deferred_lock);
 
 
 		files = NULL;
 		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;
 				proc->files = NULL;
+		}
 
 
 		if (defer & BINDER_DEFERRED_FLUSH)
 		if (defer & BINDER_DEFERRED_FLUSH)
 			binder_deferred_flush(proc);
 			binder_deferred_flush(proc);
@@ -3027,10 +3067,14 @@ static void binder_defer_work(struct binder_proc *proc, int defer)
 	mutex_unlock(&binder_deferred_lock);
 	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->from ? t->from->pid : 0,
 			t->to_proc ? t->to_proc->pid : 0,
 			t->to_proc ? t->to_proc->pid : 0,
 			t->to_thread ? t->to_thread->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;
 	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",
 	buf += snprintf(buf, end - buf, "%s %d: %p size %zd:%zd %s\n",
 			prefix, buffer->debug_id, buffer->data,
 			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,
 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_node *node;
 	struct binder_transaction *t;
 	struct binder_transaction *t;
@@ -3080,7 +3126,8 @@ static char *print_binder_work(char *buf, char *end, const char *prefix,
 	case BINDER_WORK_NODE:
 	case BINDER_WORK_NODE:
 		node = container_of(w, struct binder_node, work);
 		node = container_of(w, struct binder_node, work);
 		buf += snprintf(buf, end - buf, "%snode work %d: u%p c%p\n",
 		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;
 		break;
 	case BINDER_WORK_DEAD_BINDER:
 	case BINDER_WORK_DEAD_BINDER:
 		buf += snprintf(buf, end - buf, "%shas dead binder\n", prefix);
 		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;
 	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_transaction *t;
 	struct binder_work *w;
 	struct binder_work *w;
 	char *start_buf = buf;
 	char *start_buf = buf;
 	char *header_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;
 	header_buf = buf;
 	t = thread->transaction_stack;
 	t = thread->transaction_stack;
 	while (t) {
 	while (t) {
 		if (buf >= end)
 		if (buf >= end)
 			break;
 			break;
 		if (t->from == thread) {
 		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;
 			t = t->from_parent;
 		} else if (t->to_thread == thread) {
 		} 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;
 			t = t->to_parent;
 		} else {
 		} else {
-			buf = print_binder_transaction(buf, end, "    bad transaction", t);
+			buf = print_binder_transaction(buf, end,
+						"    bad transaction", t);
 			t = NULL;
 			t = NULL;
 		}
 		}
 	}
 	}
@@ -3142,11 +3195,14 @@ static char *print_binder_node(char *buf, char *end, struct binder_node *node)
 	struct hlist_node *pos;
 	struct hlist_node *pos;
 	struct binder_work *w;
 	struct binder_work *w;
 	int count;
 	int count;
+
 	count = 0;
 	count = 0;
 	hlist_for_each_entry(ref, pos, &node->refs, node_entry)
 	hlist_for_each_entry(ref, pos, &node->refs, node_entry)
 		count++;
 		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->debug_id, node->ptr, node->cookie,
 			node->has_strong_ref, node->has_weak_ref,
 			node->has_strong_ref, node->has_weak_ref,
 			node->local_strong_refs, node->local_weak_refs,
 			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)
 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;
 	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 binder_work *w;
 	struct rb_node *n;
 	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);
 	buf += snprintf(buf, end - buf, "proc %d\n", proc->pid);
 	header_buf = buf;
 	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)
 		if (print_all || node->has_async_transaction)
 			buf = print_binder_node(buf, end, node);
 			buf = print_binder_node(buf, end, node);
 	}
 	}
 	if (print_all) {
 	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) {
 	list_for_each_entry(w, &proc->todo, entry) {
 		if (buf >= end)
 		if (buf >= end)
 			break;
 			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) {
 	list_for_each_entry(w, &proc->delivered_death, entry) {
 		if (buf >= end)
 		if (buf >= end)
 			break;
 			break;
-		buf += snprintf(buf, end - buf, "  has delivered dead binder\n");
+		buf += snprintf(buf, end - buf,
+				"  has delivered dead binder\n");
 		break;
 		break;
 	}
 	}
 	if (!print_all && buf == header_buf)
 	if (!print_all && buf == header_buf)
@@ -3272,20 +3347,24 @@ static const char *binder_objstat_strings[] = {
 	"transaction_complete"
 	"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;
 	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++) {
 	for (i = 0; i < ARRAY_SIZE(stats->bc); i++) {
 		if (stats->bc[i])
 		if (stats->bc[i])
 			buf += snprintf(buf, end - buf, "%s%s: %d\n", prefix,
 			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)
 		if (buf >= end)
 			return buf;
 			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++) {
 	for (i = 0; i < ARRAY_SIZE(stats->br); i++) {
 		if (stats->br[i])
 		if (stats->br[i])
 			buf += snprintf(buf, end - buf, "%s%s: %d\n", prefix,
 			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;
 			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++) {
 	for (i = 0; i < ARRAY_SIZE(stats->obj_created); i++) {
 		if (stats->obj_created[i] || stats->obj_deleted[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],
 					binder_objstat_strings[i],
-					stats->obj_created[i] - stats->obj_deleted[i],
+					stats->obj_created[i] -
+						stats->obj_deleted[i],
 					stats->obj_created[i]);
 					stats->obj_created[i]);
 		if (buf >= end)
 		if (buf >= end)
 			return buf;
 			return buf;
@@ -3308,7 +3391,8 @@ static char *print_binder_stats(char *buf, char *end, const char *prefix, struct
 	return buf;
 	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 binder_work *w;
 	struct rb_node *n;
 	struct rb_node *n;
@@ -3340,12 +3424,14 @@ static char *print_binder_proc_stats(char *buf, char *end, struct binder_proc *p
 	strong = 0;
 	strong = 0;
 	weak = 0;
 	weak = 0;
 	for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) {
 	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++;
 		count++;
 		strong += ref->strong;
 		strong += ref->strong;
 		weak += ref->weak;
 		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)
 	if (buf >= end)
 		return buf;
 		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 binder_proc *proc;
 	struct hlist_node *pos;
 	struct hlist_node *pos;
@@ -3424,8 +3510,8 @@ static int binder_read_proc_state(
 	return len < count ? len  : count;
 	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 binder_proc *proc;
 	struct hlist_node *pos;
 	struct hlist_node *pos;
@@ -3464,8 +3550,8 @@ static int binder_read_proc_stats(
 	return len < count ? len  : count;
 	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 binder_proc *proc;
 	struct hlist_node *pos;
 	struct hlist_node *pos;
@@ -3502,8 +3588,8 @@ static int binder_read_proc_transactions(
 	return len < count ? len  : count;
 	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;
 	struct binder_proc *proc = data;
 	int len = 0;
 	int len = 0;
@@ -3533,9 +3619,12 @@ static int binder_read_proc_proc(
 	return len < count ? len  : count;
 	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->debug_id, (e->call_type == 2) ? "reply" :
 			((e->call_type == 1) ? "async" : "call "), e->from_proc,
 			((e->call_type == 1) ? "async" : "call "), e->from_proc,
 			e->from_thread, e->to_proc, e->to_thread, e->to_node,
 			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++) {
 		for (i = log->next; i < ARRAY_SIZE(log->entry); i++) {
 			if (buf >= end)
 			if (buf >= end)
 				break;
 				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++) {
 	for (i = 0; i < log->next; i++) {
 		if (buf >= end)
 		if (buf >= end)
 			break;
 			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;
 	*start = page + off;
@@ -3579,7 +3670,7 @@ static int binder_read_proc_transaction_log(
 	return len < count ? len  : count;
 	return len < count ? len  : count;
 }
 }
 
 
-static struct file_operations binder_fops = {
+static const struct file_operations binder_fops = {
 	.owner = THIS_MODULE,
 	.owner = THIS_MODULE,
 	.poll = binder_poll,
 	.poll = binder_poll,
 	.unlocked_ioctl = binder_ioctl,
 	.unlocked_ioctl = binder_ioctl,
@@ -3601,14 +3692,35 @@ static int __init binder_init(void)
 
 
 	binder_proc_dir_entry_root = proc_mkdir("binder", NULL);
 	binder_proc_dir_entry_root = proc_mkdir("binder", NULL);
 	if (binder_proc_dir_entry_root)
 	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);
 	ret = misc_register(&binder_miscdev);
 	if (binder_proc_dir_entry_root) {
 	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;
 	return ret;
 }
 }

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

@@ -35,7 +35,7 @@
  * mutex 'mutex'.
  * mutex 'mutex'.
  */
  */
 struct logger_log {
 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 */
 	struct miscdevice	misc;	/* misc device representing the log */
 	wait_queue_head_t	wq;	/* wait queue for readers */
 	wait_queue_head_t	wq;	/* wait queue for readers */
 	struct list_head	readers; /* this log's 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.
  * reference counting. The structure is protected by log->mutex.
  */
  */
 struct logger_reader {
 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 */
 	struct list_head	list;	/* entry in logger_log's list */
 	size_t			r_off;	/* current read head offset */
 	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
  * 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.
  * 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) {
 	if (file->f_mode & FMODE_READ) {
 		struct logger_reader *reader = file->private_data;
 		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;
 	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
  * 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;
 	return ret;
 }
 }
 
 
-static struct file_operations logger_fops = {
+static const struct file_operations logger_fops = {
 	.owner = THIS_MODULE,
 	.owner = THIS_MODULE,
 	.read = logger_read,
 	.read = logger_read,
 	.aio_write = logger_aio_write,
 	.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_events, LOGGER_LOG_EVENTS, 256*1024)
 DEFINE_LOGGER_DEVICE(log_radio, LOGGER_LOG_RADIO, 64*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)
 	if (log_main.misc.minor == minor)
 		return &log_main;
 		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 int lowmem_adj_size = 4;
 static size_t lowmem_minfree[6] = {
 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;
 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_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);
 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)
 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 i;
 	int min_adj = OOM_ADJUST_MAX + 1;
 	int min_adj = OOM_ADJUST_MAX + 1;
 	int selected_tasksize = 0;
 	int selected_tasksize = 0;
+	int selected_oom_adj;
 	int array_size = ARRAY_SIZE(lowmem_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;
 		array_size = lowmem_adj_size;
-	if(lowmem_minfree_size < array_size)
+	if (lowmem_minfree_size < array_size)
 		array_size = lowmem_minfree_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];
 			min_adj = lowmem_adj[i];
 			break;
 			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);
 	read_lock(&tasklist_lock);
 	for_each_process(p) {
 	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",
 		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);
 		force_sig(SIGKILL, selected);
 		rem -= selected_tasksize;
 		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);
 	read_unlock(&tasklist_lock);
 	return rem;
 	return rem;
 }
 }

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

@@ -20,7 +20,7 @@
 #include <linux/proc_fs.h>
 #include <linux/proc_fs.h>
 #include <linux/string.h>
 #include <linux/string.h>
 #include <linux/uaccess.h>
 #include <linux/uaccess.h>
-#include <asm/io.h>
+#include <linux/io.h>
 
 
 #ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
 #ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
 #include <linux/rslib.h>
 #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);
 		buffer_size - sizeof(struct ram_console_buffer);
 
 
 	if (ram_console_buffer_size > buffer_size) {
 	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;
 		return 0;
 	}
 	}
 
 
@@ -365,7 +366,7 @@ static ssize_t ram_console_read_old(struct file *file, char __user *buf,
 	return count;
 	return count;
 }
 }
 
 
-static struct file_operations ram_console_file_ops = {
+static const struct file_operations ram_console_file_ops = {
 	.owner = THIS_MODULE,
 	.owner = THIS_MODULE,
 	.read = ram_console_read_old,
 	.read = ram_console_read_old,
 };
 };

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

@@ -20,13 +20,12 @@
 #include <linux/err.h>
 #include <linux/err.h>
 #include <linux/gpio.h>
 #include <linux/gpio.h>
 
 
+#include "timed_output.h"
 #include "timed_gpio.h"
 #include "timed_gpio.h"
 
 
 
 
-static struct class *timed_gpio_class;
-
 struct timed_gpio_data {
 struct timed_gpio_data {
-	struct device *dev;
+	struct timed_output_dev dev;
 	struct hrtimer timer;
 	struct hrtimer timer;
 	spinlock_t lock;
 	spinlock_t lock;
 	unsigned 	gpio;
 	unsigned 	gpio;
@@ -36,70 +35,62 @@ struct timed_gpio_data {
 
 
 static enum hrtimer_restart gpio_timer_func(struct hrtimer *timer)
 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;
 	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);
 		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
 	} 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;
 	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 */
 	/* 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 > 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)
 static int timed_gpio_probe(struct platform_device *pdev)
 {
 {
 	struct timed_gpio_platform_data *pdata = pdev->dev.platform_data;
 	struct timed_gpio_platform_data *pdata = pdev->dev.platform_data;
 	struct timed_gpio *cur_gpio;
 	struct timed_gpio *cur_gpio;
 	struct timed_gpio_data *gpio_data, *gpio_dat;
 	struct timed_gpio_data *gpio_data, *gpio_dat;
-	int i, ret = 0;
+	int i, j, ret = 0;
 
 
 	if (!pdata)
 	if (!pdata)
 		return -EBUSY;
 		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)
 	if (!gpio_data)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
@@ -107,23 +98,26 @@ static int timed_gpio_probe(struct platform_device *pdev)
 		cur_gpio = &pdata->gpios[i];
 		cur_gpio = &pdata->gpios[i];
 		gpio_dat = &gpio_data[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;
 		gpio_dat->timer.function = gpio_timer_func;
 		spin_lock_init(&gpio_dat->lock);
 		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->gpio = cur_gpio->gpio;
 		gpio_dat->max_timeout = cur_gpio->max_timeout;
 		gpio_dat->max_timeout = cur_gpio->max_timeout;
 		gpio_dat->active_low = cur_gpio->active_low;
 		gpio_dat->active_low = cur_gpio->active_low;
 		gpio_direction_output(gpio_dat->gpio, gpio_dat->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);
 	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);
 	struct timed_gpio_data *gpio_data = platform_get_drvdata(pdev);
 	int i;
 	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);
 	kfree(gpio_data);
 
 
@@ -151,22 +143,18 @@ static struct platform_driver timed_gpio_driver = {
 	.probe		= timed_gpio_probe,
 	.probe		= timed_gpio_probe,
 	.remove		= timed_gpio_remove,
 	.remove		= timed_gpio_remove,
 	.driver		= {
 	.driver		= {
-		.name		= "timed-gpio",
+		.name		= TIMED_GPIO_NAME,
 		.owner		= THIS_MODULE,
 		.owner		= THIS_MODULE,
 	},
 	},
 };
 };
 
 
 static int __init timed_gpio_init(void)
 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);
 	return platform_driver_register(&timed_gpio_driver);
 }
 }
 
 
 static void __exit timed_gpio_exit(void)
 static void __exit timed_gpio_exit(void)
 {
 {
-	class_destroy(timed_gpio_class);
 	platform_driver_unregister(&timed_gpio_driver);
 	platform_driver_unregister(&timed_gpio_driver);
 }
 }
 
 

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

@@ -16,10 +16,12 @@
 #ifndef _LINUX_TIMED_GPIO_H
 #ifndef _LINUX_TIMED_GPIO_H
 #define _LINUX_TIMED_GPIO_H
 #define _LINUX_TIMED_GPIO_H
 
 
+#define TIMED_GPIO_NAME "timed-gpio"
+
 struct timed_gpio {
 struct timed_gpio {
 	const char *name;
 	const char *name;
 	unsigned 	gpio;
 	unsigned 	gpio;
-	int     max_timeout;
+	int		max_timeout;
 	u8 		active_low;
 	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;
 	max_offs = odev->width * odev->height;
 
 
 	while (offs < count && odev->buf_offs < max_offs) {
 	while (offs < count && odev->buf_offs < max_offs) {
-		int ret;
+		int ret = 0;
 
 
 		if (buf[offs] == '1' || buf[offs] == '#') {
 		if (buf[offs] == '1' || buf[offs] == '#') {
 			ret = append_values(odev, 1, 1);
 			ret = append_values(odev, 1, 1);

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

@@ -35,14 +35,13 @@
 #include <linux/poll.h>
 #include <linux/poll.h>
 #include <linux/wait.h>
 #include <linux/wait.h>
 #include <linux/mm.h>
 #include <linux/mm.h>
-#include <linux/version.h>
 #include <linux/uaccess.h>
 #include <linux/uaccess.h>
 
 
 static unsigned int b3dfg_nbuf = 2;
 static unsigned int b3dfg_nbuf = 2;
 
 
 module_param_named(buffer_count, b3dfg_nbuf, uint, 0444);
 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_AUTHOR("Daniel Drake <ddrake@brontes3d.com>");
 MODULE_DESCRIPTION("Brontes frame grabber driver");
 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
 	  This is an option for use by developers; most people should
 	  say N here. This enables comedi core and driver debugging.
 	  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
 config COMEDI_PCI_DRIVERS
 	tristate "Comedi PCI drivers"
 	tristate "Comedi PCI drivers"
 	depends on COMEDI && PCI
 	depends on COMEDI && PCI
@@ -29,10 +22,10 @@ config COMEDI_PCI_DRIVERS
 
 
 config COMEDI_PCMCIA_DRIVERS
 config COMEDI_PCMCIA_DRIVERS
 	tristate "Comedi PCMCIA drivers"
 	tristate "Comedi PCMCIA drivers"
-	depends on COMEDI && PCMCIAI
+	depends on COMEDI && PCMCIA && PCCARD
 	default N
 	default N
 	---help---
 	---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
 config COMEDI_USB_DRIVERS
 	tristate "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) += comedi.o
-obj-$(CONFIG_COMEDI_RT) += comedi_rt.o
 
 
 obj-$(CONFIG_COMEDI)	+= kcomedilib/
 obj-$(CONFIG_COMEDI)	+= kcomedilib/
 obj-$(CONFIG_COMEDI)	+= drivers/
 obj-$(CONFIG_COMEDI)	+= drivers/
@@ -11,7 +10,3 @@ comedi-objs :=		\
 	drivers.o	\
 	drivers.o	\
 	comedi_compat32.o \
 	comedi_compat32.o \
 	comedi_ksyms.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_WRITABLE	0x00020000	/* subdevice can be written (e.g. analog output) */
 #define SDF_WRITEABLE	SDF_WRITABLE	/* spelling error in API */
 #define SDF_WRITEABLE	SDF_WRITABLE	/* spelling error in API */
 #define SDF_INTERNAL	0x00040000	/* subdevice does not have externally visible lines */
 #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_GROUND	0x00100000	/* can do aref=ground */
 #define SDF_COMMON	0x00200000	/* can do aref=common */
 #define SDF_COMMON	0x00200000	/* can do aref=common */
 #define SDF_DIFF	0x00400000	/* can do aref=diff */
 #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 <linux/fs.h>
 #include "comedidev.h"
 #include "comedidev.h"
 #include <linux/cdev.h>
 #include <linux/cdev.h>
+#include <linux/stat.h>
 
 
 #include <linux/io.h>
 #include <linux/io.h>
 #include <linux/uaccess.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 comedi_fasync(int fd, struct file *file, int on);
 
 
 static int is_device_busy(struct comedi_device *dev);
 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
 #ifdef HAVE_UNLOCKED_IOCTL
 static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd,
 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_bufconfig bc;
 	struct comedi_async *async;
 	struct comedi_async *async;
 	struct comedi_subdevice *s;
 	struct comedi_subdevice *s;
-	int ret = 0;
+	int retval = 0;
 
 
 	if (copy_from_user(&bc, arg, sizeof(struct comedi_bufconfig)))
 	if (copy_from_user(&bc, arg, sizeof(struct comedi_bufconfig)))
 		return -EFAULT;
 		return -EFAULT;
@@ -303,37 +313,9 @@ static int do_bufconfig_ioctl(struct comedi_device *dev, void *arg)
 	}
 	}
 
 
 	if (bc.size) {
 	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;
 	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
 	/* by default we allow the insn since we don't have checks for
 	 * all possible cases yet */
 	 * all possible cases yet */
 	default:
 	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"
 			  "%i is implemented.\n"
 			  " Add a check to %s in %s.\n"
 			  " Add a check to %s in %s.\n"
 			  " Assuming n=%i is correct.\n", data[0], __func__,
 			  " 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);
 	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);
 	ret = s->do_cmd(dev, s);
 	if (ret == 0)
 	if (ret == 0)
 		return 0;
 		return 0;
@@ -1237,12 +1212,12 @@ static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg, void *file
 		return -EINVAL;
 		return -EINVAL;
 	s = dev->subdevices + arg;
 	s = dev->subdevices + arg;
 
 
-	comedi_spin_lock_irqsave(&s->spin_lock, flags);
+	spin_lock_irqsave(&s->spin_lock, flags);
 	if (s->busy || s->lock)
 	if (s->busy || s->lock)
 		ret = -EBUSY;
 		ret = -EBUSY;
 	else
 	else
 		s->lock = file;
 		s->lock = file;
-	comedi_spin_unlock_irqrestore(&s->spin_lock, flags);
+	spin_unlock_irqrestore(&s->spin_lock, flags);
 
 
 	if (ret < 0)
 	if (ret < 0)
 		return ret;
 		return ret;
@@ -1738,12 +1713,6 @@ void do_become_nonbusy(struct comedi_device *dev, struct comedi_subdevice *s)
 	struct comedi_async *async = s->async;
 	struct comedi_async *async = s->async;
 
 
 	comedi_set_subdevice_runflags(s, SRF_RUNNING, 0);
 	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) {
 	if (async) {
 		comedi_reset_async_buf(async);
 		comedi_reset_async_buf(async);
 		async->inttrig = NULL;
 		async->inttrig = NULL;
@@ -1970,8 +1939,6 @@ static int __init comedi_init(void)
 		}
 		}
 	}
 	}
 
 
-	comedi_rt_init();
-
 	comedi_register_ioctl32();
 	comedi_register_ioctl32();
 
 
 	return 0;
 	return 0;
@@ -1992,8 +1959,6 @@ static void __exit comedi_cleanup(void)
 
 
 	comedi_proc_cleanup();
 	comedi_proc_cleanup();
 
 
-	comedi_rt_cleanup();
-
 	comedi_unregister_ioctl32();
 	comedi_unregister_ioctl32();
 }
 }
 
 
@@ -2002,8 +1967,7 @@ module_exit(comedi_cleanup);
 
 
 void comedi_error(const struct comedi_device *dev, const char *s)
 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)
 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 (async->cb_mask & s->async->events) {
 		if (comedi_get_subdevice_runflags(s) & SRF_USER) {
 		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 {
 		} else {
 			if (async->cb_func)
 			if (async->cb_func)
 				async->cb_func(s->async->events, async->cb_arg);
 				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;
 	s->async->events = 0;
@@ -2072,10 +2020,10 @@ void comedi_set_subdevice_runflags(struct comedi_subdevice *s, unsigned mask,
 {
 {
 	unsigned long flags;
 	unsigned long flags;
 
 
-	comedi_spin_lock_irqsave(&s->spin_lock, flags);
+	spin_lock_irqsave(&s->spin_lock, flags);
 	s->runflags &= ~mask;
 	s->runflags &= ~mask;
 	s->runflags |= (bits & 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)
 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 long flags;
 	unsigned runflags;
 	unsigned runflags;
 
 
-	comedi_spin_lock_irqsave(&s->spin_lock, flags);
+	spin_lock_irqsave(&s->spin_lock, flags);
 	runflags = s->runflags;
 	runflags = s->runflags;
-	comedi_spin_unlock_irqrestore(&s->spin_lock, flags);
+	spin_unlock_irqrestore(&s->spin_lock, flags);
 	return runflags;
 	return runflags;
 }
 }
 
 
@@ -2132,6 +2080,7 @@ int comedi_alloc_board_minor(struct device *hardware_device)
 	struct comedi_device_file_info *info;
 	struct comedi_device_file_info *info;
 	struct device *csdev;
 	struct device *csdev;
 	unsigned i;
 	unsigned i;
+	int retval;
 
 
 	info = kzalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL);
 	info = kzalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL);
 	if (info == NULL)
 	if (info == NULL)
@@ -2142,20 +2091,19 @@ int comedi_alloc_board_minor(struct device *hardware_device)
 		return -ENOMEM;
 		return -ENOMEM;
 	}
 	}
 	comedi_device_init(info->device);
 	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) {
 	for (i = 0; i < COMEDI_NUM_BOARD_MINORS; ++i) {
 		if (comedi_file_info_table[i] == NULL) {
 		if (comedi_file_info_table[i] == NULL) {
 			comedi_file_info_table[i] = info;
 			comedi_file_info_table[i] = info;
 			break;
 			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) {
 	if (i == COMEDI_NUM_BOARD_MINORS) {
 		comedi_device_cleanup(info->device);
 		comedi_device_cleanup(info->device);
 		kfree(info->device);
 		kfree(info->device);
 		kfree(info);
 		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;
 		return -EBUSY;
 	}
 	}
 	info->device->minor = i;
 	info->device->minor = i;
@@ -2164,7 +2112,35 @@ int comedi_alloc_board_minor(struct device *hardware_device)
 				     hardware_device, "comedi%i", i);
 				     hardware_device, "comedi%i", i);
 	if (!IS_ERR(csdev))
 	if (!IS_ERR(csdev))
 		info->device->class_dev = 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;
 	return i;
 }
 }
 
 
@@ -2174,10 +2150,10 @@ void comedi_free_board_minor(unsigned minor)
 	struct comedi_device_file_info *info;
 	struct comedi_device_file_info *info;
 
 
 	BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS);
 	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];
 	info = comedi_file_info_table[minor];
 	comedi_file_info_table[minor] = NULL;
 	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) {
 	if (info) {
 		struct comedi_device *dev = info->device;
 		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;
 	unsigned long flags;
 	struct comedi_device_file_info *info;
 	struct comedi_device_file_info *info;
 	struct device *csdev;
 	struct device *csdev;
 	unsigned i;
 	unsigned i;
+	int retval;
 
 
 	info = kmalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL);
 	info = kmalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL);
 	if (info == NULL)
 	if (info == NULL)
@@ -2206,18 +2184,17 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, struct comedi_subdev
 	info->device = dev;
 	info->device = dev;
 	info->read_subdevice = s;
 	info->read_subdevice = s;
 	info->write_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) {
 	for (i = COMEDI_FIRST_SUBDEVICE_MINOR; i < COMEDI_NUM_MINORS; ++i) {
 		if (comedi_file_info_table[i] == NULL) {
 		if (comedi_file_info_table[i] == NULL) {
 			comedi_file_info_table[i] = info;
 			comedi_file_info_table[i] = info;
 			break;
 			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) {
 	if (i == COMEDI_NUM_MINORS) {
 		kfree(info);
 		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;
 		return -EBUSY;
 	}
 	}
 	s->minor = i;
 	s->minor = i;
@@ -2227,7 +2204,35 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, struct comedi_subdev
 				     (int)(s - dev->subdevices));
 				     (int)(s - dev->subdevices));
 	if (!IS_ERR(csdev))
 	if (!IS_ERR(csdev))
 		s->class_dev = 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;
 	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_NUM_MINORS);
 	BUG_ON(s->minor < COMEDI_FIRST_SUBDEVICE_MINOR);
 	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];
 	info = comedi_file_info_table[s->minor];
 	comedi_file_info_table[s->minor] = NULL;
 	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) {
 	if (s->class_dev) {
 		device_destroy(comedi_class, MKDEV(COMEDI_MAJOR, s->minor));
 		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;
 	struct comedi_device_file_info *info;
 
 
 	BUG_ON(minor >= COMEDI_NUM_MINORS);
 	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];
 	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;
 	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_unipolar10);
 EXPORT_SYMBOL(range_unipolar5);
 EXPORT_SYMBOL(range_unipolar5);
 EXPORT_SYMBOL(range_unknown);
 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
 #ifdef CONFIG_COMEDI_DEBUG
 EXPORT_SYMBOL(comedi_debug);
 EXPORT_SYMBOL(comedi_debug);
 #endif
 #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/module.h>
 #include <linux/kdev_t.h>
 #include <linux/kdev_t.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/errno.h>
 #include <linux/spinlock.h>
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
 #include <linux/mutex.h>
@@ -35,10 +36,10 @@
 #include <linux/mm.h>
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/vmalloc.h>
 #include <linux/vmalloc.h>
-#include "interrupt.h"
 #include <linux/dma-mapping.h>
 #include <linux/dma-mapping.h>
 #include <linux/uaccess.h>
 #include <linux/uaccess.h>
 #include <linux/io.h>
 #include <linux/io.h>
+#include <linux/timer.h>
 
 
 #include "comedi.h"
 #include "comedi.h"
 
 
@@ -264,7 +265,6 @@ struct comedi_device {
 	const char *board_name;
 	const char *board_name;
 	const void *board_ptr;
 	const void *board_ptr;
 	int attached;
 	int attached;
-	int rt;
 	spinlock_t spinlock;
 	spinlock_t spinlock;
 	struct mutex mutex;
 	struct mutex mutex;
 	int in_request_module;
 	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);
 int comedi_usb_auto_config(struct usb_device *usbdev, const char *board_name);
 void comedi_usb_auto_unconfig(struct usb_device *usbdev);
 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 */
 #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_file_info *dev_file_info = comedi_get_device_file_info(i);
 		struct comedi_device *dev;
 		struct comedi_device *dev;
 
 
-		if(dev_file_info == NULL) continue;
+		if (dev_file_info == NULL) continue;
 		dev = dev_file_info->device;
 		dev = dev_file_info->device;
 
 
 		mutex_lock(&dev->mutex);
 		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;
 		block_size = num_bytes - count;
 		if (block_size < 0) {
 		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__);
 				__FILE__, __func__);
 			break;
 			break;
 		}
 		}
@@ -633,8 +633,7 @@ unsigned comedi_buf_write_free(struct comedi_async *async, unsigned int nbytes)
 {
 {
 	if ((int)(async->buf_write_count + nbytes -
 	if ((int)(async->buf_write_count + nbytes -
 			async->buf_write_alloc_count) > 0) {
 			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;
 		nbytes = async->buf_write_alloc_count - async->buf_write_count;
 	}
 	}
 	async->buf_write_count += nbytes;
 	async->buf_write_count += nbytes;
@@ -667,8 +666,7 @@ unsigned comedi_buf_read_free(struct comedi_async *async, unsigned int nbytes)
 	smp_mb();
 	smp_mb();
 	if ((int)(async->buf_read_count + nbytes -
 	if ((int)(async->buf_read_count + nbytes -
 			async->buf_read_alloc_count) > 0) {
 			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;
 		nbytes = async->buf_read_alloc_count - async->buf_read_count;
 	}
 	}
 	async->buf_read_count += nbytes;
 	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);
 	minor = comedi_alloc_board_minor(hardware_device);
-	if(minor < 0) return minor;
+	if (minor < 0) return minor;
 
 
 	private_data = kmalloc(sizeof(unsigned), GFP_KERNEL);
 	private_data = kmalloc(sizeof(unsigned), GFP_KERNEL);
 	if (private_data == NULL) {
 	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);
 	mutex_unlock(&dev_file_info->device->mutex);
 
 
 cleanup:
 cleanup:
-	if(retval < 0)
+	if (retval < 0)
 	{
 	{
 		kfree(private_data);
 		kfree(private_data);
 		comedi_free_board_minor(minor);
 		comedi_free_board_minor(minor);
@@ -835,7 +833,7 @@ cleanup:
 void comedi_auto_unconfig(struct device *hardware_device)
 void comedi_auto_unconfig(struct device *hardware_device)
 {
 {
 	unsigned *minor = (unsigned *)dev_get_drvdata(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);
 	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 */
 	/*  pci slot */
 	options[1] = PCI_SLOT(pcidev->devfn);
 	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)
 void comedi_pci_auto_unconfig(struct pci_dev *pcidev)

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

@@ -24,11 +24,7 @@
 #ifndef _8253_H
 #ifndef _8253_H
 #define _8253_H
 #define _8253_H
 
 
-#ifndef CMDTEST
-#include "../comedi.h"
-#else
 #include "../comedi.h"
 #include "../comedi.h"
-#endif
 
 
 #define i8253_cascade_ns_to_timer i8253_cascade_ns_to_timer_2div
 #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;
 	*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;
 	*d2 = div2 & 0xffff;
 	return;
 	return;
 }
 }
@@ -247,12 +243,12 @@ static inline int i8254_load(unsigned long base_address, unsigned int regshift,
 		return -1;
 		return -1;
 
 
 	byte = counter_number << 6;
 	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));
 	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));
 	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));
 	outb(byte, base_address + (counter_number << regshift));
 
 
 	return 0;
 	return 0;
@@ -273,12 +269,12 @@ static inline int i8254_mm_load(void *base_address, unsigned int regshift,
 		return -1;
 		return -1;
 
 
 	byte = counter_number << 6;
 	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));
 	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));
 	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));
 	writeb(byte, base_address + (counter_number << regshift));
 
 
 	return 0;
 	return 0;
@@ -294,13 +290,13 @@ static inline int i8254_read(unsigned long base_address, unsigned int regshift,
 	if (counter_number > 2)
 	if (counter_number > 2)
 		return -1;
 		return -1;
 
 
-	// latch counter
+	/*  latch counter */
 	byte = counter_number << 6;
 	byte = counter_number << 6;
 	outb(byte, base_address + (i8254_control_reg << regshift));
 	outb(byte, base_address + (i8254_control_reg << regshift));
 
 
-	// read lsb
+	/*  read lsb */
 	ret = inb(base_address + (counter_number << regshift));
 	ret = inb(base_address + (counter_number << regshift));
-	// read msb
+	/*  read msb */
 	ret += inb(base_address + (counter_number << regshift)) << 8;
 	ret += inb(base_address + (counter_number << regshift)) << 8;
 
 
 	return ret;
 	return ret;
@@ -315,13 +311,13 @@ static inline int i8254_mm_read(void *base_address, unsigned int regshift,
 	if (counter_number > 2)
 	if (counter_number > 2)
 		return -1;
 		return -1;
 
 
-	// latch counter
+	/*  latch counter */
 	byte = counter_number << 6;
 	byte = counter_number << 6;
 	writeb(byte, base_address + (i8254_control_reg << regshift));
 	writeb(byte, base_address + (i8254_control_reg << regshift));
 
 
-	// read lsb
+	/*  read lsb */
 	ret = readb(base_address + (counter_number << regshift));
 	ret = readb(base_address + (counter_number << regshift));
-	// read msb
+	/*  read msb */
 	ret += readb(base_address + (counter_number << regshift)) << 8;
 	ret += readb(base_address + (counter_number << regshift)) << 8;
 
 
 	return ret;
 	return ret;
@@ -336,9 +332,9 @@ static inline void i8254_write(unsigned long base_address,
 	if (counter_number > 2)
 	if (counter_number > 2)
 		return;
 		return;
 
 
-	byte = count & 0xff;	// lsb of counter value
+	byte = count & 0xff;	/*  lsb of counter value */
 	outb(byte, base_address + (counter_number << regshift));
 	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));
 	outb(byte, base_address + (counter_number << regshift));
 }
 }
 
 
@@ -350,9 +346,9 @@ static inline void i8254_mm_write(void *base_address,
 	if (counter_number > 2)
 	if (counter_number > 2)
 		return;
 		return;
 
 
-	byte = count & 0xff;	// lsb of counter value
+	byte = count & 0xff;	/*  lsb of counter value */
 	writeb(byte, base_address + (counter_number << regshift));
 	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));
 	writeb(byte, base_address + (counter_number << regshift));
 }
 }
 
 
@@ -374,8 +370,8 @@ static inline int i8254_set_mode(unsigned long base_address,
 		return -1;
 		return -1;
 
 
 	byte = counter_number << 6;
 	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));
 	outb(byte, base_address + (i8254_control_reg << regshift));
 
 
 	return 0;
 	return 0;
@@ -392,8 +388,8 @@ static inline int i8254_mm_set_mode(void *base_address,
 		return -1;
 		return -1;
 
 
 	byte = counter_number << 6;
 	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));
 	writeb(byte, base_address + (i8254_control_reg << regshift));
 
 
 	return 0;
 	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_attach(struct comedi_device *dev, struct comedi_devconfig * it);
 static int dev_8255_detach(struct comedi_device *dev);
 static int dev_8255_detach(struct comedi_device *dev);
 static struct comedi_driver driver_8255 = {
 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);
 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,
 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]) {
 	if (data[0]) {
 		s->state &= ~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,
 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 mask;
 	unsigned int bits;
 	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,
 static int subdev_8255_cmdtest(struct comedi_device *dev, struct comedi_subdevice * s,
-	struct comedi_cmd * cmd)
+	struct comedi_cmd *cmd)
 {
 {
 	int err = 0;
 	int err = 0;
 	unsigned int tmp;
 	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)
 void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice * s)
 {
 {
 	if (s->private) {
 	if (s->private) {
-		if (subdevpriv->have_irq) {
-		}
+		/* this test does nothing, so comment it out
+		 * if (subdevpriv->have_irq) {
+		 * }
+		 */
 
 
 		kfree(s->private);
 		kfree(s->private);
 	}
 	}
@@ -394,7 +396,8 @@ static int dev_8255_attach(struct comedi_device *dev, struct comedi_devconfig *
 		return -EINVAL;
 		return -EINVAL;
 	}
 	}
 
 
-	if ((ret = alloc_subdevices(dev, i)) < 0)
+	ret = alloc_subdevices(dev, i);
+	if (ret < 0)
 		return ret;
 		return ret;
 
 
 	for (i = 0; i < dev->n_subdevices; i++) {
 	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)
 #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 (*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);
 	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
 #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)
 	void *x, unsigned long y)
 {
 {
 	printk("8255 support not configured -- disabling subdevice\n");
 	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;
 	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_bond.o
 obj-$(CONFIG_COMEDI)			+= comedi_test.o
 obj-$(CONFIG_COMEDI)			+= comedi_test.o
 obj-$(CONFIG_COMEDI)			+= comedi_parport.o
 obj-$(CONFIG_COMEDI)			+= comedi_parport.o
+obj-$(CONFIG_COMEDI)			+= pcm_common.o
 
 
 # Comedi PCI drivers
 # Comedi PCI drivers
 obj-$(CONFIG_COMEDI_PCI_DRIVERS)	+= 8255.o
 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
 obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS)	+= quatech_daqp_cs.o
 
 
 # Comedi USB drivers
 # Comedi USB drivers
+obj-$(CONFIG_COMEDI_USB_DRIVERS)	+= dt9812.o
 obj-$(CONFIG_COMEDI_USB_DRIVERS)	+= usbdux.o
 obj-$(CONFIG_COMEDI_USB_DRIVERS)	+= usbdux.o
 obj-$(CONFIG_COMEDI_USB_DRIVERS)	+= usbduxfast.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);
 static int acl7225b_detach(struct comedi_device *dev);
 
 
 struct boardtype {
 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[] = {
 static const struct boardtype boardtypes[] = {
@@ -39,19 +39,19 @@ static const struct boardtype boardtypes[] = {
 #define this_board ((const struct boardtype *)dev->board_ptr)
 #define this_board ((const struct boardtype *)dev->board_ptr)
 
 
 static struct comedi_driver driver_acl7225b = {
 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);
 COMEDI_INITCLEANUP(driver_acl7225b);
 
 
 static int acl7225b_do_insn(struct comedi_device *dev, struct comedi_subdevice * s,
 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)
 	if (insn->n != 2)
 		return -EINVAL;
 		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,
 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)
 	if (insn->n != 2)
 		return -EINVAL;
 		return -EINVAL;

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

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

Datei-Diff unterdrückt, da er zu groß ist
+ 200 - 200
drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c


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

@@ -35,10 +35,10 @@
 /*
 /*
  * CHRONOMETER INISIALISATION FUNCTION
  * 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);
 				    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_subdevice *s,
 					    struct comedi_insn *insn,
 					    struct comedi_insn *insn,
 					    unsigned int *data);
 					    unsigned int *data);
@@ -46,29 +46,29 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev,
 /*
 /*
  * CHRONOMETER READ FUNCTION
  * 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);
 			      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
  * 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,
 				       struct comedi_subdevice *s, struct comedi_insn *insn,
 				       unsigned int *data);
 				       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.
 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.
 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)|
 |						struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)|
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              : Configure the digital I/O operating mode from selected |
 | 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.                                                   |
 |                     I/O.                                                   |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  :													     |
 | Input Parameters  :													     |
-|                  BYTE_ b_ModulNbr      data[0]: Module number to               |
+|                  unsigned char_ b_ModulNbr      data[0]: Module number to               |
 |                                             configure (0 to 3)             |
 |                                             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   |
 |                                             0 : Channel used for digital   |
 |                                                 input                      |
 |                                                 input                      |
 |                                             1 : Channel used for digital   |
 |                                             1 : Channel used for digital   |
 |                                                 output                     |
 |                                                 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   |
 |                                             0 : Channel used for digital   |
 |                                                 input                      |
 |                                                 input                      |
 |                                             1 : Channel used for digital   |
 |                                             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;
 	i_ReturnValue = insn->n;
 
 
 		/**************************/
 		/**************************/
@@ -126,7 +126,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub
 	switch (b_ConfigType) {
 	switch (b_ConfigType) {
 	case APCI1710_DIGIO_MEMORYONOFF:
 	case APCI1710_DIGIO_MEMORYONOFF:
 
 
-		if (b_MemoryOnOff)	// If Memory ON
+		if (b_MemoryOnOff)	/*  If Memory ON */
 		{
 		{
 		 /****************************/
 		 /****************************/
 			/* Set the output 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].
 			devpriv->s_ModuleInfo[b_ModulNbr].
 				s_DigitalIOInfo.dw_OutputMemory = 0;
 				s_DigitalIOInfo.dw_OutputMemory = 0;
-		} else		// If memory off
+		} else		/*  If memory off */
 		{
 		{
 		 /*****************************/
 		 /*****************************/
 			/* Set the output memory off */
 			/* Set the output memory off */
@@ -197,7 +197,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub
 	/*****************************************/
 	/*****************************************/
 
 
 					dw_WriteConfig =
 					dw_WriteConfig =
-						(DWORD) (b_ChannelAMode |
+						(unsigned int) (b_ChannelAMode |
 						(b_ChannelBMode * 2));
 						(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");
 			DPRINTK("The module is not a digital I/O module\n");
 			i_ReturnValue = -3;
 			i_ReturnValue = -3;
 		}
 		}
-	}			// end of Switch
+	}			/*  end of Switch */
 	printk("Return Value %d\n", i_ReturnValue);
 	printk("Return Value %d\n", i_ReturnValue);
 	return 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)                 |
 |                                                   (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)          |
 |                                                   input ( 0 to 6)          |
 |                                                      0 : Channel C         |
 |                                                      0 : Channel C         |
 |                                                      1 : Channel D         |
 |                                                      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;
 	data[0] = 0;
-	pb_ChannelStatus = (PBYTE) & data[0];
+	pb_ChannelStatus = (unsigned char *) &data[0];
 	i_ReturnValue = insn->n;
 	i_ReturnValue = insn->n;
 
 
 	/**************************/
 	/**************************/
@@ -356,7 +356,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 								i_ReturnValue =
 								i_ReturnValue =
 									-6;
 									-6;
 							}
 							}
-						}	// if (b_InputChannel == 5)
+						}	/*  if (b_InputChannel == 5) */
 						else {
 						else {
 			  /***************************/
 			  /***************************/
 							/* Test the channel B mode */
 							/* Test the channel B mode */
@@ -375,8 +375,8 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 								i_ReturnValue =
 								i_ReturnValue =
 									-7;
 									-7;
 							}
 							}
-						}	// if (b_InputChannel == 5)
-					}	// if (b_InputChannel > 4)
+						}	/*  if (b_InputChannel == 5) */
+					}	/*  if (b_InputChannel > 4) */
 
 
 		    /***********************/
 		    /***********************/
 					/* Test if error occur */
 					/* Test if error occur */
@@ -387,11 +387,10 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 						/* Read all digital input */
 						/* 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 =
 						dw_StatusReg =
 							inl(devpriv->
 							inl(devpriv->
@@ -400,11 +399,11 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 							(64 * b_ModulNbr));
 							(64 * b_ModulNbr));
 
 
 						*pb_ChannelStatus =
 						*pb_ChannelStatus =
-							(BYTE) ((dw_StatusReg ^
+							(unsigned char) ((dw_StatusReg ^
 								0x1C) >>
 								0x1C) >>
 							b_InputChannel) & 1;
 							b_InputChannel) & 1;
 
 
-					}	// if (i_ReturnValue == 0)
+					}	/*  if (i_ReturnValue == 0) */
 				} else {
 				} else {
 		    /*******************************/
 		    /*******************************/
 					/* Digital I/O not initialised */
 					/* Digital I/O not initialised */
@@ -434,7 +433,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 		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)
 |*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   |
 |                     parameter b_Channel. Setting an output means setting   |
 |                     an ouput high.                                         |
 |                     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)               |
 |                                             channel (0 to 2)               |
 |                                                0 : Channel H               |
 |                                                0 : Channel H               |
 |                                                1 : Channel A               |
 |                                                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;
 	i_ReturnValue = insn->n;
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_OutputChannel = CR_CHAN(insn->chanspec);
 	b_OutputChannel = CR_CHAN(insn->chanspec);
@@ -602,7 +602,7 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev,
 								1 <<
 								1 <<
 								b_OutputChannel;
 								b_OutputChannel;
 						}
 						}
-					}	// set channel off
+					}	/*  set channel off */
 					else {
 					else {
 						if (devpriv->
 						if (devpriv->
 							s_ModuleInfo
 							s_ModuleInfo
@@ -627,23 +627,24 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev,
 								dw_OutputMemory
 								dw_OutputMemory
 								= dw_WriteValue;
 								= dw_WriteValue;
 						} else {
 						} else {
-		       /*****************************/
+							/*****************************/
 							/* Digital Output Memory OFF */
 							/* Digital Output Memory OFF */
-		       /*****************************/
-							// +Use previously the function "i_APCI1710_SetDigitalIOMemoryOn"
+							/*****************************/
+							/*  +Use previously the function "i_APCI1710_SetDigitalIOMemoryOn" */
 							i_ReturnValue = -8;
 							i_ReturnValue = -8;
 						}
 						}
 
 
 					}
 					}
-		    /*******************/
+					/*******************/
 					/* Write the value */
 					/* 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,
 					outl(dw_WriteValue,
 						devpriv->s_BoardInfos.
 						devpriv->s_BoardInfos.
 						ui_Address + (64 * b_ModulNbr));
 						ui_Address + (64 * b_ModulNbr));
@@ -670,7 +671,7 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev,
 		i_ReturnValue = -2;
 		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)
 |                     from selected digital I/O module (b_ModulNbr)
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  :
 | 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[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 : -                                                      |
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Return Value      :
 | Return Value      :
 
 
-                INPUT :
+|                INPUT :
 
 
 					  0: No error                                            |
 					  0: No error                                            |
 |                    -1: The handle parameter of the board is wrong          |
 |                    -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;
 	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) {
 	switch (b_PortOperation) {
 	case APCI1710_INPUT:
 	case APCI1710_INPUT:
-	/**************************/
+		/**************************/
 		/* Test the module number */
 		/* Test the module number */
-	/**************************/
+		/**************************/
 
 
 		if (b_ModulNbr < 4) {
 		if (b_ModulNbr < 4) {
-	   /*******************************/
+			/*******************************/
 			/* Test if digital I/O counter */
 			/* Test if digital I/O counter */
-	   /*******************************/
+			/*******************************/
 
 
 			if ((devpriv->s_BoardInfos.
 			if ((devpriv->s_BoardInfos.
 					dw_MolduleConfiguration[b_ModulNbr] &
 					dw_MolduleConfiguration[b_ModulNbr] &
 					0xFFFF0000UL) == APCI1710_DIGITAL_IO) {
 					0xFFFF0000UL) == APCI1710_DIGITAL_IO) {
-	      /**********************************************/
+				/**********************************************/
 				/* Test if the digital I/O module initialised */
 				/* Test if the digital I/O module initialised */
-	      /**********************************************/
+				/**********************************************/
 
 
 				if (devpriv->s_ModuleInfo[b_ModulNbr].
 				if (devpriv->s_ModuleInfo[b_ModulNbr].
 					s_DigitalIOInfo.b_DigitalInit == 1) {
 					s_DigitalIOInfo.b_DigitalInit == 1) {
-		 /**************************/
+					/**************************/
 					/* Read all digital input */
 					/* 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 =
 					dw_StatusReg =
 						inl(devpriv->s_BoardInfos.
 						inl(devpriv->s_BoardInfos.
 						ui_Address + (64 * b_ModulNbr));
 						ui_Address + (64 * b_ModulNbr));
 					*pb_PortValue =
 					*pb_PortValue =
-						(BYTE) (dw_StatusReg ^ 0x1C);
+						(unsigned char) (dw_StatusReg ^ 0x1C);
 
 
 				} else {
 				} else {
-		 /*******************************/
+					/*******************************/
 					/* Digital I/O not initialised */
 					/* Digital I/O not initialised */
-		 /*******************************/
+					/*******************************/
 
 
 					i_ReturnValue = -4;
 					i_ReturnValue = -4;
 				}
 				}
 			} else {
 			} else {
-	      /******************************************/
+				/******************************************/
 				/* The module is not a digital I/O module */
 				/* The module is not a digital I/O module */
-	      /******************************************/
+				/******************************************/
 
 
 				i_ReturnValue = -3;
 				i_ReturnValue = -3;
 			}
 			}
@@ -853,11 +857,11 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 								i_ReturnValue =
 								i_ReturnValue =
 									-6;
 									-6;
 							}
 							}
-						}	// if ((b_PortValue & 2) == 2)
+						}	/*  if ((b_PortValue & 2) == 2) */
 
 
-		    /**************************/
+						/**************************/
 						/* Test if channel B used */
 						/* Test if channel B used */
-		    /**************************/
+						/**************************/
 
 
 						if ((b_PortValue & 4) == 4) {
 						if ((b_PortValue & 4) == 4) {
 							if (devpriv->
 							if (devpriv->
@@ -866,33 +870,33 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 								s_DigitalIOInfo.
 								s_DigitalIOInfo.
 								b_ChannelBMode
 								b_ChannelBMode
 								!= 1) {
 								!= 1) {
-			  /*******************************************/
+								/*******************************************/
 								/* The digital channel B is used for input */
 								/* The digital channel B is used for input */
-			  /*******************************************/
+								/*******************************************/
 
 
 								i_ReturnValue =
 								i_ReturnValue =
 									-7;
 									-7;
 							}
 							}
-						}	// if ((b_PortValue & 4) == 4)
+						}	/*  if ((b_PortValue & 4) == 4) */
 
 
-		    /***********************/
+						/***********************/
 						/* Test if error occur */
 						/* Test if error occur */
-		    /***********************/
+						/***********************/
 
 
 						if (i_ReturnValue >= 0) {
 						if (i_ReturnValue >= 0) {
 
 
-							//if(data[1])
-							//{
+							/* if(data[1]) { */
+
 							switch (b_PortOnOFF) {
 							switch (b_PortOnOFF) {
-			   /*********************************/
+								/*********************************/
 								/* Test if set Port ON                   */
 								/* Test if set Port ON                   */
-		       /*********************************/
+								/*********************************/
 
 
 							case APCI1710_ON:
 							case APCI1710_ON:
 
 
-		       /*********************************/
+								/*********************************/
 								/* Test if output memory enabled */
 								/* Test if output memory enabled */
-		       /*********************************/
+								/*********************************/
 
 
 								if (devpriv->
 								if (devpriv->
 									s_ModuleInfo
 									s_ModuleInfo
@@ -924,7 +928,7 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 								}
 								}
 								break;
 								break;
 
 
-								// If Set PORT  OFF
+								/*  If Set PORT  OFF */
 							case APCI1710_OFF:
 							case APCI1710_OFF:
 
 
 			   /*********************************/
 			   /*********************************/
@@ -957,25 +961,26 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 										=
 										=
 										dw_WriteValue;
 										dw_WriteValue;
 								} else {
 								} else {
-			  /*****************************/
+									/*****************************/
 									/* Digital Output Memory OFF */
 									/* Digital Output Memory OFF */
-			  /*****************************/
+									/*****************************/
 
 
 									i_ReturnValue
 									i_ReturnValue
 										=
 										=
 										-8;
 										-8;
 								}
 								}
-							}	// switch
+							}	/*  switch */
 
 
-		       /*******************/
+							/*******************/
 							/* Write the value */
 							/* 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,
 							outl(dw_WriteValue,
 								devpriv->
 								devpriv->
 								s_BoardInfos.
 								s_BoardInfos.
@@ -983,16 +988,16 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 								(64 * b_ModulNbr));
 								(64 * b_ModulNbr));
 						}
 						}
 					} else {
 					} else {
-		    /**********************/
+						/**********************/
 						/* Output value wrong */
 						/* Output value wrong */
-		    /**********************/
+						/**********************/
 
 
 						i_ReturnValue = -4;
 						i_ReturnValue = -4;
 					}
 					}
 				} else {
 				} else {
-		 /*******************************/
+					/*******************************/
 					/* Digital I/O not initialised */
 					/* Digital I/O not initialised */
-		 /*******************************/
+					/*******************************/
 
 
 					i_ReturnValue = -5;
 					i_ReturnValue = -5;
 				}
 				}
@@ -1015,6 +1020,6 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev,
 	default:
 	default:
 		i_ReturnValue = -9;
 		i_ReturnValue = -9;
 		DPRINTK("NO INPUT/OUTPUT specified\n");
 		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
  * 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);
 				   struct comedi_insn *insn, unsigned int *data);
 
 
 /*
 /*
  * INPUT OUTPUT  FUNCTIONS
  * 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_subdevice *s,
 					 struct comedi_insn *insn, unsigned int *data);
 					 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_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);
 					  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_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);
 					  struct comedi_insn *insn, unsigned int *data);

Datei-Diff unterdrückt, da er zu groß ist
+ 205 - 205
drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c


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

@@ -132,140 +132,140 @@
 #define APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT		409
 #define APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT		409
 
 
 /************ Main Functions *************/
 /************ 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);
 				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);
 			      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);
 			       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);
 			      struct comedi_insn *insn, unsigned int * data);
 
 
 /*********** Supplementary Functions********/
 /*********** Supplementary Functions********/
 
 
 /* INSN CONFIG */
 /* 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 */
 /* 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 */
 /* 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 */
 /* 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.
 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.
 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                      |
 | 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)                |
 |                                ULONG_        ul_StartValue)                |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              : Configure the pulse encoder operating mode selected via|
 | 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     |
 |                     You must calling this function be for you call any     |
 |                     other function witch access of pulse encoders.         |
 |                     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)       |
 |                                                   configure (0 to 3)       |
-|                     BYTE_ b_PulseEncoderNbr     : Pulse encoder selection  |
+|                     unsigned char_ b_PulseEncoderNbr     : Pulse encoder selection  |
 |                                                   (0 to 3)                 |
 |                                                   (0 to 3)                 |
-|                     BYTE_ b_InputLevelSelection : Input level selection    |
+|                     unsigned char_ b_InputLevelSelection : Input level selection    |
 |                                                   (0 or 1)                 |
 |                                                   (0 or 1)                 |
 |                                                       0 : Set pulse encoder|
 |                                                       0 : Set pulse encoder|
 |                                                           count the the low|
 |                                                           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|
 |                                                       1 : Set pulse encoder|
 |                                                           count the the    |
 |                                                           count the the    |
 |                                                           high level pulse.|
 |                                                           high level pulse.|
-|                     BYTE_ b_TriggerOutputAction : Digital TRIGGER output   |
+|                     unsigned char_ b_TriggerOutputAction : Digital TRIGGER output   |
 |                                                   action                   |
 |                                                   action                   |
 |                                                       0 : No action        |
 |                                                       0 : No action        |
 |                                                       1 : Set the trigger  |
 |                                                       1 : Set the trigger  |
@@ -104,11 +104,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 |                                                           encoder          |
 |                                                           encoder          |
 |                     ULONG_ ul_StartValue        : Pulse encoder start value|
 |                     ULONG_ ul_StartValue        : Pulse encoder start value|
 |                                                   (1 to 4294967295)
 |                                                   (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 : -                                                      |
 | 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;
 	i_ReturnValue = insn->n;
 
 
@@ -346,17 +346,17 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 		i_ReturnValue = -2;
 		i_ReturnValue = -2;
 	}
 	}
 
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 }
 
 
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_EnablePulseEncoder                    |
 | 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)  |
 | Task              : Enableor disable  the selected pulse encoder (b_PulseEncoderNbr)  |
 |                     from selected module (b_ModulNbr). Each input pulse    |
 |                     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  |
 |                     interrupt is generated when the pulse encoder has run  |
 |                     down.                                                  |
 |                     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)       |
 |                                                   configure (0 to 3)       |
-|                     BYTE_   b_PulseEncoderNbr   : Pulse encoder selection  |
+|                     unsigned char_   b_PulseEncoderNbr   : Pulse encoder selection  |
 |                                                   (0 to 3)                 |
 |                                                   (0 to 3)                 |
-|                     BYTE_   b_CycleSelection    : APCI1710_CONTINUOUS:     |
+|                     unsigned char_   b_CycleSelection    : APCI1710_CONTINUOUS:     |
 |                                                       Each time the        |
 |                                                       Each time the        |
 |                                                       counting value is set|
 |                                                       counting value is set|
 |                                                       on "0", the pulse    |
 |                                                       on "0", the pulse    |
@@ -381,7 +381,7 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 |                                                       If the counter is set|
 |                                                       If the counter is set|
 |                                                       on "0", the pulse    |
 |                                                       on "0", the pulse    |
 |                                                       encoder is stopped.  |
 |                                                       encoder is stopped.  |
-|                     BYTE_   b_InterruptHandling : Interrupts can be        |
+|                     unsigned char_   b_InterruptHandling : Interrupts can be        |
 |                                                   generated, when the pulse|
 |                                                   generated, when the pulse|
 |                                                   encoder has run down.    |
 |                                                   encoder has run down.    |
 |                                                   With this parameter the  |
 |                                                   With this parameter the  |
@@ -393,11 +393,11 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev,
 |                                                     APCI1710_DISABLE:      |
 |                                                     APCI1710_DISABLE:      |
 |                                                     Interrupts are disabled
 |                                                     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 : -                                                      |
 | 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;
 	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 */
 	/* Test the selected module number */
@@ -515,7 +515,7 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
 									| (1UL
 									| (1UL
 									<<
 									<<
 									b_PulseEncoderNbr);
 									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));
 						(64 * b_ModulNbr));
 
 
 					break;
 					break;
-				}	// switch End
+				}	/*  switch End */
 
 
 			} else {
 			} else {
 		 /*********************************/
 		 /*********************************/
@@ -656,39 +656,39 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev,
 		i_ReturnValue = -2;
 		i_ReturnValue = -2;
 	}
 	}
 
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 }
 
 
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ReadPulseEncoderStatus                |
 | 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
 | Task    APCI1710_PULSEENCODER_READ          : Reads the pulse encoder status
 											and valuefrom selected pulse     |
 											and valuefrom selected pulse     |
 |                     encoder (b_PulseEncoderNbr) from selected module       |
 |                     encoder (b_PulseEncoderNbr) from selected module       |
 |                     (b_ModulNbr).                                          |
 |                     (b_ModulNbr).                                          |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
-	BYTE   b_Type; data[0]
+	unsigned char   b_Type; data[0]
    APCI1710_PULSEENCODER_WRITE
    APCI1710_PULSEENCODER_WRITE
  Writes a 32-bit value (ul_WriteValue) into the selected|
  Writes a 32-bit value (ul_WriteValue) into the selected|
 |                     pulse encoder (b_PulseEncoderNbr) from selected module |
 |                     pulse encoder (b_PulseEncoderNbr) from selected module |
 |                     (b_ModulNbr). This operation set the new start pulse   |
 |                     (b_ModulNbr). This operation set the new start pulse   |
 |                     encoder value.
 |                     encoder value.
  APCI1710_PULSEENCODER_READ
  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)       |
 |                                                   configure (0 to 3)       |
-|              data[1]       BYTE_   b_PulseEncoderNbr   : Pulse encoder selection  |
+|              data[1]       unsigned char_   b_PulseEncoderNbr   : Pulse encoder selection  |
 |                                                   (0 to 3)
 |                                                   (0 to 3)
    APCI1710_PULSEENCODER_WRITE
    APCI1710_PULSEENCODER_WRITE
 				data[2]		ULONG_ ul_WriteValue        : 32-bit value to be       |
 				data[2]		ULONG_ ul_WriteValue        : 32-bit value to be       |
 |                                                   written             |
 |                                                   written             |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
-| Output Parameters : PBYTE_ pb_Status            : Pulse encoder status.    |
+| Output Parameters : unsigned char *_ pb_Status            : Pulse encoder status.    |
 |                                                       0 : No overflow occur|
 |                                                       0 : No overflow occur|
 |                                                       1 : Overflow occur
 |                                                       1 : Overflow occur
 						PULONG_ pul_ReadValue       : Pulse encoder value      |  |
 						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;
 	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 */
 	/* Test the selected module number */
@@ -766,7 +766,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
 						dw_StatusRegister;
 						dw_StatusRegister;
 
 
 					*pb_Status =
 					*pb_Status =
-						(BYTE) (devpriv->
+						(unsigned char) (devpriv->
 						s_ModuleInfo[b_ModulNbr].
 						s_ModuleInfo[b_ModulNbr].
 						s_PulseEncoderModuleInfo.
 						s_PulseEncoderModuleInfo.
 						dw_StatusRegister >> (1 +
 						dw_StatusRegister >> (1 +
@@ -794,7 +794,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
 					break;
 					break;
 
 
 				case APCI1710_PULSEENCODER_WRITE:
 				case APCI1710_PULSEENCODER_WRITE:
-					ul_WriteValue = (ULONG) data[2];
+					ul_WriteValue = (unsigned int) data[2];
 			/*******************/
 			/*******************/
 					/* Write the value */
 					/* Write the value */
 			/*******************/
 			/*******************/
@@ -805,7 +805,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
 						(4 * b_PulseEncoderNbr) +
 						(4 * b_PulseEncoderNbr) +
 						(64 * b_ModulNbr));
 						(64 * b_ModulNbr));
 
 
-				}	//end of switch
+				}	/* end of switch */
 			} else {
 			} else {
 		 /*********************************/
 		 /*********************************/
 				/* Pulse encoder not initialised */
 				/* Pulse encoder not initialised */
@@ -831,11 +831,11 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev,
 		i_ReturnValue = -2;
 		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.
 	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_READ	0
 #define APCI1710_PULSEENCODER_WRITE	1
 #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_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);
 					  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_subdevice *s,
 						  struct comedi_insn *insn,
 						  struct comedi_insn *insn,
 						  unsigned int *data);
 						  unsigned int *data);
@@ -33,7 +33,7 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev,
 /*
 /*
  * READ PULSE ENCODER FUNCTIONS
  * 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_subdevice *s,
 					     struct comedi_insn *insn,
 					     struct comedi_insn *insn,
 					     unsigned int *data);
 					     unsigned int *data);
@@ -41,7 +41,7 @@ INT i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev,
 /*
 /*
  * WRITE PULSE ENCODER FUNCTIONS
  * 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_subdevice *s,
 					     struct comedi_insn *insn,
 					     struct comedi_insn *insn,
 					     unsigned int *data);
 					     unsigned int *data);

Datei-Diff unterdrückt, da er zu groß ist
+ 234 - 234
drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.c


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

@@ -26,51 +26,51 @@
 #define APCI1710_PWM_ENABLE		1
 #define APCI1710_PWM_ENABLE		1
 #define APCI1710_PWM_NEWTIMING		2
 #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);
 			     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);
 			    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);
 				    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_subdevice *s,
 					struct comedi_insn *insn, unsigned int *data);
 					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.
 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.
 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                               |
 | 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,                  |
 |                                ULONG_  ul_SSIOutputClock,                  |
-|                                BYTE_    b_SSICountingMode)                 |
+|                                unsigned char_    b_SSICountingMode)                 |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              : Configure the SSI operating mode from selected module  |
 | Task              : Configure the SSI operating mode from selected module  |
 |                     (b_ModulNbr). You must calling this function be for you|
 |                     (b_ModulNbr). You must calling this function be for you|
 |                     call any other function witch access of SSI.           |
 |                     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)       |
 |                                                   configure (0 to 3)       |
-|                     BYTE_  b_SSIProfile         : Selection from SSI       |
+|                     unsigned char_  b_SSIProfile         : Selection from SSI       |
 |                                                   profile length (2 to 32).|
 |                                                   profile length (2 to 32).|
-|                     BYTE_  b_PositionTurnLength : Selection from SSI       |
+|                     unsigned char_  b_PositionTurnLength : Selection from SSI       |
 |                                                   position data length     |
 |                                                   position data length     |
 |                                                   (1 to 31).               |
 |                                                   (1 to 31).               |
-|                     BYTE_  b_TurnCptLength      : Selection from SSI turn  |
+|                     unsigned char_  b_TurnCptLength      : Selection from SSI turn  |
 |                                                   counter data length      |
 |                                                   counter data length      |
 |                                                   (1 to 31).               |
 |                                                   (1 to 31).               |
-|                     BYTE   b_PCIInputClock      : Selection from PCI bus   |
+|                     unsigned char   b_PCIInputClock      : Selection from PCI bus   |
 |                                                   clock                    |
 |                                                   clock                    |
 |                                                 - APCI1710_30MHZ :         |
 |                                                 - APCI1710_30MHZ :         |
 |                                                   The PC have a PCI bus    |
 |                                                   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.    |
 |                                                   for 30 MHz selection.    |
 |                                                   From  252 to 5 000 000 Hz|
 |                                                   From  252 to 5 000 000 Hz|
 |                                                   for 33 MHz selection.    |
 |                                                   for 33 MHz selection.    |
-|                     BYTE   b_SSICountingMode    : SSI counting mode        |
+|                     unsigned char   b_SSICountingMode    : SSI counting mode        |
 |                                                   selection                |
 |                                                   selection                |
 |                                                 - APCI1710_BINARY_MODE :   |
 |                                                 - APCI1710_BINARY_MODE :   |
 |                                                    Binary counting 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.
 |                                                    Gray counting mode.
 
 
 	b_ModulNbr			= CR_AREF(insn->chanspec);
 	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 : -                                                      |
 | 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;
 		b_PCIInputClock, b_SSICountingMode;
-	ULONG ul_SSIOutputClock;
+	unsigned int ul_SSIOutputClock;
 
 
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	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;
 	i_ReturnValue = insn->n;
 	/**************************/
 	/**************************/
@@ -167,7 +167,7 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde
 			/* Test the SSI profile length */
 			/* 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) {
 			if (b_SSIProfile >= 2 && b_SSIProfile < 33) {
 		 /*************************************/
 		 /*************************************/
 				/* Test the SSI position data length */
 				/* Test the SSI position data length */
@@ -250,9 +250,9 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde
 
 
 										ui_TimerValue
 										ui_TimerValue
 											=
 											=
-											(UINT)
+											(unsigned int)
 											(
 											(
-											((ULONG) (b_PCIInputClock) * 500000UL) / ul_SSIOutputClock);
+											((unsigned int) (b_PCIInputClock) * 500000UL) / ul_SSIOutputClock);
 
 
 				   /************************/
 				   /************************/
 										/* Initialise the timer */
 										/* Initialise the timer */
@@ -351,18 +351,18 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde
 		i_ReturnValue = -2;
 		i_ReturnValue = -2;
 	}
 	}
 
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 }
 
 
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_  i_APCI1710_Read1SSIValue                        |
 | 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_Position,                       |
 |                                PULONG_ pul_TurnCpt)
 |                                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)                       |
 	struct comedi_insn *insn,unsigned int *data)                       |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              :
 | Task              :
@@ -373,22 +373,22 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde
 						or Read all SSI counter (b_SelectedSSI) from              |
 						or Read all SSI counter (b_SelectedSSI) from              |
 |                     selected module (b_ModulNbr).                            |
 |                     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)       |
 |                                                   configure (0 to 3)       |
-|                     BYTE_ b_SelectedSSI         : Selection from SSI       |
+|                     unsigned char_ b_SelectedSSI         : Selection from SSI       |
 |                                                   counter (0 to 2)
 |                                                   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 |
 | Output Parameters : PULONG_  pul_Position       : SSI position in the turn |
 |                     PULONG_  pul_TurnCpt        : Number of turns
 |                     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                                            |
 | Return Value      : 0: No error                                            |
 |                    -1: The handle parameter of the board is wrong          |
 |                    -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;
 	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 */
 	/* Test the module number */
@@ -477,9 +477,8 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev
 								s_BoardInfos.
 								s_BoardInfos.
 								ui_Address +
 								ui_Address +
 								(64 * b_ModulNbr));
 								(64 * b_ModulNbr));
-						}
-						while ((dw_StatusReg & 0x1) !=
-							0);
+						} while ((dw_StatusReg & 0x1)
+							 != 0);
 
 
 		    /******************************/
 		    /******************************/
 						/* Read the SSI counter value */
 						/* Read the SSI counter value */
@@ -608,8 +607,7 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev
 							s_BoardInfos.
 							s_BoardInfos.
 							ui_Address +
 							ui_Address +
 							(64 * b_ModulNbr));
 							(64 * b_ModulNbr));
-					}
-					while ((dw_StatusReg & 0x1) != 0);
+					} while ((dw_StatusReg & 0x1) != 0);
 
 
 					for (b_SSICpt = 0; b_SSICpt < 3;
 					for (b_SSICpt = 0; b_SSICpt < 3;
 						b_SSICpt++) {
 						b_SSICpt++) {
@@ -667,7 +665,7 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev
 				default:
 				default:
 					printk("Read Type Inputs Wrong\n");
 					printk("Read Type Inputs Wrong\n");
 
 
-				}	// switch  ending
+				}	/*  switch  ending */
 
 
 			} else {
 			} else {
 		 /***********************/
 		 /***********************/
@@ -695,16 +693,16 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev
 		i_ReturnValue = -2;
 		i_ReturnValue = -2;
 	}
 	}
 
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 }
 
 
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_   i_APCI1710_ReadSSI1DigitalInput                |
 | 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              :
 | Task              :
 					(0) Set the digital output from selected SSI moule         |
 					(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       |
                     (3)Read the status from all SSI digital inputs from       |
 |                     selected SSI module (b_ModulNbr)                   |
 |                     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)       |
 |                                                   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)          |
 |                        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                   |
 |                                 data[0]                  status                   |
 |                                                   0 : Channle is not active|
 |                                                   0 : Channle is not active|
 |                                                   1 : Channle is 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;
 	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 */
 	/* 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 */
 				/* 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) {
 				if (b_InputChannel <= 2) {
 					/**************************/
 					/**************************/
@@ -797,7 +795,7 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su
 						inl(devpriv->s_BoardInfos.
 						inl(devpriv->s_BoardInfos.
 						ui_Address + (64 * b_ModulNbr));
 						ui_Address + (64 * b_ModulNbr));
 					*pb_ChannelStatus =
 					*pb_ChannelStatus =
-						(BYTE) (((~dw_StatusReg) >> (4 +
+						(unsigned char) (((~dw_StatusReg) >> (4 +
 								b_InputChannel))
 								b_InputChannel))
 						& 1);
 						& 1);
 				} else {
 				} else {
@@ -814,19 +812,19 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su
 					/**************************/
 					/**************************/
 				/* Read all digital input */
 				/* Read all digital input */
 					/**************************/
 					/**************************/
-				pb_InputStatus = (PBYTE) & data[0];
+				pb_InputStatus = (unsigned char *) &data[0];
 
 
 				dw_StatusReg =
 				dw_StatusReg =
 					inl(devpriv->s_BoardInfos.ui_Address +
 					inl(devpriv->s_BoardInfos.ui_Address +
 					(64 * b_ModulNbr));
 					(64 * b_ModulNbr));
 				*pb_InputStatus =
 				*pb_InputStatus =
-					(BYTE) (((~dw_StatusReg) >> 4) & 7);
+					(unsigned char) (((~dw_StatusReg) >> 4) & 7);
 				break;
 				break;
 
 
 			default:
 			default:
 				printk("IO type wrong\n");
 				printk("IO type wrong\n");
 
 
-			}	//switch end
+			}	/* switch end */
 		} else {
 		} else {
 	      /**********************************/
 	      /**********************************/
 			/* The module is not a SSI module */
 			/* 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;
 		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
  * 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);
 				 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);
 				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);
 				    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.
 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.
 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                    |
 | 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,         |
 |                                        ULONG_   ul_TimingInterval,         |
 |                                        PULONG_ pul_RealTimingInterval)     |
 |                                        PULONG_ pul_RealTimingInterval)     |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
@@ -82,11 +82,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  :    |
 | Input Parameters  :    |
 |
 |
-		CR_AREF	BYTE_   b_ModulNbr       : Module number to configure  |
+		CR_AREF	unsigned char_   b_ModulNbr       : Module number to configure  |
 |                                                (0 to 3)                    |
 |                                                (0 to 3)                    |
-|           data[0] BYTE_   b_TorCounter     : Tor counter selection       |
+|           data[0] unsigned char_   b_TorCounter     : Tor counter selection       |
 |                                                (0 or 1).                   |
 |                                                (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 :          |
 |                                                - APCI1710_30MHZ :          |
 |                                                  The PC have a PCI bus     |
 |                                                  The PC have a PCI bus     |
 |                                                  clock from 30 MHz         |
 |                                                  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 |
 |						   than it is not possibl to |
 |						   used the gate input for   |
 |						   used the gate input for   |
 |						   enabled the acquisition   |
 |						   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                     |
 |                                                 0 : ns                     |
 |                                                 1 : µs                     |
 |                                                 1 : µs                     |
 |                                                 2 : ms                     |
 |                                                 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;
 	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;
 	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);
 	printk("INPUT clock %d\n", b_PCIInputClock);
 
 
 		/**************************/
 		/**************************/
@@ -225,7 +225,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 
 											ul_TimerValue
 											ul_TimerValue
 												=
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimingInterval
 												(ul_TimingInterval
 												*
 												*
 												(0.00025 * b_PCIInputClock));
 												(0.00025 * b_PCIInputClock));
@@ -248,7 +248,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 
 											ul_RealTimingInterval
 											ul_RealTimingInterval
 												=
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimerValue
 												(ul_TimerValue
 												/
 												/
 												(0.00025 * (double)b_PCIInputClock));
 												(0.00025 * (double)b_PCIInputClock));
@@ -284,7 +284,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 												ul_TimerValue
 												ul_TimerValue
 													=
 													=
-													(ULONG)
+													(unsigned int)
 													(
 													(
 													(double)
 													(double)
 													(ul_TimerValue)
 													(ul_TimerValue)
@@ -306,7 +306,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 
 											ul_TimerValue
 											ul_TimerValue
 												=
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimingInterval
 												(ul_TimingInterval
 												*
 												*
 												(0.25 * b_PCIInputClock));
 												(0.25 * b_PCIInputClock));
@@ -329,7 +329,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 
 											ul_RealTimingInterval
 											ul_RealTimingInterval
 												=
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimerValue
 												(ul_TimerValue
 												/
 												/
 												(0.25 * (double)b_PCIInputClock));
 												(0.25 * (double)b_PCIInputClock));
@@ -367,7 +367,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 												ul_TimerValue
 												ul_TimerValue
 													=
 													=
-													(ULONG)
+													(unsigned int)
 													(
 													(
 													(double)
 													(double)
 													(ul_TimerValue)
 													(ul_TimerValue)
@@ -413,7 +413,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 
 											ul_RealTimingInterval
 											ul_RealTimingInterval
 												=
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimerValue
 												(ul_TimerValue
 												/
 												/
 												(250.0 * (double)b_PCIInputClock));
 												(250.0 * (double)b_PCIInputClock));
@@ -449,7 +449,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 												ul_TimerValue
 												ul_TimerValue
 													=
 													=
-													(ULONG)
+													(unsigned int)
 													(
 													(
 													(double)
 													(double)
 													(ul_TimerValue)
 													(ul_TimerValue)
@@ -471,7 +471,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 
 											ul_TimerValue
 											ul_TimerValue
 												=
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimingInterval
 												(ul_TimingInterval
 												*
 												*
 												(250000.0
 												(250000.0
@@ -496,7 +496,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 
 											ul_RealTimingInterval
 											ul_RealTimingInterval
 												=
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimerValue
 												(ul_TimerValue
 												/
 												/
 												(250000.0
 												(250000.0
@@ -535,7 +535,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 												ul_TimerValue
 												ul_TimerValue
 													=
 													=
-													(ULONG)
+													(unsigned int)
 													(
 													(
 													(double)
 													(double)
 													(ul_TimerValue)
 													(ul_TimerValue)
@@ -557,7 +557,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 
 											ul_TimerValue
 											ul_TimerValue
 												=
 												=
-												(ULONG)
+												(unsigned int)
 												(
 												(
 												(ul_TimingInterval
 												(ul_TimingInterval
 													*
 													*
@@ -585,7 +585,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 
 											ul_RealTimingInterval
 											ul_RealTimingInterval
 												=
 												=
-												(ULONG)
+												(unsigned int)
 												(ul_TimerValue
 												(ul_TimerValue
 												/
 												/
 												(250000.0
 												(250000.0
@@ -629,7 +629,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 											if (b_PCIInputClock != APCI1710_40MHZ) {
 												ul_TimerValue
 												ul_TimerValue
 													=
 													=
-													(ULONG)
+													(unsigned int)
 													(
 													(
 													(double)
 													(double)
 													(ul_TimerValue)
 													(ul_TimerValue)
@@ -641,7 +641,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 										}
 										}
 
 
 										fpu_end();
 										fpu_end();
-									}	// if (b_PCIInputClock != APCI1710_GATE_INPUT)
+									}	/*  if (b_PCIInputClock != APCI1710_GATE_INPUT) */
 									else {
 									else {
 				   /*************************************************************/
 				   /*************************************************************/
 										/* 2 Clock used for the overflow and the reload from counter */
 										/* 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
 											ul_TimingInterval
 											-
 											-
 											2;
 											2;
-									}	// if (b_PCIInputClock != APCI1710_GATE_INPUT)
+									}	/*  if (b_PCIInputClock != APCI1710_GATE_INPUT) */
 
 
 				/****************************/
 				/****************************/
 									/* Save the PCI input clock */
 									/* Save the PCI input clock */
@@ -814,7 +814,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 							DPRINTK("Base timing selection is wrong\n");
 							DPRINTK("Base timing selection is wrong\n");
 							i_ReturnValue = -7;
 							i_ReturnValue = -7;
 						}
 						}
-					}	// if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4))
+					}	/*  if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */
 					else {
 					else {
 		       /**********************************/
 		       /**********************************/
 						/* Timing unit selection is wrong */
 						/* Timing unit selection is wrong */
@@ -822,8 +822,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 
 						DPRINTK("Timing unit selection is wrong\n");
 						DPRINTK("Timing unit selection is wrong\n");
 						i_ReturnValue = -6;
 						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 {
 				else {
 		    /*****************************************/
 		    /*****************************************/
 					/* The selected PCI input clock is wrong */
 					/* 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");
 					DPRINTK("The selected PCI input clock is wrong\n");
 					i_ReturnValue = -5;
 					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 {
 			else {
 		 /**********************************/
 		 /**********************************/
 				/* Tor Counter selection is wrong */
 				/* Tor Counter selection is wrong */
@@ -840,7 +840,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 
 
 				DPRINTK("Tor Counter selection is wrong\n");
 				DPRINTK("Tor Counter selection is wrong\n");
 				i_ReturnValue = -4;
 				i_ReturnValue = -4;
-			}	// if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7)
+			}	/*  if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) */
 		} else {
 		} else {
 	      /******************************************/
 	      /******************************************/
 			/* The module is not a tor counter module */
 			/* 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");
 		DPRINTK("Module number error\n");
 		i_ReturnValue = -2;
 		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                      |
 | 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    |
 | Task              : Enable the tor counter (b_TorCounter) from selected    |
 |		      module (b_ModulNbr). You must calling the              |
 |		      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        |
 |                     The b_CycleMode parameter determine if you will        |
 |                     measured a single or more cycle.                       |
 |                     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 |
 |						0 : Tor count each low level |
 |						1 : Tor count each high 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   |
 |						0 : Extern gate signal not   |
 |						    used                     |
 |						    used                     |
 |						1 : Extern gate signal 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 |
 |					      The gate input is used for the |
 |					      signal B                       |
 |					      signal B                       |
 |									     |
 |									     |
-|                     BYTE_ b_CycleMode    : Selected the tor counter        |
+|                     unsigned char_ b_CycleMode    : Selected the tor counter        |
 |                                            acquisition mode                |
 |                                            acquisition mode                |
-|                     BYTE_ b_InterruptEnable : Enable or disable the        |
+|                     unsigned char_ b_InterruptEnable : Enable or disable the        |
 |                                               tor counter interrupt.       |
 |                                               tor counter interrupt.       |
 |                                               APCI1710_ENABLE:             |
 |                                               APCI1710_ENABLE:             |
 |                                               Enable the tor counter       |
 |                                               Enable the tor counter       |
@@ -959,9 +959,9 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev,
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_DisableTorCounter                     |
 | 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   |
 | Task              : Disable the tor counter (b_TorCounter) from selected   |
 |		      module (b_ModulNbr). If you disable the tor counter    |
 |		      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"       |
 |		      counter witch the " i_APCI1710_EnableTorCounter"       |
 |		      function, the status register is cleared               |
 |		      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 : -                                                      |
 | 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;;
 	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 */
 	/* Test the module number */
 	/**************************/
 	/**************************/
@@ -1027,7 +1027,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 	      /**********************************/
 	      /**********************************/
 
 
 			if (b_TorCounter <= 1) {
 			if (b_TorCounter <= 1) {
-				switch (b_Action)	// Enable or Disable
+				switch (b_Action)	/*  Enable or Disable */
 				{
 				{
 				case APCI1710_ENABLE:
 				case APCI1710_ENABLE:
 		 /***********************************/
 		 /***********************************/
@@ -1149,7 +1149,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 													|
 													|
 													0x780;
 													0x780;
 
 
-											}	// if (b_InputMode == APCI1710_TOR_SIMPLE_MODE)
+											}	/*  if (b_InputMode == APCI1710_TOR_SIMPLE_MODE) */
 
 
 				      /***********************/
 				      /***********************/
 											/* Test if double mode */
 											/* Test if double mode */
@@ -1166,12 +1166,12 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 													|
 													|
 													0x180;
 													0x180;
 
 
-											}	// if (b_InputMode == APCI1710_TOR_DOUBLE_MODE)
+											}	/*  if (b_InputMode == APCI1710_TOR_DOUBLE_MODE) */
 
 
 											b_InputMode
 											b_InputMode
 												=
 												=
 												0;
 												0;
-										}	// if (b_InputMode > 1)
+										}	/*  if (b_InputMode > 1) */
 
 
 				   /*******************/
 				   /*******************/
 										/* Set the command */
 										/* 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));
 										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 {
 									else {
 				/********************************/
 				/********************************/
 										/* Interrupt parameter is wrong */
 										/* Interrupt parameter is wrong */
@@ -1247,8 +1247,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 										i_ReturnValue
 										i_ReturnValue
 											=
 											=
 											-9;
 											-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 {
 								else {
 			     /***********************************************/
 			     /***********************************************/
 									/* Tor counter acquisition mode cycle is wrong */
 									/* Tor counter acquisition mode cycle is wrong */
@@ -1258,8 +1258,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 									i_ReturnValue
 									i_ReturnValue
 										=
 										=
 										-8;
 										-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 {
 							else {
 			  /***********************************/
 			  /***********************************/
 								/* Extern gate input mode is wrong */
 								/* 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");
 								DPRINTK("Extern gate input mode is wrong\n");
 								i_ReturnValue =
 								i_ReturnValue =
 									-7;
 									-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 {
 						else {
 		       /***************************************/
 		       /***************************************/
 							/* Tor input signal selection is wrong */
 							/* Tor input signal selection is wrong */
@@ -1329,7 +1329,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 								s_BoardInfos.
 								s_BoardInfos.
 								ui_Address + 8 +
 								ui_Address + 8 +
 								(16 * b_TorCounter) + (64 * b_ModulNbr));
 								(16 * b_TorCounter) + (64 * b_ModulNbr));
-						}	// if (dw_Status & 0x1)
+						}	/*  if (dw_Status & 0x1) */
 						else {
 						else {
 		       /***************************/
 		       /***************************/
 							/* Tor counter not enabled */
 							/* Tor counter not enabled */
@@ -1337,8 +1337,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 
 
 							DPRINTK("Tor counter not enabled \n");
 							DPRINTK("Tor counter not enabled \n");
 							i_ReturnValue = -6;
 							i_ReturnValue = -6;
-						}	// if (dw_Status & 0x1)
-					}	// if (dw_Status & 0x10)
+						}	/*  if (dw_Status & 0x1) */
+					}	/*  if (dw_Status & 0x10) */
 					else {
 					else {
 		    /*******************************/
 		    /*******************************/
 						/* Tor counter not initialised */
 						/* Tor counter not initialised */
@@ -1346,10 +1346,10 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 
 
 						DPRINTK("Tor counter not initialised\n");
 						DPRINTK("Tor counter not initialised\n");
 						i_ReturnValue = -5;
 						i_ReturnValue = -5;
-					}	// // if (dw_Status & 0x10)
+					}	/*  // if (dw_Status & 0x10) */
 
 
-				}	// switch
-			}	// if (b_TorCounter <= 1)
+				}	/*  switch */
+			}	/*  if (b_TorCounter <= 1) */
 			else {
 			else {
 		 /**********************************/
 		 /**********************************/
 				/* Tor counter selection is wrong */
 				/* Tor counter selection is wrong */
@@ -1357,7 +1357,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 
 
 				DPRINTK("Tor counter selection is wrong\n");
 				DPRINTK("Tor counter selection is wrong\n");
 				i_ReturnValue = -4;
 				i_ReturnValue = -4;
-			}	// if (b_TorCounter <= 1)
+			}	/*  if (b_TorCounter <= 1) */
 		} else {
 		} else {
 	      /******************************************/
 	      /******************************************/
 			/* The module is not a tor counter module */
 			/* The module is not a tor counter module */
@@ -1375,22 +1375,22 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 		i_ReturnValue = -2;
 		i_ReturnValue = -2;
 	}
 	}
 
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 }
 
 
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_GetTorCounterInitialisation           |
 | 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, |
 |                                        	 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    |
 | Task              : Enable the tor counter (b_TorCounter) from selected    |
 |		      module (b_ModulNbr). You must calling the              |
 |		      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        |
 |                     The b_CycleMode parameter determine if you will        |
 |                     measured a single or more cycle.                       |
 |                     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_ModulNbr			=	CR_AREF(insn->chanspec);
 	b_TorCounter		=	CR_CHAN(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                     |
 |                                                 0 : ns                     |
 |                                                 1 : µs                     |
 |                                                 1 : µs                     |
 |                                                 2 : ms                     |
 |                                                 2 : ms                     |
 |                                                 3 : s                      |
 |                                                 3 : s                      |
 |                                                 4 : mn                     |
 |                                                 4 : mn                     |
 |                     PULONG_ pul_TimingInterval : Base timing value.        |
 |                     PULONG_ pul_TimingInterval : Base timing value.        |
-|		      PBYTE_ pb_InputMode        : Input signal level        |
+|		      unsigned char *_ pb_InputMode        : Input signal level        |
 |						   selection  		     |
 |						   selection  		     |
 |						0 : Tor count each low level |
 |						0 : Tor count each low level |
 |						1 : Tor count each high level|
 |						1 : Tor count each high level|
-|		      PBYTE_ pb_ExternGate	: Extern gate action         |
+|		      unsigned char *_ pb_ExternGate	: Extern gate action         |
 |						  selection                  |
 |						  selection                  |
 |						  0 : Extern gate signal not |
 |						  0 : Extern gate signal not |
 |						      used                   |
 |						      used                   |
 |						  1 : Extern gate signal used|
 |						  1 : Extern gate signal used|
-|                     PBYTE_ pb_CycleMode       : Tor counter acquisition    |
+|                     unsigned char *_ pb_CycleMode       : Tor counter acquisition    |
 |						  mode           	     |
 |						  mode           	     |
-|		      PBYTE_ pb_Enable		: Indicate if the tor counter|
+|		      unsigned char *_ pb_Enable		: Indicate if the tor counter|
 |						  is enabled or no           |
 |						  is enabled or no           |
 |						  0 : Tor counter disabled   |
 |						  0 : Tor counter disabled   |
 |						  1 : Tor counter enabled    |
 |						  1 : Tor counter enabled    |
-|                     PBYTE_ pb_InterruptEnable : Enable or disable the      |
+|                     unsigned char *_ pb_InterruptEnable : Enable or disable the      |
 |                                                 tor counter interrupt.     |
 |                                                 tor counter interrupt.     |
 |                                                 APCI1710_ENABLE:           |
 |                                                 APCI1710_ENABLE:           |
 |                                                 Enable the tor counter     |
 |                                                 Enable the tor counter     |
@@ -1441,13 +1441,13 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev,
 |                                                 APCI1710_DISABLE:          |
 |                                                 APCI1710_DISABLE:          |
 |                                                 Disable the tor counter    |
 |                                                 Disable the tor counter    |
 |                                                 interrupt
 |                                                 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                                           |
 | 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;
 	i_ReturnValue = insn->n;
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_TorCounter = CR_CHAN(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 */
 	/* Test the module number */
@@ -1526,9 +1526,9 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 						(64 * b_ModulNbr));
 						(64 * b_ModulNbr));
 
 
 					*pb_CycleMode =
 					*pb_CycleMode =
-						(BYTE) ((dw_Status >> 4) & 1);
+						(unsigned char) ((dw_Status >> 4) & 1);
 					*pb_InterruptEnable =
 					*pb_InterruptEnable =
-						(BYTE) ((dw_Status >> 5) & 1);
+						(unsigned char) ((dw_Status >> 5) & 1);
 
 
 		    /******************************************************/
 		    /******************************************************/
 					/* Test if extern gate used for clock or for signal B */
 					/* 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 =
 								*pb_InputMode =
 									APCI1710_TOR_QUADRUPLE_MODE;
 									APCI1710_TOR_QUADRUPLE_MODE;
 							}
 							}
-						}	// if (dw_Status & 0x400)
+						}	/*  if (dw_Status & 0x400) */
 						else {
 						else {
 							*pb_InputMode = 1;
 							*pb_InputMode = 1;
-						}	// // if (dw_Status & 0x400)
+						}	/*  // if (dw_Status & 0x400) */
 
 
 		       /************************/
 		       /************************/
 						/* Extern gate not used */
 						/* Extern gate not used */
 		       /************************/
 		       /************************/
 
 
 						*pb_ExternGate = 0;
 						*pb_ExternGate = 0;
-					}	// if (dw_Status & 0x600)
+					}	/*  if (dw_Status & 0x600) */
 					else {
 					else {
 						*pb_InputMode =
 						*pb_InputMode =
-							(BYTE) ((dw_Status >> 6)
+							(unsigned char) ((dw_Status >> 6)
 							& 1);
 							& 1);
 						*pb_ExternGate =
 						*pb_ExternGate =
-							(BYTE) ((dw_Status >> 7)
+							(unsigned char) ((dw_Status >> 7)
 							& 1);
 							& 1);
-					}	// if (dw_Status & 0x600)
+					}	/*  if (dw_Status & 0x600) */
 
 
 					*pb_TimingUnit =
 					*pb_TimingUnit =
 						devpriv->
 						devpriv->
@@ -1611,7 +1611,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 					i_ReturnValue = -5;
 					i_ReturnValue = -5;
 				}
 				}
 
 
-			}	// if (b_TorCounter <= 1)
+			}	/*  if (b_TorCounter <= 1) */
 			else {
 			else {
 		 /**********************************/
 		 /**********************************/
 				/* Tor counter selection is wrong */
 				/* Tor counter selection is wrong */
@@ -1619,7 +1619,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 
 
 				DPRINTK("Tor counter selection is wrong \n");
 				DPRINTK("Tor counter selection is wrong \n");
 				i_ReturnValue = -4;
 				i_ReturnValue = -4;
-			}	// if (b_TorCounter <= 1)
+			}	/*  if (b_TorCounter <= 1) */
 		} else {
 		} else {
 	      /******************************************/
 	      /******************************************/
 			/* The module is not a tor counter module */
 			/* The module is not a tor counter module */
@@ -1637,17 +1637,17 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 		i_ReturnValue = -2;
 		i_ReturnValue = -2;
 	}
 	}
 
 
-	return (i_ReturnValue);
+	return i_ReturnValue;
 }
 }
 
 
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function Name     : _INT_ i_APCI1710_ReadTorCounterValue                   |
 | 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)                |
 |                                PULONG_ pul_TorCounterValue)                |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task        	case APCI1710_TOR_GETPROGRESSSTATUS: Return the tor counter
 | 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       |
 |		      (pul_TorCounterValue) after a conting cycle stop       |
 |                     from selected tor counter module (b_ModulNbr).         |
 |                     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_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.                 |
 |                                                    status.                 |
 |                                               0 : Conting cycle not started|
 |                                               0 : Conting cycle not started|
 |                                                   Software gate not set.   |
 |                                                   Software gate not set.   |
@@ -1683,9 +1683,9 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev,
 |                                                   function                 |
 |                                                   function                 |
 |                                                 "i_APCI1710_InitTorCounter"|
 |                                                 "i_APCI1710_InitTorCounter"|
 |						4 : Timeeout occur           |
 |						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                                           |
 | Return Value      :  0: No error                                           |
 |                     -1: The handle parameter of the board is wrong         |
 |                     -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;
 	i_ReturnValue = insn->n;
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	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 */
 	/* Test the module number */
@@ -1896,7 +1896,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 											+
 											+
 											(16 * b_TorCounter) + (64 * b_ModulNbr));
 											(16 * b_TorCounter) + (64 * b_ModulNbr));
 										break;
 										break;
-									}	// if ((dw_Status & 4) == 4)
+									}	/*  if ((dw_Status & 4) == 4) */
 									else {
 									else {
 				/*******************************/
 				/*******************************/
 										/* Test if measurement stopped */
 										/* Test if measurement stopped */
@@ -1927,7 +1927,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 												(16 * b_TorCounter) + (64 * b_ModulNbr));
 												(16 * b_TorCounter) + (64 * b_ModulNbr));
 
 
 											break;
 											break;
-										}	// if ((dw_Status & 2) == 2)
+										}	/*  if ((dw_Status & 2) == 2) */
 										else {
 										else {
 				   /*******************************/
 				   /*******************************/
 											/* Test if measurement started */
 											/* Test if measurement started */
@@ -1941,7 +1941,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 												*pb_TorCounterStatus
 												*pb_TorCounterStatus
 													=
 													=
 													1;
 													1;
-											}	// if ((dw_Status & 1) == 1)
+											}	/*  if ((dw_Status & 1) == 1) */
 											else {
 											else {
 				      /***************************/
 				      /***************************/
 												/* Measurement not started */
 												/* Measurement not started */
@@ -1950,9 +1950,9 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 												*pb_TorCounterStatus
 												*pb_TorCounterStatus
 													=
 													=
 													0;
 													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) {
 									if (dw_TimeOut == ui_TimeOut) {
 				/*****************/
 				/*****************/
@@ -1973,7 +1973,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 
 
 										mdelay(1000);
 										mdelay(1000);
 									}
 									}
-								}	// for (;;)
+								}	/*  for (;;) */
 
 
 			  /*************************/
 			  /*************************/
 								/* Test if timeout occur */
 								/* Test if timeout occur */
@@ -2001,8 +2001,8 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 
 
 						default:
 						default:
 							printk("Inputs wrong\n");
 							printk("Inputs wrong\n");
-						}	// switch end
-					}	// if (dw_Status & 0x1)
+						}	/*  switch end */
+					}	/*  if (dw_Status & 0x1) */
 					else {
 					else {
 		       /***************************/
 		       /***************************/
 						/* Tor counter not enabled */
 						/* Tor counter not enabled */
@@ -2010,7 +2010,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 
 
 						DPRINTK("Tor counter not enabled\n");
 						DPRINTK("Tor counter not enabled\n");
 						i_ReturnValue = -6;
 						i_ReturnValue = -6;
-					}	// if (dw_Status & 0x1)
+					}	/*  if (dw_Status & 0x1) */
 				} else {
 				} else {
 		    /*******************************/
 		    /*******************************/
 					/* Tor counter not initialised */
 					/* Tor counter not initialised */
@@ -2019,7 +2019,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 					DPRINTK("Tor counter not initialised\n");
 					DPRINTK("Tor counter not initialised\n");
 					i_ReturnValue = -5;
 					i_ReturnValue = -5;
 				}
 				}
-			}	// if (b_TorCounter <= 1)
+			}	/*  if (b_TorCounter <= 1) */
 			else {
 			else {
 		 /**********************************/
 		 /**********************************/
 				/* Tor counter selection is wrong */
 				/* Tor counter selection is wrong */
@@ -2027,7 +2027,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 
 
 				DPRINTK("Tor counter selection is wrong\n");
 				DPRINTK("Tor counter selection is wrong\n");
 				i_ReturnValue = -4;
 				i_ReturnValue = -4;
-			}	// if (b_TorCounter <= 1)
+			}	/*  if (b_TorCounter <= 1) */
 		} else {
 		} else {
 	      /******************************************/
 	      /******************************************/
 			/* The module is not a tor counter module */
 			/* The module is not a tor counter module */
@@ -2045,5 +2045,5 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device
 		i_ReturnValue = -2;
 		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
  * 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_subdevice *s,
 					struct comedi_insn *insn, unsigned int *data);
 					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_subdevice *s,
 						struct comedi_insn *insn,
 						struct comedi_insn *insn,
 						unsigned int *data);
 						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_subdevice *s,
 						   struct comedi_insn *insn,
 						   struct comedi_insn *insn,
 						   unsigned int *data);
 						   unsigned int *data);
 /*
 /*
  * TOR_COUNTER READ FUNCTION
  * 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_subdevice *s,
 							   struct comedi_insn *insn,
 							   struct comedi_insn *insn,
 							   unsigned int *data);
 							   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.
 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.
 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                    |
 | 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     |
 | Task           APCI1710_TTL_INIT (using defaults)   : Configure the TTL I/O operating mode from selected     |
 |                     module  (b_ModulNbr). You must calling this function be|
 |                     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)
 				 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)
 |                                                   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 : -                                                      |
 | 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;
 	i_ReturnValue = insn->n;
 
 
 	/**************************/
 	/**************************/
@@ -172,10 +172,10 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub
 
 
 			case APCI1710_TTL_INITDIRECTION:
 			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 */
 				/* Test the version */
@@ -322,7 +322,7 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub
 				DPRINTK("\n");
 				DPRINTK("\n");
 			default:
 			default:
 				printk("Bad Config Type\n");
 				printk("Bad Config Type\n");
-			}	// switch end
+			}	/*  switch end */
 		} else {
 		} else {
 	      /**********************************/
 	      /**********************************/
 			/* The module is not a TTL module */
 			/* 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;
 		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               |
 | 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        |
 | Task              : Read the status from selected TTL digital input        |
 |                     (b_InputChannel)
 |                     (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)       |
 |                                                   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)            |
 |                                                   port (0 to 2)            |
 |                                                      0 : Port A selection  |
 |                                                      0 : Port A selection  |
 |                                                      1 : Port B selection  |
 |                                                      1 : Port B selection  |
 |                                                      2 : Port C selection  |
 |                                                      2 : Port C selection  |
 |                                                      3 : Port D selection  |
 |                                                      3 : Port D selection  |
-|                     BYTE_ b_InputChannel        : Selection from digital   |
+|                     unsigned char_ b_InputChannel        : Selection from digital   |
 |                                                   input ( 0 to 2)
 |                                                   input ( 0 to 2)
 APCI1710_TTL_READCHANNEL
 APCI1710_TTL_READCHANNEL
 	b_ModulNbr	  = CR_AREF(insn->chanspec);
 	b_ModulNbr	  = CR_AREF(insn->chanspec);
 	b_SelectedPort= CR_RANGE(insn->chanspec);
 	b_SelectedPort= CR_RANGE(insn->chanspec);
 	b_InputChannel= CR_CHAN(insn->chanspec);
 	b_InputChannel= CR_CHAN(insn->chanspec);
-	b_ReadType	  = (BYTE) data[0];
+	b_ReadType	  = (unsigned char) data[0];
 
 
  APCI1710_TTL_READPORT|
  APCI1710_TTL_READPORT|
 	b_ModulNbr	  = CR_AREF(insn->chanspec);
 	b_ModulNbr	  = CR_AREF(insn->chanspec);
 	b_SelectedPort= CR_RANGE(insn->chanspec);
 	b_SelectedPort= CR_RANGE(insn->chanspec);
-	b_ReadType	  = (BYTE) data[0];
+	b_ReadType	  = (unsigned char) data[0];
 
 
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters : data[0]
 | Output Parameters : data[0]
 
 
-	PBYTE_  pb_ChannelStatus    : Digital input channel    |
+	unsigned char *_  pb_ChannelStatus    : Digital input channel    |
 |                                                   status                   |
 |                                                   status                   |
 |                                                   0 : Channle is not active|
 |                                                   0 : Channle is not active|
 |                                                   1 : Channle is 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;
 	i_ReturnValue = insn->n;
-	b_ReadType = (BYTE) data[0];
+	b_ReadType = (unsigned char) data[0];
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_SelectedPort = CR_RANGE(insn->chanspec);
 	b_SelectedPort = CR_RANGE(insn->chanspec);
 	b_InputChannel = CR_CHAN(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) {
 			switch (b_ReadType) {
 
 
 			case APCI1710_TTL_READCHANNEL:
 			case APCI1710_TTL_READCHANNEL:
-				pb_ChannelStatus = (PBYTE) & data[0];
+				pb_ChannelStatus = (unsigned char *) &data[0];
 	      /********************************/
 	      /********************************/
 				/* Test the TTL I/O port number */
 				/* Test the TTL I/O port number */
 	      /********************************/
 	      /********************************/
@@ -493,7 +493,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde
 
 
 								*pb_ChannelStatus
 								*pb_ChannelStatus
 									=
 									=
-									(BYTE) (
+									(unsigned char) (
 									(dw_StatusReg
 									(dw_StatusReg
 										>>
 										>>
 										(8 * b_SelectedPort)) >> b_InputChannel) & 1;
 										(8 * b_SelectedPort)) >> b_InputChannel) & 1;
@@ -533,7 +533,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde
 				break;
 				break;
 
 
 			case APCI1710_TTL_READPORT:
 			case APCI1710_TTL_READPORT:
-				pb_PortValue = (PBYTE) & data[0];
+				pb_PortValue = (unsigned char *) &data[0];
 			  /********************************/
 			  /********************************/
 				/* Test the TTL I/O port number */
 				/* 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));
 								(64 * b_ModulNbr));
 
 
 							*pb_PortValue =
 							*pb_PortValue =
-								(BYTE) (
+								(unsigned char) (
 								(dw_StatusReg >>
 								(dw_StatusReg >>
 									(8 * b_SelectedPort)) & 0xFF);
 									(8 * b_SelectedPort)) & 0xFF);
 						} else {
 						} else {
@@ -610,7 +610,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde
 			default:
 			default:
 				printk("Bad ReadType\n");
 				printk("Bad ReadType\n");
 
 
-			}	//End Switch
+			}	/* End Switch */
 		} else {
 		} else {
 	      /**********************************/
 	      /**********************************/
 			/* The module is not a TTL module */
 			/* 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;
 		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)              |
 *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)              |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              : Read the status from all digital input ports           |
 | Task              : Read the status from all digital input ports           |
 |                     (port A, port B and port C) from selected TTL          |
 |                     (port A, port B and port C) from selected TTL          |
 |		      module (b_ModulNbr) 				     |
 |		      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)       |
 |                                                   configure (0 to 3)       |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters : PULONG_  pul_PortValue      : Digital TTL inputs port  |
 | 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;
 	i_ReturnValue = insn->n;
-	pul_PortValue = (PULONG) & data[0];
+	pul_PortValue = (unsigned int *) &data[0];
 
 
 	/**************************/
 	/**************************/
 	/* Test the module number */
 	/* Test the module number */
@@ -777,7 +777,7 @@ INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 		i_ReturnValue = -2;
 		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                         |
 | 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)           |
 	struct comedi_insn *insn,unsigned int *data)           |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              : Sets or resets  the output witch has been passed with the         |
 | Task              : Sets or resets  the output witch has been passed with the         |
 |                     parameter b_Channel. Setting an output means setting   |
 |                     parameter b_Channel. Setting an output means setting   |
 |                     an ouput high.                                         |
 |                     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)               |
 |                                             channel (0 or 1)               |
 |                                                0      : PD0                |
 |                                                0      : PD0                |
 |                                                1      : PD1                |
 |                                                1      : PD1                |
@@ -811,7 +811,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi
 
 
   b_ModulNbr	   = CR_AREF(insn->chanspec);
   b_ModulNbr	   = CR_AREF(insn->chanspec);
 	b_OutputChannel= CR_CHAN(insn->chanspec);
 	b_OutputChannel= CR_CHAN(insn->chanspec);
-	ui_State	   = data[0]; // ON or OFF
+	ui_State	   = data[0]; /*  ON or OFF */
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 | 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;
 	i_ReturnValue = insn->n;
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_ModulNbr = CR_AREF(insn->chanspec);
 	b_OutputChannel = CR_CHAN(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 */
 	/* Test the module number */
@@ -953,7 +953,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev,
 									ui_Address
 									ui_Address
 									+
 									+
 									(64 * b_ModulNbr));
 									(64 * b_ModulNbr));
-								if (ui_State)	// ON
+								if (ui_State)	/*  ON */
 								{
 								{
 									dw_StatusReg
 									dw_StatusReg
 										=
 										=
@@ -969,7 +969,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev,
 										(b_OutputChannel
 										(b_OutputChannel
 											%
 											%
 											8));
 											8));
-								} else	// Off
+								} else	/*  Off */
 								{
 								{
 									dw_StatusReg
 									dw_StatusReg
 										=
 										=
@@ -1034,5 +1034,5 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev,
 		i_ReturnValue = -2;
 		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
  * 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);
 				   struct comedi_insn *insn, unsigned int *data);
 
 
 /*
 /*
  * TTL INPUT FUNCTION
  * 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);
 				 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_subdevice *s,
 					 struct comedi_insn *insn, unsigned int *data);
 					 struct comedi_insn *insn, unsigned int *data);
 
 
 /*
 /*
  * TTL OUTPUT FUNCTIONS
  * 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_subdevice *s,
 					 struct comedi_insn *insn, unsigned int *data);
 					 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.
 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.
 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"
 #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.                        |*/
 /*| 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      : -                                                      |*/
 /*| 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;
 	for (i_WordCounter = 0; i_WordCounter < i_NbOfWordsToRead;
 		i_WordCounter++) {
 		i_WordCounter++) {
@@ -88,106 +88,99 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead,
 				inl(dw_PCIBoardEepromAddress +
 				inl(dw_PCIBoardEepromAddress +
 				AMCC_OP_REG_MCSR);
 				AMCC_OP_REG_MCSR);
 			dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
 			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++) {
 		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,
 			outb(NVCMD_LOAD_LOW,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				3);
 				3);
 
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 			do {
 				dw_eeprom_busy =
 				dw_eeprom_busy =
 					inl(dw_PCIBoardEepromAddress +
 					inl(dw_PCIBoardEepromAddress +
 					AMCC_OP_REG_MCSR);
 					AMCC_OP_REG_MCSR);
 				dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
 				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,
 			outb(b_SelectedAddressLow,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				2);
 				2);
 
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 			do {
 				dw_eeprom_busy =
 				dw_eeprom_busy =
 					inl(dw_PCIBoardEepromAddress +
 					inl(dw_PCIBoardEepromAddress +
 					AMCC_OP_REG_MCSR);
 					AMCC_OP_REG_MCSR);
 				dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
 				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,
 			outb(NVCMD_LOAD_HIGH,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				3);
 				3);
 
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 			do {
 				dw_eeprom_busy =
 				dw_eeprom_busy =
 					inl(dw_PCIBoardEepromAddress +
 					inl(dw_PCIBoardEepromAddress +
 					AMCC_OP_REG_MCSR);
 					AMCC_OP_REG_MCSR);
 				dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
 				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,
 			outb(b_SelectedAddressHigh,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				2);
 				2);
 
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 			do {
 				dw_eeprom_busy =
 				dw_eeprom_busy =
 					inl(dw_PCIBoardEepromAddress +
 					inl(dw_PCIBoardEepromAddress +
 					AMCC_OP_REG_MCSR);
 					AMCC_OP_REG_MCSR);
 				dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
 				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,
 			outb(NVCMD_BEGIN_READ,
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR +
 				3);
 				3);
 
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 			do {
 				dw_eeprom_busy =
 				dw_eeprom_busy =
 					inl(dw_PCIBoardEepromAddress +
 					inl(dw_PCIBoardEepromAddress +
 					AMCC_OP_REG_MCSR);
 					AMCC_OP_REG_MCSR);
 				dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
 				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 =
 			*pb_ReadByte =
 				inb(dw_PCIBoardEepromAddress +
 				inb(dw_PCIBoardEepromAddress +
 				AMCC_OP_REG_MCSR + 2);
 				AMCC_OP_REG_MCSR + 2);
 
 
-			//Wait on busy
+			/* Wait on busy */
 			do {
 			do {
 				dw_eeprom_busy =
 				dw_eeprom_busy =
 					inl(dw_PCIBoardEepromAddress +
 					inl(dw_PCIBoardEepromAddress +
 					AMCC_OP_REG_MCSR);
 					AMCC_OP_REG_MCSR);
 				dw_eeprom_busy = dw_eeprom_busy & EEPROM_BUSY;
 				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) {
 			if (i_Counter == 0) {
 				b_ReadLowByte = pb_ReadByte[0];
 				b_ReadLowByte = pb_ReadByte[0];
 			} else {
 			} else {
 				b_ReadHighByte = pb_ReadByte[0];
 				b_ReadHighByte = pb_ReadByte[0];
 			}
 			}
 
 
-			//Sleep
-			for (i = 0; i < 10000; i++) ;
+			/* Sleep */
+			msleep(1);
 
 
 		}
 		}
 		w_ReadWord =
 		w_ReadWord =
@@ -196,8 +189,8 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead,
 
 
 		pw_DataRead[i_WordCounter] = w_ReadWord;
 		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_READ	(0x7 << 5)	/* nvRam begin read command */
 #define NVCMD_BEGIN_WRITE	(0x6 << 5)	/* EEPROM begin write 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_MRTC		0x30
 #define AMCC_OP_REG_MBEF		0x34
 #define AMCC_OP_REG_MBEF		0x34
 #define AMCC_OP_REG_INTCSR		0x38
 #define AMCC_OP_REG_INTCSR		0x38
-/* INT source */
+/* int source */
 #define  AMCC_OP_REG_INTCSR_SRC		(AMCC_OP_REG_INTCSR + 2)
 #define  AMCC_OP_REG_INTCSR_SRC		(AMCC_OP_REG_INTCSR + 2)
 /* FIFO ctrl */
 /* FIFO ctrl */
 #define  AMCC_OP_REG_INTCSR_FEC		(AMCC_OP_REG_INTCSR + 3)
 #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;
 				*card = amcc;
 				return 0;	/* ok, card is found */
 				return 0;	/* ok, card is found */
 			} else {
 			} 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);
 					  pci_bus, pci_slot);
 				return 2;	/* card exist but is used */
 				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 */
 		/* use autodetection */
 		card = ptr_find_free_pci_card_by_device(vendor_id, device_id);
 		card = ptr_find_free_pci_card_by_device(vendor_id, device_id);
 		if (card == NULL) {
 		if (card == NULL) {
-			rt_printk(" - Unused card not found in system!\n");
+			printk(" - Unused card not found in system!\n");
 			return NULL;
 			return NULL;
 		}
 		}
 	} else {
 	} else {
@@ -455,18 +455,18 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
 							 pci_bus, pci_slot,
 							 pci_bus, pci_slot,
 							 &card)) {
 							 &card)) {
 		case 1:
 		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);
 				  pci_bus, pci_slot);
 			return NULL;
 			return NULL;
 		case 2:
 		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);
 				  pci_bus, pci_slot);
 			return NULL;
 			return NULL;
 		}
 		}
 	}
 	}
 
 
 	if (pci_card_alloc(card, i_Master) != 0) {
 	if (pci_card_alloc(card, i_Master) != 0) {
-		rt_printk(" - Can't allocate card!\n");
+		printk(" - Can't allocate card!\n");
 		return NULL;
 		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.
 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.
 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_common.h"
 #include "addi_amcc_s5933.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)
 #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)
 void fpu_begin(void)
 {
 {
-	//asm ("fstenv b_SaveFPUReg");
+	/* asm ("fstenv b_SaveFPUReg"); */
 	kernel_fpu_begin();
 	kernel_fpu_begin();
 }
 }
 
 
 void fpu_end(void)
 void fpu_end(void)
 {
 {
-	// asm ("frstor b_SaveFPUReg");
+	/*  asm ("frstor b_SaveFPUReg"); */
 	kernel_fpu_end();
 	kernel_fpu_end();
 }
 }
 #endif
 #endif
@@ -219,7 +219,7 @@ static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = {
 
 
 MODULE_DEVICE_TABLE(pci, addi_apci_tbl);
 MODULE_DEVICE_TABLE(pci, addi_apci_tbl);
 
 
-static const boardtype boardtypes[] = {
+static const struct addi_board boardtypes[] = {
 #ifdef CONFIG_APCI_3120
 #ifdef CONFIG_APCI_3120
 	{"apci3120",
 	{"apci3120",
 			APCI3120_BOARD_VENDOR_ID,
 			APCI3120_BOARD_VENDOR_ID,
@@ -901,7 +901,7 @@ static const boardtype boardtypes[] = {
 		NULL},
 		NULL},
 #endif
 #endif
 #ifdef CONFIG_APCI_3300
 #ifdef CONFIG_APCI_3300
-	//Begin JK 20.10.2004: APCI-3300 integration
+	/* Begin JK	.20.10.2004 = APCI-3300 integration */
 	{"apci3300",
 	{"apci3300",
 			APCI3200_BOARD_VENDOR_ID,
 			APCI3200_BOARD_VENDOR_ID,
 			0x3007,
 			0x3007,
@@ -2525,16 +2525,16 @@ static const boardtype boardtypes[] = {
 #endif
 #endif
 };
 };
 
 
-#define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype))
+#define n_boardtypes (sizeof(boardtypes)/sizeof(struct addi_board))
 
 
 struct comedi_driver driver_addi = {
 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);
 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;
 	struct comedi_subdevice *s;
 	int ret, pages, i, n_subdevices;
 	int ret, pages, i, n_subdevices;
-	DWORD dw_Dummy;
+	unsigned int dw_Dummy;
 	resource_size_t io_addr[5];
 	resource_size_t io_addr[5];
 	unsigned int irq;
 	unsigned int irq;
 	resource_size_t iobase_a, iobase_main, iobase_addon, iobase_reserved;
 	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",
 	sprintf(c_Identifier, "Addi-Data GmbH Comedi %s",
 		this_board->pc_DriverName);
 		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) {
 	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;
 		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)) {
 	if ((this_board->i_Dma) && (it->options[2] == 0)) {
 		i_Dma = 1;
 		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;
 		return -EIO;
-	}
+
 	devpriv->allocated = 1;
 	devpriv->allocated = 1;
 
 
 	if ((i_pci_card_data(card, &pci_bus, &pci_slot, &pci_func, &io_addr[0],
 	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) {
 		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 {
 		} 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;
 		dev->board_name = this_board->pc_DriverName;
 		devpriv->amcc = card;
 		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;
 		devpriv->ps_BoardInfo = this_board;
 	} else {
 	} else {
 		dev->board_name = this_board->pc_DriverName;
 		dev->board_name = this_board->pc_DriverName;
 		dev->iobase = (unsigned long)io_addr[2];
 		dev->iobase = (unsigned long)io_addr[2];
 		devpriv->amcc = card;
 		devpriv->amcc = card;
-		devpriv->iobase = (INT) io_addr[2];
+		devpriv->iobase = (int) io_addr[2];
 		devpriv->ps_BoardInfo = this_board;
 		devpriv->ps_BoardInfo = this_board;
-		devpriv->i_IobaseReserved = (INT) io_addr[3];
+		devpriv->i_IobaseReserved = (int) io_addr[3];
 		printk("\nioremap begin");
 		printk("\nioremap begin");
 		devpriv->dw_AiBase =
 		devpriv->dw_AiBase =
-			(ULONG_PTR) ioremap(io_addr[3],
+			(unsigned long) ioremap(io_addr[3],
 			this_board->i_IorangeBase3);
 			this_board->i_IorangeBase3);
 		printk("\nioremap end");
 		printk("\nioremap end");
 	}
 	}
 
 
-	//##
+	/* ## */
 
 
 	if (irq > 0) {
 	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) {
 				c_Identifier, dev) < 0) {
 			printk(", unable to allocate IRQ %u, DISABLING IT",
 			printk(", unable to allocate IRQ %u, DISABLING IT",
 				irq);
 				irq);
 			irq = 0;	/* Can't use IRQ */
 			irq = 0;	/* Can't use IRQ */
 		} else {
 		} else {
-			rt_printk("\nirq=%u", irq);
+			printk("\nirq=%u", irq);
 		}
 		}
 	} else {
 	} else {
-		rt_printk(", IRQ disabled");
+		printk(", IRQ disabled");
 	}
 	}
 
 
 	printk("\nOption %d %d %d\n", it->options[0], it->options[1],
 	printk("\nOption %d %d %d\n", it->options[0], it->options[1],
 		it->options[2]);
 		it->options[2]);
 	dev->irq = irq;
 	dev->irq = irq;
 
 
-	// Read eepeom and fill boardtype Structure
+	/*  Read eepeom and fill addi_board Structure */
 
 
 	if (this_board->i_PCIEeprom) {
 	if (this_board->i_PCIEeprom) {
 		printk("\nPCI Eeprom used");
 		printk("\nPCI Eeprom used");
 		if (!(strcmp(this_board->pc_EepromChip, "S5920"))) {
 		if (!(strcmp(this_board->pc_EepromChip, "S5920"))) {
-			// Set 3 wait stait
+			/*  Set 3 wait stait */
 			if (!(strcmp(this_board->pc_DriverName, "apci035"))) {
 			if (!(strcmp(this_board->pc_DriverName, "apci035"))) {
 				outl(0x80808082, devpriv->i_IobaseAmcc + 0x60);
 				outl(0x80808082, devpriv->i_IobaseAmcc + 0x60);
 			} else {
 			} else {
 				outl(0x83838383, devpriv->i_IobaseAmcc + 0x60);
 				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);
 			dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38);
 			outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38);
 			outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38);
 			printk("\nEnable the interrupt for the controler");
 			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) {
 	if (this_board->i_Dma) {
 		printk("\nDMA used");
 		printk("\nDMA used");
 		if (devpriv->us_UseDma == ADDI_ENABLE) {
 		if (devpriv->us_UseDma == ADDI_ENABLE) {
-			// alloc DMA buffers
+			/*  alloc DMA buffers */
 			devpriv->b_DmaDoubleBuffer = 0;
 			devpriv->b_DmaDoubleBuffer = 0;
 			for (i = 0; i < 2; i++) {
 			for (i = 0; i < 2; i++) {
 				for (pages = 4; pages >= 0; pages--) {
 				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;
 						break;
-					}
 				}
 				}
 				if (devpriv->ul_DmaBufferVirtual[i]) {
 				if (devpriv->ul_DmaBufferVirtual[i]) {
 					devpriv->ui_DmaBufferPages[i] = pages;
 					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]) {
 			if (!devpriv->ul_DmaBufferVirtual[0]) {
-				rt_printk
+				printk
 					(", Can't allocate DMA buffer, DMA disabled!");
 					(", Can't allocate DMA buffer, DMA disabled!");
 				devpriv->us_UseDma = ADDI_DISABLE;
 				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)) {
 		if ((devpriv->us_UseDma == ADDI_ENABLE)) {
-			rt_printk("\nDMA ENABLED\n");
+			printk("\nDMA ENABLED\n");
 		} else {
 		} else {
 			printk("\nDMA DISABLED\n");
 			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
 #ifdef CONFIG_APCI_1710
 		i_ADDI_AttachPCI1710(dev);
 		i_ADDI_AttachPCI1710(dev);
 
 
-		// save base address
+		/*  save base address */
 		devpriv->s_BoardInfos.ui_Address = io_addr[2];
 		devpriv->s_BoardInfos.ui_Address = io_addr[2];
 #endif
 #endif
 	} else {
 	} else {
-		//Update-0.7.57->0.7.68dev->n_subdevices = 7;
+		/* Update-0.7.57->0.7.68dev->n_subdevices = 7; */
 		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;
 			return ret;
 
 
-		// Allocate and Initialise AI Subdevice Structures
+		/*  Allocate and Initialise AI Subdevice Structures */
 		s = dev->subdevices + 0;
 		s = dev->subdevices + 0;
 		if ((this_board->i_NbrAiChannel)
 		if ((this_board->i_NbrAiChannel)
 			|| (this_board->i_NbrAiChannelDiff)) {
 			|| (this_board->i_NbrAiChannelDiff)) {
 			dev->read_subdev = s;
 			dev->read_subdev = s;
 			s->type = COMEDI_SUBD_AI;
 			s->type = COMEDI_SUBD_AI;
 			s->subdev_flags =
 			s->subdev_flags =
-				SDF_READABLE | SDF_RT | SDF_COMMON | SDF_GROUND
+				SDF_READABLE | SDF_COMMON | SDF_GROUND
 				| SDF_DIFF;
 				| SDF_DIFF;
 			if (this_board->i_NbrAiChannel) {
 			if (this_board->i_NbrAiChannel) {
 				s->n_chan = 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;
 			s->type = COMEDI_SUBD_UNUSED;
 		}
 		}
 
 
-		// Allocate and Initialise AO Subdevice Structures
+		/*  Allocate and Initialise AO Subdevice Structures */
 		s = dev->subdevices + 1;
 		s = dev->subdevices + 1;
 		if (this_board->i_NbrAoChannel) {
 		if (this_board->i_NbrAoChannel) {
 			s->type = COMEDI_SUBD_AO;
 			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->n_chan = this_board->i_NbrAoChannel;
 			s->maxdata = this_board->i_AoMaxdata;
 			s->maxdata = this_board->i_AoMaxdata;
 			s->len_chanlist = this_board->i_NbrAoChannel;
 			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 {
 		} else {
 			s->type = COMEDI_SUBD_UNUSED;
 			s->type = COMEDI_SUBD_UNUSED;
 		}
 		}
-		// Allocate and Initialise DI Subdevice Structures
+		/*  Allocate and Initialise DI Subdevice Structures */
 		s = dev->subdevices + 2;
 		s = dev->subdevices + 2;
 		if (this_board->i_NbrDiChannel) {
 		if (this_board->i_NbrDiChannel) {
 			s->type = COMEDI_SUBD_DI;
 			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->n_chan = this_board->i_NbrDiChannel;
 			s->maxdata = 1;
 			s->maxdata = 1;
 			s->len_chanlist = this_board->i_NbrDiChannel;
 			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 {
 		} else {
 			s->type = COMEDI_SUBD_UNUSED;
 			s->type = COMEDI_SUBD_UNUSED;
 		}
 		}
-		// Allocate and Initialise DO Subdevice Structures
+		/*  Allocate and Initialise DO Subdevice Structures */
 		s = dev->subdevices + 3;
 		s = dev->subdevices + 3;
 		if (this_board->i_NbrDoChannel) {
 		if (this_board->i_NbrDoChannel) {
 			s->type = COMEDI_SUBD_DO;
 			s->type = COMEDI_SUBD_DO;
 			s->subdev_flags =
 			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->n_chan = this_board->i_NbrDoChannel;
 			s->maxdata = this_board->i_DoMaxdata;
 			s->maxdata = this_board->i_DoMaxdata;
 			s->len_chanlist = this_board->i_NbrDoChannel;
 			s->len_chanlist = this_board->i_NbrDoChannel;
 			s->range_table = &range_digital;
 			s->range_table = &range_digital;
 			s->io_bits = 0xf;	/* all bits output */
 			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 =
 			s->insn_write =
 				this_board->i_hwdrv_InsnWriteDigitalOutput;
 				this_board->i_hwdrv_InsnWriteDigitalOutput;
 			s->insn_bits =
 			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;
 			s->type = COMEDI_SUBD_UNUSED;
 		}
 		}
 
 
-		// Allocate and Initialise Timer Subdevice Structures
+		/*  Allocate and Initialise Timer Subdevice Structures */
 		s = dev->subdevices + 4;
 		s = dev->subdevices + 4;
 		if (this_board->i_Timer) {
 		if (this_board->i_Timer) {
 			s->type = COMEDI_SUBD_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->n_chan = 1;
 			s->maxdata = 0;
 			s->maxdata = 0;
 			s->len_chanlist = 1;
 			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;
 			s->type = COMEDI_SUBD_UNUSED;
 		}
 		}
 
 
-		// Allocate and Initialise TTL
+		/*  Allocate and Initialise TTL */
 		s = dev->subdevices + 5;
 		s = dev->subdevices + 5;
 		if (this_board->i_NbrTTLChannel) {
 		if (this_board->i_NbrTTLChannel) {
 			s->type = COMEDI_SUBD_TTLIO;
 			s->type = COMEDI_SUBD_TTLIO;
 			s->subdev_flags =
 			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->n_chan = this_board->i_NbrTTLChannel;
 			s->maxdata = 1;
 			s->maxdata = 1;
 			s->io_bits = 0;	/* all bits input */
 			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) {
 	if (dev->private) {
@@ -2935,7 +2930,7 @@ static int i_ADDI_Detach(struct comedi_device * dev)
 		}
 		}
 
 
 		if (dev->irq) {
 		if (dev->irq) {
-			comedi_free_irq(dev->irq, dev);
+			free_irq(dev->irq, dev);
 		}
 		}
 
 
 		if ((devpriv->ps_BoardInfo->pc_EepromChip == NULL)
 		if ((devpriv->ps_BoardInfo->pc_EepromChip == NULL)
@@ -2965,7 +2960,7 @@ static int i_ADDI_Detach(struct comedi_device * dev)
 		}
 		}
 
 
 		if (pci_list_builded) {
 		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);
 			v_pci_card_list_cleanup(this_board->i_VendorId);
 			pci_list_builded = 0;
 			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);
 	this_board->i_hwdrv_Reset(dev);
 	return 0;
 	return 0;
 }
 }
 
 
-// Interrupt function
+/* Interrupt function */
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function name     :                                                        |
 | 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						     |
 | 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;
 	struct comedi_device *dev = d;
 	this_board->v_hwdrv_Interrupt(irq, d);
 	this_board->v_hwdrv_Interrupt(irq, d);
 	return IRQ_RETVAL(1);
 	return IRQ_RETVAL(1);
 }
 }
 
 
-// EEPROM Read Function
+/* EEPROM Read Function */
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function name     :                                                        |
 | 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,
 	w_Data = w_EepromReadWord(devpriv->i_IobaseAmcc,
 		this_board->pc_EepromChip, 0x100 + (2 * w_Address));
 		this_board->pc_EepromChip, 0x100 + (2 * w_Address));
 	data[0] = w_Data;
 	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;
 	return insn->n;
 
 
 }
 }

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

@@ -36,26 +36,12 @@
 #define ERROR	-1
 #define ERROR	-1
 #define SUCCESS	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_ENABLE		1
 #define ADDI_DISABLE		0
 #define ADDI_DISABLE		0
@@ -75,37 +61,37 @@ typedef const struct comedi_lrange *PCRANGE;
 /* Structures */
 /* Structures */
 
 
 /* structure for the boardtype */
 /* 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 */
 	/* interrupt and reset */
 	void (*v_hwdrv_Interrupt)(int irq, void *d);
 	void (*v_hwdrv_Interrupt)(int irq, void *d);
@@ -213,21 +199,21 @@ typedef struct {
 	int (*i_hwdr_WriteTTLIOChlOnOff)(struct comedi_device *dev,
 	int (*i_hwdr_WriteTTLIOChlOnOff)(struct comedi_device *dev,
 					 struct comedi_subdevice *s,
 					 struct comedi_subdevice *s,
 					 struct comedi_insn *insn, unsigned int *data);
 					 struct comedi_insn *insn, unsigned int *data);
-} boardtype;
+};
 
 
-//MODULE INFO STRUCTURE
+/* MODULE INFO STRUCTURE */
 
 
-typedef union {
+union str_ModuleInfo {
 	/* Incremental counter infos */
 	/* Incremental counter infos */
 	struct {
 	struct {
 		union {
 		union {
 			struct {
 			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;
 			} s_ByteModeRegister;
-			DWORD dw_ModeRegister1_2_3_4;
+			unsigned int dw_ModeRegister1_2_3_4;
 		} s_ModeRegister;
 		} s_ModeRegister;
 
 
 		struct {
 		struct {
@@ -244,25 +230,25 @@ typedef union {
 
 
 	/* SSI infos */
 	/* SSI infos */
 	struct {
 	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;
 	} s_SSICounterInfo;
 
 
 	/* TTL I/O infos */
 	/* TTL I/O infos */
 	struct {
 	struct {
-		BYTE b_TTLInit;
-		BYTE b_PortConfiguration[4];
+		unsigned char b_TTLInit;
+		unsigned char b_PortConfiguration[4];
 	} s_TTLIOInfo;
 	} s_TTLIOInfo;
 
 
 	/* Digital I/O infos */
 	/* Digital I/O infos */
 	struct {
 	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;
 	} s_DigitalIOInfo;
 
 
       /*********************/
       /*********************/
@@ -271,14 +257,14 @@ typedef union {
 
 
 	struct {
 	struct {
 		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];
 		} s_82X54TimerInfo[3];
-		BYTE b_InterruptMask;
+		unsigned char b_InterruptMask;
 	} s_82X54ModuleInfo;
 	} s_82X54ModuleInfo;
 
 
       /*********************/
       /*********************/
@@ -286,13 +272,13 @@ typedef union {
       /*********************/
       /*********************/
 
 
 	struct {
 	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;
 		double d_TimingInterval;
-		DWORD dw_ConfigReg;
+		unsigned int dw_ConfigReg;
 	} s_ChronoModuleInfo;
 	} s_ChronoModuleInfo;
 
 
       /***********************/
       /***********************/
@@ -301,154 +287,154 @@ typedef union {
 
 
 	struct {
 	struct {
 		struct {
 		struct {
-			BYTE b_PulseEncoderInit;
+			unsigned char b_PulseEncoderInit;
 		} s_PulseEncoderInfo[4];
 		} 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;
 	} s_PulseEncoderModuleInfo;
 
 
 	/* Tor conter infos */
 	/* Tor conter infos */
 	struct {
 	struct {
 		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;
 			double d_TimingInterval;
-			ULONG ul_RealTimingInterval;
+			unsigned int ul_RealTimingInterval;
 		} s_TorCounterInfo[2];
 		} s_TorCounterInfo[2];
-		BYTE b_PCIInputClock;
+		unsigned char b_PCIInputClock;
 	} s_TorCounterModuleInfo;
 	} s_TorCounterModuleInfo;
 
 
 	/* PWM infos */
 	/* PWM infos */
 	struct {
 	struct {
 		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_LowTiming;
 			double d_HighTiming;
 			double d_HighTiming;
-			ULONG ul_RealLowTiming;
-			ULONG ul_RealHighTiming;
+			unsigned int ul_RealLowTiming;
+			unsigned int ul_RealHighTiming;
 		} s_PWMInfo[2];
 		} s_PWMInfo[2];
-		BYTE b_ClockSelection;
+		unsigned char b_ClockSelection;
 	} s_PWMModuleInfo;
 	} s_PWMModuleInfo;
 
 
 	/* ETM infos */
 	/* ETM infos */
 	struct {
 	struct {
 		struct {
 		struct {
-			BYTE b_ETMEnable;
-			BYTE b_ETMInterrupt;
+			unsigned char b_ETMEnable;
+			unsigned char b_ETMInterrupt;
 		} s_ETMInfo[2];
 		} 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;
 		double d_TimingInterval;
-		ULONG ul_Timing;
+		unsigned int ul_Timing;
 	} s_ETMModuleInfo;
 	} s_ETMModuleInfo;
 
 
 	/* CDA infos */
 	/* CDA infos */
 	struct {
 	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;
 	} s_CDAModuleInfo;
 
 
-} str_ModuleInfo;
+};
 
 
 /* Private structure for the addi_apci3120 driver */
 /* 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 */
 	/* Pointer to the current process */
 	struct task_struct *tsk_Current;
 	struct task_struct *tsk_Current;
-	boardtype *ps_BoardInfo;
+	struct addi_board *ps_BoardInfo;
 
 
 	/* Hardware board infos for 1710 */
 	/* Hardware board infos for 1710 */
 	struct {
 	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;
 	} s_BoardInfos;
 
 
 	/* Interrupt infos */
 	/* Interrupt infos */
 	struct {
 	struct {
-		ULONG ul_InterruptOccur;	/* 0   : No interrupt occur */
+		unsigned int ul_InterruptOccur;	/* 0   : No interrupt occur */
 						/* > 0 : 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 {
 		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_FIFOInterruptParameters[APCI1710_SAVE_INTERRUPT];
 	} s_InterruptParameters;
 	} 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 */
 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_Detach(struct comedi_device *dev);
 static int i_ADDI_Reset(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,
 static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, struct comedi_subdevice *s,
 				     struct comedi_insn *insn, unsigned int *data);
 				     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.
 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.
 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_DIGITALINPUT 			0
 #define EEPROM_DIGITALOUTPUT			1
 #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
 #define EEPROM_TIMER_WATCHDOG_COUNTER	10
 
 
 struct str_Functionality {
 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];
 	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 {
 typedef struct {
-	WORD w_Nchannel;
-	BYTE b_Resolution;
+	unsigned short w_Nchannel;
+	unsigned char b_Resolution;
 } str_AnalogOutputHeader;
 } 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              */
 		/*            Read Header Functions              */
 		/*****************************************/
 		/*****************************************/
 
 
-INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
+int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress,
 	char *pc_PCIChipInformation, struct comedi_device *dev);
 	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                         */
 		/*      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,               		 |
 |				 char *	pc_PCIChipInformation,               		 |
-|				 WORD   w_EepromStartAddress)                		 |
+|				 unsigned short   w_EepromStartAddress)                		 |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              : Read from eepromn a word                               |
 | 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.          |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
 |																	 |
-|		      WORD w_EepromStartAddress    : Selected eeprom address |
+|		      unsigned short w_EepromStartAddress    : Selected eeprom address |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 | 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++)
 		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;
 				b_ReadLowByte = b_ReadByte;
 
 
-			}	// if(b_Counter==0)
+			}	/*  if(b_Counter==0) */
 
 
 			else
 			else
 			{
 			{
 
 
 				b_ReadHighByte = b_ReadByte;
 				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"))
 	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                                  |
 | 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
 	do
 	{
 	{
@@ -403,17 +402,16 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress)
 
 
 		/*      the operator register is AMCC_OP_REG_MCSR+3 */
 		/*      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 = inb(w_PCIBoardEepromAddress + 0x3F);
 		b_EepromBusy = b_EepromBusy & 0x80;
 		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;
 	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;
         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)    |
 |				char *	pc_PCIChipInformation,struct comedi_device *dev)    |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              : Read from eeprom Main Header                           |
 | 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.          |
 |		      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)
 	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_AnalogOutputHeader s_AnalogOutputHeader;
-	str_AnalogInputHeader s_AnalogInputHeader;
+	struct str_AnalogInputHeader s_AnalogInputHeader;
 
 
-	// Read size
+	/* Read size */
 	s_MainHeader.w_HeaderSize =
 	s_MainHeader.w_HeaderSize =
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		0x100 + 8);
 		0x100 + 8);
 
 
-	// Read nbr of functionality
+	/* Read nbr of functionality */
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + 10);
 		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++) {
 	for (i = 0; i < s_MainHeader.b_Nfunctions; i++) {
-		// Read Type
+		/* Read Type */
 		w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 			pc_PCIChipInformation, 0x100 + 12 + w_Count);
 			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;
 		w_Count = w_Count + 2;
-		//Read Address
+		/* Read Address */
 		s_MainHeader.s_Functions[i].w_Address =
 		s_MainHeader.s_Functions[i].w_Address =
 			w_EepromReadWord(w_PCIBoardEepromAddress,
 			w_EepromReadWord(w_PCIBoardEepromAddress,
 			pc_PCIChipInformation, 0x100 + 12 + w_Count);
 			pc_PCIChipInformation, 0x100 + 12 + w_Count);
 		w_Count = w_Count + 2;
 		w_Count = w_Count + 2;
 	}
 	}
 
 
-	// Display main header info
+	/* Display main header info */
 	for (i = 0; i < s_MainHeader.b_Nfunctions; i++) {
 	for (i = 0; i < s_MainHeader.b_Nfunctions; i++) {
 
 
 		switch (s_MainHeader.s_Functions[i].b_Type) {
 		switch (s_MainHeader.s_Functions[i].b_Type) {
@@ -878,10 +876,10 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
 					s_AnalogInputHeader.w_Nchannel;
 					s_AnalogInputHeader.w_Nchannel;
 			this_board->i_Dma = s_AnalogInputHeader.b_HasDma;
 			this_board->i_Dma = s_AnalogInputHeader.b_HasDma;
 			this_board->ui_MinAcquisitiontimeNs =
 			this_board->ui_MinAcquisitiontimeNs =
-				(UINT) s_AnalogInputHeader.w_MinConvertTiming *
+				(unsigned int) s_AnalogInputHeader.w_MinConvertTiming *
 				1000;
 				1000;
 			this_board->ui_MinDelaytimeNs =
 			this_board->ui_MinDelaytimeNs =
-				(UINT) s_AnalogInputHeader.w_MinDelayTiming *
+				(unsigned int) s_AnalogInputHeader.w_MinDelayTiming *
 				1000;
 				1000;
 			ui_Temp = 0xffff;
 			ui_Temp = 0xffff;
 			this_board->i_AiMaxdata =
 			this_board->i_AiMaxdata =
@@ -903,15 +901,15 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
 			break;
 			break;
 
 
 		case EEPROM_TIMER:
 		case EEPROM_TIMER:
-			this_board->i_Timer = 1;	//Timer subdevice present
+			this_board->i_Timer = 1;	/* Timer subdevice present */
 			break;
 			break;
 
 
 		case EEPROM_WATCHDOG:
 		case EEPROM_WATCHDOG:
-			this_board->i_Timer = 1;	//Timer subdevice present
+			this_board->i_Timer = 1;	/* Timer subdevice present */
 			break;
 			break;
 
 
 		case EEPROM_TIMER_WATCHDOG_COUNTER:
 		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,	 |
 |			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                              |
 | 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.          |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
 |																	 |
-|			 str_DigitalInputHeader *s_Header: Digita Input Header   |
+|			 struct str_DigitalInputHeader *s_Header: Digita Input Header   |
 |												   Pointer			 |
 |												   Pointer			 |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 | Output Parameters : -                                                      |
@@ -939,23 +937,23 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,
 | Return Value      : 0							                             |
 | 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 =
 	s_Header->w_Nchannel =
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		0x100 + w_Address + 6);
 		0x100 + w_Address + 6);
 
 
-	// interruptible or not
+	/*  interruptible or not */
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + 8);
 		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 =
 	s_Header->w_NinterruptLogic =
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		0x100 + w_Address + 10);
 		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,	 |
 |			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                             |
 | 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.          |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
 |																	 |
-|			 str_DigitalOutputHeader *s_Header: Digital Output Header|
+|			 struct str_DigitalOutputHeader *s_Header: Digital Output Header|
 |											   Pointer				 |
 |											   Pointer				 |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 | Output Parameters : -                                                      |
@@ -984,11 +982,11 @@ INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress,
 | Return Value      : 0							                             |
 | 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 =
 	s_Header->w_Nchannel =
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		0x100 + w_Address + 6);
 		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,				 |
 |			char *pc_PCIChipInformation,WORD w_Address,				 |
-|			str_TimerMainHeader *s_Header)							 |
+|			struct str_TimerMainHeader *s_Header)							 |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              : Read Timer or Watchdog 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.          |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
 |																	 |
-|			 str_TimerMainHeader *s_Header: Timer Header			 |
+|			 struct str_TimerMainHeader *s_Header: Timer Header			 |
 |											   Pointer				 |
 |											   Pointer				 |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 | Output Parameters : -                                                      |
@@ -1015,18 +1013,18 @@ INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress,
 | Return Value      : 0							                             |
 | 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 =
 	s_Header->w_Ntimer =
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation,
 		0x100 + w_Address + 6);
 		0x100 + w_Address + 6);
-//Read header size
+/* Read header size */
 
 
 	for (i = 0; i < s_Header->w_Ntimer; i++) {
 	for (i = 0; i < s_Header->w_Ntimer; i++) {
 		s_Header->s_TimerDetails[i].w_HeaderSize =
 		s_Header->s_TimerDetails[i].w_HeaderSize =
@@ -1037,23 +1035,23 @@ INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,
 			pc_PCIChipInformation,
 			pc_PCIChipInformation,
 			0x100 + w_Address + 8 + w_Size + 2);
 			0x100 + w_Address + 8 + w_Size + 2);
 
 
-		//Read Resolution
+		/* Read Resolution */
 		s_Header->s_TimerDetails[i].b_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 =
 		s_Header->s_TimerDetails[i].b_Mode =
-			(BYTE) (w_Temp >> 4) & 0x3F;
+			(unsigned char) (w_Temp >> 4) & 0x3F;
 
 
 		w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 			pc_PCIChipInformation,
 			pc_PCIChipInformation,
 			0x100 + w_Address + 8 + w_Size + 4);
 			0x100 + w_Address + 8 + w_Size + 4);
 
 
-		//Read MinTiming
+		/* Read MinTiming */
 		s_Header->s_TimerDetails[i].w_MinTiming = (w_Temp >> 6) & 0x3FF;
 		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;
 		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,	 |
 |			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                              |
 | 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.          |
 |		      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,
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + 10);
 		pc_PCIChipInformation, 0x100 + w_Address + 10);
 	s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
 	s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
-	// Resolution for 1st hard component
+	/*  Resolution for 1st hard component */
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + 16);
 		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;
 	return 0;
 }
 }
 
 
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
-| Function Name  : INT i_EepromReadAnlogInputHeader(WORD 					 |
+| Function Name  : int i_EepromReadAnlogInputHeader(unsigned short 					 |
 |			w_PCIBoardEepromAddress,char *pc_PCIChipInformation,     |
 |			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                              |
 | 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.          |
 |		      char *pc_PCIChipInformation  : PCI Chip Type.          |
 |																	 |
 |																	 |
-|			 str_AnalogInputHeader *s_Header:Anlog Input Header      |
+|			 struct str_AnalogInputHeader *s_Header:Anlog Input Header      |
 |											   Pointer				 |
 |											   Pointer				 |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 | 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,
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + 10);
 		pc_PCIChipInformation, 0x100 + w_Address + 10);
 	s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
 	s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
@@ -1135,24 +1133,24 @@ INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress,
 		0x100 + w_Address + 30);
 		0x100 + w_Address + 30);
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + 20);
 		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;
 	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 = 74;
-		w_Offset = w_Offset + 2;	// resolution
+		w_Offset = w_Offset + 2;	/*  resolution */
 	}
 	}
 
 
-// read Resolution
+/* read Resolution */
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 	w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,
 		pc_PCIChipInformation, 0x100 + w_Address + w_Offset);
 		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;
 	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 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_LOW       0x00
 #define     APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH      0x1200
 #define     APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH      0x1200
 #define     APCI3120_A2P_FIFO_MANAGEMENT              0x04000400L
 #define     APCI3120_A2P_FIFO_MANAGEMENT              0x04000400L
@@ -52,7 +52,7 @@
 #define     APCI3120_DISABLE_BUS_MASTER_ADD_ON        0x0
 #define     APCI3120_DISABLE_BUS_MASTER_ADD_ON        0x0
 #define     APCI3120_DISABLE_BUS_MASTER_PCI           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_LOW       0x3C
 #define     APCI3120_ADD_ON_AGCSTS_HIGH      APCI3120_ADD_ON_AGCSTS_LOW + 2
 #define     APCI3120_ADD_ON_AGCSTS_HIGH      APCI3120_ADD_ON_AGCSTS_LOW + 2
 #define     APCI3120_ADD_ON_MWAR_LOW         0x24
 #define     APCI3120_ADD_ON_MWAR_LOW         0x24
@@ -60,7 +60,7 @@
 #define     APCI3120_ADD_ON_MWTC_LOW         0x058
 #define     APCI3120_ADD_ON_MWTC_LOW         0x058
 #define     APCI3120_ADD_ON_MWTC_HIGH        APCI3120_ADD_ON_MWTC_LOW + 2
 #define     APCI3120_ADD_ON_MWTC_HIGH        APCI3120_ADD_ON_MWTC_LOW + 2
 
 
-// AMCC
+/* AMCC */
 #define     APCI3120_AMCC_OP_MCSR            0x3C
 #define     APCI3120_AMCC_OP_MCSR            0x3C
 #define     APCI3120_AMCC_OP_REG_INTCSR      0x38
 #define     APCI3120_AMCC_OP_REG_INTCSR      0x38
 
 
@@ -85,7 +85,7 @@
 #define AMCC_OP_REG_MRTC         0x30
 #define AMCC_OP_REG_MRTC         0x30
 #define AMCC_OP_REG_MBEF         0x34
 #define AMCC_OP_REG_MBEF         0x34
 #define AMCC_OP_REG_INTCSR       0x38
 #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_INTCSR_FEC  (AMCC_OP_REG_INTCSR + 3)	/* FIFO ctrl */
 #define AMCC_OP_REG_MCSR         0x3c
 #define AMCC_OP_REG_MCSR         0x3c
 #define  AMCC_OP_REG_MCSR_NVDATA (AMCC_OP_REG_MCSR + 2)	/* Data in byte 2 */
 #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;
 	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->vendor = pcidev->vendor;
 			amcc->device = pcidev->device;
 			amcc->device = pcidev->device;
 #if 0
 #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
 #endif
 			amcc->pci_bus = pcidev->bus->number;
 			amcc->pci_bus = pcidev->bus->number;
 			amcc->pci_slot = PCI_SLOT(pcidev->devfn);
 			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)) {
 		    && (amcc->pci_slot == pci_slot)) {
 			if (!(amcc->used)) {
 			if (!(amcc->used)) {
 				*card = amcc;
 				*card = amcc;
-				return 0;	// ok, card is found
+				return 0;	/*  ok, card is found */
 			} else {
 			} else {
-				rt_printk
+				printk
 				    (" - \nCard on requested position is used b:s %d:%d!\n",
 				    (" - \nCard on requested position is used b:s %d:%d!\n",
 				     pci_bus, pci_slot);
 				     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;
 	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;
 			return NULL;
 		}
 		}
 	} else {
 	} else {
@@ -434,12 +433,12 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
 							 pci_bus, pci_slot,
 							 pci_bus, pci_slot,
 							 &card)) {
 							 &card)) {
 		case 1:
 		case 1:
-			rt_printk
+			printk
 			    (" - Card not found on requested position b:s %d:%d!\n",
 			    (" - Card not found on requested position b:s %d:%d!\n",
 			     pci_bus, pci_slot);
 			     pci_bus, pci_slot);
 			return NULL;
 			return NULL;
 		case 2:
 		case 2:
-			rt_printk
+			printk
 			    (" - Card on requested position is used b:s %d:%d!\n",
 			    (" - Card on requested position is used b:s %d:%d!\n",
 			     pci_bus, pci_slot);
 			     pci_bus, pci_slot);
 			return NULL;
 			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) {
 	if (i_pci_card_alloc(card) != 0) {
-		rt_printk(" - Can't allocate card!\n");
+		printk(" - Can't allocate card!\n");
 		return NULL;
 		return NULL;
 	}
 	}
 
 

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

@@ -1,15 +1,15 @@
-/**
+//**
 @verbatim
 @verbatim
 
 
 Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
 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.
 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_Pwm.c"
 #include "APCI1710_INCCPT.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;
 	struct comedi_subdevice *s;
 	int ret = 0;
 	int ret = 0;
 	int n_subdevices = 9;
 	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;
 		return;
 
 
-	// Allocate and Initialise Timer Subdevice Structures
+	/*  Allocate and Initialise Timer Subdevice Structures */
 	s = dev->subdevices + 0;
 	s = dev->subdevices + 0;
 
 
 	s->type = COMEDI_SUBD_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 = 3;
 	s->n_chan = 3;
 	s->maxdata = 0;
 	s->maxdata = 0;
 	s->len_chanlist = 3;
 	s->len_chanlist = 3;
@@ -80,12 +81,12 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_config = i_APCI1710_InsnConfigInitTimer;
 	s->insn_config = i_APCI1710_InsnConfigInitTimer;
 	s->insn_bits = i_APCI1710_InsnBitsTimer;
 	s->insn_bits = i_APCI1710_InsnBitsTimer;
 
 
-	// Allocate and Initialise DIO Subdevice Structures
+	/*  Allocate and Initialise DIO Subdevice Structures */
 	s = dev->subdevices + 1;
 	s = dev->subdevices + 1;
 
 
 	s->type = COMEDI_SUBD_DIO;
 	s->type = COMEDI_SUBD_DIO;
 	s->subdev_flags =
 	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->n_chan = 7;
 	s->maxdata = 1;
 	s->maxdata = 1;
 	s->len_chanlist = 7;
 	s->len_chanlist = 7;
@@ -95,11 +96,11 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_bits = i_APCI1710_InsnBitsDigitalIOPortOnOff;
 	s->insn_bits = i_APCI1710_InsnBitsDigitalIOPortOnOff;
 	s->insn_write = i_APCI1710_InsnWriteDigitalIOChlOnOff;
 	s->insn_write = i_APCI1710_InsnWriteDigitalIOChlOnOff;
 
 
-	// Allocate and Initialise Chrono Subdevice Structures
+	/*  Allocate and Initialise Chrono Subdevice Structures */
 	s = dev->subdevices + 2;
 	s = dev->subdevices + 2;
 
 
 	s->type = COMEDI_SUBD_CHRONO;
 	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->n_chan = 4;
 	s->maxdata = 0;
 	s->maxdata = 0;
 	s->len_chanlist = 4;
 	s->len_chanlist = 4;
@@ -109,55 +110,55 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_config = i_APCI1710_InsnConfigInitChrono;
 	s->insn_config = i_APCI1710_InsnConfigInitChrono;
 	s->insn_bits = i_APCI1710_InsnBitsChronoDigitalIO;
 	s->insn_bits = i_APCI1710_InsnBitsChronoDigitalIO;
 
 
-	// Allocate and Initialise PWM Subdevice Structures
+	/*  Allocate and Initialise PWM Subdevice Structures */
 	s = dev->subdevices + 3;
 	s = dev->subdevices + 3;
 	s->type = COMEDI_SUBD_PWM;
 	s->type = COMEDI_SUBD_PWM;
 	s->subdev_flags =
 	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->n_chan = 3;
 	s->maxdata = 1;
 	s->maxdata = 1;
 	s->len_chanlist = 3;
 	s->len_chanlist = 3;
 	s->range_table = &range_digital;
 	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_config = i_APCI1710_InsnConfigPWM;
 	s->insn_read = i_APCI1710_InsnReadGetPWMStatus;
 	s->insn_read = i_APCI1710_InsnReadGetPWMStatus;
 	s->insn_write = i_APCI1710_InsnWritePWM;
 	s->insn_write = i_APCI1710_InsnWritePWM;
 	s->insn_bits = i_APCI1710_InsnBitsReadPWMInterrupt;
 	s->insn_bits = i_APCI1710_InsnBitsReadPWMInterrupt;
 
 
-	// Allocate and Initialise TTLIO Subdevice Structures
+	/*  Allocate and Initialise TTLIO Subdevice Structures */
 	s = dev->subdevices + 4;
 	s = dev->subdevices + 4;
 	s->type = COMEDI_SUBD_TTLIO;
 	s->type = COMEDI_SUBD_TTLIO;
 	s->subdev_flags =
 	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->n_chan = 8;
 	s->maxdata = 1;
 	s->maxdata = 1;
 	s->len_chanlist = 8;
 	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_config = i_APCI1710_InsnConfigInitTTLIO;
 	s->insn_bits = i_APCI1710_InsnBitsReadTTLIO;
 	s->insn_bits = i_APCI1710_InsnBitsReadTTLIO;
 	s->insn_write = i_APCI1710_InsnWriteSetTTLIOChlOnOff;
 	s->insn_write = i_APCI1710_InsnWriteSetTTLIOChlOnOff;
 	s->insn_read = i_APCI1710_InsnReadTTLIOAllPortValue;
 	s->insn_read = i_APCI1710_InsnReadTTLIOAllPortValue;
 
 
-	// Allocate and Initialise TOR Subdevice Structures
+	/*  Allocate and Initialise TOR Subdevice Structures */
 	s = dev->subdevices + 5;
 	s = dev->subdevices + 5;
 	s->type = COMEDI_SUBD_TOR;
 	s->type = COMEDI_SUBD_TOR;
 	s->subdev_flags =
 	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->n_chan = 8;
 	s->maxdata = 1;
 	s->maxdata = 1;
 	s->len_chanlist = 8;
 	s->len_chanlist = 8;
 	s->range_table = &range_digital;
 	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_config = i_APCI1710_InsnConfigInitTorCounter;
 	s->insn_read = i_APCI1710_InsnReadGetTorCounterInitialisation;
 	s->insn_read = i_APCI1710_InsnReadGetTorCounterInitialisation;
 	s->insn_write = i_APCI1710_InsnWriteEnableDisableTorCounter;
 	s->insn_write = i_APCI1710_InsnWriteEnableDisableTorCounter;
 	s->insn_bits = i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue;
 	s->insn_bits = i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue;
 
 
-	// Allocate and Initialise SSI Subdevice Structures
+	/*  Allocate and Initialise SSI Subdevice Structures */
 	s = dev->subdevices + 6;
 	s = dev->subdevices + 6;
 	s->type = COMEDI_SUBD_SSI;
 	s->type = COMEDI_SUBD_SSI;
 	s->subdev_flags =
 	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->n_chan = 4;
 	s->maxdata = 1;
 	s->maxdata = 1;
 	s->len_chanlist = 4;
 	s->len_chanlist = 4;
@@ -166,11 +167,11 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_read = i_APCI1710_InsnReadSSIValue;
 	s->insn_read = i_APCI1710_InsnReadSSIValue;
 	s->insn_bits = i_APCI1710_InsnBitsSSIDigitalIO;
 	s->insn_bits = i_APCI1710_InsnBitsSSIDigitalIO;
 
 
-	// Allocate and Initialise PULSEENCODER Subdevice Structures
+	/*  Allocate and Initialise PULSEENCODER Subdevice Structures */
 	s = dev->subdevices + 7;
 	s = dev->subdevices + 7;
 	s->type = COMEDI_SUBD_PULSEENCODER;
 	s->type = COMEDI_SUBD_PULSEENCODER;
 	s->subdev_flags =
 	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->n_chan = 4;
 	s->maxdata = 1;
 	s->maxdata = 1;
 	s->len_chanlist = 4;
 	s->len_chanlist = 4;
@@ -180,11 +181,11 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_bits = i_APCI1710_InsnBitsReadWritePulseEncoder;
 	s->insn_bits = i_APCI1710_InsnBitsReadWritePulseEncoder;
 	s->insn_read = i_APCI1710_InsnReadInterruptPulseEncoder;
 	s->insn_read = i_APCI1710_InsnReadInterruptPulseEncoder;
 
 
-	// Allocate and Initialise INCREMENTALCOUNTER Subdevice Structures
+	/*  Allocate and Initialise INCREMENTALCOUNTER Subdevice Structures */
 	s = dev->subdevices + 8;
 	s = dev->subdevices + 8;
 	s->type = COMEDI_SUBD_INCREMENTALCOUNTER;
 	s->type = COMEDI_SUBD_INCREMENTALCOUNTER;
 	s->subdev_flags =
 	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->n_chan = 500;
 	s->maxdata = 1;
 	s->maxdata = 1;
 	s->len_chanlist = 500;
 	s->len_chanlist = 500;
@@ -195,14 +196,14 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev)
 	s->insn_bits = i_APCI1710_InsnBitsINCCPT;
 	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);
 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;
 	int ret;
-	DWORD dw_Dummy;
+	unsigned int dw_Dummy;
 
 
 	/*********************************/
 	/*********************************/
 	/* Read all module configuration */
 	/* Read all module configuration */
@@ -219,12 +220,12 @@ int i_APCI1710_Reset(struct comedi_device * dev)
 	ret = inl(devpriv->s_BoardInfos.ui_Address + 252);
 	ret = inl(devpriv->s_BoardInfos.ui_Address + 252);
 	devpriv->s_BoardInfos.dw_MolduleConfiguration[3] = ret;
 	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);
 	outl(0x83838383, devpriv->s_BoardInfos.ui_Address + 0x60);
 
 
 	devpriv->s_BoardInfos.b_BoardVersion = 1;
 	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);
 	dw_Dummy = inl(devpriv->s_BoardInfos.ui_Address + 0x38);
 	outl(dw_Dummy | 0x2000, 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                  |
 | Function's Name   : __void__ v_APCI1710_InterruptFunction                  |
-|				(BYTE b_Interrupt, __CPPARGS)                |
+|				(unsigned char b_Interrupt, __CPPARGS)                |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              : APCI-1710 interrupt function                           |
 | Task              : APCI-1710 interrupt function                           |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
-| Input Parameters  : BYTE b_Interrupt : Interrupt number                    |
+| Input Parameters  : unsigned char b_Interrupt : Interrupt number                    |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters : -                                                      |
 | Output Parameters : -                                                      |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
@@ -250,18 +251,18 @@ int i_APCI1710_Reset(struct comedi_device * dev)
 void v_APCI1710_Interrupt(int irq, void *d)
 void v_APCI1710_Interrupt(int irq, void *d)
 {
 {
 	struct comedi_device *dev = 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");
 	printk("APCI1710 Interrupt\n");
 	for (b_ModuleCpt = 0; b_ModuleCpt < 4; b_ModuleCpt++, ps_ModuleInfo++) {
 	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] &
 				dw_MolduleConfiguration[b_ModuleCpt] &
 				0xFFFF0000UL) == APCI1710_82X54_TIMER) {
 				0xFFFF0000UL) == APCI1710_82X54_TIMER) {
 
 
-			//printk("TIMER Interrupt Occurred\n");
+			/* printk("TIMER Interrupt Occurred\n"); */
 			ul_82X54InterruptStatus = inl(devpriv->s_BoardInfos.
 			ul_82X54InterruptStatus = inl(devpriv->s_BoardInfos.
 				ui_Address + 12 + (64 * b_ModuleCpt));
 				ui_Address + 12 + (64 * b_ModuleCpt));
 
 
@@ -332,11 +333,11 @@ void v_APCI1710_Interrupt(int irq, void *d)
 			     /**********************/
 			     /**********************/
 				/* Call user function */
 				/* 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);
 				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 */
 		/* Test if increm. counter */
@@ -412,7 +413,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				/**********************/
 				/**********************/
 					/* Call user function */
 					/* 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,
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 						0);
 
 
@@ -473,7 +474,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 			    /**********************/
 			    /**********************/
 					/* Call user function */
 					/* 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,
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 						0);
 
 
@@ -562,7 +563,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				/**********************/
 				/**********************/
 					/* Call user function */
 					/* 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,
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 						0);
 
 
@@ -628,7 +629,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				/**********************/
 				/**********************/
 					/* Call user function */
 					/* 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,
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 						0);
 
 
@@ -675,7 +676,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 						if ((ul_LatchRegisterValue &
 						if ((ul_LatchRegisterValue &
 								0xFFFFU) != 0) {
 								0xFFFFU) != 0) {
 							ui_16BitValue =
 							ui_16BitValue =
-								(UINT)
+								(unsigned int)
 								ul_LatchRegisterValue
 								ul_LatchRegisterValue
 								& 0xFFFFU;
 								& 0xFFFFU;
 							ul_LatchRegisterValue =
 							ul_LatchRegisterValue =
@@ -693,7 +694,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 								0xFFFF0000UL) !=
 								0xFFFF0000UL) !=
 							0) {
 							0) {
 							ui_16BitValue =
 							ui_16BitValue =
-								(UINT) (
+								(unsigned int) (
 								(ul_LatchRegisterValue
 								(ul_LatchRegisterValue
 									>> 16) &
 									>> 16) &
 								0xFFFFU);
 								0xFFFFU);
@@ -721,7 +722,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 					if ((ul_LatchRegisterValue &
 					if ((ul_LatchRegisterValue &
 							0xFFFF0000UL) != 0) {
 							0xFFFF0000UL) != 0) {
 						ui_16BitValue =
 						ui_16BitValue =
-							(UINT) (
+							(unsigned int) (
 							(ul_LatchRegisterValue
 							(ul_LatchRegisterValue
 								>> 16) &
 								>> 16) &
 							0xFFFFU);
 							0xFFFFU);
@@ -741,7 +742,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 					if ((ul_LatchRegisterValue & 0xFFFFU) !=
 					if ((ul_LatchRegisterValue & 0xFFFFU) !=
 						0) {
 						0) {
 						ui_16BitValue =
 						ui_16BitValue =
-							(UINT)
+							(unsigned int)
 							ul_LatchRegisterValue &
 							ul_LatchRegisterValue &
 							0xFFFFU;
 							0xFFFFU;
 						ul_LatchRegisterValue =
 						ul_LatchRegisterValue =
@@ -795,11 +796,11 @@ void v_APCI1710_Interrupt(int irq, void *d)
 			     /**********************/
 			     /**********************/
 				/* Call user function */
 				/* 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);
 				send_sig(SIGIO, devpriv->tsk_Current, 0);
 
 
 			}
 			}
-		}		// Incremental counter
+		}		/*  Incremental counter */
 
 
 		 /***************/
 		 /***************/
 		/* Test if CDA */
 		/* Test if CDA */
@@ -870,14 +871,14 @@ void v_APCI1710_Interrupt(int irq, void *d)
 					/* Call user function */
 					/* 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,
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 						0);
 
 
-				}	// if (ul_StatusRegister & 1)
+				}	/*  if (ul_StatusRegister & 1) */
 
 
 			}
 			}
-		}		// CDA
+		}		/*  CDA */
 
 
 		 /***********************/
 		 /***********************/
 		/* Test if PWM counter */
 		/* Test if PWM counter */
@@ -950,15 +951,15 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				   /**********************/
 				   /**********************/
 						/* Call user function */
 						/* Call user function */
 				   /**********************/
 				   /**********************/
-						//Send a signal to from kernel to user space
+						/* Send a signal to from kernel to user space */
 						send_sig(SIGIO,
 						send_sig(SIGIO,
 							devpriv->tsk_Current,
 							devpriv->tsk_Current,
 							0);
 							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 */
 		/* Test if tor counter */
@@ -1054,14 +1055,14 @@ void v_APCI1710_Interrupt(int irq, void *d)
 						/* Call user function */
 						/* Call user function */
 				   /**********************/
 				   /**********************/
 
 
-						//Send a signal to from kernel to user space
+						/* Send a signal to from kernel to user space */
 						send_sig(SIGIO,
 						send_sig(SIGIO,
 							devpriv->tsk_Current,
 							devpriv->tsk_Current,
 							0);
 							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 */
 		/* Test if chronometer */
@@ -1071,7 +1072,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				dw_MolduleConfiguration[b_ModuleCpt] &
 				dw_MolduleConfiguration[b_ModuleCpt] &
 				0xFFFF0000UL) == APCI1710_CHRONOMETER) {
 				0xFFFF0000UL) == APCI1710_CHRONOMETER) {
 
 
-			//printk("APCI1710 Chrono Interrupt\n");
+			/* printk("APCI1710 Chrono Interrupt\n"); */
 		    /*****************************/
 		    /*****************************/
 			/* Read the interrupt status */
 			/* Read the interrupt status */
 		    /*****************************/
 		    /*****************************/
@@ -1163,13 +1164,13 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				/**********************/
 				/**********************/
 					/* Call user function */
 					/* 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,
 					send_sig(SIGIO, devpriv->tsk_Current,
 						0);
 						0);
 
 
 				}
 				}
 			}
 			}
-		}		// Chronometer
+		}		/*  Chronometer */
 
 
 		 /*************************/
 		 /*************************/
 		/* Test if pulse encoder */
 		/* Test if pulse encoder */
@@ -1249,7 +1250,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 				   /**********************/
 				   /**********************/
 						/* Call user function */
 						/* Call user function */
 				   /**********************/
 				   /**********************/
-						//Send a signal to from kernel to user space
+						/* Send a signal to from kernel to user space */
 						send_sig(SIGIO,
 						send_sig(SIGIO,
 							devpriv->tsk_Current,
 							devpriv->tsk_Current,
 							0);
 							0);
@@ -1257,7 +1258,7 @@ void v_APCI1710_Interrupt(int irq, void *d)
 					}
 					}
 				}
 				}
 			}
 			}
-		}		//pulse encoder
+		}		/* pulse encoder */
 
 
 	}
 	}
 	return;
 	return;

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

@@ -44,7 +44,7 @@
 #define APCI1710_SYNCHRONOUS_MODE	1
 #define APCI1710_SYNCHRONOUS_MODE	1
 #define APCI1710_ASYNCHRONOUS_MODE	0
 #define APCI1710_ASYNCHRONOUS_MODE	0
 
 
-//MODULE INFO STRUCTURE
+/* MODULE INFO STRUCTURE */
 
 
 static const struct comedi_lrange range_apci1710_ttl = { 4, {
 static const struct comedi_lrange range_apci1710_ttl = { 4, {
 						      BIP_RANGE(10),
 						      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.
 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.
 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"
 #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                      |
 | Function   Name   : int i_APCI035_ConfigTimerWatchdog                      |
@@ -64,42 +64,42 @@ INT i_Flag = 1;
 | Task              : Configures The Timer , Counter or Watchdog             |
 | Task              : Configures The Timer , Counter or Watchdog             |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                                                                            |
 |                                                                            |
 |					  data[0]            : 0 Configure As Timer      |
 |					  data[0]            : 0 Configure As Timer      |
 |										   1 Configure As Watchdog   |
 |										   1 Configure As Watchdog   |
-                              data[1]            : Watchdog number
+|                                         data[1]            : Watchdog number
 |					  data[2]            : Time base Unit            |
 |					  data[2]            : Time base Unit            |
 |					  data[3]			 : Reload Value			     |
 |					  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 :	--													 |
 | 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;
 	i_Temp = 0;
 	devpriv->tsk_Current = current;
 	devpriv->tsk_Current = current;
 	devpriv->b_TimerSelectMode = data[0];
 	devpriv->b_TimerSelectMode = data[0];
@@ -124,9 +124,9 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd
 	} else {
 	} else {
 		ui_Mode = 0;
 		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 = 0;
-//ui_Command = ui_Command & 0xFFFFF9FEUL;
+/* ui_Command = ui_Command & 0xFFFFF9FEUL; */
 	outl(ui_Command, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
 	outl(ui_Command, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
 	ui_Command = 0;
 	ui_Command = 0;
 	ui_Command = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
 	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 =
 			(ui_Command & 0xFFF719E2UL) | ui_Mode << 13UL | 0x10UL;
 			(ui_Command & 0xFFF719E2UL) | ui_Mode << 13UL | 0x10UL;
 
 
-	}			//if (data[0] == ADDIDATA_TIMER)
+	}			/* if (data[0] == ADDIDATA_TIMER) */
 	else {
 	else {
 		if (data[0] == ADDIDATA_WATCHDOG) {
 		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  |
 | Task              : Start / Stop The Selected Timer , or Watchdog  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |					                                                 |
 |					                                                 |
 |					  data[0] : 0 - Stop Selected Timer/Watchdog     |
 |					  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) {
 	if (data[0] == 1) {
 		ui_Command =
 		ui_Command =
 			inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
 			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;
 		ui_Command = (ui_Command & 0xFFFFF9FFUL) | 0x1UL;
 		outl(ui_Command,
 		outl(ui_Command,
 			devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
 			devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
-	}			// if  (data[0]==1)
+	}			/*  if  (data[0]==1) */
 	if (data[0] == 2) {
 	if (data[0] == 2) {
 		ui_Command =
 		ui_Command =
 			inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
 			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);
 			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 = 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,
 		outl(ui_Command,
 			devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12);
 			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;
 		ui_Command = 0;
 		for (i_Count = 1; i_Count <= 4; i_Count++) {
 		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;
 		ui_Command = 0;
 		for (i_Count = 1; i_Count <= 4; i_Count++) {
 		for (i_Count = 1; i_Count <= 4; i_Count++) {
@@ -344,7 +346,7 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev,
 				0);
 				0);
 		}
 		}
 	}
 	}
-	if (data[0] == 5)	//trigger all Watchdogs
+	if (data[0] == 5)	/* trigger all Watchdogs */
 	{
 	{
 		ui_Command = 0;
 		ui_Command = 0;
 		for (i_Count = 1; i_Count <= 4; i_Count++) {
 		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          |
 | Task              : Read The Selected Timer , Counter or Watchdog          |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                                                                            |
 |                                                                            |
 |     																	 |
 |     																	 |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	data[0]            : software trigger status
 | 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                                 |
 | 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];
 	i_WatchdogNbr = insn->unused[0];
-	      /******************/
+
+	/******************/
 	/* Get the status */
 	/* Get the status */
-	      /******************/
+	/******************/
+
 	ui_Status = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 16);
 	ui_Status = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 16);
-      /***********************************/
+
+	/***********************************/
 	/* Get the software trigger status */
 	/* Get the software trigger status */
-      /***********************************/
+	/***********************************/
+
 	data[0] = ((ui_Status >> 1) & 1);
 	data[0] = ((ui_Status >> 1) & 1);
-      /***********************************/
+	/***********************************/
 	/* Get the hardware trigger status */
 	/* Get the hardware trigger status */
-      /***********************************/
+	/***********************************/
 	data[1] = ((ui_Status >> 2) & 1);
 	data[1] = ((ui_Status >> 2) & 1);
-      /*********************************/
+	/*********************************/
 	/* Get the software clear status */
 	/* Get the software clear status */
-      /*********************************/
+	/*********************************/
 	data[2] = ((ui_Status >> 3) & 1);
 	data[2] = ((ui_Status >> 3) & 1);
-      /***************************/
+	/***************************/
 	/* Get the overflow status */
 	/* Get the overflow status */
-      /***************************/
+	/***************************/
 	data[3] = ((ui_Status >> 0) & 1);
 	data[3] = ((ui_Status >> 0) & 1);
 	if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
 	if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
 		data[4] = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 0);
 		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;
 	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_device *dev,struct comedi_subdevice *s,               |
 |                      struct comedi_insn *insn,unsigned int *data)                     |
 |                      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;
 	devpriv->tsk_Current = current;
 	outl(0x200 | 0, devpriv->iobase + 128 + 0x4);
 	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			         |
 | Task              : Read  value  of the selected channel			         |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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 :	--													 |
 | Output Parameters :	--													 |
 |			          data[0]  : Digital Value Of Input              |
 |			          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 */
 /*  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++) {
 	for (i_Count = 1; i_Count <= 4; i_Count++) {
 		i_WatchdogNbr = 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;
 	return 0;
 }
 }
@@ -551,11 +557,11 @@ INT i_APCI035_Reset(struct comedi_device * dev)
 static void v_APCI035_Interrupt(int irq, void *d)
 static void v_APCI035_Interrupt(int irq, void *d)
 {
 {
 	struct comedi_device *dev = 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) {
 	if (i_Temp == 1) {
 		i_WatchdogNbr = i_Flag;
 		i_WatchdogNbr = i_Flag;
 		i_Flag = i_Flag + 1;
 		i_Flag = i_Flag + 1;
@@ -571,7 +577,7 @@ static void v_APCI035_Interrupt(int irq, void *d)
 	ui_StatusRegister2 =
 	ui_StatusRegister2 =
 		inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 20);
 		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 */
 		/* Disable the temperature warning */
@@ -587,14 +593,14 @@ static void v_APCI035_Interrupt(int irq, void *d)
 		/* Read the digital temperature value */
 		/* Read the digital temperature value */
 	/**************************************/
 	/**************************************/
 		ui_DigitalTemperature = inl(devpriv->iobase + 128 + 60);
 		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 {
 	else {
 		if ((ui_StatusRegister2 & 0x1) == 0x1) {
 		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;
 	return;
 }
 }

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

@@ -19,18 +19,18 @@
 #define APCI035_BOARD_VENDOR_ID		0x15B8
 #define APCI035_BOARD_VENDOR_ID		0x15B8
 #define APCI035_ADDRESS_RANGE		255
 #define APCI035_ADDRESS_RANGE		255
 
 
-INT i_TW_Number;
+int i_TW_Number;
 struct {
 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;
 } Config_Parameters_Main;
 
 
 /* ANALOG INPUT RANGE */
 /* ANALOG INPUT RANGE */
@@ -101,23 +101,23 @@ struct comedi_lrange range_apci035_ai = { 8, {
 
 
 /* TIMER */
 /* TIMER */
 /* timer value is passed as u seconds */
 /* 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);
 				  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_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);
 					  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);
 				struct comedi_insn *insn, unsigned int *data);
 
 
 /* Temperature Related Defines (Analog Input Subdevice) */
 /* 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);
 				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);
 			      struct comedi_insn *insn, unsigned int *data);
 
 
 /* Interrupt */
 /* Interrupt */
 static void v_APCI035_Interrupt(int irq, void *d);
 static void v_APCI035_Interrupt(int irq, void *d);
 
 
 /* Reset functions */
 /* 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.
 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.
 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 "hwdrv_apci1032.h"
 #include <linux/delay.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;
 	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);
 			outl(0x4, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
 			ui_TmpValue =
 			ui_TmpValue =
 				inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
 				inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
-		}		//if (data[1] == ADDIDATA_OR)
+		}		/* if (data[1] == ADDIDATA_OR) */
 		else {
 		else {
 			outl(0x6, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
 			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 {
 	else {
 		ul_Command1 = ul_Command1 & 0xFFFF0000;
 		ul_Command1 = ul_Command1 & 0xFFFF0000;
 		ul_Command2 = ul_Command2 & 0xFFFF0000;
 		ul_Command2 = ul_Command2 & 0xFFFF0000;
@@ -120,7 +120,7 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd
 		outl(ul_Command2,
 		outl(ul_Command2,
 			devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE2);
 			devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE2);
 		outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
 		outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
-	}			//else if  ( data[0] == ADDIDATA_ENABLE)
+	}			/* else if  ( data[0] == ADDIDATA_ENABLE) */
 
 
 	return insn->n;
 	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                 |
 | Task              : Return the status of the digital input                 |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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  |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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);
 	ui_Channel = CR_CHAN(insn->chanspec);
 	if (ui_Channel >= 0 && ui_Channel <= 31) {
 	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;
 		*data = (ui_TmpValue >> ui_Channel) & 0x1;
-	}			//if(ui_Channel >= 0 && ui_Channel <=31)
+	}			/* if(ui_Channel >= 0 && ui_Channel <=31) */
 	else {
 	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;
 	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      |
 | Task              : Return the status of the Requested digital inputs      |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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 :	--													 |
 | 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);
 	ui_NoOfChannels = CR_CHAN(insn->chanspec);
 	if (data[1] == 0) {
 	if (data[1] == 0) {
-		*data = (UINT) inl(devpriv->iobase + APCI1032_DIGITAL_IP);
+		*data = (unsigned int) inl(devpriv->iobase + APCI1032_DIGITAL_IP);
 		switch (ui_NoOfChannels) {
 		switch (ui_NoOfChannels) {
 		case 2:
 		case 2:
 			ui_Mask = 3;
 			ui_Mask = 3;
@@ -213,16 +215,16 @@ INT i_APCI1032_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 		case 31:
 		case 31:
 			break;
 			break;
 		default:
 		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;
 			break;
-		}		//switch(ui_NoOfChannels)
-	}			//if(data[1]==0)
+		}		/* switch(ui_NoOfChannels) */
+	}			/* if(data[1]==0) */
 	else {
 	else {
 		if (data[1] == 1) {
 		if (data[1] == 1) {
 			*data = ui_InterruptStatus;
 			*data = ui_InterruptStatus;
-		}		//if(data[1]==1)
-	}			//else if(data[1]==0)
+		}		/* if(data[1]==1) */
+	}			/* else if(data[1]==0) */
 	return insn->n;
 	return insn->n;
 }
 }
 
 
@@ -247,16 +249,16 @@ static void v_APCI1032_Interrupt(int irq, void *d)
 {
 {
 	struct comedi_device *dev = 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);
 	ui_Temp = inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
 	outl(ui_Temp & APCI1032_DIGITAL_IP_INTERRUPT_DISABLE,
 	outl(ui_Temp & APCI1032_DIGITAL_IP_INTERRUPT_DISABLE,
 		devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
 		devpriv->iobase + APCI1032_DIGITAL_IP_IRQ);
 	ui_InterruptStatus =
 	ui_InterruptStatus =
 		inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS);
 		inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS);
 	ui_InterruptStatus = ui_InterruptStatus & 0X0000FFFF;
 	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;
 	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);
 	outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE2);
 	return 0;
 	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_BOARD_VENDOR_ID 0x15B8
 #define APCI1032_ADDRESS_RANGE  20
 #define APCI1032_ADDRESS_RANGE  20
-//DIGITAL INPUT DEFINE
+/* DIGITAL INPUT DEFINE */
 
 
 #define APCI1032_DIGITAL_IP                     0
 #define APCI1032_DIGITAL_IP                     0
 #define APCI1032_DIGITAL_IP_INTERRUPT_MODE1     4
 #define APCI1032_DIGITAL_IP_INTERRUPT_MODE1     4
 #define APCI1032_DIGITAL_IP_INTERRUPT_MODE2     8
 #define APCI1032_DIGITAL_IP_INTERRUPT_MODE2     8
 #define APCI1032_DIGITAL_IP_IRQ                 16
 #define APCI1032_DIGITAL_IP_IRQ                 16
 
 
-//Digital Input IRQ Function Selection
+/* Digital Input IRQ Function Selection */
 #define ADDIDATA_OR                  0
 #define ADDIDATA_OR                  0
 #define ADDIDATA_AND                 1
 #define ADDIDATA_AND                 1
 
 
-//Digital Input Interrupt Status
+/* Digital Input Interrupt Status */
 #define APCI1032_DIGITAL_IP_INTERRUPT_STATUS    12
 #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_ENABLE    0x4
 #define APCI1032_DIGITAL_IP_INTERRUPT_DISABLE   0xFFFFFFFB
 #define APCI1032_DIGITAL_IP_INTERRUPT_DISABLE   0xFFFFFFFB
 
 
-//ADDIDATA Enable Disable
+/* ADDIDATA Enable Disable */
 
 
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_DISABLE                           0
 #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);
 				  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);
 				 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);
 				    struct comedi_insn *insn, unsigned int *data);
 
 
-// Interrupt functions.....
+/* Interrupt functions..... */
 
 
 static void v_APCI1032_Interrupt(int irq, void *d);
 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);

Datei-Diff unterdrückt, da er zu groß ist
+ 200 - 200
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c


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

@@ -17,11 +17,11 @@
 
 
 /*********      Definitions for APCI-1500 card  *****/
 /*********      Definitions for APCI-1500 card  *****/
 
 
-// Card Specific information
+/* Card Specific information */
 #define APCI1500_BOARD_VENDOR_ID           0x10e8
 #define APCI1500_BOARD_VENDOR_ID           0x10e8
 #define APCI1500_ADDRESS_RANGE              4
 #define APCI1500_ADDRESS_RANGE              4
 
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 
 #define  APCI1500_DIGITAL_OP                 	2
 #define  APCI1500_DIGITAL_OP                 	2
 #define  APCI1500_DIGITAL_IP                    0
 #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.
 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.
 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                |
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |		       struct comedi_subdevice *s,   :pointer to subdevice structure
 |		       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  |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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);
 	ui_Channel = CR_CHAN(insn->chanspec);
 	if (ui_Channel >= 0 && ui_Channel <= 7) {
 	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;
 		*data = (ui_TmpValue >> ui_Channel) & 0x1;
-	}			//if(ui_Channel >= 0 && ui_Channel <=7)
+	}			/* if(ui_Channel >= 0 && ui_Channel <=7) */
 	else {
 	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;
 	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                |
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                      struct comedi_subdevice *s,   :pointer to subdevice structure
 |                      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  |
 |                      unsigned int *data         : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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);
 	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) {
 	switch (ui_NoOfChannels) {
 	case 2:
 	case 2:
 		ui_Mask = 3;
 		ui_Mask = 3;
@@ -139,9 +139,9 @@ INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 
 
 	default:
 	default:
 		printk("\nWrong parameters\n");
 		printk("\nWrong parameters\n");
-		return -EINVAL;	// "sorry channel spec wrong "
+		return -EINVAL;	/*  "sorry channel spec wrong " */
 		break;
 		break;
-	}			//switch(ui_NoOfChannels)
+	}			/* switch(ui_NoOfChannels) */
 
 
 	return insn->n;
 	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,
 | 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.               |
 | 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         |
 |                     unsigned int *data         : Data Pointer contains         |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                      struct comedi_subdevice *s,   :pointer to subdevice structure
 |                      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                          |
 |					  data[0]  :1:Memory on                          |
 |					            0:Memory off                         |
 |					            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];
 	devpriv->b_OutputMemoryStatus = data[0];
 	return insn->n;
 	return insn->n;
@@ -182,13 +182,13 @@ int i_APCI1516_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI1516_WriteDigitalOutput                      |
 | Function   Name   : int i_APCI1516_WriteDigitalOutput                      |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
 |			(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                |
 | Task              : Writes port value  To the selected port                |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
 |                     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  |
 |                    unsigned int *data           : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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);
 	printk("EL311003 : @=%x\n", devpriv->iobase + APCI1516_DIGITAL_OP);
 
 
 	if (devpriv->b_OutputMemoryStatus) {
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp = inw(devpriv->iobase + APCI1516_DIGITAL_OP);
 		ui_Temp = inw(devpriv->iobase + APCI1516_DIGITAL_OP);
 
 
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	else {
 	else {
 		ui_Temp = 0;
 		ui_Temp = 0;
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			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],
 			printk("EL311003 : d=%d @=%x\n", data[0],
 				devpriv->iobase + APCI1516_DIGITAL_OP);
 				devpriv->iobase + APCI1516_DIGITAL_OP);
 
 
-		}		//if(data[1]==0)
+		}		/* if(data[1]==0) */
 		else {
 		else {
 			if (data[1] == 1) {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
 				switch (ui_NoOfChannel) {
@@ -245,21 +245,21 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 
 
 				default:
 				default:
 					comedi_error(dev, " chan spec wrong");
 					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],
 				outw(data[0],
 					devpriv->iobase + APCI1516_DIGITAL_OP);
 					devpriv->iobase + APCI1516_DIGITAL_OP);
 
 
 				printk("EL311003 : d=%d @=%x\n", data[0],
 				printk("EL311003 : d=%d @=%x\n", data[0],
 					devpriv->iobase + APCI1516_DIGITAL_OP);
 					devpriv->iobase + APCI1516_DIGITAL_OP);
-			}	// if(data[1]==1)
+			}	/*  if(data[1]==1) */
 			else {
 			else {
 				printk("\nSpecified channel not supported\n");
 				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 {
 	else {
 		if (data[3] == 1) {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
 			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],
 				printk("EL311003 : d=%d @=%x\n", data[0],
 					devpriv->iobase + APCI1516_DIGITAL_OP);
 					devpriv->iobase + APCI1516_DIGITAL_OP);
 
 
-			}	//if(data[1]==0)
+			}	/* if(data[1]==0) */
 			else {
 			else {
 				if (data[1] == 1) {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
 					switch (ui_NoOfChannel) {
@@ -312,9 +312,9 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 					default:
 						comedi_error(dev,
 						comedi_error(dev,
 							" chan spec wrong");
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
+						return -EINVAL;	/*  "sorry channel spec wrong " */
 
 
-					}	//switch(ui_NoOfChannels)
+					}	/* switch(ui_NoOfChannels) */
 
 
 					outw(data[0],
 					outw(data[0],
 						devpriv->iobase +
 						devpriv->iobase +
@@ -324,17 +324,17 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 						data[0],
 						data[0],
 						devpriv->iobase +
 						devpriv->iobase +
 						APCI1516_DIGITAL_OP);
 						APCI1516_DIGITAL_OP);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 				else {
 					printk("\nSpecified channel not supported\n");
 					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 {
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
 			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);;
 	return (insn->n);;
 }
 }
 
 
@@ -342,13 +342,13 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI1516_ReadDigitalOutput                       |
 | Function   Name   : int i_APCI1516_ReadDigitalOutput                       |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
 |			(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           |
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
 |                     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  |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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];
 	ui_Temp = data[0];
 	*data = inw(devpriv->iobase + APCI1516_DIGITAL_OP_RW);
 	*data = inw(devpriv->iobase + APCI1516_DIGITAL_OP_RW);
 	if (ui_Temp == 0) {
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			//if(ui_Temp==0)
+	}			/* if(ui_Temp==0) */
 	else {
 	else {
 		if (ui_Temp == 1) {
 		if (ui_Temp == 1) {
 			switch (ui_NoOfChannel) {
 			switch (ui_NoOfChannel) {
@@ -387,28 +387,28 @@ INT i_APCI1516_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 
 
 			default:
 			default:
 				comedi_error(dev, " chan spec wrong");
 				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 {
 		else {
 			printk("\nSpecified channel not supported \n");
 			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;
 	return insn->n;
 }
 }
 
 
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI1516_ConfigWatchdog(struct comedi_device *dev,
 | 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                                |
 | Task              : Configures The Watchdog                                |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
 |                     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                                                     |
 |                     unsigned int *data          : Data Pointer to read status                                                     |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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) {
 	if (data[0] == 0) {
-		//Disable the watchdog
+		/* Disable the watchdog */
 		outw(0x0,
 		outw(0x0,
 			devpriv->i_IobaseAddon +
 			devpriv->i_IobaseAddon +
 			APCI1516_WATCHDOG_ENABLEDISABLE);
 			APCI1516_WATCHDOG_ENABLEDISABLE);
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outw(data[1],
 		outw(data[1],
 			devpriv->i_IobaseAddon +
 			devpriv->i_IobaseAddon +
 			APCI1516_WATCHDOG_RELOAD_VALUE);
 			APCI1516_WATCHDOG_RELOAD_VALUE);
@@ -435,11 +435,11 @@ int i_APCI1516_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic
 		outw(data[1],
 		outw(data[1],
 			devpriv->i_IobaseAddon +
 			devpriv->i_IobaseAddon +
 			APCI1516_WATCHDOG_RELOAD_VALUE + 2);
 			APCI1516_WATCHDOG_RELOAD_VALUE + 2);
-	}			//if(data[0]==0)
+	}			/* if(data[0]==0) */
 	else {
 	else {
 		printk("\nThe input parameters are wrong\n");
 		printk("\nThe input parameters are wrong\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			//elseif(data[0]==0)
+	}			/* elseif(data[0]==0) */
 
 
 	return insn->n;
 	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]) {
 	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;
 		break;
-	case 1:		//start the watchdog
+	case 1:		/* start the watchdog */
 		outw(0x0001,
 		outw(0x0001,
 			devpriv->i_IobaseAddon +
 			devpriv->i_IobaseAddon +
 			APCI1516_WATCHDOG_ENABLEDISABLE);
 			APCI1516_WATCHDOG_ENABLEDISABLE);
 		break;
 		break;
-	case 2:		//Software trigger
+	case 2:		/* Software trigger */
 		outw(0x0201,
 		outw(0x0201,
 			devpriv->i_IobaseAddon +
 			devpriv->i_IobaseAddon +
 			APCI1516_WATCHDOG_ENABLEDISABLE);
 			APCI1516_WATCHDOG_ENABLEDISABLE);
@@ -485,7 +485,7 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 	default:
 	default:
 		printk("\nSpecified functionality does not exist\n");
 		printk("\nSpecified functionality does not exist\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			// switch(data[0])
+	}			/*  switch(data[0]) */
 	return insn->n;
 	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;
 	data[0] = inw(devpriv->i_IobaseAddon + APCI1516_WATCHDOG_STATUS) & 0x1;
 	return insn->n;
 	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_ENABLEDISABLE);
 	outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE);
 	outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE);
 	outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE + 2);
 	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  *****/
 /*********      Definitions for APCI-1516 card  *****/
 
 
-// Card Specific information
+/* Card Specific information */
 #define APCI1516_BOARD_VENDOR_ID                 0x15B8
 #define APCI1516_BOARD_VENDOR_ID                 0x15B8
 #define APCI1516_ADDRESS_RANGE                   8
 #define APCI1516_ADDRESS_RANGE                   8
 
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 
 #define APCI1516_DIGITAL_OP                 	4
 #define APCI1516_DIGITAL_OP                 	4
 #define APCI1516_DIGITAL_OP_RW                 	4
 #define APCI1516_DIGITAL_OP_RW                 	4
 #define APCI1516_DIGITAL_IP                     0
 #define APCI1516_DIGITAL_IP                     0
 
 
-// TIMER COUNTER WATCHDOG DEFINES
+/* TIMER COUNTER WATCHDOG DEFINES */
 
 
 #define ADDIDATA_WATCHDOG                          2
 #define ADDIDATA_WATCHDOG                          2
 #define APCI1516_DIGITAL_OP_WATCHDOG               0
 #define APCI1516_DIGITAL_OP_WATCHDOG               0
@@ -35,24 +35,25 @@
 #define APCI1516_WATCHDOG_RELOAD_VALUE             4
 #define APCI1516_WATCHDOG_RELOAD_VALUE             4
 #define APCI1516_WATCHDOG_STATUS                   16
 #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);
 				    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);
 				 struct comedi_insn *insn, unsigned int *data);
 
 
-//Digital Output
+/* Digital Output */
 int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 				   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);
 				  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);
 				 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,
 int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			      struct comedi_insn *insn, unsigned int *data);
 			      struct comedi_insn *insn, unsigned int *data);
 int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 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,
 int i_APCI1516_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			    struct comedi_insn *insn, unsigned int *data);
 			    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.
 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.
 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 <linux/delay.h>
 #include "hwdrv_apci1564.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;
 	devpriv->tsk_Current = current;
    /*******************************/
    /*******************************/
@@ -106,13 +106,13 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd
 			outl(0x4,
 			outl(0x4,
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 				APCI1564_DIGITAL_IP_IRQ);
 				APCI1564_DIGITAL_IP_IRQ);
-		}		// if  (data[1] == ADDIDATA_OR)
+		}		/*  if  (data[1] == ADDIDATA_OR) */
 		else {
 		else {
 			outl(0x6,
 			outl(0x6,
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 				APCI1564_DIGITAL_IP_IRQ);
 				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 {
 	else {
 		outl(0x0,
 		outl(0x0,
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
@@ -123,7 +123,7 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd
 		outl(0x0,
 		outl(0x0,
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 			APCI1564_DIGITAL_IP_IRQ);
 			APCI1564_DIGITAL_IP_IRQ);
-	}			// else if  (data[0] == ADDIDATA_ENABLE)
+	}			/*  else if  (data[0] == ADDIDATA_ENABLE) */
 
 
 	return insn->n;
 	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                 |
 | Task              : Return the status of the digital input                 |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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  |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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);
 	ui_Channel = CR_CHAN(insn->chanspec);
 	if (ui_Channel >= 0 && ui_Channel <= 31) {
 	if (ui_Channel >= 0 && ui_Channel <= 31) {
 		ui_TmpValue =
 		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;
 		*data = (ui_TmpValue >> ui_Channel) & 0x1;
-	}			// if  (ui_Channel >= 0 && ui_Channel <=31)
+	}			/*  if  (ui_Channel >= 0 && ui_Channel <=31) */
 	else {
 	else {
 		comedi_error(dev, "Not a valid channel number !!! \n");
 		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;
 	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      |
 | Task              : Return the status of the Requested digital inputs      |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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 :	--													 |
 | 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);
 	ui_NoOfChannels = CR_CHAN(insn->chanspec);
 	if (data[1] == 0) {
 	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) {
 		switch (ui_NoOfChannels) {
 		case 2:
 		case 2:
 			ui_Mask = 3;
 			ui_Mask = 3;
@@ -218,15 +220,15 @@ INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 			break;
 			break;
 		default:
 		default:
 			comedi_error(dev, "Not a valid Channel number !!!\n");
 			comedi_error(dev, "Not a valid Channel number !!!\n");
-			return -EINVAL;	// "sorry channel spec wrong "
+			return -EINVAL;	/*  "sorry channel spec wrong " */
 			break;
 			break;
-		}		// switch  (ui_NoOfChannels)
-	}			// if  (data[1]==0)
+		}		/*  switch  (ui_NoOfChannels) */
+	}			/*  if  (data[1]==0) */
 	else {
 	else {
 		if (data[1] == 1) {
 		if (data[1] == 1) {
 			*data = ui_InterruptStatus_1564;
 			*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;
 	return insn->n;
 }
 }
 
 
@@ -239,7 +241,7 @@ INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 | Task              : Configures The Digital Output Subdevice.               |
 | Task              : Configures The Digital Output Subdevice.               |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                                                                            |
 |                                                                            |
 |					  data[1]            : 1 Enable  VCC  Interrupt  |
 |					  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)) {
 	if ((data[0] != 0) && (data[0] != 1)) {
 		comedi_error(dev,
 		comedi_error(dev,
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			// if  ((data[0]!=0) && (data[0]!=1))
+	}			/*  if  ((data[0]!=0) && (data[0]!=1)) */
 	if (data[0]) {
 	if (data[0]) {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
-	}			// if  (data[0])
+	}			/*  if  (data[0]) */
 	else {
 	else {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
-	}			// else if  (data[0])
+	}			/*  else if  (data[0]) */
 	if (data[1] == ADDIDATA_ENABLE) {
 	if (data[1] == ADDIDATA_ENABLE) {
 		ul_Command = ul_Command | 0x1;
 		ul_Command = ul_Command | 0x1;
-	}			// if  (data[1] == ADDIDATA_ENABLE)
+	}			/*  if  (data[1] == ADDIDATA_ENABLE) */
 	else {
 	else {
 		ul_Command = ul_Command & 0xFFFFFFFE;
 		ul_Command = ul_Command & 0xFFFFFFFE;
-	}			// else if  (data[1] == ADDIDATA_ENABLE)
+	}			/*  else if  (data[1] == ADDIDATA_ENABLE) */
 	if (data[2] == ADDIDATA_ENABLE) {
 	if (data[2] == ADDIDATA_ENABLE) {
 		ul_Command = ul_Command | 0x2;
 		ul_Command = ul_Command | 0x2;
-	}			// if  (data[2] == ADDIDATA_ENABLE)
+	}			/*  if  (data[2] == ADDIDATA_ENABLE) */
 	else {
 	else {
 		ul_Command = ul_Command & 0xFFFFFFFD;
 		ul_Command = ul_Command & 0xFFFFFFFD;
-	}			// else if  (data[2] == ADDIDATA_ENABLE)
+	}			/*  else if  (data[2] == ADDIDATA_ENABLE) */
 	outl(ul_Command,
 	outl(ul_Command,
 		devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 		devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 		APCI1564_DIGITAL_OP_INTERRUPT);
 		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                |
 | Task              : Writes port value  To the selected port                |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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 :	--													 |
 | 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);
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	if (devpriv->b_OutputMemoryStatus) {
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp =
 		ui_Temp =
 			inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 			inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 			APCI1564_DIGITAL_OP_RW);
 			APCI1564_DIGITAL_OP_RW);
-	}			// if  (devpriv->b_OutputMemoryStatus )
+	}			/*  if  (devpriv->b_OutputMemoryStatus ) */
 	else {
 	else {
 		ui_Temp = 0;
 		ui_Temp = 0;
-	}			// else if  (devpriv->b_OutputMemoryStatus )
+	}			/*  else if  (devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outl(data[0],
 			outl(data[0],
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 				APCI1564_DIGITAL_OP_RW);
 				APCI1564_DIGITAL_OP_RW);
-		}		// if  (data[1]==0)
+		}		/*  if  (data[1]==0) */
 		else {
 		else {
 			if (data[1] == 1) {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
 				switch (ui_NoOfChannel) {
@@ -362,18 +364,18 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					break;
 					break;
 				default:
 				default:
 					comedi_error(dev, " chan spec wrong");
 					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],
 				outl(data[0],
 					devpriv->i_IobaseAmcc +
 					devpriv->i_IobaseAmcc +
 					APCI1564_DIGITAL_OP +
 					APCI1564_DIGITAL_OP +
 					APCI1564_DIGITAL_OP_RW);
 					APCI1564_DIGITAL_OP_RW);
-			}	// if  (data[1]==1)
+			}	/*  if  (data[1]==1) */
 			else {
 			else {
 				printk("\nSpecified channel not supported\n");
 				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 {
 	else {
 		if (data[3] == 1) {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
 			if (data[1] == 0) {
@@ -389,7 +391,7 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					devpriv->i_IobaseAmcc +
 					devpriv->i_IobaseAmcc +
 					APCI1564_DIGITAL_OP +
 					APCI1564_DIGITAL_OP +
 					APCI1564_DIGITAL_OP_RW);
 					APCI1564_DIGITAL_OP_RW);
-			}	// if  (data[1]==0)
+			}	/*  if  (data[1]==0) */
 			else {
 			else {
 				if (data[1] == 1) {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
 					switch (ui_NoOfChannel) {
@@ -447,23 +449,23 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 					default:
 						comedi_error(dev,
 						comedi_error(dev,
 							" chan spec wrong");
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
-					}	//switch(ui_NoOfChannels)
+						return -EINVAL;	/*  "sorry channel spec wrong " */
+					}	/* switch(ui_NoOfChannels) */
 					outl(data[0],
 					outl(data[0],
 						devpriv->i_IobaseAmcc +
 						devpriv->i_IobaseAmcc +
 						APCI1564_DIGITAL_OP +
 						APCI1564_DIGITAL_OP +
 						APCI1564_DIGITAL_OP_RW);
 						APCI1564_DIGITAL_OP_RW);
-				}	// if  (data[1]==1)
+				}	/*  if  (data[1]==1) */
 				else {
 				else {
 					printk("\nSpecified channel not supported\n");
 					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 {
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
 			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;
 	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           |
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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 :	--													 |
 | 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_NoOfChannel = CR_CHAN(insn->chanspec);
 	ui_Temp = data[0];
 	ui_Temp = data[0];
@@ -498,7 +500,7 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 		APCI1564_DIGITAL_OP_RW);
 		APCI1564_DIGITAL_OP_RW);
 	if (ui_Temp == 0) {
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			// if  (ui_Temp==0)
+	}			/*  if  (ui_Temp==0) */
 	else {
 	else {
 		if (ui_Temp == 1) {
 		if (ui_Temp == 1) {
 			switch (ui_NoOfChannel) {
 			switch (ui_NoOfChannel) {
@@ -523,14 +525,14 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 
 
 			default:
 			default:
 				comedi_error(dev, " chan spec wrong");
 				comedi_error(dev, " chan spec wrong");
-				return -EINVAL;	// "sorry channel spec wrong "
+				return -EINVAL;	/*  "sorry channel spec wrong " */
 				break;
 				break;
-			}	// switch(ui_NoOfChannels)
-		}		// if  (ui_Temp==1)
+			}	/*  switch(ui_NoOfChannels) */
+		}		/*  if  (ui_Temp==1) */
 		else {
 		else {
 			printk("\nSpecified channel not supported \n");
 			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;
 	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             |
 | Task              : Configures The Timer , Counter or Watchdog             |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                                                                            |
 |                                                                            |
 |					  data[0]            : 0 Configure As Timer      |
 |					  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;
 	devpriv->tsk_Current = current;
 	if (data[0] == ADDIDATA_WATCHDOG) {
 	if (data[0] == ADDIDATA_WATCHDOG) {
 		devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG;
 		devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG;
 
 
-		//Disable the watchdog
+		/* Disable the watchdog */
 		outl(0x0,
 		outl(0x0,
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
 			APCI1564_TCW_PROG);
 			APCI1564_TCW_PROG);
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outl(data[3],
 		outl(data[3],
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
 			APCI1564_TCW_RELOAD_VALUE);
 			APCI1564_TCW_RELOAD_VALUE);
-	}			// if  (data[0]==ADDIDATA_WATCHDOG)
+	}			/*  if  (data[0]==ADDIDATA_WATCHDOG) */
 	else if (data[0] == ADDIDATA_TIMER) {
 	else if (data[0] == ADDIDATA_TIMER) {
-		//First Stop The Timer
+		/* First Stop The Timer */
 		ul_Command1 =
 		ul_Command1 =
 			inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			APCI1564_TCW_PROG);
 			APCI1564_TCW_PROG);
 		ul_Command1 = ul_Command1 & 0xFFFFF9FEUL;
 		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;
 		devpriv->b_TimerSelectMode = ADDIDATA_TIMER;
 		if (data[1] == 1) {
 		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,
 			outl(0x0,
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 				devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 				APCI1564_DIGITAL_IP_IRQ);
 				APCI1564_DIGITAL_IP_IRQ);
@@ -614,18 +616,18 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 			outl(0x0,
 			outl(0x0,
 				devpriv->iobase + APCI1564_COUNTER4 +
 				devpriv->iobase + APCI1564_COUNTER4 +
 				APCI1564_TCW_IRQ);
 				APCI1564_TCW_IRQ);
-		}		// if  (data[1]==1)
+		}		/*  if  (data[1]==1) */
 		else {
 		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],
 		outl(data[2],
 			devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			APCI1564_TCW_TIMEBASE);
 			APCI1564_TCW_TIMEBASE);
 
 
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outl(data[3],
 		outl(data[3],
 			devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			APCI1564_TCW_RELOAD_VALUE);
 			APCI1564_TCW_RELOAD_VALUE);
@@ -635,18 +637,18 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 			APCI1564_TCW_PROG);
 			APCI1564_TCW_PROG);
 		ul_Command1 =
 		ul_Command1 =
 			(ul_Command1 & 0xFFF719E2UL) | 2UL << 13UL | 0x10UL;
 			(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) {
 	else if (data[0] == ADDIDATA_COUNTER) {
 		devpriv->b_TimerSelectMode = ADDIDATA_COUNTER;
 		devpriv->b_TimerSelectMode = ADDIDATA_COUNTER;
 		devpriv->b_ModeSelectRegister = data[5];
 		devpriv->b_ModeSelectRegister = data[5];
 
 
-		//First Stop The Counter
+		/* First Stop The Counter */
 		ul_Command1 =
 		ul_Command1 =
 			inl(devpriv->iobase + ((data[5] - 1) * 0x20) +
 			inl(devpriv->iobase + ((data[5] - 1) * 0x20) +
 			APCI1564_TCW_PROG);
 			APCI1564_TCW_PROG);
 		ul_Command1 = ul_Command1 & 0xFFFFF9FEUL;
 		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 */
 		/* Set the reload value */
@@ -666,12 +668,12 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
       /******************************/
       /******************************/
 		ul_Command1 =
 		ul_Command1 =
 			(ul_Command1 & 0xFFFC19E2UL) | 0x80000UL |
 			(ul_Command1 & 0xFFFC19E2UL) | 0x80000UL |
-			(ULONG) ((ULONG) data[4] << 16UL);
+			(unsigned int) ((unsigned int) data[4] << 16UL);
 		outl(ul_Command1,
 		outl(ul_Command1,
 			devpriv->iobase + ((data[5] - 1) * 0x20) +
 			devpriv->iobase + ((data[5] - 1) * 0x20) +
 			APCI1564_TCW_PROG);
 			APCI1564_TCW_PROG);
 
 
-		// Enable or Disable Interrupt
+		/*  Enable or Disable Interrupt */
 		ul_Command1 = (ul_Command1 & 0xFFFFF9FD) | (data[1] << 1);
 		ul_Command1 = (ul_Command1 & 0xFFFFF9FD) | (data[1] << 1);
 		outl(ul_Command1,
 		outl(ul_Command1,
 			devpriv->iobase + ((data[5] - 1) * 0x20) +
 			devpriv->iobase + ((data[5] - 1) * 0x20) +
@@ -684,10 +686,10 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 		outl(ul_Command1,
 		outl(ul_Command1,
 			devpriv->iobase + ((data[5] - 1) * 0x20) +
 			devpriv->iobase + ((data[5] - 1) * 0x20) +
 			APCI1564_TCW_PROG);
 			APCI1564_TCW_PROG);
-	}			// else if  (data[0]==ADDIDATA_COUNTER)
+	}			/*  else if  (data[0]==ADDIDATA_COUNTER) */
 	else {
 	else {
 		printk(" Invalid subdevice.");
 		printk(" Invalid subdevice.");
-	}			// else if  (data[0]==ADDIDATA_WATCHDOG)
+	}			/*  else if  (data[0]==ADDIDATA_WATCHDOG) */
 
 
 	return insn->n;
 	return insn->n;
 }
 }
@@ -701,7 +703,7 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 | Task              : Start / Stop The Selected Timer , Counter or Watchdog  |
 | Task              : Start / Stop The Selected Timer , Counter or Watchdog  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                                                                            |
 |                                                                            |
 |					  data[0]            : 0 Timer                   |
 |					  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) {
 	if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
 		switch (data[1]) {
 		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;
 			break;
-		case 1:	//start the watchdog
+		case 1:	/* start the watchdog */
 			outl(0x0001,
 			outl(0x0001,
 				devpriv->i_IobaseAmcc +
 				devpriv->i_IobaseAmcc +
 				APCI1564_DIGITAL_OP_WATCHDOG +
 				APCI1564_DIGITAL_OP_WATCHDOG +
 				APCI1564_TCW_PROG);
 				APCI1564_TCW_PROG);
 			break;
 			break;
-		case 2:	//Software trigger
+		case 2:	/* Software trigger */
 			outl(0x0201,
 			outl(0x0201,
 				devpriv->i_IobaseAmcc +
 				devpriv->i_IobaseAmcc +
 				APCI1564_DIGITAL_OP_WATCHDOG +
 				APCI1564_DIGITAL_OP_WATCHDOG +
@@ -742,8 +744,8 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 		default:
 		default:
 			printk("\nSpecified functionality does not exist\n");
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
 			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 (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
 		if (data[1] == 1) {
 		if (data[1] == 1) {
 			ul_Command1 =
 			ul_Command1 =
@@ -751,13 +753,13 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 				APCI1564_TCW_PROG);
 				APCI1564_TCW_PROG);
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
 
 
-			//Enable the Timer
+			/* Enable the Timer */
 			outl(ul_Command1,
 			outl(ul_Command1,
 				devpriv->i_IobaseAmcc + APCI1564_TIMER +
 				devpriv->i_IobaseAmcc + APCI1564_TIMER +
 				APCI1564_TCW_PROG);
 				APCI1564_TCW_PROG);
-		}		// if  (data[1]==1)
+		}		/*  if  (data[1]==1) */
 		else if (data[1] == 0) {
 		else if (data[1] == 0) {
-			//Stop The Timer
+			/* Stop The Timer */
 
 
 			ul_Command1 =
 			ul_Command1 =
 				inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
 				inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
@@ -766,29 +768,29 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 			outl(ul_Command1,
 			outl(ul_Command1,
 				devpriv->i_IobaseAmcc + APCI1564_TIMER +
 				devpriv->i_IobaseAmcc + APCI1564_TIMER +
 				APCI1564_TCW_PROG);
 				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) {
 	if (devpriv->b_TimerSelectMode == ADDIDATA_COUNTER) {
 		ul_Command1 =
 		ul_Command1 =
 			inl(devpriv->iobase + ((devpriv->b_ModeSelectRegister -
 			inl(devpriv->iobase + ((devpriv->b_ModeSelectRegister -
 					1) * 0x20) + APCI1564_TCW_PROG);
 					1) * 0x20) + APCI1564_TCW_PROG);
 		if (data[1] == 1) {
 		if (data[1] == 1) {
-			//Start the Counter subdevice
+			/* Start the Counter subdevice */
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
-		}		// if  (data[1] == 1)
+		}		/*  if  (data[1] == 1) */
 		else if (data[1] == 0) {
 		else if (data[1] == 0) {
-			// Stops the Counter subdevice
+			/*  Stops the Counter subdevice */
 			ul_Command1 = 0;
 			ul_Command1 = 0;
 
 
-		}		// else if  (data[1] == 0)
+		}		/*  else if  (data[1] == 0) */
 		else if (data[1] == 2) {
 		else if (data[1] == 2) {
-			// Clears the Counter subdevice
+			/*  Clears the Counter subdevice */
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x400;
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x400;
-		}		// else if  (data[1] == 3)
+		}		/*  else if  (data[1] == 3) */
 		outl(ul_Command1,
 		outl(ul_Command1,
 			devpriv->iobase + ((devpriv->b_ModeSelectRegister -
 			devpriv->iobase + ((devpriv->b_ModeSelectRegister -
 					1) * 0x20) + APCI1564_TCW_PROG);
 					1) * 0x20) + APCI1564_TCW_PROG);
-	}			// if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER)
+	}			/*  if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) */
 	return insn->n;
 	return insn->n;
 }
 }
 
 
@@ -801,7 +803,7 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 | Task              : Read The Selected Timer , Counter or Watchdog          |
 | Task              : Read The Selected Timer , Counter or Watchdog          |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          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) {
 	if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
-		// Stores the status of the Watchdog
+		/*  Stores the status of the Watchdog */
 		data[0] =
 		data[0] =
 			inl(devpriv->i_IobaseAmcc +
 			inl(devpriv->i_IobaseAmcc +
 			APCI1564_DIGITAL_OP_WATCHDOG +
 			APCI1564_DIGITAL_OP_WATCHDOG +
@@ -827,18 +829,18 @@ INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev,
 		data[1] =
 		data[1] =
 			inl(devpriv->i_IobaseAmcc +
 			inl(devpriv->i_IobaseAmcc +
 			APCI1564_DIGITAL_OP_WATCHDOG);
 			APCI1564_DIGITAL_OP_WATCHDOG);
-	}			// if  (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG)
+	}			/*  if  (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */
 	else if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
 	else if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
-		// Stores the status of the Timer
+		/*  Stores the status of the Timer */
 		data[0] =
 		data[0] =
 			inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			inl(devpriv->i_IobaseAmcc + APCI1564_TIMER +
 			APCI1564_TCW_TRIG_STATUS) & 0x1;
 			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);
 		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) {
 	else if (devpriv->b_TimerSelectMode == ADDIDATA_COUNTER) {
-		// Read the Counter Actual Value.
+		/*  Read the Counter Actual Value. */
 		data[0] =
 		data[0] =
 			inl(devpriv->iobase + ((devpriv->b_ModeSelectRegister -
 			inl(devpriv->iobase + ((devpriv->b_ModeSelectRegister -
 					1) * 0x20) +
 					1) * 0x20) +
@@ -850,28 +852,28 @@ INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev,
       /***********************************/
       /***********************************/
 		/* Get the software trigger status */
 		/* 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 */
 		/* 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 */
 		/* Get the software clear status */
       /*********************************/
       /*********************************/
-		data[3] = (BYTE) ((ul_Command1 >> 3) & 1);
+		data[3] = (unsigned char) ((ul_Command1 >> 3) & 1);
 
 
       /***************************/
       /***************************/
 		/* Get the overflow status */
 		/* 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)
 	else if ((devpriv->b_TimerSelectMode != ADDIDATA_TIMER)
 		&& (devpriv->b_TimerSelectMode != ADDIDATA_WATCHDOG)
 		&& (devpriv->b_TimerSelectMode != ADDIDATA_WATCHDOG)
 		&& (devpriv->b_TimerSelectMode != ADDIDATA_COUNTER)) {
 		&& (devpriv->b_TimerSelectMode != ADDIDATA_COUNTER)) {
 		printk("\n Invalid Subdevice !!!\n");
 		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;
 	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;
 	*data = ui_Type;
 	return insn->n;
 	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)
 static void v_APCI1564_Interrupt(int irq, void *d)
 {
 {
 	struct comedi_device *dev = 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 +
 	ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 		APCI1564_DIGITAL_IP_IRQ) & 0x01;
 		APCI1564_DIGITAL_IP_IRQ) & 0x01;
 	ui_DO = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 	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
 	if (ui_DI == 0 && ui_DO == 0 && ui_Timer == 0 && ui_C1 == 0
 		&& ui_C2 == 0 && ui_C3 == 0 && ui_C4 == 0) {
 		&& ui_C2 == 0 && ui_C3 == 0 && ui_C4 == 0) {
 		printk("\nInterrupt from unknown source\n");
 		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) {
 	if (ui_DI == 1) {
 		ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 		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 +
 			inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +
 			APCI1564_DIGITAL_IP_INTERRUPT_STATUS);
 			APCI1564_DIGITAL_IP_INTERRUPT_STATUS);
 		ui_InterruptStatus_1564 = ui_InterruptStatus_1564 & 0X000FFFF0;
 		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;
 		return;
 	}
 	}
 
 
 	if (ui_DO == 1) {
 	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 =
 		ui_Type =
 			inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 			inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 			APCI1564_DIGITAL_OP_INTERRUPT_STATUS) & 0x3;
 			APCI1564_DIGITAL_OP_INTERRUPT_STATUS) & 0x3;
-		//Disable the  Interrupt
+		/* Disable the  Interrupt */
 		outl(0x0,
 		outl(0x0,
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 			devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP +
 			APCI1564_DIGITAL_OP_INTERRUPT);
 			APCI1564_DIGITAL_OP_INTERRUPT);
 
 
-		//Sends signal to user space
+		/* Sends signal to user space */
 		send_sig(SIGIO, devpriv->tsk_Current, 0);
 		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;
 	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);
 	outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP_INTERRUPT_MODE2);
 	devpriv->b_DigitalOutputRegister = 0;
 	devpriv->b_DigitalOutputRegister = 0;
 	ui_Type = 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,
 	outl(0x0,
 		devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
 		devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
 		APCI1564_TCW_RELOAD_VALUE);
 		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_BOARD_VENDOR_ID                0x15B8
 #define APCI1564_ADDRESS_RANGE                  128
 #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                     0x04
 #define APCI1564_DIGITAL_IP_INTERRUPT_MODE1     4
 #define APCI1564_DIGITAL_IP_INTERRUPT_MODE1     4
 #define APCI1564_DIGITAL_IP_INTERRUPT_MODE2     8
 #define APCI1564_DIGITAL_IP_INTERRUPT_MODE2     8
 #define APCI1564_DIGITAL_IP_IRQ                 16
 #define APCI1564_DIGITAL_IP_IRQ                 16
 
 
-// Output defines
+/* Output defines */
 #define APCI1564_DIGITAL_OP                 	0x18
 #define APCI1564_DIGITAL_OP                 	0x18
 #define APCI1564_DIGITAL_OP_RW               	0
 #define APCI1564_DIGITAL_OP_RW               	0
 #define APCI1564_DIGITAL_OP_INTERRUPT           4
 #define APCI1564_DIGITAL_OP_INTERRUPT           4
 #define APCI1564_DIGITAL_OP_IRQ                 12
 #define APCI1564_DIGITAL_OP_IRQ                 12
 
 
-//Digital Input IRQ Function Selection
+/* Digital Input IRQ Function Selection */
 #define ADDIDATA_OR                             0
 #define ADDIDATA_OR                             0
 #define ADDIDATA_AND                            1
 #define ADDIDATA_AND                            1
 
 
-//Digital Input Interrupt Status
+/* Digital Input Interrupt Status */
 #define APCI1564_DIGITAL_IP_INTERRUPT_STATUS    12
 #define APCI1564_DIGITAL_IP_INTERRUPT_STATUS    12
 
 
-//Digital Output Interrupt Status
+/* Digital Output Interrupt Status */
 #define APCI1564_DIGITAL_OP_INTERRUPT_STATUS    8
 #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_ENABLE    0x4
 #define APCI1564_DIGITAL_IP_INTERRUPT_DISABLE   0xFFFFFFFB
 #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_ENABLE   0x1
 #define APCI1564_DIGITAL_OP_VCC_INTERRUPT_DISABLE  0xFFFFFFFE
 #define APCI1564_DIGITAL_OP_VCC_INTERRUPT_DISABLE  0xFFFFFFFE
 #define APCI1564_DIGITAL_OP_CC_INTERRUPT_ENABLE    0x2
 #define APCI1564_DIGITAL_OP_CC_INTERRUPT_ENABLE    0x2
 #define APCI1564_DIGITAL_OP_CC_INTERRUPT_DISABLE   0xFFFFFFFD
 #define APCI1564_DIGITAL_OP_CC_INTERRUPT_DISABLE   0xFFFFFFFD
 
 
-//ADDIDATA Enable Disable
+/* ADDIDATA Enable Disable */
 
 
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_DISABLE                           0
 #define ADDIDATA_DISABLE                           0
 
 
-// TIMER COUNTER WATCHDOG DEFINES
+/* TIMER COUNTER WATCHDOG DEFINES */
 
 
 #define ADDIDATA_TIMER                             0
 #define ADDIDATA_TIMER                             0
 #define ADDIDATA_COUNTER                           1
 #define ADDIDATA_COUNTER                           1
@@ -78,30 +78,32 @@
 #define APCI1564_TCW_WARN_TIMEVAL                  24
 #define APCI1564_TCW_WARN_TIMEVAL                  24
 #define APCI1564_TCW_WARN_TIMEBASE                 28
 #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);
 				  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);
 				 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);
 				    struct comedi_insn *insn, unsigned int *data);
 
 
-//DO
+/* DO */
 int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 				   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);
 				  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);
 				 struct comedi_insn *insn, unsigned int *data);
 int i_APCI1564_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s,
 int i_APCI1564_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 				   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_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);
 					  struct comedi_insn *insn, unsigned int *data);
 int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
 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_subdevice *s,
 					struct comedi_insn *insn, unsigned int *data);
 					struct comedi_insn *insn, unsigned int *data);
 
 
-// INTERRUPT
+/* intERRUPT */
 static void v_APCI1564_Interrupt(int irq, void *d);
 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.
 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.
 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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           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.        |
 |                for you call any other function witch access of TTL.        |
 |                APCI16XX_TTL_INITDIRECTION(user inputs for direction)       |
 |                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 : -                                                      |
 | 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 */
 	/* Test the buffer size */
@@ -108,7 +108,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 		/* Get the command */
 		/* Get the command */
 		/* **************** */
 		/* **************** */
 
 
-		b_Command = (BYTE) data[0];
+		b_Command = (unsigned char) data[0];
 
 
 	   /********************/
 	   /********************/
 		/* Test the command */
 		/* Test the command */
@@ -122,7 +122,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 	      /***************************************/
 	      /***************************************/
 
 
 			if ((b_Command == APCI16XX_TTL_INITDIRECTION)
 			if ((b_Command == APCI16XX_TTL_INITDIRECTION)
-				&& ((BYTE) (insn->n - 1) != b_NumberOfPort)) {
+				&& ((unsigned char) (insn->n - 1) != b_NumberOfPort)) {
 		 /*******************/
 		 /*******************/
 				/* Data size error */
 				/* Data size error */
 		 /*******************/
 		 /*******************/
@@ -132,7 +132,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 			}
 			}
 
 
 			if ((b_Command == APCI16XX_TTL_OUTPUTMEMORY)
 			if ((b_Command == APCI16XX_TTL_OUTPUTMEMORY)
-				&& ((BYTE) (insn->n) != 2)) {
+				&& ((unsigned char) (insn->n) != 2)) {
 		 /*******************/
 		 /*******************/
 				/* Data size error */
 				/* Data size error */
 		 /*******************/
 		 /*******************/
@@ -182,8 +182,8 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 		 /************************/
 		 /************************/
 
 
 				printk("\nPort %d direction selection error",
 				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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           struct comedi_insn      *insn,                          |
@@ -266,11 +266,11 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev,
 |              APCI16XX_TTL_READCHANNEL                                      |
 |              APCI16XX_TTL_READCHANNEL                                      |
 |                    b_SelectedPort= CR_RANGE(insn->chanspec);               |
 |                    b_SelectedPort= CR_RANGE(insn->chanspec);               |
 |                    b_InputChannel= CR_CHAN(insn->chanspec);                |
 |                    b_InputChannel= CR_CHAN(insn->chanspec);                |
-|                    b_ReadType	  = (BYTE) data[0];                          |
+|                    b_ReadType	  = (unsigned char) data[0];                          |
 |                                                                            |
 |                                                                            |
 |              APCI16XX_TTL_READPORT                                         |
 |              APCI16XX_TTL_READPORT                                         |
 |                    b_SelectedPort= CR_RANGE(insn->chanspec);               |
 |                    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                   |
 | Output Parameters : data[0]    0 : Channle is not active                   |
 |                                1 : Channle is 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 */
 	/* Test the buffer size */
@@ -304,7 +304,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
 		/* Get the command */
 		/* Get the command */
 		/* **************** */
 		/* **************** */
 
 
-		b_Command = (BYTE) data[0];
+		b_Command = (unsigned char) data[0];
 
 
 	   /********************/
 	   /********************/
 		/* Test the command */
 		/* Test the command */
@@ -380,7 +380,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
 	/**************************/
 	/**************************/
 
 
 	if (i_ReturnValue >= 0) {
 	if (i_ReturnValue >= 0) {
-		pb_Status = (PBYTE) & data[0];
+		pb_Status = (unsigned char *) &data[0];
 
 
 	   /*******************************/
 	   /*******************************/
 		/* Get the digital inpu status */
 		/* Get the digital inpu status */
@@ -394,7 +394,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev,
 		/* Save the port value */
 		/* Save the port value */
 	   /***********************/
 	   /***********************/
 
 
-		*pb_Status = (BYTE) dw_Status;
+		*pb_Status = (unsigned char) dw_Status;
 
 
 	   /***************************************/
 	   /***************************************/
 		/* Test if read channel status command */
 		/* 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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           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;
 	unsigned int *pls_ReadData = data;
 
 
 	/********************/
 	/********************/
@@ -450,7 +450,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 	   /**********************************/
 	   /**********************************/
 
 
 		b_NumberOfPort =
 		b_NumberOfPort =
-			(BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 32);
+			(unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 32);
 		if ((b_NumberOfPort * 32) <
 		if ((b_NumberOfPort * 32) <
 			devpriv->ps_BoardInfo->i_NbrTTLChannel) {
 			devpriv->ps_BoardInfo->i_NbrTTLChannel) {
 			b_NumberOfPort = b_NumberOfPort + 1;
 			b_NumberOfPort = b_NumberOfPort + 1;
@@ -524,7 +524,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 		i_ReturnValue = -100;
 		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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           struct comedi_insn      *insn,                          |
@@ -551,11 +551,11 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev,
 |              APCI16XX_TTL_WRITECHANNEL_ON | APCI16XX_TTL_WRITECHANNEL_OFF  |
 |              APCI16XX_TTL_WRITECHANNEL_ON | APCI16XX_TTL_WRITECHANNEL_OFF  |
 |                    b_SelectedPort = CR_RANGE(insn->chanspec);              |
 |                    b_SelectedPort = CR_RANGE(insn->chanspec);              |
 |                    b_OutputChannel= CR_CHAN(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        |
 |              APCI16XX_TTL_WRITEPORT_ON | APCI16XX_TTL_WRITEPORT_OFF        |
 |                    b_SelectedPort = CR_RANGE(insn->chanspec);              |
 |                    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                  |
 | Output Parameters : data[0] : TTL output port 0 to 3 data                  |
 |                     data[1] : TTL output port 4 to 7 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 */
 	/* Test the buffer size */
@@ -590,7 +590,7 @@ int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev,
 		/* Get the command */
 		/* Get the command */
 		/* **************** */
 		/* **************** */
 
 
-		b_Command = (BYTE) data[0];
+		b_Command = (unsigned char) data[0];
 
 
 	   /********************/
 	   /********************/
 		/* Test the command */
 		/* Test the command */
@@ -758,7 +758,7 @@ int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev,
 			devpriv->iobase + 20 + ((b_SelectedPort / 4) * 4));
 			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;
 	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.
 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.
 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.               |
 | Task              : Configures The Digital Output Subdevice.               |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                                                                            |
 |                                                                            |
 |			  data[0]            : 1 Digital Memory On               |
 |			  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)) {
 	if ((data[0] != 0) && (data[0] != 1)) {
 		comedi_error(dev,
 		comedi_error(dev,
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			// if  ((data[0]!=0) && (data[0]!=1))
+	}			/*  if  ((data[0]!=0) && (data[0]!=1)) */
 	if (data[0]) {
 	if (data[0]) {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
-	}			// if  (data[0]
+	}			/*  if  (data[0] */
 	else {
 	else {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
-	}			// else if  (data[0]
+	}			/*  else if  (data[0] */
 	return insn->n;
 	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                |
 | Task              : Writes port value  To the selected port                |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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 :	--													 |
 | 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);
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	if ((ui_NoOfChannel < 0) || (ui_NoOfChannel > 15)) {
 	if ((ui_NoOfChannel < 0) || (ui_NoOfChannel > 15)) {
 		comedi_error(dev,
 		comedi_error(dev,
 			"Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n");
 			"Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			// if  ((ui_NoOfChannel<0) || (ui_NoOfChannel>15))
+	}			/*  if  ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) */
 	if (devpriv->b_OutputMemoryStatus) {
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp = inw(devpriv->iobase + APCI2016_DIGITAL_OP);
 		ui_Temp = inw(devpriv->iobase + APCI2016_DIGITAL_OP);
-	}			// if  (devpriv->b_OutputMemoryStatus )
+	}			/*  if  (devpriv->b_OutputMemoryStatus ) */
 	else {
 	else {
 		ui_Temp = 0;
 		ui_Temp = 0;
-	}			// else if  (devpriv->b_OutputMemoryStatus )
+	}			/*  else if  (devpriv->b_OutputMemoryStatus ) */
 	if ((data[1] != 0) && (data[1] != 1)) {
 	if ((data[1] != 0) && (data[1] != 1)) {
 		comedi_error(dev,
 		comedi_error(dev,
 			"Invalid Data[1] value !!!, Data[1] should be 0 or 1\n");
 			"Invalid Data[1] value !!!, Data[1] should be 0 or 1\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			// if  ((data[1]!=0) && (data[1]!=1))
+	}			/*  if  ((data[1]!=0) && (data[1]!=1)) */
 
 
 	if (data[3] == 0) {
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outw(data[0], devpriv->iobase + APCI2016_DIGITAL_OP);
 			outw(data[0], devpriv->iobase + APCI2016_DIGITAL_OP);
-		}		// if (data[1]==0)
+		}		/*  if (data[1]==0) */
 		else {
 		else {
 			if (data[1] == 1) {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
 				switch (ui_NoOfChannel) {
@@ -162,16 +162,16 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					break;
 					break;
 				default:
 				default:
 					comedi_error(dev, " chan spec wrong");
 					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],
 				outw(data[0],
 					devpriv->iobase + APCI2016_DIGITAL_OP);
 					devpriv->iobase + APCI2016_DIGITAL_OP);
-			}	// if  (data[1]==1)
+			}	/*  if  (data[1]==1) */
 			else {
 			else {
 				printk("\nSpecified channel not supported\n");
 				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 {
 	else {
 		if (data[3] == 1) {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
 			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;
 				data[0] = data[0] & ui_Temp;
 				outw(data[0],
 				outw(data[0],
 					devpriv->iobase + APCI2016_DIGITAL_OP);
 					devpriv->iobase + APCI2016_DIGITAL_OP);
-			}	// if  (data[1]==0)
+			}	/*  if  (data[1]==0) */
 			else {
 			else {
 				if (data[1] == 1) {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
 					switch (ui_NoOfChannel) {
@@ -228,22 +228,22 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 					default:
 						comedi_error(dev,
 						comedi_error(dev,
 							" chan spec wrong");
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
-					}	//switch(ui_NoOfChannels)
+						return -EINVAL;	/*  "sorry channel spec wrong " */
+					}	/* switch(ui_NoOfChannels) */
 					outw(data[0],
 					outw(data[0],
 						devpriv->iobase +
 						devpriv->iobase +
 						APCI2016_DIGITAL_OP);
 						APCI2016_DIGITAL_OP);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 				else {
 					printk("\nSpecified channel not supported\n");
 					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 {
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
 			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;
 	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           |
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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 :	--													 |
 | 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);
 	ui_NoOfChannel = CR_CHAN(insn->chanspec);
 	if ((ui_NoOfChannel < 0) || (ui_NoOfChannel > 15)) {
 	if ((ui_NoOfChannel < 0) || (ui_NoOfChannel > 15)) {
 		comedi_error(dev,
 		comedi_error(dev,
 			"Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n");
 			"Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			// if  ((ui_NoOfChannel<0) || (ui_NoOfChannel>15))
+	}			/*  if  ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) */
 	if ((data[0] != 0) && (data[0] != 1)) {
 	if ((data[0] != 0) && (data[0] != 1)) {
 		comedi_error(dev,
 		comedi_error(dev,
 			"Invalid Data[0] value !!!, Data[0] should be 0 or 1\n");
 			"Invalid Data[0] value !!!, Data[0] should be 0 or 1\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			// if  ((data[0]!=0) && (data[0]!=1))
+	}			/*  if  ((data[0]!=0) && (data[0]!=1)) */
 	ui_Temp = data[0];
 	ui_Temp = data[0];
 	*data = inw(devpriv->iobase + APCI2016_DIGITAL_OP_RW);
 	*data = inw(devpriv->iobase + APCI2016_DIGITAL_OP_RW);
 	if (ui_Temp == 0) {
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			// if  (ui_Temp==0)
+	}			/*  if  (ui_Temp==0) */
 	else {
 	else {
 		if (ui_Temp == 1) {
 		if (ui_Temp == 1) {
 			switch (ui_NoOfChannel) {
 			switch (ui_NoOfChannel) {
@@ -307,13 +307,13 @@ int i_APCI2016_BitsDigitalOutput(struct comedi_device * dev, struct comedi_subde
 
 
 			default:
 			default:
 				comedi_error(dev, " chan spec wrong");
 				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 {
 		else {
 			printk("\nSpecified channel not supported \n");
 			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;
 	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) {
 	if (data[0] == 0) {
-		//Disable the watchdog
+		/* Disable the watchdog */
 		outw(0x0,
 		outw(0x0,
 			devpriv->i_IobaseAddon +
 			devpriv->i_IobaseAddon +
 			APCI2016_WATCHDOG_ENABLEDISABLE);
 			APCI2016_WATCHDOG_ENABLEDISABLE);
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outw(data[1],
 		outw(data[1],
 			devpriv->i_IobaseAddon +
 			devpriv->i_IobaseAddon +
 			APCI2016_WATCHDOG_RELOAD_VALUE);
 			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]) {
 	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;
 		break;
-	case 1:		//start the watchdog
+	case 1:		/* start the watchdog */
 		outw(0x0001,
 		outw(0x0001,
 			devpriv->i_IobaseAddon +
 			devpriv->i_IobaseAddon +
 			APCI2016_WATCHDOG_ENABLEDISABLE);
 			APCI2016_WATCHDOG_ENABLEDISABLE);
 		break;
 		break;
-	case 2:		//Software trigger
+	case 2:		/* Software trigger */
 		outw(0x0201,
 		outw(0x0201,
 			devpriv->i_IobaseAddon +
 			devpriv->i_IobaseAddon +
 			APCI2016_WATCHDOG_ENABLEDISABLE);
 			APCI2016_WATCHDOG_ENABLEDISABLE);
@@ -401,7 +401,7 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 	default:
 	default:
 		printk("\nSpecified functionality does not exist\n");
 		printk("\nSpecified functionality does not exist\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			// switch(data[0])
+	}			/*  switch(data[0]) */
 
 
 	return insn->n;
 	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);
 	udelay(5);
 	data[0] = inw(devpriv->i_IobaseAddon + APCI2016_WATCHDOG_STATUS) & 0x1;
 	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_ENABLEDISABLE);
 	outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE);
 	outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE);
 	outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE + 2);
 	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_BOARD_VENDOR_ID 0x15B8
 #define APCI2016_ADDRESS_RANGE   8
 #define APCI2016_ADDRESS_RANGE   8
 
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 
 #define APCI2016_DIGITAL_OP                 	0x04
 #define APCI2016_DIGITAL_OP                 	0x04
 #define APCI2016_DIGITAL_OP_RW                 	4
 #define APCI2016_DIGITAL_OP_RW                 	4
 
 
-//ADDIDATA Enable Disable
+/* ADDIDATA Enable Disable */
 
 
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_DISABLE                           0
 #define ADDIDATA_DISABLE                           0
 
 
-// TIMER COUNTER WATCHDOG DEFINES
+/* TIMER COUNTER WATCHDOG DEFINES */
 
 
 #define ADDIDATA_WATCHDOG                          2
 #define ADDIDATA_WATCHDOG                          2
 #define APCI2016_DIGITAL_OP_WATCHDOG               0
 #define APCI2016_DIGITAL_OP_WATCHDOG               0
@@ -37,9 +37,9 @@
 #define APCI2016_WATCHDOG_RELOAD_VALUE             4
 #define APCI2016_WATCHDOG_RELOAD_VALUE             4
 #define APCI2016_WATCHDOG_STATUS                   16
 #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,
 int i_APCI2016_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 				   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,
 int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				 struct comedi_insn *insn, unsigned int *data);
 				 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,
 int i_APCI2016_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			      struct comedi_insn *insn, unsigned int *data);
 			      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,
 int i_APCI2016_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			    struct comedi_insn *insn, unsigned int *data);
 			    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.
 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.
 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"
 #include "hwdrv_apci2032.h"
-UINT ui_InterruptData, ui_Type;
+unsigned int ui_InterruptData, ui_Type;
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2032_ConfigDigitalOutput                     |
 | Function   Name   : int i_APCI2032_ConfigDigitalOutput                     |
@@ -63,7 +63,7 @@ UINT ui_InterruptData, ui_Type;
 | Task              : Configures The Digital Output Subdevice.               |
 | Task              : Configures The Digital Output Subdevice.               |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                                                                            |
 |                                                                            |
 |					  data[1]            : 1 Enable  VCC  Interrupt  |
 |					  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;
 	devpriv->tsk_Current = current;
 
 
 	if ((data[0] != 0) && (data[0] != 1)) {
 	if ((data[0] != 0) && (data[0] != 1)) {
 		comedi_error(dev,
 		comedi_error(dev,
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			//if  ( (data[0]!=0) && (data[0]!=1) )
+	}			/* if  ( (data[0]!=0) && (data[0]!=1) ) */
 	if (data[0]) {
 	if (data[0]) {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
-	}			// if  (data[0])
+	}			/*  if  (data[0]) */
 	else {
 	else {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
-	}			//else if  (data[0])
+	}			/* else if  (data[0]) */
 
 
 	if (data[1] == ADDIDATA_ENABLE) {
 	if (data[1] == ADDIDATA_ENABLE) {
 		ul_Command = ul_Command | 0x1;
 		ul_Command = ul_Command | 0x1;
-	}			//if  (data[1] == ADDIDATA_ENABLE)
+	}			/* if  (data[1] == ADDIDATA_ENABLE) */
 	else {
 	else {
 		ul_Command = ul_Command & 0xFFFFFFFE;
 		ul_Command = ul_Command & 0xFFFFFFFE;
-	}			//elseif  (data[1] == ADDIDATA_ENABLE)
+	}			/* elseif  (data[1] == ADDIDATA_ENABLE) */
 	if (data[2] == ADDIDATA_ENABLE) {
 	if (data[2] == ADDIDATA_ENABLE) {
 		ul_Command = ul_Command | 0x2;
 		ul_Command = ul_Command | 0x2;
-	}			//if  (data[2] == ADDIDATA_ENABLE)
+	}			/* if  (data[2] == ADDIDATA_ENABLE) */
 	else {
 	else {
 		ul_Command = ul_Command & 0xFFFFFFFD;
 		ul_Command = ul_Command & 0xFFFFFFFD;
-	}			//elseif  (data[2] == ADDIDATA_ENABLE)
+	}			/* elseif  (data[2] == ADDIDATA_ENABLE) */
 	outl(ul_Command, devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT);
 	outl(ul_Command, devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT);
 	ui_InterruptData = inl(devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT);
 	ui_InterruptData = inl(devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT);
 	return insn->n;
 	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                |
 | Task              : Writes port value  To the selected port                |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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 :	--													 |
 | 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) {
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp = inl(devpriv->iobase + APCI2032_DIGITAL_OP);
 		ui_Temp = inl(devpriv->iobase + APCI2032_DIGITAL_OP);
 
 
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	else {
 	else {
 		ui_Temp = 0;
 		ui_Temp = 0;
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outl(data[0], devpriv->iobase + APCI2032_DIGITAL_OP);
 			outl(data[0], devpriv->iobase + APCI2032_DIGITAL_OP);
-		}		//if(data[1]==0)
+		}		/* if(data[1]==0) */
 		else {
 		else {
 			if (data[1] == 1) {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
 				switch (ui_NoOfChannel) {
@@ -184,18 +184,18 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 
 
 				default:
 				default:
 					comedi_error(dev, " chan spec wrong");
 					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],
 				outl(data[0],
 					devpriv->iobase + APCI2032_DIGITAL_OP);
 					devpriv->iobase + APCI2032_DIGITAL_OP);
-			}	// if(data[1]==1)
+			}	/*  if(data[1]==1) */
 			else {
 			else {
 				printk("\nSpecified channel not supported\n");
 				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 {
 	else {
 		if (data[3] == 1) {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
 			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;
 				data[0] = data[0] & ui_Temp;
 				outl(data[0],
 				outl(data[0],
 					devpriv->iobase + APCI2032_DIGITAL_OP);
 					devpriv->iobase + APCI2032_DIGITAL_OP);
-			}	//if(data[1]==0)
+			}	/* if(data[1]==0) */
 			else {
 			else {
 				if (data[1] == 1) {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
 					switch (ui_NoOfChannel) {
@@ -272,25 +272,25 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 					default:
 						comedi_error(dev,
 						comedi_error(dev,
 							" chan spec wrong");
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
+						return -EINVAL;	/*  "sorry channel spec wrong " */
 
 
-					}	//switch(ui_NoOfChannels)
+					}	/* switch(ui_NoOfChannels) */
 
 
 					outl(data[0],
 					outl(data[0],
 						devpriv->iobase +
 						devpriv->iobase +
 						APCI2032_DIGITAL_OP);
 						APCI2032_DIGITAL_OP);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 				else {
 					printk("\nSpecified channel not supported\n");
 					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 {
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
 			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           |
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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 :	--													 |
 | 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_NoOfChannel = CR_CHAN(insn->chanspec);
 	ui_Temp = data[0];
 	ui_Temp = data[0];
 	*data = inl(devpriv->iobase + APCI2032_DIGITAL_OP_RW);
 	*data = inl(devpriv->iobase + APCI2032_DIGITAL_OP_RW);
 	if (ui_Temp == 0) {
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			//if  (ui_Temp==0)
+	}			/* if  (ui_Temp==0) */
 	else {
 	else {
 		if (ui_Temp == 1) {
 		if (ui_Temp == 1) {
 			switch (ui_NoOfChannel) {
 			switch (ui_NoOfChannel) {
@@ -349,28 +349,28 @@ INT i_APCI2032_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 
 
 			default:
 			default:
 				comedi_error(dev, " chan spec wrong");
 				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 {
 		else {
 			printk("\nSpecified channel not supported \n");
 			printk("\nSpecified channel not supported \n");
-		}		//elseif  (ui_Temp==1)
+		}		/* elseif  (ui_Temp==1) */
 	}
 	}
 	return insn->n;
 	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                                |
 | Task              : Configures The Watchdog                                |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
 |                     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                                                                                                             |
 |                     unsigned int *data          : Data Pointer to read status                                                                                                             |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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) {
 	if (data[0] == 0) {
-		//Disable the watchdog
+		/* Disable the watchdog */
 		outl(0x0,
 		outl(0x0,
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			APCI2032_TCW_PROG);
 			APCI2032_TCW_PROG);
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outl(data[1],
 		outl(data[1],
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			APCI2032_TCW_RELOAD_VALUE);
 			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]) {
 	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;
 		break;
-	case 1:		//start the watchdog
+	case 1:		/* start the watchdog */
 		outl(0x0001,
 		outl(0x0001,
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			APCI2032_TCW_PROG);
 			APCI2032_TCW_PROG);
 		break;
 		break;
-	case 2:		//Software trigger
+	case 2:		/* Software trigger */
 		outl(0x0201,
 		outl(0x0201,
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG +
 			APCI2032_TCW_PROG);
 			APCI2032_TCW_PROG);
@@ -449,13 +449,13 @@ int i_APCI2032_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2032_ReadWatchdog                            |
 | Function   Name   : int i_APCI2032_ReadWatchdog                            |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                    unsigned int *data); 	                                     |
+|                    unsigned int *data); 	                                     |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              : Read The Watchdog                                      |
 | Task              : Read The Watchdog                                      |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
 |                     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  |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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] =
 	data[0] =
@@ -498,13 +498,13 @@ void v_APCI2032_Interrupt(int irq, void *d)
 	struct comedi_device *dev = d;
 	struct comedi_device *dev = d;
 	unsigned int ui_DO;
 	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) {
 	if (ui_DO == 0) {
 		printk("\nInterrupt from unKnown source\n");
 		printk("\nInterrupt from unKnown source\n");
-	}			// if(ui_DO==0)
+	}			/*  if(ui_DO==0) */
 	if (ui_DO) {
 	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 =
 		ui_Type =
 			inl(devpriv->iobase +
 			inl(devpriv->iobase +
 			APCI2032_DIGITAL_OP_INTERRUPT_STATUS) & 0x3;
 			APCI2032_DIGITAL_OP_INTERRUPT_STATUS) & 0x3;
@@ -512,16 +512,16 @@ void v_APCI2032_Interrupt(int irq, void *d)
 			devpriv->iobase + APCI2032_DIGITAL_OP +
 			devpriv->iobase + APCI2032_DIGITAL_OP +
 			APCI2032_DIGITAL_OP_INTERRUPT);
 			APCI2032_DIGITAL_OP_INTERRUPT);
 		if (ui_Type == 1) {
 		if (ui_Type == 1) {
-			//Sends signal to user space
+			/* Sends signal to user space */
 			send_sig(SIGIO, devpriv->tsk_Current, 0);
 			send_sig(SIGIO, devpriv->tsk_Current, 0);
-		}		// if (ui_Type==1)
+		}		/*  if (ui_Type==1) */
 		else {
 		else {
 			if (ui_Type == 2) {
 			if (ui_Type == 2) {
-				// Sends signal to user space
+				/*  Sends signal to user space */
 				send_sig(SIGIO, devpriv->tsk_Current, 0);
 				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;
 	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;
 	*data = ui_Type;
 	return insn->n;
 	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;
 	devpriv->b_DigitalOutputRegister = 0;
 	ui_Type = 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;
 	return 0;
 }
 }

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

@@ -17,32 +17,32 @@
 
 
 /*********      Definitions for APCI-2032 card  *****/
 /*********      Definitions for APCI-2032 card  *****/
 
 
-// Card Specific information
+/* Card Specific information */
 #define APCI2032_BOARD_VENDOR_ID                 0x15B8
 #define APCI2032_BOARD_VENDOR_ID                 0x15B8
 #define APCI2032_ADDRESS_RANGE                   63
 #define APCI2032_ADDRESS_RANGE                   63
 
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 
 #define APCI2032_DIGITAL_OP                 	0
 #define APCI2032_DIGITAL_OP                 	0
 #define APCI2032_DIGITAL_OP_RW                 	0
 #define APCI2032_DIGITAL_OP_RW                 	0
 #define APCI2032_DIGITAL_OP_INTERRUPT           4
 #define APCI2032_DIGITAL_OP_INTERRUPT           4
 #define APCI2032_DIGITAL_OP_IRQ                 12
 #define APCI2032_DIGITAL_OP_IRQ                 12
 
 
-//Digital Output Interrupt Status
+/* Digital Output Interrupt Status */
 #define APCI2032_DIGITAL_OP_INTERRUPT_STATUS    8
 #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_ENABLE   0x1
 #define APCI2032_DIGITAL_OP_VCC_INTERRUPT_DISABLE  0xFFFFFFFE
 #define APCI2032_DIGITAL_OP_VCC_INTERRUPT_DISABLE  0xFFFFFFFE
 #define APCI2032_DIGITAL_OP_CC_INTERRUPT_ENABLE    0x2
 #define APCI2032_DIGITAL_OP_CC_INTERRUPT_ENABLE    0x2
 #define APCI2032_DIGITAL_OP_CC_INTERRUPT_DISABLE   0xFFFFFFFD
 #define APCI2032_DIGITAL_OP_CC_INTERRUPT_DISABLE   0xFFFFFFFD
 
 
-//ADDIDATA Enable Disable
+/* ADDIDATA Enable Disable */
 
 
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_ENABLE                            1
 #define ADDIDATA_DISABLE                           0
 #define ADDIDATA_DISABLE                           0
 
 
-// TIMER COUNTER WATCHDOG DEFINES
+/* TIMER COUNTER WATCHDOG DEFINES */
 
 
 #define ADDIDATA_WATCHDOG                          2
 #define ADDIDATA_WATCHDOG                          2
 #define APCI2032_DIGITAL_OP_WATCHDOG               16
 #define APCI2032_DIGITAL_OP_WATCHDOG               16
@@ -52,30 +52,32 @@
 #define APCI2032_TCW_TRIG_STATUS                   16
 #define APCI2032_TCW_TRIG_STATUS                   16
 #define APCI2032_TCW_IRQ                           20
 #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,
 int i_APCI2032_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 				   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);
 				  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);
 				 struct comedi_insn *insn, unsigned int *data);
 int i_APCI2032_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s,
 int i_APCI2032_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 				   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);
 			      struct comedi_insn *insn, unsigned int *data);
 int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 				      struct comedi_insn *insn, unsigned int *data);
 				      struct comedi_insn *insn, unsigned int *data);
 int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			    struct comedi_insn *insn, unsigned int *data);
 			    struct comedi_insn *insn, unsigned int *data);
 
 
-// Interrupt functions.....
+/* Interrupt functions..... */
 
 
 void v_APCI2032_Interrupt(int irq, void *d);
 void v_APCI2032_Interrupt(int irq, void *d);
 
 
-//Reset functions
+/* Reset functions */
 int i_APCI2032_Reset(struct comedi_device *dev);
 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.
 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.
 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                |
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |		       struct comedi_subdevice *s,   :pointer to subdevice structure
 |		       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  |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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);
 	ui_Channel = CR_CHAN(insn->chanspec);
 	if (ui_Channel >= 0 && ui_Channel <= 7) {
 	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;
 		*data = (ui_TmpValue >> ui_Channel) & 0x1;
-	}			//if(ui_Channel >= 0 && ui_Channel <=7)
+	}			/* if(ui_Channel >= 0 && ui_Channel <=7) */
 	else {
 	else {
 		printk("\nThe specified channel does not exist\n");
 		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;
 	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                |
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                      struct comedi_subdevice *s,   :pointer to subdevice structure
 |                      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  |
 |                      unsigned int *data         : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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);
 	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) {
 	switch (ui_NoOfChannels) {
 	case 2:
 	case 2:
 		ui_Mask = 3;
 		ui_Mask = 3;
@@ -137,9 +137,9 @@ INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su
 
 
 	default:
 	default:
 		printk("\nWrong parameters\n");
 		printk("\nWrong parameters\n");
-		return -EINVAL;	// "sorry channel spec wrong "
+		return -EINVAL;	/*  "sorry channel spec wrong " */
 		break;
 		break;
-	}			//switch(ui_NoOfChannels)
+	}			/* switch(ui_NoOfChannels) */
 
 
 	return insn->n;
 	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,
 | 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.               |
 | 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         |
 |                     unsigned int *data         : Data Pointer contains         |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                      struct comedi_subdevice *s,   :pointer to subdevice structure
 |                      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                          |
 |					  data[0]  :1:Memory on                          |
 |					            0:Memory off                         |
 |					            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];
 	devpriv->b_OutputMemoryStatus = data[0];
 	return insn->n;
 	return insn->n;
@@ -180,13 +180,13 @@ int i_APCI2200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2200_WriteDigitalOutput                      |
 | Function   Name   : int i_APCI2200_WriteDigitalOutput                      |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
 |			(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                |
 | Task              : Writes port value  To the selected port                |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
 |                     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  |
 |                    unsigned int *data           : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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) {
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp = inw(devpriv->iobase + APCI2200_DIGITAL_OP);
 		ui_Temp = inw(devpriv->iobase + APCI2200_DIGITAL_OP);
 
 
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	else {
 	else {
 		ui_Temp = 0;
 		ui_Temp = 0;
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outw(data[0], devpriv->iobase + APCI2200_DIGITAL_OP);
 			outw(data[0], devpriv->iobase + APCI2200_DIGITAL_OP);
-		}		//if(data[1]==0)
+		}		/* if(data[1]==0) */
 		else {
 		else {
 			if (data[1] == 1) {
 			if (data[1] == 1) {
 				switch (ui_NoOfChannel) {
 				switch (ui_NoOfChannel) {
@@ -240,18 +240,18 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					break;
 					break;
 				default:
 				default:
 					comedi_error(dev, " chan spec wrong");
 					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],
 				outw(data[0],
 					devpriv->iobase + APCI2200_DIGITAL_OP);
 					devpriv->iobase + APCI2200_DIGITAL_OP);
-			}	// if(data[1]==1)
+			}	/*  if(data[1]==1) */
 			else {
 			else {
 				printk("\nSpecified channel not supported\n");
 				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 {
 	else {
 		if (data[3] == 1) {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
 			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;
 				data[0] = data[0] & ui_Temp;
 				outw(data[0],
 				outw(data[0],
 					devpriv->iobase + APCI2200_DIGITAL_OP);
 					devpriv->iobase + APCI2200_DIGITAL_OP);
-			}	//if(data[1]==0)
+			}	/* if(data[1]==0) */
 			else {
 			else {
 				if (data[1] == 1) {
 				if (data[1] == 1) {
 					switch (ui_NoOfChannel) {
 					switch (ui_NoOfChannel) {
@@ -312,38 +312,38 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					default:
 					default:
 						comedi_error(dev,
 						comedi_error(dev,
 							" chan spec wrong");
 							" chan spec wrong");
-						return -EINVAL;	// "sorry channel spec wrong "
+						return -EINVAL;	/*  "sorry channel spec wrong " */
 
 
-					}	//switch(ui_NoOfChannels)
+					}	/* switch(ui_NoOfChannels) */
 
 
 					outw(data[0],
 					outw(data[0],
 						devpriv->iobase +
 						devpriv->iobase +
 						APCI2200_DIGITAL_OP);
 						APCI2200_DIGITAL_OP);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 				else {
 					printk("\nSpecified channel not supported\n");
 					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 {
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
 			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                       |
 | Function   Name   : int i_APCI2200_ReadDigitalOutput                       |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
 |			(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           |
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
 |                     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  |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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];
 	ui_Temp = data[0];
 	*data = inw(devpriv->iobase + APCI2200_DIGITAL_OP);
 	*data = inw(devpriv->iobase + APCI2200_DIGITAL_OP);
 	if (ui_Temp == 0) {
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			//if(ui_Temp==0)
+	}			/* if(ui_Temp==0) */
 	else {
 	else {
 		if (ui_Temp == 1) {
 		if (ui_Temp == 1) {
 			switch (ui_NoOfChannel) {
 			switch (ui_NoOfChannel) {
@@ -386,28 +386,28 @@ INT i_APCI2200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde
 
 
 			default:
 			default:
 				comedi_error(dev, " chan spec wrong");
 				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 {
 		else {
 			printk("\nSpecified channel not supported \n");
 			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;
 	return insn->n;
 }
 }
 
 
 /*
 /*
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2200_ConfigWatchdog(struct comedi_device *dev,
 | 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                                |
 | Task              : Configures The Watchdog                                |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
 |                     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                                                                                                             |
 |                     unsigned int *data          : Data Pointer to read status                                                                                                             |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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) {
 	if (data[0] == 0) {
-		//Disable the watchdog
+		/* Disable the watchdog */
 		outw(0x0,
 		outw(0x0,
 			devpriv->iobase + APCI2200_WATCHDOG +
 			devpriv->iobase + APCI2200_WATCHDOG +
 			APCI2200_WATCHDOG_ENABLEDISABLE);
 			APCI2200_WATCHDOG_ENABLEDISABLE);
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outw(data[1],
 		outw(data[1],
 			devpriv->iobase + APCI2200_WATCHDOG +
 			devpriv->iobase + APCI2200_WATCHDOG +
 			APCI2200_WATCHDOG_RELOAD_VALUE);
 			APCI2200_WATCHDOG_RELOAD_VALUE);
@@ -434,11 +434,11 @@ int i_APCI2200_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic
 		outw(data[1],
 		outw(data[1],
 			devpriv->iobase + APCI2200_WATCHDOG +
 			devpriv->iobase + APCI2200_WATCHDOG +
 			APCI2200_WATCHDOG_RELOAD_VALUE + 2);
 			APCI2200_WATCHDOG_RELOAD_VALUE + 2);
-	}			//if(data[0]==0)
+	}			/* if(data[0]==0) */
 	else {
 	else {
 		printk("\nThe input parameters are wrong\n");
 		printk("\nThe input parameters are wrong\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			//elseif(data[0]==0)
+	}			/* elseif(data[0]==0) */
 
 
 	return insn->n;
 	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]) {
 	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;
 		break;
-	case 1:		//start the watchdog
+	case 1:		/* start the watchdog */
 		outw(0x0001,
 		outw(0x0001,
 			devpriv->iobase + APCI2200_WATCHDOG +
 			devpriv->iobase + APCI2200_WATCHDOG +
 			APCI2200_WATCHDOG_ENABLEDISABLE);
 			APCI2200_WATCHDOG_ENABLEDISABLE);
 		break;
 		break;
-	case 2:		//Software trigger
+	case 2:		/* Software trigger */
 		outw(0x0201,
 		outw(0x0201,
 			devpriv->iobase + APCI2200_WATCHDOG +
 			devpriv->iobase + APCI2200_WATCHDOG +
 			APCI2200_WATCHDOG_ENABLEDISABLE);
 			APCI2200_WATCHDOG_ENABLEDISABLE);
@@ -484,7 +484,7 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 	default:
 	default:
 		printk("\nSpecified functionality does not exist\n");
 		printk("\nSpecified functionality does not exist\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			// switch(data[0])
+	}			/*  switch(data[0]) */
 	return insn->n;
 	return insn->n;
 }
 }
 
 
@@ -492,13 +492,13 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Function   Name   : int i_APCI2200_ReadWatchdog                            |
 | Function   Name   : int i_APCI2200_ReadWatchdog                            |
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
 |			(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,
-                    unsigned int *data); 	                                     |
+|                    unsigned int *data); 	                                     |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task              : Read The Watchdog                                      |
 | Task              : Read The Watchdog                                      |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 | Input Parameters  :   struct comedi_device *dev      : Driver handle              |
 |                     struct comedi_subdevice *s,   :pointer to subdevice structure
 |                     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  |
 |                     unsigned int *data          : Data Pointer to read status  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Output Parameters :	--													 |
 | 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] =
 	data[0] =
 		inw(devpriv->iobase + APCI2200_WATCHDOG +
 		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,
 	outw(0x0,
 		devpriv->iobase + APCI2200_WATCHDOG +
 		devpriv->iobase + APCI2200_WATCHDOG +
 		APCI2200_WATCHDOG_ENABLEDISABLE);
 		APCI2200_WATCHDOG_ENABLEDISABLE);

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

@@ -17,39 +17,39 @@
 
 
 /*********      Definitions for APCI-2200 card  *****/
 /*********      Definitions for APCI-2200 card  *****/
 
 
-// Card Specific information
+/* Card Specific information */
 #define APCI2200_BOARD_VENDOR_ID                 0x15b8
 #define APCI2200_BOARD_VENDOR_ID                 0x15b8
 #define APCI2200_ADDRESS_RANGE                   64
 #define APCI2200_ADDRESS_RANGE                   64
 
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 
 #define APCI2200_DIGITAL_OP                 	4
 #define APCI2200_DIGITAL_OP                 	4
 #define APCI2200_DIGITAL_IP                     0
 #define APCI2200_DIGITAL_IP                     0
 
 
-// TIMER COUNTER WATCHDOG DEFINES
+/* TIMER COUNTER WATCHDOG DEFINES */
 
 
 #define APCI2200_WATCHDOG                          0x08
 #define APCI2200_WATCHDOG                          0x08
 #define APCI2200_WATCHDOG_ENABLEDISABLE            12
 #define APCI2200_WATCHDOG_ENABLEDISABLE            12
 #define APCI2200_WATCHDOG_RELOAD_VALUE             4
 #define APCI2200_WATCHDOG_RELOAD_VALUE             4
 #define APCI2200_WATCHDOG_STATUS                   16
 #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);
 				    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);
 				 struct comedi_insn *insn, unsigned int *data);
 
 
-//Digital Output
+/* Digital Output */
 int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 				   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);
 				  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);
 				 struct comedi_insn *insn, unsigned int *data);
 
 
-// TIMER
+/* TIMER */
 int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			      struct comedi_insn *insn, unsigned int *data);
 			      struct comedi_insn *insn, unsigned int *data);
 int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 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,
 int i_APCI2200_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s,
 			    struct comedi_insn *insn, unsigned int *data);
 			    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);

Datei-Diff unterdrückt, da er zu groß ist
+ 258 - 227
drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c


+ 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.
  * Copyright (C) 2004,2005  ADDI-DATA GmbH for the source code of this module.
@@ -18,9 +18,9 @@
  * any later version.
  * any later version.
  */
  */
 
 
-// comedi related defines
+/* comedi related defines */
 
 
-//ANALOG INPUT RANGE
+/* ANALOG INPUT RANGE */
 static const struct comedi_lrange range_apci3120_ai = { 8, {
 static const struct comedi_lrange range_apci3120_ai = { 8, {
 						     BIP_RANGE(10),
 						     BIP_RANGE(10),
 						     BIP_RANGE(5),
 						     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, {
 static const struct comedi_lrange range_apci3120_ao = { 2, {
 						     BIP_RANGE(10),
 						     BIP_RANGE(10),
 						     UNI_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_BOARD_VENDOR_ID                 0x10E8
 #define APCI3120_ADDRESS_RANGE            			16
 #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_EOS_MODE         2
 #define     APCI3120_DMA_MODE         3
 #define     APCI3120_DMA_MODE         3
 
 
-//DIGITAL INPUT-OUTPUT DEFINE
+/* DIGITAL INPUT-OUTPUT DEFINE */
 
 
 #define APCI3120_DIGITAL_OUTPUT                  	0x0D
 #define APCI3120_DIGITAL_OUTPUT                  	0x0D
 #define APCI3120_RD_STATUS                       	0x02
 #define APCI3120_RD_STATUS                       	0x02
 #define APCI3120_RD_FIFO                     		0x00
 #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_SET4DIGITALOUTPUTON				1
 #define APCI3120_SET4DIGITALOUTPUTOFF				0
 #define APCI3120_SET4DIGITALOUTPUTOFF				0
 
 
-// analog output SELECT BIT
+/* analog output SELECT BIT */
 #define APCI3120_ANALOG_OP_CHANNEL_1   0x0000
 #define APCI3120_ANALOG_OP_CHANNEL_1   0x0000
 #define APCI3120_ANALOG_OP_CHANNEL_2   0x4000
 #define APCI3120_ANALOG_OP_CHANNEL_2   0x4000
 #define APCI3120_ANALOG_OP_CHANNEL_3   0x8000
 #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_7   0x8000
 #define APCI3120_ANALOG_OP_CHANNEL_8   0xC000
 #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
 #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_TIMER_0_MODE_4       0x2
 #define APCI3120_SELECT_TIMER_0_WORD 0x00
 #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_PR          0xF0FF
 #define APCI3120_CLEAR_PA          0xFFF0
 #define APCI3120_CLEAR_PA          0xFFF0
 #define APCI3120_CLEAR_PA_PR       (APCI3120_CLEAR_PR & APCI3120_CLEAR_PA)
 #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_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_DISABLE_EOS_INT   (~APCI3120_ENABLE_EOS_INT)
 #define APCI3120_ENABLE_EOC_INT       0x1
 #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_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)
 #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_EOC                     0x8000
 #define APCI3120_EOS                     0x2000
 #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_A				  70
 #define APCI3120_QUARTZ_B				  50
 #define APCI3120_QUARTZ_B				  50
 #define APCI3120_TIMER                            1
 #define APCI3120_TIMER                            1
 #define APCI3120_WATCHDOG                         2
 #define APCI3120_WATCHDOG                         2
 #define APCI3120_TIMER_DISABLE                    0
 #define APCI3120_TIMER_DISABLE                    0
 #define APCI3120_TIMER_ENABLE                     1
 #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_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_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_0_WORD  0x00
 #define APCI3120_SELECT_TIMER_1_WORD  0x01
 #define APCI3120_SELECT_TIMER_1_WORD  0x01
 #define APCI3120_TIMER_1_MODE_2       0x4
 #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_0                   0x0
 #define APCI3120_TIMER_2_MODE_2                   0x10
 #define APCI3120_TIMER_2_MODE_2                   0x10
 #define APCI3120_TIMER_2_MODE_5                   0x30
 #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_LOW_WORD          0x02
 #define APCI3120_SELECT_TIMER_2_HIGH_WORD         0x03
 #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_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_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_TIMER0                    0x1000
 #define APCI3120_ENABLE_TIMER1                    0x2000
 #define APCI3120_ENABLE_TIMER1                    0x2000
 #define APCI3120_ENABLE_TIMER2                    0x4000
 #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_TIMER1		              (~APCI3120_ENABLE_TIMER1)
 #define APCI3120_DISABLE_TIMER2	                  (~APCI3120_ENABLE_TIMER2)
 #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
 #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 i_APCI3120_SetupChannelList(struct comedi_device *dev, struct comedi_subdevice *s,
 				int n_chan, unsigned int *chanlist, char check);
 				int n_chan, unsigned int *chanlist, char check);
 int i_APCI3120_ExttrigEnable(struct comedi_device *dev);
 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_Reset(struct comedi_device *dev);
 int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev,
 int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev,
 				 struct comedi_subdevice *s);
 				 struct comedi_subdevice *s);
-// Interrupt functions
+/* Interrupt functions */
 void v_APCI3120_Interrupt(int irq, void *d);
 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,
 void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,
 					   struct comedi_subdevice *s,
 					   struct comedi_subdevice *s,
 					   short *dma_buffer,
 					   short *dma_buffer,
@@ -196,7 +198,7 @@ void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,
 int i_APCI3120_InterruptHandleEos(struct comedi_device *dev);
 int i_APCI3120_InterruptHandleEos(struct comedi_device *dev);
 void v_APCI3120_InterruptDma(int irq, void *d);
 void v_APCI3120_InterruptDma(int irq, void *d);
 
 
-// TIMER
+/* TIMER */
 
 
 int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevice *s,
 int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevice *s,
 			       struct comedi_insn *insn, unsigned int *data);
 			       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,
 int i_APCI3120_InsnReadTimer(struct comedi_device *dev, struct comedi_subdevice *s,
 			     struct comedi_insn *insn, unsigned int *data);
 			     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,
 int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				    struct comedi_insn *insn, unsigned int *data);
 				    struct comedi_insn *insn, unsigned int *data);
 int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				    struct comedi_insn *insn, unsigned int *data);
 				    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,
 int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device *dev,
 				       struct comedi_subdevice *s, struct comedi_insn *insn,
 				       struct comedi_subdevice *s, struct comedi_insn *insn,
 				       unsigned int *data);
 				       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,
 int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				      struct comedi_insn *insn, unsigned int *data);
 				      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,
 int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				     struct comedi_insn *insn, unsigned int *data);
 				     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,
 int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				     struct comedi_insn *insn, unsigned int *data);
 				     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,
 int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s,
 				      struct comedi_cmd *cmd);
 				      struct comedi_cmd *cmd);
 int i_APCI3120_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s);
 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);
 int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s);

Datei-Diff unterdrückt, da er zu groß ist
+ 370 - 377
drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c


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

@@ -15,26 +15,26 @@
  * any later version.
  * any later version.
  */
  */
 
 
-// Card Specific information
+/* Card Specific information */
 #define APCI3200_BOARD_VENDOR_ID                 0x15B8
 #define APCI3200_BOARD_VENDOR_ID                 0x15B8
-//#define APCI3200_ADDRESS_RANGE                   264
+/* #define APCI3200_ADDRESS_RANGE                   264 */
 
 
 int MODULE_NO;
 int MODULE_NO;
 struct {
 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_Module1, Config_Parameters_Module2,
     Config_Parameters_Module3, Config_Parameters_Module4;
     Config_Parameters_Module3, Config_Parameters_Module4;
 
 
-//ANALOG INPUT RANGE
+/* ANALOG INPUT RANGE */
 static const struct comedi_lrange range_apci3200_ai = { 8, {
 static const struct comedi_lrange range_apci3200_ai = { 8, {
 						     BIP_RANGE(10),
 						     BIP_RANGE(10),
 						     BIP_RANGE(5),
 						     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_OFFSET_GAIN                  0
 #define APCI3200_AI_SC_TEST                      4
 #define APCI3200_AI_SC_TEST                      4
 #define APCI3200_AI_IRQ                          8
 #define APCI3200_AI_IRQ                          8
@@ -89,98 +89,102 @@ static const struct comedi_lrange range_apci3300_ai = { 4, {
 #define ADDIDATA_UNIPOLAR                        1
 #define ADDIDATA_UNIPOLAR                        1
 #define ADDIDATA_BIPOLAR                         2
 #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
 #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_CurrentSourceCJC;
 	unsigned long ul_CurrentSource[5];
 	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];
 	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);
 				 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);
 			       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_subdevice *s,
 					   struct comedi_insn *insn, unsigned int *data);
 					   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_subdevice *s,
 					 struct comedi_insn *insn, unsigned int *data);
 					 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);
 				      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);
 				struct comedi_insn *insn, unsigned int *data);
-//Interrupt
+/* Interrupt */
 void v_APCI3200_Interrupt(int irq, void *d);
 void v_APCI3200_Interrupt(int irq, void *d);
 int i_APCI3200_InterruptHandleEos(struct comedi_device *dev);
 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_ReadCJCCalOffset(struct comedi_device *dev, unsigned int *data);
 int i_APCI3200_ReadCJCValue(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,
 int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev,
 				       struct comedi_subdevice *s, struct comedi_insn *insn,
 				       struct comedi_subdevice *s, struct comedi_insn *insn,
 				       unsigned int *data);
 				       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.
 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.
 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           |
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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 :	--													 |
 | 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_NoOfChannel = CR_CHAN(insn->chanspec);
 	ui_Temp = data[0];
 	ui_Temp = data[0];
 	*data = inl(devpriv->iobase + APCI3501_DIGITAL_IP);
 	*data = inl(devpriv->iobase + APCI3501_DIGITAL_IP);
 	if (ui_Temp == 0) {
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			//if  (ui_Temp==0)
+	}			/* if  (ui_Temp==0) */
 	else {
 	else {
 		if (ui_Temp == 1) {
 		if (ui_Temp == 1) {
 
 
 			*data = *data & 0x3;
 			*data = *data & 0x3;
-		}		//if  (ui_Temp==1)
+		}		/* if  (ui_Temp==1) */
 		else {
 		else {
 			printk("\nSpecified channel not supported \n");
 			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;
 	return insn->n;
 }
 }
 
 
@@ -105,7 +105,7 @@ INT i_APCI3501_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdev
 | Task              : Configures The Digital Output Subdevice.               |
 | Task              : Configures The Digital Output Subdevice.               |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                                                                            |
 |                                                                            |
 |					  data[1]            : 1 Enable  VCC  Interrupt  |
 |					  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)) {
 	if ((data[0] != 0) && (data[0] != 1)) {
 		comedi_error(dev,
 		comedi_error(dev,
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 			"Not a valid Data !!! ,Data should be 1 or 0\n");
 		return -EINVAL;
 		return -EINVAL;
-	}			//if  ( (data[0]!=0) && (data[0]!=1) )
+	}			/* if  ( (data[0]!=0) && (data[0]!=1) ) */
 	if (data[0]) {
 	if (data[0]) {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
 		devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE;
-	}			// if  (data[0])
+	}			/*  if  (data[0]) */
 	else {
 	else {
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
 		devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE;
-	}			//else if  (data[0])
+	}			/* else if  (data[0]) */
 	return insn->n;
 	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) {
 	if (devpriv->b_OutputMemoryStatus) {
 		ui_Temp = inl(devpriv->iobase + APCI3501_DIGITAL_OP);
 		ui_Temp = inl(devpriv->iobase + APCI3501_DIGITAL_OP);
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	else {
 	else {
 		ui_Temp = 0;
 		ui_Temp = 0;
-	}			//if(devpriv->b_OutputMemoryStatus )
+	}			/* if(devpriv->b_OutputMemoryStatus ) */
 	if (data[3] == 0) {
 	if (data[3] == 0) {
 		if (data[1] == 0) {
 		if (data[1] == 0) {
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
 			outl(data[0], devpriv->iobase + APCI3501_DIGITAL_OP);
 			outl(data[0], devpriv->iobase + APCI3501_DIGITAL_OP);
-		}		//if(data[1]==0)
+		}		/* if(data[1]==0) */
 		else {
 		else {
 			if (data[1] == 1) {
 			if (data[1] == 1) {
 				data[0] = (data[0] << (2 * data[2])) | ui_Temp;
 				data[0] = (data[0] << (2 * data[2])) | ui_Temp;
 				outl(data[0],
 				outl(data[0],
 					devpriv->iobase + APCI3501_DIGITAL_OP);
 					devpriv->iobase + APCI3501_DIGITAL_OP);
-			}	// if(data[1]==1)
+			}	/*  if(data[1]==1) */
 			else {
 			else {
 				printk("\nSpecified channel not supported\n");
 				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 {
 	else {
 		if (data[3] == 1) {
 		if (data[3] == 1) {
 			if (data[1] == 0) {
 			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;
 				data[0] = data[0] & ui_Temp;
 				outl(data[0],
 				outl(data[0],
 					devpriv->iobase + APCI3501_DIGITAL_OP);
 					devpriv->iobase + APCI3501_DIGITAL_OP);
-			}	//if(data[1]==0)
+			}	/* if(data[1]==0) */
 			else {
 			else {
 				if (data[1] == 1) {
 				if (data[1] == 1) {
 					data[0] = ~data[0] & 0x3;
 					data[0] = ~data[0] & 0x3;
@@ -215,17 +215,17 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd
 					outl(data[0],
 					outl(data[0],
 						devpriv->iobase +
 						devpriv->iobase +
 						APCI3501_DIGITAL_OP);
 						APCI3501_DIGITAL_OP);
-				}	// if(data[1]==1)
+				}	/*  if(data[1]==1) */
 				else {
 				else {
 					printk("\nSpecified channel not supported\n");
 					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 {
 		else {
 			printk("\nSpecified functionality does not exist\n");
 			printk("\nSpecified functionality does not exist\n");
 			return -EINVAL;
 			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;
 	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           |
 | Task              : Read  value  of the selected channel or port           |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev      : Driver handle                |
 | 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 :	--													 |
 | 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_NoOfChannel = CR_CHAN(insn->chanspec);
 	ui_Temp = data[0];
 	ui_Temp = data[0];
 	*data = inl(devpriv->iobase + APCI3501_DIGITAL_OP);
 	*data = inl(devpriv->iobase + APCI3501_DIGITAL_OP);
 	if (ui_Temp == 0) {
 	if (ui_Temp == 0) {
 		*data = (*data >> ui_NoOfChannel) & 0x1;
 		*data = (*data >> ui_NoOfChannel) & 0x1;
-	}			// if  (ui_Temp==0)
+	}			/*  if  (ui_Temp==0) */
 	else {
 	else {
 		if (ui_Temp == 1) {
 		if (ui_Temp == 1) {
 			*data = *data & 0x3;
 			*data = *data & 0x3;
 
 
-		}		// if  (ui_Temp==1)
+		}		/*  if  (ui_Temp==1) */
 		else {
 		else {
 			printk("\nSpecified channel not supported \n");
 			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;
 	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],
 	outl(data[0],
 		devpriv->iobase + APCI3501_ANALOG_OUTPUT +
 		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);
 	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");
 			printk("\nIn WriteAnalogOutput :: Not Valid Data\n");
 		}
 		}
 
 
-	}			// end if(devpriv->b_InterruptMode==MODE1)
+	}			/*  end if(devpriv->b_InterruptMode==MODE1) */
 	else {
 	else {
 		ul_Polarity = 0;
 		ul_Polarity = 0;
 		if ((*data < 0) || (*data > 8192)) {
 		if ((*data < 0) || (*data > 8192)) {
 			printk("\nIn WriteAnalogOutput :: Not Valid Data\n");
 			printk("\nIn WriteAnalogOutput :: Not Valid Data\n");
 		}
 		}
 
 
-	}			// end else
+	}			/*  end else */
 
 
 	if ((ul_Channel_no < 0) || (ul_Channel_no > 7)) {
 	if ((ul_Channel_no < 0) || (ul_Channel_no > 7)) {
 		printk("\nIn WriteAnalogOutput :: Not Valid Channel\n");
 		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);
 	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) {
 	if (ul_DAC_Ready) {
-// Output the Value on the output channels.
+/* Output the Value on the output channels. */
 		ul_Command1 =
 		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,
 		outl(ul_Command1,
 			devpriv->iobase + APCI3501_ANALOG_OUTPUT +
 			devpriv->iobase + APCI3501_ANALOG_OUTPUT +
 			APCI3501_AO_PROG);
 			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             |
 | Task              : Configures The Timer , Counter or Watchdog             |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                                                                            |
 |                                                                            |
 |					  data[0]            : 0 Configure As Timer      |
 |					  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;
 	devpriv->tsk_Current = current;
 	if (data[0] == ADDIDATA_WATCHDOG) {
 	if (data[0] == ADDIDATA_WATCHDOG) {
 
 
 		devpriv->b_TimerSelectMode = 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) {
 		if (data[1] == 1) {
-			//Enable TIMER int & DISABLE ALL THE OTHER int SOURCES
+			/* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */
 			outl(0x02,
 			outl(0x02,
 				devpriv->iobase + APCI3501_WATCHDOG +
 				devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 				APCI3501_TCW_PROG);
 		} else {
 		} 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],
 		outl(data[2],
 			devpriv->iobase + APCI3501_WATCHDOG +
 			devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_TIMEBASE);
 			APCI3501_TCW_TIMEBASE);
 
 
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outl(data[3],
 		outl(data[3],
 			devpriv->iobase + APCI3501_WATCHDOG +
 			devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_RELOAD_VALUE);
 			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,
 		outl(ul_Command1,
 			devpriv->iobase + APCI3501_WATCHDOG +
 			devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_PROG);
 			APCI3501_TCW_PROG);
-	}			//end if(data[0]==ADDIDATA_WATCHDOG)
+	}			/* end if(data[0]==ADDIDATA_WATCHDOG) */
 
 
 	else if (data[0] == ADDIDATA_TIMER) {
 	else if (data[0] == ADDIDATA_TIMER) {
-		//First Stop The Timer
+		/* First Stop The Timer */
 		ul_Command1 =
 		ul_Command1 =
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_PROG);
 			APCI3501_TCW_PROG);
 		ul_Command1 = ul_Command1 & 0xFFFFF9FEUL;
 		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;
 		devpriv->b_TimerSelectMode = ADDIDATA_TIMER;
 		if (data[1] == 1) {
 		if (data[1] == 1) {
-			//Enable TIMER int & DISABLE ALL THE OTHER int SOURCES
+			/* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */
 			outl(0x02,
 			outl(0x02,
 				devpriv->iobase + APCI3501_WATCHDOG +
 				devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 				APCI3501_TCW_PROG);
 		} else {
 		} 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],
 		outl(data[2],
 			devpriv->iobase + APCI3501_WATCHDOG +
 			devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_TIMEBASE);
 			APCI3501_TCW_TIMEBASE);
 
 
-		//Loading the Reload value
+		/* Loading the Reload value */
 		outl(data[3],
 		outl(data[3],
 			devpriv->iobase + APCI3501_WATCHDOG +
 			devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_RELOAD_VALUE);
 			APCI3501_TCW_RELOAD_VALUE);
 
 
-		// printk ("\nTimer Address :: %x\n", (devpriv->iobase+APCI3501_WATCHDOG));
+		/*  printk ("\nTimer Address :: %x\n", (devpriv->iobase+APCI3501_WATCHDOG)); */
 		ul_Command1 =
 		ul_Command1 =
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_PROG);
 			APCI3501_TCW_PROG);
 		ul_Command1 =
 		ul_Command1 =
 			(ul_Command1 & 0xFFF719E2UL) | 2UL << 13UL | 0x10UL;
 			(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;
 	return insn->n;
 }
 }
@@ -495,7 +495,7 @@ INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device * dev,
 | Task              : Start / Stop The Selected Timer , Counter or Watchdog  |
 | Task              : Start / Stop The Selected Timer , Counter or Watchdog  |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                                                                            |
 |                                                                            |
 |					  data[0]            : 0 Timer                   |
 |					  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;
 	int i_Temp;
 	if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
 	if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
 
 
@@ -523,15 +523,15 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 				APCI3501_TCW_PROG);
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
-			//Enable the Watchdog
+			/* Enable the Watchdog */
 			outl(ul_Command1,
 			outl(ul_Command1,
 				devpriv->iobase + APCI3501_WATCHDOG +
 				devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 				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 =
 			ul_Command1 =
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 				APCI3501_TCW_PROG);
@@ -547,8 +547,8 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 			outl(ul_Command1,
 			outl(ul_Command1,
 				devpriv->iobase + APCI3501_WATCHDOG +
 				devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 				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 (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
 		if (data[1] == 1) {
 		if (data[1] == 1) {
@@ -557,12 +557,12 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 				APCI3501_TCW_PROG);
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
 			ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
-			//Enable the Timer
+			/* Enable the Timer */
 			outl(ul_Command1,
 			outl(ul_Command1,
 				devpriv->iobase + APCI3501_WATCHDOG +
 				devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 				APCI3501_TCW_PROG);
 		} else if (data[1] == 0) {
 		} else if (data[1] == 0) {
-			//Stop The Timer
+			/* Stop The Timer */
 			ul_Command1 =
 			ul_Command1 =
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 				APCI3501_TCW_PROG);
@@ -573,7 +573,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 		}
 		}
 
 
 		else if (data[1] == 2) {
 		else if (data[1] == 2) {
-			//Trigger the Timer
+			/* Trigger the Timer */
 			ul_Command1 =
 			ul_Command1 =
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				inl(devpriv->iobase + APCI3501_WATCHDOG +
 				APCI3501_TCW_PROG);
 				APCI3501_TCW_PROG);
@@ -583,7 +583,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 				APCI3501_TCW_PROG);
 				APCI3501_TCW_PROG);
 		}
 		}
 
 
-	}			// end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER)
+	}			/*  end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */
 	i_Temp = inl(devpriv->iobase + APCI3501_WATCHDOG +
 	i_Temp = inl(devpriv->iobase + APCI3501_WATCHDOG +
 		APCI3501_TCW_TRIG_STATUS) & 0x1;
 		APCI3501_TCW_TRIG_STATUS) & 0x1;
 	return insn->n;
 	return insn->n;
@@ -598,7 +598,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev,
 | Task              : Read The Selected Timer , Counter or Watchdog          |
 | Task              : Read The Selected Timer , Counter or Watchdog          |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
 | Input Parameters  : struct comedi_device *dev : Driver handle                     |
-|                     UINT *data         : Data Pointer contains             |
+|                     unsigned int *data         : Data Pointer contains             |
 |                                          configuration parameters as below |
 |                                          configuration parameters as below |
 |                                                                            |
 |                                                                            |
 |					  data[0]            : 0 Timer                   |
 |					  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) {
 	if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
@@ -622,14 +622,14 @@ int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device * dev,
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_TRIG_STATUS) & 0x1;
 			APCI3501_TCW_TRIG_STATUS) & 0x1;
 		data[1] = inl(devpriv->iobase + APCI3501_WATCHDOG);
 		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) {
 	else if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
 		data[0] =
 		data[0] =
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			inl(devpriv->iobase + APCI3501_WATCHDOG +
 			APCI3501_TCW_TRIG_STATUS) & 0x1;
 			APCI3501_TCW_TRIG_STATUS) & 0x1;
 		data[1] = inl(devpriv->iobase + APCI3501_WATCHDOG);
 		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)
 	else if ((devpriv->b_TimerSelectMode != ADDIDATA_TIMER)
 		&& (devpriv->b_TimerSelectMode != ADDIDATA_WATCHDOG)) {
 		&& (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;
 	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(0x0, devpriv->iobase + APCI3501_DIGITAL_OP);
 	outl(1, devpriv->iobase + APCI3501_ANALOG_OUTPUT +
 	outl(1, devpriv->iobase + APCI3501_ANALOG_OUTPUT +
 		APCI3501_AO_VOLT_MODE);
 		APCI3501_AO_VOLT_MODE);
@@ -674,11 +674,11 @@ int i_APCI3501_Reset(struct comedi_device * dev)
 		}
 		}
 
 
 		if (ul_DAC_Ready) {
 		if (ul_DAC_Ready) {
-			// Output the Value on the output channels.
+			/*  Output the Value on the output channels. */
 			ul_Command1 =
 			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,
 			outl(ul_Command1,
 				devpriv->iobase + APCI3501_ANALOG_OUTPUT +
 				devpriv->iobase + APCI3501_ANALOG_OUTPUT +
 				APCI3501_AO_PROG);
 				APCI3501_AO_PROG);
@@ -711,7 +711,7 @@ void v_APCI3501_Interrupt(int irq, void *d)
 	struct comedi_device *dev = d;
 	struct comedi_device *dev = d;
 	unsigned int ui_Timer_AOWatchdog;
 	unsigned int ui_Timer_AOWatchdog;
 	unsigned long ul_Command1;
 	unsigned long ul_Command1;
-	// Disable Interrupt
+	/*  Disable Interrupt */
 	ul_Command1 =
 	ul_Command1 =
 		inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);
 		inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);
 
 
@@ -728,8 +728,9 @@ void v_APCI3501_Interrupt(int irq, void *d)
 		return;
 		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);
 	send_sig(SIGIO, devpriv->tsk_Current, 0);
 	ul_Command1 =
 	ul_Command1 =
 		inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG);
 		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.
  * any later version.
  */
  */
 
 
-// Card Specific information
+/* Card Specific information */
 #define APCI3501_BOARD_VENDOR_ID                 0x15B8
 #define APCI3501_BOARD_VENDOR_ID                 0x15B8
 #define APCI3501_ADDRESS_RANGE                   255
 #define APCI3501_ADDRESS_RANGE                   255
 
 
@@ -23,7 +23,7 @@
 #define APCI3501_DIGITAL_OP                       0x40
 #define APCI3501_DIGITAL_OP                       0x40
 #define APCI3501_ANALOG_OUTPUT                    0x00
 #define APCI3501_ANALOG_OUTPUT                    0x00
 
 
-//Analog Output related Defines
+/* Analog Output related Defines */
 #define APCI3501_AO_VOLT_MODE                     0
 #define APCI3501_AO_VOLT_MODE                     0
 #define APCI3501_AO_PROG                          4
 #define APCI3501_AO_PROG                          4
 #define APCI3501_AO_TRIG_SCS                      8
 #define APCI3501_AO_TRIG_SCS                      8
@@ -31,14 +31,14 @@
 #define BIPOLAR                                   1
 #define BIPOLAR                                   1
 #define MODE0                                     0
 #define MODE0                                     0
 #define MODE1                                     1
 #define MODE1                                     1
-// ANALOG OUTPUT RANGE
+/* ANALOG OUTPUT RANGE */
 struct comedi_lrange range_apci3501_ao = { 2, {
 struct comedi_lrange range_apci3501_ao = { 2, {
 					BIP_RANGE(10),
 					BIP_RANGE(10),
 					UNI_RANGE(10)
 					UNI_RANGE(10)
 					}
 					}
 };
 };
 
 
-//Watchdog Related Defines
+/* Watchdog Related Defines */
 
 
 #define APCI3501_WATCHDOG                         0x20
 #define APCI3501_WATCHDOG                         0x20
 #define APCI3501_TCW_SYNC_ENABLEDISABLE           0
 #define APCI3501_TCW_SYNC_ENABLEDISABLE           0
@@ -52,32 +52,36 @@ struct comedi_lrange range_apci3501_ao = { 2, {
 #define ADDIDATA_TIMER                            0
 #define ADDIDATA_TIMER                            0
 #define ADDIDATA_WATCHDOG                         2
 #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);
 				  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);
 				 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);
 				struct comedi_insn *insn, unsigned int *data);
 
 
-//DO
+/* DO */
 int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s,
 				   struct comedi_insn *insn, unsigned int *data);
 				   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);
 				  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);
 				 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_subdevice *s,
 					  struct comedi_insn *insn, unsigned int *data);
 					  struct comedi_insn *insn, unsigned int *data);
 int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev,
 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,
 int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device *dev,
 					struct comedi_subdevice *s,
 					struct comedi_subdevice *s,
 					struct comedi_insn *insn, unsigned int *data);
 					struct comedi_insn *insn, unsigned int *data);
-//Interrupt
+/* Interrupt */
 void v_APCI3501_Interrupt(int irq, void *d);
 void v_APCI3501_Interrupt(int irq, void *d);
 
 
-//Reset functions
+/* Reset functions */
 int i_APCI3501_Reset(struct comedi_device *dev);
 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.
 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.
 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)                           |
 |                          (struct comedi_device    *dev)                           |
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task                Test if any conversion started                         |
 | 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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           struct comedi_insn      *insn,                          |
@@ -87,9 +87,9 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device * dev)
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task           Converting mode and convert time selection                  |
 | 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 : -                                                      |
 | 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 */
 	/* Test the buffer size */
@@ -123,19 +123,19 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
 		/* Get the Singel/Diff flag */
 		/* Get the Singel/Diff flag */
 	   /****************************/
 	   /****************************/
 
 
-		b_SingleDiff = (BYTE) data[1];
+		b_SingleDiff = (unsigned char) data[1];
 
 
 	   /****************************/
 	   /****************************/
 		/* Get the time base unitiy */
 		/* Get the time base unitiy */
 	   /****************************/
 	   /****************************/
 
 
-		b_TimeBase = (BYTE) data[2];
+		b_TimeBase = (unsigned char) data[2];
 
 
 	   /*************************************/
 	   /*************************************/
 		/* Get the convert time reload value */
 		/* Get the convert time reload value */
 	   /*************************************/
 	   /*************************************/
 
 
-		dw_ReloadValue = (DWORD) data[3];
+		dw_ReloadValue = (unsigned int) data[3];
 
 
 	   /**********************/
 	   /**********************/
 		/* Test the time base */
 		/* Test the time base */
@@ -186,7 +186,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
 								devpriv->
 								devpriv->
 									ui_EocEosConversionTime
 									ui_EocEosConversionTime
 									=
 									=
-									(UINT)
+									(unsigned int)
 									dw_ReloadValue;
 									dw_ReloadValue;
 								devpriv->
 								devpriv->
 									b_EocEosConversionTimeBase
 									b_EocEosConversionTimeBase
@@ -204,7 +204,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
 								/* Set the convert timing unit */
 								/* Set the convert timing unit */
 			      /*******************************/
 			      /*******************************/
 
 
-								writel((DWORD)
+								writel((unsigned int)
 									b_TimeBase,
 									b_TimeBase,
 									(void *)
 									(void *)
 									(devpriv->
 									(devpriv->
@@ -268,12 +268,12 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
 		i_ReturnValue = -101;
 		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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           struct comedi_insn      *insn,                          |
@@ -281,9 +281,9 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev,
 +----------------------------------------------------------------------------+
 +----------------------------------------------------------------------------+
 | Task           Converting mode and convert time selection                  |
 | 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 : -                                                      |
 | 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 */
 	/* Test the buffer size */
 	/************************/
 	/************************/
 
 
 	if (insn->n >= 1) {
 	if (insn->n >= 1) {
-		switch ((BYTE) data[0]) {
+		switch ((unsigned char) data[0]) {
 		case APCI3XXX_CONFIGURATION:
 		case APCI3XXX_CONFIGURATION:
 			i_ReturnValue =
 			i_ReturnValue =
 				i_APCI3XXX_AnalogInputConfigOperatingMode(dev,
 				i_APCI3XXX_AnalogInputConfigOperatingMode(dev,
@@ -326,12 +326,12 @@ int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 		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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           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 */
 	/* Test if operating mode configured */
@@ -449,8 +449,8 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev,
 
 
 					dw_Configuration =
 					dw_Configuration =
 						(b_Configuration & 3) |
 						(b_Configuration & 3) |
-						((DWORD) (b_Configuration >> 2)
-						<< 6) | ((DWORD) devpriv->
+						((unsigned int) (b_Configuration >> 2)
+						<< 6) | ((unsigned int) devpriv->
 						b_SingelDiff << 7);
 						b_SingelDiff << 7);
 
 
 		    /***************************/
 		    /***************************/
@@ -468,7 +468,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev,
 					writel(dw_Temp | 0x100UL,
 					writel(dw_Temp | 0x100UL,
 						(void *)(devpriv->dw_AiBase +
 						(void *)(devpriv->dw_AiBase +
 							4));
 							4));
-					writel((DWORD) b_Channel,
+					writel((unsigned int) b_Channel,
 						(void *)(devpriv->dw_AiBase +
 						(void *)(devpriv->dw_AiBase +
 							0));
 							0));
 
 
@@ -535,8 +535,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev,
 								dw_Temp =
 								dw_Temp =
 									dw_Temp
 									dw_Temp
 									& 1;
 									& 1;
-							}
-							while (dw_Temp != 1);
+							} while (dw_Temp != 1);
 
 
 			  /*************************/
 			  /*************************/
 							/* Read the analog value */
 							/* Read the analog value */
@@ -585,7 +584,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev,
 		printk("Operating mode not configured\n");
 		printk("Operating mode not configured\n");
 		i_ReturnValue = -1;
 		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)
 void v_APCI3XXX_Interrupt(int irq, void *d)
 {
 {
 	struct comedi_device *dev = 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 */
 	/* 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 */
 		/* Reset the interrupt */
 	   /***********************/
 	   /***********************/
@@ -635,7 +634,7 @@ void v_APCI3XXX_Interrupt(int irq, void *d)
 				b_CopyCpt < devpriv->ui_AiNbrofChannels;
 				b_CopyCpt < devpriv->ui_AiNbrofChannels;
 				b_CopyCpt++) {
 				b_CopyCpt++) {
 				devpriv->ui_AiReadData[b_CopyCpt] =
 				devpriv->ui_AiReadData[b_CopyCpt] =
-					(UINT) readl((void *)(devpriv->
+					(unsigned int) readl((void *)(devpriv->
 						dw_AiBase + 28));
 						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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           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 */
 	/* Test the buffer size */
@@ -729,8 +728,7 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev,
 					dw_Status =
 					dw_Status =
 						readl((void *)(devpriv->
 						readl((void *)(devpriv->
 							dw_AiBase + 96));
 							dw_AiBase + 96));
-				}
-				while ((dw_Status & 0x100) != 0x100);
+				} while ((dw_Status & 0x100) != 0x100);
 			} else {
 			} else {
 		 /***************************/
 		 /***************************/
 				/* Channel not initialised */
 				/* Channel not initialised */
@@ -757,7 +755,7 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 		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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           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.        |
 |                for you call any other function witch access of TTL.        |
 |                APCI3XXX_TTL_INIT_DIRECTION_PORT2(user inputs for direction)|
 |                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 : -                                                      |
 | 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 */
 	/* Test the buffer size */
@@ -806,7 +804,7 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev,
 		/* Get the command */
 		/* Get the command */
 		/* **************** */
 		/* **************** */
 
 
-		b_Command = (BYTE) data[0];
+		b_Command = (unsigned char) data[0];
 
 
 	   /********************/
 	   /********************/
 		/* Test the command */
 		/* 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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           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 */
 	/* Test the buffer size */
@@ -1051,12 +1049,12 @@ int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device * dev,
 		i_ReturnValue = -101;
 		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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           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;
 	unsigned int *pls_ReadData = data;
 
 
 	/************************/
 	/************************/
@@ -1157,7 +1155,7 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev,
 		i_ReturnValue = -101;
 		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_device    *dev,                           |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_subdevice *s,                             |
 |                           struct comedi_insn      *insn,                          |
 |                           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 */
 	/* Test the buffer size */
 	/************************/
 	/************************/
 
 
 	if (insn->n >= 1) {
 	if (insn->n >= 1) {
-		b_State = (BYTE) data[0];
+		b_State = (unsigned char) data[0];
 
 
 	   /***********************/
 	   /***********************/
 		/* Test if read port 0 */
 		/* Test if read port 0 */
@@ -1269,7 +1267,7 @@ int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device * dev,
 		i_ReturnValue = -101;
 		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 */
 	/* Test the channel number */
@@ -1334,7 +1332,7 @@ int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device * dev,
 		i_ReturnValue = -3;
 		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                                  |
 |                    -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 */
 	/* Test the buffer size */
@@ -1378,7 +1376,7 @@ int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 		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                                  |
 |                    -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 */
 	/* Test the buffer size */
@@ -1481,7 +1479,7 @@ int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 		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 */
 	/* Test the buffer size */
@@ -1527,7 +1525,7 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev,
 			/* Get the command */
 			/* Get the command */
 	      /*******************/
 	      /*******************/
 
 
-			b_State = (BYTE) data[0];
+			b_State = (unsigned char) data[0];
 
 
 	      /********************************/
 	      /********************************/
 			/* Read the digital output port */
 			/* Read the digital output port */
@@ -1557,7 +1555,7 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 		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 */
 	/* Test the buffer size */
@@ -1622,7 +1620,7 @@ int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device * dev,
 		i_ReturnValue = -101;
 		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;
 	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 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"
 #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;
 	const char *name;
 	unsigned short dev_id;	/* `lspci` will show you this */
 	unsigned short dev_id;	/* `lspci` will show you this */
 	int ao_chans;
 	int ao_chans;
-	//int ao_bits;
+	/* int ao_bits; */
 };
 };
 
 
 static const struct pci6208_board pci6208_boards[] = {
 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
 /* This is used by modprobe to translate PCI IDs to drivers.  Should
  * only be used for PCI and ISA-PnP devices */
  * only be used for PCI and ISA-PnP devices */
 static DEFINE_PCI_DEVICE_TABLE(pci6208_pci_table) = {
 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},
 	{PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 	{0}
 	{0}
 };
 };
@@ -107,35 +107,32 @@ struct pci6208_private {
 
 
 #define devpriv ((struct pci6208_private *)dev->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 = {
 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);
 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
 static int
 pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr,
 pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr,
 	int dev_minor);
 	int dev_minor);
 
 
 /*read/write functions*/
 /*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
  * 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
  * in the driver structure, dev->board_ptr contains that
  * address.
  * 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;
 	struct comedi_subdevice *s;
 	int retval;
 	int retval;
@@ -176,22 +173,22 @@ static int pci6208_attach(struct comedi_device * dev, struct comedi_devconfig *
 	s = dev->subdevices + 0;
 	s = dev->subdevices + 0;
 	/* analog output subdevice */
 	/* analog output subdevice */
 	s->type = COMEDI_SUBD_AO;
 	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->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_write = pci6208_ao_winsn;
 	s->insn_read = pci6208_ao_rinsn;
 	s->insn_read = pci6208_ao_rinsn;
 
 
-	//s=dev->subdevices+1;
+	/* s=dev->subdevices+1; */
 	/* digital i/o subdevice */
 	/* 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");
 	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
  * allocated by _attach().  dev->private and dev->subdevices are
  * deallocated automatically by the core.
  * 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);
 	printk("comedi%d: pci6208: remove\n", dev->minor);
 
 
@@ -220,8 +217,8 @@ static int pci6208_detach(struct comedi_device * dev)
 	return 0;
 	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;
 	int i = 0, Data_Read;
 	unsigned short chan = CR_CHAN(insn->chanspec);
 	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.
 /* AO subdevices should have a read insn as well as a write insn.
  * Usually this means copying a value stored in devpriv. */
  * 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 i;
 	int chan = CR_CHAN(insn->chanspec);
 	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.
  * useful to applications if you implement the insn_bits interface.
  * This allows packed reading/writing of the DIO channels.  The
  * This allows packed reading/writing of the DIO channels.  The
  * comedi core can convert between insn_bits and insn_read/write */
  * 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
 	/* The insn data is a mask in data[0] and the new data
 	 * in data[1], each channel cooresponding to a bit. */
 	 * 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 */
 		/* 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
 	/* on return, data[1] contains the value of the digital
 	 * input and output lines. */
 	 * 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
 	/* or we could just return the software copy of the output values if
 	 * it was a purely digital output subdevice */
 	 * 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
 	/* The input or output configuration of each digital line is
 	 * configured by a special insn_config instruction.  chanspec
 	 * configured by a special insn_config instruction.  chanspec
 	 * contains the channel to be changed, and data[0] contains the
 	 * contains the channel to be changed, and data[0] contains the
 	 * value COMEDI_INPUT or COMEDI_OUTPUT. */
 	 * 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;
 	struct pci_dev *pci_dev;
 	int i;
 	int i;
@@ -315,11 +312,11 @@ static int pci6208_find_device(struct comedi_device * dev, int bus, int slot)
 		pci_dev != NULL;
 		pci_dev != NULL;
 		pci_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) {
 		pci_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) {
 		if (pci_dev->vendor == PCI_VENDOR_ID_ADLINK) {
 		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) {
 				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)) {
 					if ((bus != 0) || (slot != 0)) {
-						// are we on the wrong bus/slot?
+						/*  are we on the wrong bus/slot? */
 						if (pci_dev->bus->number
 						if (pci_dev->bus->number
 							!= bus ||
 							!= bus ||
 							PCI_SLOT(pci_dev->devfn)
 							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_SLOT(pci_dev->devfn),
 		PCI_FUNC(pci_dev->devfn), pci_dev->irq);
 		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;
 	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;
 	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) {
 	if (comedi_pci_enable(pci_dev, PCI6208_DRIVER_NAME) < 0) {
 		printk("comedi%d: Failed to enable PCI device and request regions\n", dev_minor);
 		printk("comedi%d: Failed to enable PCI device and request regions\n", dev_minor);
 		return -EIO;
 		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_base = pci_resource_start(pci_dev, 1);
 	lcr_io_range = pci_resource_len(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",
 	printk("comedi%d: local config registers at address 0x%4lx [0x%4lx]\n",
 		dev_minor, lcr_io_base, lcr_io_range);
 		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_base = pci_resource_start(pci_dev, 2);
 	io_range = pci_resource_end(pci_dev, 2) - io_base + 1;
 	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);
 		dev_minor, io_base, io_range);
 
 
 	*io_base_ptr = io_base;
 	*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;
 	return 0;
 }
 }

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

@@ -39,7 +39,7 @@ Configuration Options:
 
 
 #include "comedi_pci.h"
 #include "comedi_pci.h"
 #include "8255.h"
 #include "8255.h"
-// #include "8253.h"
+/* #include "8253.h" */
 
 
 #define PORT1A 0
 #define PORT1A 0
 #define PORT2A 4
 #define PORT2A 4
@@ -64,16 +64,16 @@ struct adl_pci7296_private {
 
 
 #define devpriv ((struct adl_pci7296_private *)dev->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 = {
 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 pci_dev *pcidev;
 	struct comedi_subdevice *s;
 	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);
 			dev->iobase = pci_resource_start(pcidev, 2);
 			printk("comedi: base addr %4lx\n", dev->iobase);
 			printk("comedi: base addr %4lx\n", dev->iobase);
 
 
-			// four 8255 digital io subdevices
+			/*  four 8255 digital io subdevices */
 			s = dev->subdevices + 0;
 			s = dev->subdevices + 0;
 			subdev_8255_init(dev, s, NULL,
 			subdev_8255_init(dev, s, NULL,
 				(unsigned long)(dev->iobase));
 				(unsigned long)(dev->iobase));
@@ -149,7 +149,7 @@ static int adl_pci7296_attach(struct comedi_device * dev, struct comedi_devconfi
 	return -EIO;
 	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);
 	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);
 		pci_dev_put(devpriv->pci_dev);
 	}
 	}
-	// detach four 8255 digital io subdevices
+	/*  detach four 8255 digital io subdevices */
 	if (dev->subdevices) {
 	if (dev->subdevices) {
 		subdev_8255_cleanup(dev, dev->subdevices + 0);
 		subdev_8255_cleanup(dev, dev->subdevices + 0);
 		subdev_8255_cleanup(dev, dev->subdevices + 1);
 		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)
 #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 = {
 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 */
 /* 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 pci_dev *pcidev;
 	struct comedi_subdevice *s;
 	struct comedi_subdevice *s;
@@ -150,7 +150,7 @@ static int adl_pci7432_attach(struct comedi_device * dev, struct comedi_devconfi
 	return -EIO;
 	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);
 	printk("comedi%d: pci7432: remove\n", dev->minor);
 
 
@@ -164,8 +164,8 @@ static int adl_pci7432_detach(struct comedi_device * dev)
 	return 0;
 	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: pci7432_do_insn_bits called\n");
 	printk("comedi: data0: %8x data1: %8x\n", data[0], data[1]);
 	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;
 	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: pci7432_di_insn_bits called\n");
 	printk("comedi: data0: %8x data1: %8x\n", data[0], data[1]);
 	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)
 #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 = {
 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 pci_dev *pcidev;
 	struct comedi_subdevice *s;
 	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->n_chan = 4;
 			s->maxdata = 0xffff;
 			s->maxdata = 0xffff;
 			s->len_chanlist = 4;
 			s->len_chanlist = 4;
-			//s->range_table = &range_axis;
+			/* s->range_table = &range_axis; */
 			s->insn_read = adl_pci8164_insn_read_msts;
 			s->insn_read = adl_pci8164_insn_read_msts;
 			s->insn_write = adl_pci8164_insn_write_cmd;
 			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->n_chan = 4;
 			s->maxdata = 0xffff;
 			s->maxdata = 0xffff;
 			s->len_chanlist = 4;
 			s->len_chanlist = 4;
-			//s->range_table = &range_axis;
+			/* s->range_table = &range_axis; */
 			s->insn_read = adl_pci8164_insn_read_ssts;
 			s->insn_read = adl_pci8164_insn_read_ssts;
 			s->insn_write = adl_pci8164_insn_write_otp;
 			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->n_chan = 4;
 			s->maxdata = 0xffff;
 			s->maxdata = 0xffff;
 			s->len_chanlist = 4;
 			s->len_chanlist = 4;
-			//s->range_table = &range_axis;
+			/* s->range_table = &range_axis; */
 			s->insn_read = adl_pci8164_insn_read_buf0;
 			s->insn_read = adl_pci8164_insn_read_buf0;
 			s->insn_write = adl_pci8164_insn_write_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->n_chan = 4;
 			s->maxdata = 0xffff;
 			s->maxdata = 0xffff;
 			s->len_chanlist = 4;
 			s->len_chanlist = 4;
-			//s->range_table = &range_axis;
+			/* s->range_table = &range_axis; */
 			s->insn_read = adl_pci8164_insn_read_buf1;
 			s->insn_read = adl_pci8164_insn_read_buf1;
 			s->insn_write = adl_pci8164_insn_write_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;
 	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);
 	printk("comedi%d: pci8164: remove\n", dev->minor);
 
 
@@ -208,8 +208,16 @@ static int adl_pci8164_detach(struct comedi_device * dev)
 	return 0;
 	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;
 	int axis, axis_reg;
 	char *axisname;
 	char *axisname;
@@ -238,127 +246,51 @@ static int adl_pci8164_insn_read_msts(struct comedi_device * dev, struct comedi_
 		axisname = "X";
 		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);
 		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;
 	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;
 	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;
 	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;
 	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;
 	unsigned int axis, axis_reg;
 
 
@@ -388,124 +320,39 @@ static int adl_pci8164_insn_write_cmd(struct comedi_device * dev, struct comedi_
 		axisname = "X";
 		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;
 	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;
 	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;
 	return 2;
 }
 }
 
 

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

@@ -77,6 +77,7 @@ TODO:
 #include "../comedidev.h"
 #include "../comedidev.h"
 
 
 #include <linux/delay.h>
 #include <linux/delay.h>
+#include <linux/interrupt.h>
 
 
 #include "8253.h"
 #include "8253.h"
 #include "comedi_pci.h"
 #include "comedi_pci.h"
@@ -186,24 +187,24 @@ TODO:
   (inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK)&0x0F)
   (inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK)&0x0F)
 
 
 #define pci9111_trigger_and_autoscan_set(flags) \
 #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() \
 #define pci9111_interrupt_and_fifo_get() \
   ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK) >> 4) &0x03)
   ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_MODE_INTERRUPT_READBACK) >> 4) &0x03)
 
 
 #define pci9111_interrupt_and_fifo_set(flags) \
 #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() \
 #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() \
 #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() \
 #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() \
 #define pci9111_is_fifo_full() \
   ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_RANGE_STATUS_READBACK)& \
   ((inb(PCI9111_IO_BASE+PCI9111_REGISTER_RANGE_STATUS_READBACK)& \
@@ -218,13 +219,13 @@ TODO:
     PCI9111_FIFO_EMPTY_MASK)==0)
     PCI9111_FIFO_EMPTY_MASK)==0)
 
 
 #define pci9111_ai_channel_set(channel) \
 #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() \
 #define pci9111_ai_channel_get() \
   inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_CHANNEL_READBACK)&PCI9111_CHANNEL_MASK
   inb(PCI9111_IO_BASE+PCI9111_REGISTER_AD_CHANNEL_READBACK)&PCI9111_CHANNEL_MASK
 
 
 #define pci9111_ai_range_set(range) \
 #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() \
 #define pci9111_ai_range_get() \
   inb(PCI9111_IO_BASE+PCI9111_REGISTER_RANGE_STATUS_READBACK)&PCI9111_RANGE_MASK
   inb(PCI9111_IO_BASE+PCI9111_REGISTER_RANGE_STATUS_READBACK)&PCI9111_RANGE_MASK
@@ -238,34 +239,34 @@ TODO:
   ^ PCI9111_HR_AI_RESOLUTION_2_CMP_BIT
   ^ PCI9111_HR_AI_RESOLUTION_2_CMP_BIT
 
 
 #define pci9111_ao_set_data(data) \
 #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() \
 #define pci9111_di_get_bits() \
   inw(PCI9111_IO_BASE+PCI9111_REGISTER_DIGITAL_IO)
   inw(PCI9111_IO_BASE+PCI9111_REGISTER_DIGITAL_IO)
 
 
 #define pci9111_do_set_bits(bits) \
 #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) \
 #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) \
 #define pci9111_8254_counter_0_set(data) \
   outb(data & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_0); \
   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) \
 #define pci9111_8254_counter_1_set(data) \
   outb(data & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_1); \
   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) \
 #define pci9111_8254_counter_2_set(data) \
   outb(data & 0xFF, PCI9111_IO_BASE+PCI9111_REGISTER_8254_COUNTER_2); \
   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 */
 /*  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);
 	void *data, unsigned int num_bytes, unsigned int start_chan_index);
 
 
 static const struct comedi_lrange pci9111_hr_ai_range = {
 static const struct comedi_lrange pci9111_hr_ai_range = {
@@ -308,27 +309,27 @@ struct pci9111_board {
 
 
 static const struct pci9111_board pci9111_boards[] = {
 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 \
 #define pci9111_board_nbr \
   (sizeof(pci9111_boards)/sizeof(struct pci9111_board))
   (sizeof(pci9111_boards)/sizeof(struct pci9111_board))
 
 
 static struct comedi_driver pci9111_driver = {
 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);
 COMEDI_PCI_INITCLEANUP(pci9111_driver, pci9111_pci_table);
@@ -405,7 +406,7 @@ static void plx9050_interrupt_control(unsigned long io_base,
 
 
 /*  8254 timer */
 /*  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_control_set(PCI9111_8254_COUNTER_0 |
 		PCI9111_8254_READ_LOAD_LSB_MSB |
 		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_READ_LOAD_LSB_MSB |
 		PCI9111_8254_MODE_2 | PCI9111_8254_BINARY_COUNTER);
 		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_2_set(dev_private->timer_divisor_2);
 	pci9111_8254_counter_1_set(dev_private->timer_divisor_1);
 	pci9111_8254_counter_1_set(dev_private->timer_divisor_1);
@@ -431,7 +432,7 @@ enum pci9111_trigger_sources {
 	external
 	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)
 	enum pci9111_trigger_sources source)
 {
 {
 	int flags;
 	int flags;
@@ -455,7 +456,7 @@ static void pci9111_trigger_source_set(struct comedi_device * dev,
 	pci9111_trigger_and_autoscan_set(flags);
 	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;
 	int flags;
 
 
@@ -467,7 +468,7 @@ static void pci9111_pretrigger_set(struct comedi_device * dev, bool pretrigger)
 	pci9111_trigger_and_autoscan_set(flags);
 	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;
 	int flags;
 
 
@@ -489,7 +490,7 @@ enum pci9111_ISC1_sources {
 	irq_on_external_trigger
 	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)
 	enum pci9111_ISC0_sources irq_0_source, enum pci9111_ISC1_sources irq_1_source)
 {
 {
 	int flags;
 	int flags;
@@ -513,7 +514,7 @@ static void pci9111_interrupt_source_set(struct comedi_device * dev,
 
 
 #undef AI_DO_CMD_DEBUG
 #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 */
 	/*  Disable interrupts */
 
 
@@ -535,14 +536,14 @@ static int pci9111_ai_cancel(struct comedi_device * dev, struct comedi_subdevice
 
 
 /*  Test analog input command */
 /*  Test analog input command */
 
 
-#define pci9111_check_trigger_src(src,flags) \
+#define pci9111_check_trigger_src(src, flags) \
   tmp = src; \
   tmp = src; \
   src &= flags; \
   src &= flags; \
   if (!src || tmp != src) error++
   if (!src || tmp != src) error++
 
 
 static int
 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 tmp;
 	int error = 0;
 	int error = 0;
@@ -740,7 +741,7 @@ pci9111_ai_do_cmd_test(struct comedi_device * dev,
 
 
 /*  Analog input command */
 /*  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;
 	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;
 	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)
 	void *data, unsigned int num_bytes, unsigned int start_chan_index)
 {
 {
 	unsigned int i, num_samples = num_bytes / sizeof(short);
 	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
 #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_device *dev = p_device;
 	struct comedi_subdevice *subdevice = dev->read_subdev;
 	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;
 	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 */
 	/*  Check if we are source of interrupt */
 	intcsr = inb(dev_private->lcr_io_base +
 	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))))) {
 						PLX9050_LINTI2_STATUS))))) {
 		/*  Not the source of the interrupt. */
 		/*  Not the source of the interrupt. */
 		/*  (N.B. not using PLX9050_SOFTWARE_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;
 		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 */
 		/*  Interrupt comes from fifo_half-full signal */
 
 
 		if (pci9111_is_fifo_full()) {
 		if (pci9111_is_fifo_full()) {
-			comedi_spin_unlock_irqrestore(&dev->spinlock,
+			spin_unlock_irqrestore(&dev->spinlock,
 				irq_flags);
 				irq_flags);
 			comedi_error(dev, PCI9111_DRIVER_NAME " fifo overflow");
 			comedi_error(dev, PCI9111_DRIVER_NAME " fifo overflow");
 			pci9111_interrupt_clear();
 			pci9111_interrupt_clear();
@@ -1027,7 +1028,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device PT_REGS_ARG)
 
 
 	pci9111_interrupt_clear();
 	pci9111_interrupt_clear();
 
 
-	comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags);
+	spin_unlock_irqrestore(&dev->spinlock, irq_flags);
 
 
 	comedi_event(dev, subdevice);
 	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
 #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 =
 	int resolution =
 		((struct pci9111_board *) dev->board_ptr)->ai_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 */
 /*  Analog instant output */
 
 
 static int
 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;
 	int i;
 
 
@@ -1115,8 +1116,8 @@ pci9111_ao_insn_write(struct comedi_device * dev,
 
 
 /*  Analog output readback */
 /*  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;
 	int i;
 
 
@@ -1133,8 +1134,8 @@ static int pci9111_ao_insn_read(struct comedi_device * dev,
 
 
 /*  Digital inputs */
 /*  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;
 	unsigned int bits;
 
 
@@ -1146,8 +1147,8 @@ static int pci9111_di_insn_bits(struct comedi_device * dev,
 
 
 /*  Digital outputs */
 /*  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;
 	unsigned int bits;
 
 
@@ -1175,7 +1176,7 @@ static int pci9111_do_insn_bits(struct comedi_device * dev,
 
 
 /*  Reset device */
 /*  Reset device */
 
 
-static int pci9111_reset(struct comedi_device * dev)
+static int pci9111_reset(struct comedi_device *dev)
 {
 {
 	/*  Set trigger source to software */
 	/*  Set trigger source to software */
 
 
@@ -1200,7 +1201,7 @@ static int pci9111_reset(struct comedi_device * dev)
 /*       - Register PCI device */
 /*       - Register PCI device */
 /*       - Declare device driver capability */
 /*       - 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;
 	struct comedi_subdevice *subdevice;
 	unsigned long io_base, io_range, lcr_io_base, lcr_io_range;
 	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;
 	dev->irq = 0;
 	if (pci_device->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) {
 				IRQF_SHARED, PCI9111_DRIVER_NAME, dev) != 0) {
 			printk("comedi%d: unable to allocate irq  %u\n",
 			printk("comedi%d: unable to allocate irq  %u\n",
 				dev->minor, pci_device->irq);
 				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]). */
 	/*  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;
 		return error;
 
 
 	subdevice = dev->subdevices + 0;
 	subdevice = dev->subdevices + 0;
@@ -1365,7 +1366,7 @@ static int pci9111_attach(struct comedi_device * dev, struct comedi_devconfig *
 
 
 /*  Detach */
 /*  Detach */
 
 
-static int pci9111_detach(struct comedi_device * dev)
+static int pci9111_detach(struct comedi_device *dev)
 {
 {
 	/*  Reset device */
 	/*  Reset device */
 
 
@@ -1377,7 +1378,7 @@ static int pci9111_detach(struct comedi_device * dev)
 	/*  Release previously allocated irq */
 	/*  Release previously allocated irq */
 
 
 	if (dev->irq != 0) {
 	if (dev->irq != 0) {
-		comedi_free_irq(dev->irq, dev);
+		free_irq(dev->irq, dev);
 	}
 	}
 
 
 	if (dev_private != 0 && dev_private->pci_device != 0) {
 	if (dev_private != 0 && dev_private->pci_device != 0) {

Datei-Diff unterdrückt, da er zu groß ist
+ 215 - 215
drivers/staging/comedi/drivers/adl_pci9118.c


+ 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"
 #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_SIZE     16
 
 
 #define ADQ12B_CTREG    0x00
 #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_CONT2    0x0e
 #define ADQ12B_COWORD   0x0f
 #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 ADQ12B_EOC     0x20
 
 
 #define TIMEOUT        20
 #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, {
 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, {
 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[] = {
 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 board, and also about the kernel module that contains
  * the device code.
  * 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 int adq12b_detach(struct comedi_device *dev);
 static struct comedi_driver driver_adq12b={
 static struct comedi_driver driver_adq12b={
         driver_name:    "adq12b",
         driver_name:    "adq12b",
@@ -171,12 +171,12 @@ static struct comedi_driver driver_adq12b={
         detach:         adq12b_detach,
         detach:         adq12b_detach,
         board_name:     &adq12b_boards[0].name,
         board_name:     &adq12b_boards[0].name,
         offset:         sizeof(struct adq12b_board),
         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
  * 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
  * in the driver structure, dev->board_ptr contains that
  * address.
  * 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;
         struct comedi_subdevice *s;
         unsigned long iobase;
         unsigned long iobase;
@@ -194,7 +194,7 @@ static int adq12b_attach(struct comedi_device *dev,struct comedi_devconfig *it)
         unipolar = it->options[1];
         unipolar = it->options[1];
         differential = it->options[2];
         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 no address was specified, try the default 0x300 */
         if (iobase == 0) {
         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
  * Allocate the private structure area.  alloc_private() is a
  * convenient macro defined in comedidev.h.
  * 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;
           return -ENOMEM;
 
 
 /* fill in devpriv structure */
 /* 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
  * Allocate the subdevice structures.  alloc_subdevice() is a
  * convenient macro defined in comedidev.h.
  * convenient macro defined in comedidev.h.
  */
  */
-        if(alloc_subdevices(dev, 3)<0)
+        if (alloc_subdevices (dev, 3)<0)
            return -ENOMEM;
            return -ENOMEM;
 
 
         s = dev->subdevices+0;
         s = dev->subdevices+0;
@@ -304,7 +304,7 @@ static int adq12b_detach(struct comedi_device *dev)
 
 
         kfree(devpriv);
         kfree(devpriv);
 
 
-        printk("comedi%d: adq12b: removed\n",dev->minor);
+        printk("comedi%d: adq12b: removed\n", dev->minor);
 
 
         return 0;
         return 0;
 }
 }
@@ -314,7 +314,7 @@ static int adq12b_detach(struct comedi_device *dev)
  * mode.
  * 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 n, i;
         int range, channel;
         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);
         channel = CR_CHAN(insn->chanspec);
         if (channel != devpriv->last_channel || range != devpriv->last_range) {
         if (channel != devpriv->last_channel || range != devpriv->last_range) {
           outb((range << 4) | channel, dev->iobase + ADQ12B_CTREG);
           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 */
         /* trigger conversion */
         status = inb(dev->iobase + ADQ12B_ADLOW);
         status = inb(dev->iobase + ADQ12B_ADLOW);
 
 
         /* convert n samples */
         /* convert n samples */
-        for(n=0; n < insn->n; n++){
+        for (n=0; n < insn->n; n++){
 
 
           /* wait for end of convertion */
           /* wait for end of convertion */
 	  i = 0;
 	  i = 0;
           do {
           do {
-//            comedi_udelay(1);
+/* udelay(1); */
 	    status = inb(dev->iobase + ADQ12B_STINR);
 	    status = inb(dev->iobase + ADQ12B_STINR);
             status = status & ADQ12B_EOC;
             status = status & ADQ12B_EOC;
           } while (status == 0 && ++i < TIMEOUT);
           } while (status == 0 && ++i < TIMEOUT);
-//          } while (++i < 10);
+/* } while (++i < 10); */
 
 
           /* read data */
           /* read data */
           hi = inb(dev->iobase + ADQ12B_ADHIG);
           hi = inb(dev->iobase + ADQ12B_ADHIG);
           lo = inb(dev->iobase + ADQ12B_ADLOW);
           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;
           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 */
         /* 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;
         int channel;
 
 

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

@@ -41,6 +41,8 @@ Configuration options:
           device will be used.
           device will be used.
 */
 */
 
 
+#include <linux/interrupt.h>
+
 #include "../comedidev.h"
 #include "../comedidev.h"
 
 
 #include "comedi_pci.h"
 #include "comedi_pci.h"
@@ -56,12 +58,12 @@ Configuration options:
 
 
 #undef DPRINTK
 #undef DPRINTK
 #ifdef PCI171X_EXTDEBUG
 #ifdef PCI171X_EXTDEBUG
-#define DPRINTK(fmt, args...) rt_printk(fmt, ## args)
+#define DPRINTK(fmt, args...) printk(fmt, ## args)
 #else
 #else
 #define DPRINTK(fmt, args...)
 #define DPRINTK(fmt, args...)
 #endif
 #endif
 
 
-// hardware types of the cards
+/* hardware types of the cards */
 #define TYPE_PCI171X	0
 #define TYPE_PCI171X	0
 #define TYPE_PCI1713	2
 #define TYPE_PCI1713	2
 #define TYPE_PCI1720	3
 #define TYPE_PCI1720	3
@@ -87,12 +89,12 @@ Configuration options:
 #define PCI171x_CNT2	28	/* R/W: 8254 couter 2 */
 #define PCI171x_CNT2	28	/* R/W: 8254 couter 2 */
 #define PCI171x_CNTCTRL	30	/* W:   8254 counter control */
 #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_FE	0x0100	/* 1=FIFO is empty */
 #define Status_FH	0x0200	/* 1=FIFO is half full */
 #define Status_FH	0x0200	/* 1=FIFO is half full */
 #define Status_FF	0x0400	/* 1=FIFO is full, fatal error */
 #define Status_FF	0x0400	/* 1=FIFO is full, fatal error */
 #define Status_IRQ	0x0800	/* 1=IRQ occured */
 #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_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_ONEFH	0x0020	/* 1=IRQ on FIFO is half full, 0=every sample */
 #define Control_IRQEN	0x0010	/* 1=enable IRQ */
 #define Control_IRQEN	0x0010	/* 1=enable IRQ */
@@ -100,7 +102,7 @@ Configuration options:
 #define Control_EXT	0x0004	/* 1=external trigger source */
 #define Control_EXT	0x0004	/* 1=external trigger source */
 #define Control_PACER	0x0002	/* 1=enable internal 8254 trigger source */
 #define Control_PACER	0x0002	/* 1=enable internal 8254 trigger source */
 #define Control_SW	0x0001	/* 1=enable software 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_BCD     0x0001	/* 0 = binary counter, 1 = BCD counter */
 #define Counter_M0      0x0002	/* M0-M2 select modes 0-5 */
 #define Counter_M0      0x0002	/* M0-M2 select modes 0-5 */
 #define Counter_M1      0x0004	/* 000 = mode 0, 010 = mode 2 ... */
 #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_SYNCOUT	 9	/* W:   D/A synchronized output register */
 #define PCI1720_SYNCONT	15	/* R/W: D/A synchronized control */
 #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 */
 #define Syncont_SC0	 1	/* set synchronous output mode */
 
 
 static const struct comedi_lrange range_pci1710_3 = { 9, {
 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 {
 struct boardtype {
-	const char *name;	// board name
+	const char *name;	/*  board name */
 	int device_id;
 	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) = {
 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,
 		16, 0, 0, 16, 16, 0, 0x0fff, 0x0000,
 		&range_pci17x1, range_codes_pci17x1, NULL,
 		&range_pci17x1, range_codes_pci17x1, NULL,
 		10000, 512},
 		10000, 512},
-	// dummy entry corresponding to driver name
+	/*  dummy entry corresponding to driver name */
 	{.name = DRV_NAME},
 	{.name = DRV_NAME},
 };
 };
 
 
@@ -267,34 +269,34 @@ static struct comedi_driver driver_pci1710 = {
 };
 };
 
 
 struct pci1710_private {
 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 char ai_et;
 	unsigned int ai_et_CntrlReg;
 	unsigned int ai_et_CntrlReg;
 	unsigned int ai_et_MuxVal;
 	unsigned int ai_et_MuxVal;
 	unsigned int ai_et_div1, ai_et_div2;
 	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;
 	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)
 #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);
 	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);
 	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);
 	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,
 	0x0808, 0x0909, 0x0a0a, 0x0b0b, 0x0c0c, 0x0d0d, 0x0e0e, 0x0f0f,
 	0x1010, 0x1111, 0x1212, 0x1313, 0x1414, 0x1515, 0x1616, 0x1717,
 	0x1010, 0x1111, 0x1212, 0x1313, 0x1414, 0x1515, 0x1616, 0x1717,
 	0x1818, 0x1919, 0x1a1a, 0x1b1b, 0x1c1c, 0x1d1d, 0x1e1e, 0x1f1f
 	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;
 	int n, timeout;
 #ifdef PCI171x_PARANOIDCHECK
 #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");
 	DPRINTK("adv_pci1710 EDBG: BGN: pci171x_insn_read_ai(...)\n");
 	devpriv->CntrlReg &= Control_CNT0;
 	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);
 	outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
 	outb(0, dev->iobase + PCI171x_CLRFIFO);
 	outb(0, dev->iobase + PCI171x_CLRFIFO);
 	outb(0, dev->iobase + PCI171x_CLRINT);
 	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 */
 		outw(0, dev->iobase + PCI171x_SOFTTRG);	/* start conversion */
 		DPRINTK("adv_pci1710 B n=%d ST=%4x\n", n,
 		DPRINTK("adv_pci1710 B n=%d ST=%4x\n", n,
 			inw(dev->iobase + PCI171x_STATUS));
 			inw(dev->iobase + PCI171x_STATUS));
-		//comedi_udelay(1);
+		/* udelay(1); */
 		DPRINTK("adv_pci1710 C n=%d ST=%4x\n", n,
 		DPRINTK("adv_pci1710 C n=%d ST=%4x\n", n,
 			inw(dev->iobase + PCI171x_STATUS));
 			inw(dev->iobase + PCI171x_STATUS));
 		timeout = 100;
 		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;
 	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;
 	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);
 	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]) {
 	if (data[0]) {
 		s->state &= ~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;
 	unsigned int msb, lsb, ccntrl;
 	int i;
 	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;
 	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
 #ifdef unused
 	/* This doesn't work like a normal Comedi counter config */
 	/* 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;
 	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++) {
 	for (n = 0; n < insn->n; n++) {
 		outw(data[n], dev->iobase + PCI1720_DA0 + (chan << 1));
 		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];
 	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");
 	DPRINTK("adv_pci1710 EDBG: BGN: interrupt_pci1710_every_sample(...)\n");
 	m = inw(dev->iobase + PCI171x_STATUS);
 	m = inw(dev->iobase + PCI171x_STATUS);
 	if (m & Status_FE) {
 	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);
 		pci171x_ai_cancel(dev, s);
 		s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
 		s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
 		comedi_event(dev, s);
 		comedi_event(dev, s);
 		return;
 		return;
 	}
 	}
 	if (m & Status_FF) {
 	if (m & Status_FF) {
-		rt_printk
+		printk
 			("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n",
 			("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n",
 			dev->minor, m);
 			dev->minor, m);
 		pci171x_ai_cancel(dev, s);
 		pci171x_ai_cancel(dev, s);
@@ -602,7 +604,7 @@ static void interrupt_pci1710_every_sample(void *d)
 		return;
 		return;
 	}
 	}
 
 
-	outb(0, dev->iobase + PCI171x_CLRINT);	// clear our INT request
+	outb(0, dev->iobase + PCI171x_CLRINT);	/*  clear our INT request */
 
 
 	DPRINTK("FOR ");
 	DPRINTK("FOR ");
 	for (; !(inw(dev->iobase + PCI171x_STATUS) & Status_FE);) {
 	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 (this_board->cardtype != TYPE_PCI1713)
 			if ((sampl & 0xf000) !=
 			if ((sampl & 0xf000) !=
 				devpriv->act_chanlist[s->async->cur_chan]) {
 				devpriv->act_chanlist[s->async->cur_chan]) {
-				rt_printk
+				printk
 					("comedi: A/D data dropout: received data from channel %d, expected %d!\n",
 					("comedi: A/D data dropout: received data from channel %d, expected %d!\n",
 					(sampl & 0xf000) >> 12,
 					(sampl & 0xf000) >> 12,
 					(devpriv->act_chanlist[s->async->
 					(devpriv->act_chanlist[s->async->
@@ -637,11 +639,11 @@ static void interrupt_pci1710_every_sample(void *d)
 			s->async->cur_chan = 0;
 			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++;
 			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: 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");
 			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);
 				pci171x_ai_cancel(dev, s);
 				s->async->events |= COMEDI_CB_EOA;
 				s->async->events |= COMEDI_CB_EOA;
 				comedi_event(dev, s);
 				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");
 	DPRINTK("adv_pci1710 EDBG: END: interrupt_pci1710_every_sample(...)\n");
 
 
 	comedi_event(dev, s);
 	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 n, int turn)
 {
 {
 	int i, j;
 	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);
 		sampl = inw(dev->iobase + PCI171x_AD_DATA);
 		if (this_board->cardtype != TYPE_PCI1713)
 		if (this_board->cardtype != TYPE_PCI1713)
 			if ((sampl & 0xf000) != devpriv->act_chanlist[j]) {
 			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",
 					("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,
 					dev->minor, (sampl & 0xf000) >> 12,
 					(devpriv->
 					(devpriv->
@@ -714,7 +716,7 @@ static void interrupt_pci1710_half_fifo(void *d)
 	DPRINTK("adv_pci1710 EDBG: BGN: interrupt_pci1710_half_fifo(...)\n");
 	DPRINTK("adv_pci1710 EDBG: BGN: interrupt_pci1710_half_fifo(...)\n");
 	m = inw(dev->iobase + PCI171x_STATUS);
 	m = inw(dev->iobase + PCI171x_STATUS);
 	if (!(m & Status_FH)) {
 	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);
 			dev->minor, m);
 		pci171x_ai_cancel(dev, s);
 		pci171x_ai_cancel(dev, s);
 		s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
 		s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
@@ -722,7 +724,7 @@ static void interrupt_pci1710_half_fifo(void *d)
 		return;
 		return;
 	}
 	}
 	if (m & Status_FF) {
 	if (m & Status_FF) {
-		rt_printk
+		printk
 			("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n",
 			("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n",
 			dev->minor, m);
 			dev->minor, m);
 		pci171x_ai_cancel(dev, s);
 		pci171x_ai_cancel(dev, s);
@@ -751,7 +753,7 @@ static void interrupt_pci1710_half_fifo(void *d)
 			comedi_event(dev, s);
 			comedi_event(dev, s);
 			return;
 			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");
 	DPRINTK("adv_pci1710 EDBG: END: interrupt_pci1710_half_fifo(...)\n");
 
 
 	comedi_event(dev, s);
 	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;
 	struct comedi_device *dev = d;
 
 
 	DPRINTK("adv_pci1710 EDBG: BGN: interrupt_service_pci1710(%d,...)\n",
 	DPRINTK("adv_pci1710 EDBG: BGN: interrupt_service_pci1710(%d,...)\n",
 		irq);
 		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",
 	DPRINTK("adv_pci1710 EDBG: interrupt_service_pci1710() ST: %4x\n",
 		inw(dev->iobase + PCI171x_STATUS));
 		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->ai_et = 0;
 		devpriv->CntrlReg &= Control_CNT0;
 		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);
 		outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
 		devpriv->CntrlReg = devpriv->ai_et_CntrlReg;
 		devpriv->CntrlReg = devpriv->ai_et_CntrlReg;
 		outb(0, dev->iobase + PCI171x_CLRFIFO);
 		outb(0, dev->iobase + PCI171x_CLRFIFO);
 		outb(0, dev->iobase + PCI171x_CLRINT);
 		outb(0, dev->iobase + PCI171x_CLRINT);
 		outw(devpriv->ai_et_MuxVal, dev->iobase + PCI171x_MUX);
 		outw(devpriv->ai_et_MuxVal, dev->iobase + PCI171x_MUX);
 		outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
 		outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
-		// start pacer
+		/*  start pacer */
 		start_pacer(dev, 1, devpriv->ai_et_div1, devpriv->ai_et_div2);
 		start_pacer(dev, 1, devpriv->ai_et_div1, devpriv->ai_et_div2);
 		return IRQ_HANDLED;
 		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);
 		interrupt_pci1710_every_sample(d);
 	} else {
 	} else {
 		interrupt_pci1710_half_fifo(d);
 		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 divisor1, divisor2;
 	unsigned int seglen;
 	unsigned int seglen;
 
 
 	DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_docmd_and_mode(%d,...)\n",
 	DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_docmd_and_mode(%d,...)\n",
 		mode);
 		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,
 	seglen = check_channel_list(dev, s, devpriv->ai_chanlist,
 		devpriv->ai_n_chan);
 		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->neverending_ai = 0;
 
 
 	devpriv->CntrlReg &= Control_CNT0;
 	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;
 		devpriv->ai_eos = 1;
 	} else {
 	} else {
 		devpriv->CntrlReg |= Control_ONEFH;
 		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)) {
 	if ((devpriv->ai_scans == 0) || (devpriv->ai_scans == -1)) {
 		devpriv->neverending_ai = 1;
 		devpriv->neverending_ai = 1;
-	}			//well, user want neverending
+	}			/* well, user want neverending */
 	else {
 	else {
 		devpriv->neverending_ai = 0;
 		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);
 		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);
 		outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
 		if (mode != 2) {
 		if (mode != 2) {
-			// start pacer
+			/*  start pacer */
 			start_pacer(dev, mode, divisor1, divisor2);
 			start_pacer(dev, mode, divisor1, divisor2);
 		} else {
 		} else {
 			devpriv->ai_et_div1 = divisor1;
 			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);
 		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);
 		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);
 		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);
 		e, cmd->stop_arg, cmd->scan_end_arg, cmd->chanlist_len);
 }
 }
 #endif
 #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 err = 0;
 	int tmp, divisor1, divisor2;
 	int tmp, divisor1, divisor2;
@@ -1055,7 +1057,7 @@ static int pci171x_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic
 	if (cmd->chanlist) {
 	if (cmd->chanlist) {
 		if (!check_channel_list(dev, s, cmd->chanlist,
 		if (!check_channel_list(dev, s, cmd->chanlist,
 				cmd->chanlist_len))
 				cmd->chanlist_len))
-			return 5;	// incorrect channels list
+			return 5;	/*  incorrect channels list */
 	}
 	}
 
 
 	DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_cmdtest(...) ret=0\n");
 	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;
 	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;
 		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;
 			devpriv->ai_timer1 = cmd->convert_arg;
 			return pci171x_ai_docmd_and_mode(cmd->start_src ==
 			return pci171x_ai_docmd_and_mode(cmd->start_src ==
 				TRIG_EXT ? 2 : 1, dev, s);
 				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);
 			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.
  If it's ok, then program scan/gain logic.
  This works for all cards.
  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 *chanlist, unsigned int n_chan)
 {
 {
 	unsigned int chansegment[32];
 	unsigned int chansegment[32];
@@ -1118,12 +1120,12 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic
 	}
 	}
 
 
 	if (n_chan > 1) {
 	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])
 			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) {
 				if (CR_AREF(chanlist[i]) == AREF_DIFF) {
 					comedi_error(dev,
 					comedi_error(dev,
 						"Odd channel can't be differential input!\n");
 						"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;
 				(CR_CHAN(chansegment[i - 1]) + 1) % s->n_chan;
 			if (CR_AREF(chansegment[i - 1]) == AREF_DIFF)
 			if (CR_AREF(chansegment[i - 1]) == AREF_DIFF)
 				nowmustbechan = (nowmustbechan + 1) % s->n_chan;
 				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",
 					("channel list must be continous! chanlist[%i]=%d but must be %d or %d!\n",
 					i, CR_CHAN(chanlist[i]), nowmustbechan,
 					i, CR_CHAN(chanlist[i]), nowmustbechan,
 					CR_CHAN(chanlist[0]));
 					CR_CHAN(chanlist[0]));
 				return 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]) {
 			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",
 					("bad channel, reference or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n",
 					i, CR_CHAN(chansegment[i]),
 					i, CR_CHAN(chansegment[i]),
 					CR_RANGE(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_CHAN(chanlist[i % seglen]),
 					CR_RANGE(chanlist[i % seglen]),
 					CR_RANGE(chanlist[i % seglen]),
 					CR_AREF(chansegment[i % seglen]));
 					CR_AREF(chansegment[i % seglen]));
-				return 0;	// chan/gain list is strange
+				return 0;	/*  chan/gain list is strange */
 			}
 			}
 		}
 		}
 	} else {
 	} else {
@@ -1163,7 +1165,7 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic
 	return seglen;
 	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 *chanlist, unsigned int n_chan, unsigned int seglen)
 {
 {
 	unsigned int i, range, chanprog;
 	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;
 	devpriv->act_chanlist_pos = 0;
 
 
 	DPRINTK("SegLen: %d\n", seglen);
 	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])];
 		chanprog = muxonechan[CR_CHAN(chanlist[i])];
 		outw(chanprog, dev->iobase + PCI171x_MUX);	/* select channel */
 		outw(chanprog, dev->iobase + PCI171x_MUX);	/* select channel */
 		range = this_board->rangecode_ai[CR_RANGE(chanlist[i])];
 		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)
 	unsigned int divisor2)
 {
 {
 	DPRINTK("adv_pci1710 EDBG: BGN: start_pacer(%d,%u,%u)\n", mode,
 	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");
 	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_CNT0;
 		devpriv->CntrlReg |= Control_SW;
 		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);
 		start_pacer(dev, -1, 0, 0);
 		outb(0, dev->iobase + PCI171x_CLRFIFO);
 		outb(0, dev->iobase + PCI171x_CLRFIFO);
 		outb(0, dev->iobase + PCI171x_CLRINT);
 		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");
 	DPRINTK("adv_pci1710 EDBG: BGN: pci171x_reset(...)\n");
 	outw(0x30, dev->iobase + PCI171x_CNTCTRL);
 	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;
 	devpriv->da_ranges = 0;
 	if (this_board->n_aochan) {
 	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;
 		devpriv->ao_data[0] = 0x0000;
 		if (this_board->n_aochan > 1) {
 		if (this_board->n_aochan > 1) {
 			outw(0, dev->iobase + PCI171x_DA2);
 			outw(0, dev->iobase + PCI171x_DA2);
 			devpriv->ao_data[1] = 0x0000;
 			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");
 	DPRINTK("adv_pci1710 EDBG: END: pci171x_reset(...)\n");
 	return 0;
 	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");
 	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;
 	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_DA1);
 	outw(0x0800, dev->iobase + PCI1720_DA2);
 	outw(0x0800, dev->iobase + PCI1720_DA2);
 	outw(0x0800, dev->iobase + PCI1720_DA3);
 	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[0] = 0x0800;
 	devpriv->ao_data[1] = 0x0800;
 	devpriv->ao_data[1] = 0x0800;
 	devpriv->ao_data[2] = 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");
 	DPRINTK("adv_pci1710 EDBG: BGN: pci1710_reset(...)\n");
 	switch (this_board->cardtype) {
 	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;
 	struct comedi_subdevice *s;
 	int ret, subdev, n_subdevices;
 	int ret, subdev, n_subdevices;
@@ -1329,13 +1331,14 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 	int i;
 	int i;
 	int board_index;
 	int board_index;
 
 
-	rt_printk("comedi%d: adv_pci1710: ", dev->minor);
+	printk("comedi%d: adv_pci1710: ", dev->minor);
 
 
 	opt_bus = it->options[0];
 	opt_bus = it->options[0];
 	opt_slot = it->options[1];
 	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;
 		return -ENOMEM;
 	}
 	}
 
 
@@ -1345,20 +1348,20 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 	board_index = this_board - boardtypes;
 	board_index = this_board - boardtypes;
 	while (NULL != (pcidev = pci_get_device(PCI_VENDOR_ID_ADVANTECH,
 	while (NULL != (pcidev = pci_get_device(PCI_VENDOR_ID_ADVANTECH,
 		PCI_ANY_ID, pcidev))) {
 		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;
 					board_index = i;
 					break;
 					break;
 				}
 				}
 			}
 			}
-			if(i == n_boardtypes) continue;
+			if (i == n_boardtypes) continue;
 		}else
 		}else
 		{
 		{
-			if(pcidev->device != boardtypes[board_index].device_id) continue;
+			if (pcidev->device != boardtypes[board_index].device_id) continue;
 		}
 		}
 
 
 		/* Found matching vendor/device. */
 		/* 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!";
 			errstr = "failed to enable PCI device and request regions!";
 			continue;
 			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];
 		dev->board_ptr = &boardtypes[board_index];
 		break;
 		break;
 	}
 	}
 
 
 	if (!pcidev) {
 	if (!pcidev) {
 		if (opt_bus || opt_slot) {
 		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);
 				opt_bus, opt_slot, errstr);
 		} else {
 		} else {
-			rt_printk(" - Card %s\n", errstr);
+			printk(" - Card %s\n", errstr);
 		}
 		}
 		return -EIO;
 		return -EIO;
 	}
 	}
@@ -1397,7 +1400,7 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 	irq = pcidev->irq;
 	irq = pcidev->irq;
 	iobase = pci_resource_start(pcidev, 2);
 	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);
 		iobase);
 
 
 	dev->iobase = iobase;
 	dev->iobase = iobase;
@@ -1417,8 +1420,9 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 	if (this_board->n_counter)
 	if (this_board->n_counter)
 		n_subdevices++;
 		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;
 		return ret;
 	}
 	}
 
 
@@ -1426,18 +1430,18 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig *
 
 
 	if (this_board->have_irq) {
 	if (this_board->have_irq) {
 		if (irq) {
 		if (irq) {
-			if (comedi_request_irq(irq, interrupt_service_pci1710,
+			if (request_irq(irq, interrupt_service_pci1710,
 					IRQF_SHARED, "Advantech PCI-1710",
 					IRQF_SHARED, "Advantech PCI-1710",
 					dev)) {
 					dev)) {
-				rt_printk
+				printk
 					(", unable to allocate IRQ %d, DISABLING IT",
 					(", unable to allocate IRQ %d, DISABLING IT",
 					irq);
 					irq);
 				irq = 0;	/* Can't use IRQ */
 				irq = 0;	/* Can't use IRQ */
 			} else {
 			} else {
-				rt_printk(", irq=%u", irq);
+				printk(", irq=%u", irq);
 			}
 			}
 		} else {
 		} else {
-			rt_printk(", IRQ disabled");
+			printk(", IRQ disabled");
 		}
 		}
 	} else {
 	} else {
 		irq = 0;
 		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_cmdtest = pci171x_ai_cmdtest;
 			s->do_cmd = pci171x_ai_cmd;
 			s->do_cmd = pci171x_ai_cmd;
 		}
 		}
-		devpriv->i8254_osc_base = 100;	// 100ns=10MHz
+		devpriv->i8254_osc_base = 100;	/*  100ns=10MHz */
 		subdev++;
 		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 (dev->private) {
 		if (devpriv->valid)
 		if (devpriv->valid)
 			pci1710_reset(dev);
 			pci1710_reset(dev);
 		if (dev->irq)
 		if (dev->irq)
-			comedi_free_irq(dev->irq, dev);
+			free_irq(dev->irq, dev);
 		if (devpriv->pcidev) {
 		if (devpriv->pcidev) {
 			if (dev->iobase) {
 			if (dev->iobase) {
 				comedi_pci_disable(devpriv->pcidev);
 				comedi_pci_disable(devpriv->pcidev);

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

@@ -54,7 +54,7 @@ TODO:
 
 
 #define ADVANTECH_VENDOR        0x13fe	/* Advantech PCI vendor ID */
 #define ADVANTECH_VENDOR        0x13fe	/* Advantech PCI vendor ID */
 
 
-// hardware types of the cards
+/* hardware types of the cards */
 #define TYPE_PCI1723 0
 #define TYPE_PCI1723 0
 
 
 #define IORANGE_1723  0x2A
 #define IORANGE_1723  0x2A
@@ -92,7 +92,7 @@ TODO:
 
 
 #define PCI1723_SELECT_CALIBRATION 0x28	/* Select the calibration Ref_V */
 #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, {
 static const struct comedi_lrange range_pci1723 = { 1, {
 			BIP_RANGE(10)
 			BIP_RANGE(10)
@@ -104,27 +104,27 @@ static const struct comedi_lrange range_pci1723 = { 1, {
  */
  */
 struct pci1723_board {
 struct pci1723_board {
 	const char *name;
 	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 device_id;
 	int iorange;
 	int iorange;
 	char cardtype;
 	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[] = {
 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 board, and also about the kernel module that contains
  * the device code.
  * 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))
 #define n_boardtypes (sizeof(boardtypes)/sizeof(struct pci1723_board))
 
 
 static struct comedi_driver driver_pci1723 = {
 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. */
 /* this structure is for data unique to this hardware driver. */
 struct pci1723_private {
 struct pci1723_private {
-	int valid;		//card is usable;
+	int valid;		/* card is usable; */
 
 
 	struct pci_dev *pcidev;
 	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
 /*the following macro to make it easy to
@@ -175,35 +175,35 @@ struct pci1723_private {
 /*
 /*
  *   the pci1723 card reset;
  *   the pci1723 card reset;
  */
  */
-static int pci1723_reset(struct comedi_device * dev)
+static int pci1723_reset(struct comedi_device *dev)
 {
 {
 	int i;
 	int i;
 	DPRINTK("adv_pci1723 EDBG: BGN: pci1723_reset(...)\n");
 	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++) {
 	for (i = 0; i < 8; i++) {
-		// set all outputs to 0V
+		/*  set all outputs to 0V */
 		devpriv->ao_data[i] = 0x8000;
 		devpriv->ao_data[i] = 0x8000;
 		outw(devpriv->ao_data[i], dev->iobase + PCI1723_DA(i));
 		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;
 		devpriv->da_range[i] = 0;
 		outw(((devpriv->da_range[i] << 4) | i),
 		outw(((devpriv->da_range[i] << 4) | i),
 			PCI1723_RANGE_CALIBRATION_MODE);
 			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);
 	outw(0, dev->iobase + PCI1723_SYN_SET);
 
 
 	DPRINTK("adv_pci1723 EDBG: END: pci1723_reset(...)\n");
 	DPRINTK("adv_pci1723 EDBG: END: pci1723_reset(...)\n");
 	return 0;
 	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;
 	int n, chan;
 
 
@@ -218,8 +218,8 @@ static int pci1723_insn_read_ao(struct comedi_device * dev, struct comedi_subdev
 /*
 /*
   analog data output;
   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;
 	int n, chan;
 	chan = CR_CHAN(insn->chanspec);
 	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
   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 mask;
 	unsigned int bits;
 	unsigned int bits;
@@ -265,12 +265,12 @@ static int pci1723_dio_insn_config(struct comedi_device * dev, struct comedi_sub
 		return -EINVAL;
 		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)
 	if ((s->io_bits & 0x00FF) == 0)
-		dio_mode |= 0x0001;	// low byte input
+		dio_mode |= 0x0001;	/*  low byte input */
 	if ((s->io_bits & 0xFF00) == 0)
 	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);
 	outw(dio_mode, dev->iobase + PCI1723_DIGITAL_IO_PORT_SET);
 	return 1;
 	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
   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]) {
 	if (data[0]) {
 		s->state &= ~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
  * Attach is called by the Comedi core to configure the driver
  * for a pci1723 board.
  * 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;
 	struct comedi_subdevice *s;
 	int ret, subdev, n_subdevices;
 	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;
 	int opt_bus, opt_slot;
 	const char *errstr;
 	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);
 		this_board->name);
 
 
 	opt_bus = it->options[0];
 	opt_bus = it->options[0];
 	opt_slot = it->options[1];
 	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;
 		return -ENOMEM;
 	}
 	}
 
 
@@ -341,10 +342,10 @@ static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig *
 
 
 	if (!pcidev) {
 	if (!pcidev) {
 		if (opt_bus || opt_slot) {
 		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);
 				opt_bus, opt_slot, errstr);
 		} else {
 		} else {
-			rt_printk(" - Card %s\n", errstr);
+			printk(" - Card %s\n", errstr);
 		}
 		}
 		return -EIO;
 		return -EIO;
 	}
 	}
@@ -354,7 +355,7 @@ static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig *
 	pci_func = PCI_FUNC(pcidev->devfn);
 	pci_func = PCI_FUNC(pcidev->devfn);
 	iobase = pci_resource_start(pcidev, 2);
 	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);
 		iobase);
 
 
 	dev->iobase = iobase;
 	dev->iobase = iobase;
@@ -369,8 +370,9 @@ static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig *
 	if (this_board->n_diochan)
 	if (this_board->n_diochan)
 		n_subdevices++;
 		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;
 		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_write = pci1723_ao_write_winsn;
 		s->insn_read = pci1723_insn_read_ao;
 		s->insn_read = pci1723_insn_read_ao;
 
 
-		// read DIO config
+		/*  read DIO config */
 		switch (inw(dev->iobase + PCI1723_DIGITAL_IO_PORT_MODE) & 0x03) {
 		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;
 			s->io_bits = 0xFFFF;
 			break;
 			break;
-		case 0x01:	// low byte input, high byte output
+		case 0x01:	/*  low byte input, high byte output */
 			s->io_bits = 0xFF00;
 			s->io_bits = 0xFF00;
 			break;
 			break;
-		case 0x02:	// low byte output, high byte input
+		case 0x02:	/*  low byte output, high byte input */
 			s->io_bits = 0x00FF;
 			s->io_bits = 0x00FF;
 			break;
 			break;
-		case 0x03:	// low byte input, high byte input
+		case 0x03:	/*  low byte input, high byte input */
 			s->io_bits = 0x0000;
 			s->io_bits = 0x0000;
 			break;
 			break;
 		}
 		}
-		// read DIO port state
+		/*  read DIO port state */
 		s->state = inw(dev->iobase + PCI1723_READ_DIGITAL_INPUT_DATA);
 		s->state = inw(dev->iobase + PCI1723_READ_DIGITAL_INPUT_DATA);
 
 
 		subdev++;
 		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
  * allocated by _attach().  dev->private and dev->subdevices are
  * deallocated automatically by the core.
  * 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);
 	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
 #undef DPRINTK
 #ifdef PCI_DIO_EXTDEBUG
 #ifdef PCI_DIO_EXTDEBUG
-#define DPRINTK(fmt, args...) rt_printk(fmt, ## args)
+#define DPRINTK(fmt, args...) printk(fmt, ## args)
 #else
 #else
 #define DPRINTK(fmt, args...)
 #define DPRINTK(fmt, args...)
 #endif
 #endif
@@ -183,8 +183,8 @@ enum hw_io_access {
 
 
 #define OMBCMD_RETRY	0x03	/* 3 times try request before error */
 #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 {
 struct diosubd_data {
 	int chans;		/*  num of chans */
 	int chans;		/*  num of chans */
@@ -323,10 +323,10 @@ static const struct dio_boardtype boardtypes[] = {
 #define n_boardtypes (sizeof(boardtypes)/sizeof(struct dio_boardtype))
 #define n_boardtypes (sizeof(boardtypes)/sizeof(struct dio_boardtype))
 
 
 static struct comedi_driver driver_pci_dio = {
 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 {
 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;
 	const struct diosubd_data *d = (const struct diosubd_data *)s->private;
 	int i;
 	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;
 	const struct diosubd_data *d = (const struct diosubd_data *)s->private;
 	int i;
 	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;
 	const struct diosubd_data *d = (const struct diosubd_data *)s->private;
 	int i;
 	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;
 	const struct diosubd_data *d = (const struct diosubd_data *)s->private;
 	int i;
 	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)
 	unsigned char *omb, unsigned char *imb, int repeats)
 {
 {
 	int cnt, tout, ok = 0;
 	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[2], dev->iobase + OMB2);
 		outb(omb[3], dev->iobase + OMB3);
 		outb(omb[3], dev->iobase + OMB3);
 		for (tout = 0; tout < 251; tout++) {
 		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[0] = inb(dev->iobase + IMB0);
 				imb[1] = inb(dev->iobase + IMB1);
 				imb[1] = inb(dev->iobase + IMB1);
 				imb[3] = inb(dev->iobase + IMB3);
 				imb[3] = inb(dev->iobase + IMB3);
 				ok = 1;
 				ok = 1;
 				break;
 				break;
 			}
 			}
-			comedi_udelay(1);
+			udelay(1);
 		}
 		}
 		if (ok)
 		if (ok)
 			return 0;
 			return 0;
@@ -460,7 +461,7 @@ static int pci1760_unchecked_mbxrequest(struct comedi_device * dev,
 	return -ETIME;
 	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 omb[4] = { 0x0, 0x0, CMD_ClearIMB2, 0x0 };
 	unsigned char imb[4];
 	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);
 	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)
 	unsigned char *omb, unsigned char *imb)
 {
 {
 	if (omb[2] == CMD_ClearIMB2) {
 	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);
 	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;
 	int ret;
 	unsigned char omb[4] = {
 	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];
 		s->state |= (data[0] & data[1]);
 		s->state |= (data[0] & data[1]);
 		omb[0] = s->state;
 		omb[0] = s->state;
-		if (!(ret = pci1760_mbxrequest(dev, omb, imb)))
+		ret = pci1760_mbxrequest(dev, omb, imb);
+		if (!ret)
 			return ret;
 			return ret;
 	}
 	}
 	data[1] = s->state;
 	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;
 	int ret, n;
 	unsigned char omb[4] = {
 	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];
 	unsigned char imb[4];
 
 
 	for (n = 0; n < insn->n; n++) {
 	for (n = 0; n < insn->n; n++) {
-		if (!(ret = pci1760_mbxrequest(dev, omb, imb)))
+		ret = pci1760_mbxrequest(dev, omb, imb);
+		if (!ret)
 			return ret;
 			return ret;
 		data[n] = (imb[1] << 8) + imb[0];
 		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;
 	int ret;
 	unsigned char chan = CR_CHAN(insn->chanspec) & 0x07;
 	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];
 	unsigned char imb[4];
 
 
 	if (devpriv->CntResValue[chan] != (data[0] & 0xffff)) {	/*  Set reset value if different */
 	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;
 			return ret;
 		devpriv->CntResValue[chan] = data[0] & 0xffff;
 		devpriv->CntResValue[chan] = data[0] & 0xffff;
 	}
 	}
 
 
 	omb[0] = bitmask;	/*  reset counter to it reset value */
 	omb[0] = bitmask;	/*  reset counter to it reset value */
 	omb[2] = CMD_ResetIDICounters;
 	omb[2] = CMD_ResetIDICounters;
-	if (!(ret = pci1760_mbxrequest(dev, omb, imb)))
+	ret = pci1760_mbxrequest(dev, omb, imb);
+	if (!ret)
 		return ret;
 		return ret;
 
 
 	if (!(bitmask & devpriv->IDICntEnable)) {	/*  start counter if it don't run */
 	if (!(bitmask & devpriv->IDICntEnable)) {	/*  start counter if it don't run */
 		omb[0] = bitmask;
 		omb[0] = bitmask;
 		omb[2] = CMD_EnableIDICounters;
 		omb[2] = CMD_EnableIDICounters;
-		if (!(ret = pci1760_mbxrequest(dev, omb, imb)))
+		ret = pci1760_mbxrequest(dev, omb, imb);
+		if (!ret)
 			return ret;
 			return ret;
 		devpriv->IDICntEnable |= bitmask;
 		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;
 	int i;
 	unsigned char omb[4] = { 0x00, 0x00, 0x00, 0x00 };
 	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");
 	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;
 	struct comedi_subdevice *s;
 	int subdev = 0;
 	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->type = COMEDI_SUBD_DI;
 	s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON | d->specflags;
 	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->type = COMEDI_SUBD_DO;
 	s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
 	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_dev *pcidev)
 {
 {
 	struct pci_dio_private *pr, *prev;
 	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;
 	struct comedi_subdevice *s;
 	int ret, subdev, n_subdevices, i, j;
 	int ret, subdev, n_subdevices, i, j;
 	unsigned long iobase;
 	unsigned long iobase;
 	struct pci_dev *pcidev;
 	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;
 		return -ENOMEM;
 	}
 	}
 
 
@@ -925,18 +932,18 @@ static int pci_dio_attach(struct comedi_device * dev, struct comedi_devconfig *
 	}
 	}
 
 
 	if (!dev->board_ptr) {
 	if (!dev->board_ptr) {
-		rt_printk
+		printk
 			(", Error: Requested type of the card was not found!\n");
 			(", Error: Requested type of the card was not found!\n");
 		return -EIO;
 		return -EIO;
 	}
 	}
 
 
 	if (comedi_pci_enable(pcidev, driver_pci_dio.driver_name)) {
 	if (comedi_pci_enable(pcidev, driver_pci_dio.driver_name)) {
-		rt_printk
+		printk
 			(", Error: Can't enable PCI device and request regions!\n");
 			(", Error: Can't enable PCI device and request regions!\n");
 		return -EIO;
 		return -EIO;
 	}
 	}
 	iobase = pci_resource_start(pcidev, this_board->main_pci_region);
 	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),
 		pcidev->bus->number, PCI_SLOT(pcidev->devfn),
 		PCI_FUNC(pcidev->devfn), iobase);
 		PCI_FUNC(pcidev->devfn), iobase);
 
 
@@ -959,12 +966,13 @@ static int pci_dio_attach(struct comedi_device * dev, struct comedi_devconfig *
 			n_subdevices++;
 			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;
 		return ret;
 	}
 	}
 
 
-	rt_printk(".\n");
+	printk(".\n");
 
 
 	subdev = 0;
 	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;
 	int i, j;
 	struct comedi_subdevice *s;
 	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[] = {
 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)
 #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)
 #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;
 	int n;
 	unsigned char control =
 	unsigned char control =
 		ADC_MODE_NORMAL |
 		ADC_MODE_NORMAL |
 		(CR_RANGE(insn->chanspec) << 3) | CR_CHAN(insn->chanspec);
 		(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);
 	inb(dev->iobase + AIO12_8_STATUS);
 
 
 	for (n = 0; n < insn->n; n++) {
 	for (n = 0; n < insn->n; n++) {
 		int timeout = 5;
 		int timeout = 5;
 
 
-		// Setup and start conversion
+		/*  Setup and start conversion */
 		outb(control, dev->iobase + AIO12_8_ADC);
 		outb(control, dev->iobase + AIO12_8_ADC);
 
 
-		// Wait for conversion to complete
+		/*  Wait for conversion to complete */
 		while (timeout &&
 		while (timeout &&
 			!(inb(dev->iobase + AIO12_8_STATUS) & STATUS_ADC_EOC)) {
 			!(inb(dev->iobase + AIO12_8_STATUS) & STATUS_ADC_EOC)) {
 			timeout--;
 			timeout--;
 			printk("timeout %d\n", timeout);
 			printk("timeout %d\n", timeout);
-			comedi_udelay(1);
+			udelay(1);
 		}
 		}
 		if (timeout == 0) {
 		if (timeout == 0) {
 			comedi_error(dev, "ADC timeout");
 			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;
 	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 i;
 	int val = devpriv->ao_readback[CR_CHAN(insn->chanspec)];
 	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;
 	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 i;
 	int chan = CR_CHAN(insn->chanspec);
 	int chan = CR_CHAN(insn->chanspec);
 	unsigned long port = dev->iobase + AIO12_8_DAC_0 + (2 * chan);
 	unsigned long port = dev->iobase + AIO12_8_DAC_0 + (2 * chan);
 
 
-	//enable DACs
+	/* enable DACs */
 	outb(0x01, dev->iobase + DAC_ENABLE);
 	outb(0x01, dev->iobase + DAC_ENABLE);
 
 
 	for (i = 0; i < insn->n; i++) {
 	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];
 		devpriv->ao_readback[chan] = data[i];
 	}
 	}
 	return insn->n;
 	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;
 	int iobase;
 	struct comedi_subdevice *s;
 	struct comedi_subdevice *s;
@@ -205,7 +205,7 @@ static int aio_aio12_8_attach(struct comedi_device * dev, struct comedi_devconfi
 	return 0;
 	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]);
 	subdev_8255_cleanup(dev, &dev->subdevices[2]);
 	if (dev->iobase)
 	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 = {
 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);
 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[] = {
 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)
 #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)
 #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 = {
 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;
 	int iobase;
 	struct comedi_subdevice *s;
 	struct comedi_subdevice *s;
@@ -132,7 +132,7 @@ static int aio_iiro_16_attach(struct comedi_device * dev, struct comedi_devconfi
 	return 1;
 	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);
 	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;
 	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)
 	if (insn->n != 2)
 		return -EINVAL;
 		return -EINVAL;
@@ -161,8 +161,8 @@ static int aio_iiro_16_dio_insn_bits_write(struct comedi_device * dev,
 	return 2;
 	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)
 	if (insn->n != 2)
 		return -EINVAL;
 		return -EINVAL;

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

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

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.