diff options
Diffstat (limited to 'drivers/staging/comedi/drivers')
67 files changed, 2155 insertions, 1667 deletions
diff --git a/drivers/staging/comedi/drivers/8253.h b/drivers/staging/comedi/drivers/8253.h index 0bb35db..3eb45d4 100644 --- a/drivers/staging/comedi/drivers/8253.h +++ b/drivers/staging/comedi/drivers/8253.h @@ -214,7 +214,8 @@ static inline void i8253_cascade_ns_to_timer_2div(int i8253_osc_base, #ifndef CMDTEST /* i8254_load programs 8254 counter chip. It should also work for the 8253. - * base_address is the lowest io address for the chip (the address of counter 0). + * base_address is the lowest io address + * for the chip (the address of counter 0). * counter_number is the counter you want to load (0,1 or 2) * count is the number to load into the counter. * diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 2d54993..fe63830 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -82,6 +82,7 @@ I/O port base address can be found in the output of 'lspci -v'. #include <linux/ioport.h> #include <linux/slab.h> +#include "8255.h" #define _8255_SIZE 4 @@ -395,8 +396,6 @@ static int dev_8255_attach(struct comedi_device *dev, unsigned long iobase; int i; - printk("comedi%d: 8255:", dev->minor); - dev->board_name = "8255"; for (i = 0; i < COMEDI_NDEVCONFOPTS; i++) { @@ -405,13 +404,20 @@ static int dev_8255_attach(struct comedi_device *dev, break; } if (i == 0) { - printk(" no devices specified\n"); + printk(KERN_WARNING + "comedi%d: 8255: no devices specified\n", dev->minor); return -EINVAL; } ret = alloc_subdevices(dev, i); - if (ret < 0) + if (ret < 0) { + /* FIXME this printk call should give a proper message, the + * below line just maintains previous functionality */ + printk("comedi%d: 8255:", dev->minor); return ret; + } + + printk(KERN_INFO "comedi%d: 8255:", dev->minor); for (i = 0; i < dev->n_subdevices; i++) { iobase = it->options[i]; @@ -438,7 +444,7 @@ static int dev_8255_detach(struct comedi_device *dev) unsigned long iobase; struct comedi_subdevice *s; - printk("comedi%d: 8255: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: 8255: remove\n", dev->minor); for (i = 0; i < dev->n_subdevices; i++) { s = dev->subdevices + i; diff --git a/drivers/staging/comedi/drivers/8255.h b/drivers/staging/comedi/drivers/8255.h index 02c5a36..b6314c9 100644 --- a/drivers/staging/comedi/drivers/8255.h +++ b/drivers/staging/comedi/drivers/8255.h @@ -26,8 +26,6 @@ #include "../comedidev.h" -#if defined(CONFIG_COMEDI_8255) || defined(CONFIG_COMEDI_8255_MODULE) - int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, int (*cb) (int, int, int, unsigned long), unsigned long arg); @@ -38,24 +36,4 @@ void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice *s); void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice *s); -#else - -static inline int subdev_8255_init(struct comedi_device *dev, - struct comedi_subdevice *s, void *x, - unsigned long y) -{ - printk("8255 support not configured -- disabling subdevice\n"); - - s->type = COMEDI_SUBD_UNUSED; - - return 0; -} - -static inline void subdev_8255_cleanup(struct comedi_device *dev, - struct comedi_subdevice *s) -{ -} - -#endif - #endif diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index df2854d..5ccf246 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -2,132 +2,137 @@ # # Comedi "helper" modules -obj-$(CONFIG_COMEDI) += comedi_fc.o -obj-$(CONFIG_COMEDI) += comedi_bond.o -obj-$(CONFIG_COMEDI) += comedi_test.o -obj-$(CONFIG_COMEDI) += comedi_parport.o obj-$(CONFIG_COMEDI) += pcm_common.o +# Comedi misc drivers +obj-$(CONFIG_COMEDI_BOND) += comedi_bond.o +obj-$(CONFIG_COMEDI_TEST) += comedi_test.o +obj-$(CONFIG_COMEDI_PARPORT) += comedi_parport.o +obj-$(CONFIG_COMEDI_SERIAL2002) += serial2002.o +obj-$(CONFIG_COMEDI_SKEL) += skel.o + +# Comedi ISA drivers +obj-$(CONFIG_COMEDI_8255) += 8255.o +obj-$(CONFIG_COMEDI_ACL7225B) += acl7225b.o +obj-$(CONFIG_COMEDI_PCL711) += pcl711.o +obj-$(CONFIG_COMEDI_PCL724) += pcl724.o +obj-$(CONFIG_COMEDI_PCL725) += pcl725.o +obj-$(CONFIG_COMEDI_PCL726) += pcl726.o +obj-$(CONFIG_COMEDI_PCL730) += pcl730.o +obj-$(CONFIG_COMEDI_PCL812) += pcl812.o +obj-$(CONFIG_COMEDI_PCL816) += pcl816.o +obj-$(CONFIG_COMEDI_PCL818) += pcl818.o +obj-$(CONFIG_COMEDI_PCM3724) += pcm3724.o +obj-$(CONFIG_COMEDI_PCM3730) += pcm3730.o +obj-$(CONFIG_COMEDI_RTI800) += rti800.o +obj-$(CONFIG_COMEDI_RTI802) += rti802.o +obj-$(CONFIG_COMEDI_DAS08) += das08.o +obj-$(CONFIG_COMEDI_DAS16M1) += das16m1.o +obj-$(CONFIG_COMEDI_DAS16) += das16.o +obj-$(CONFIG_COMEDI_DAS800) += das800.o +obj-$(CONFIG_COMEDI_DAS1800) += das1800.o +obj-$(CONFIG_COMEDI_DAS6402) += das6402.o +obj-$(CONFIG_COMEDI_DT2801) += dt2801.o +obj-$(CONFIG_COMEDI_DT2811) += dt2811.o +obj-$(CONFIG_COMEDI_DT2814) += dt2814.o +obj-$(CONFIG_COMEDI_DT2815) += dt2815.o +obj-$(CONFIG_COMEDI_DT2817) += dt2817.o +obj-$(CONFIG_COMEDI_DT282X) += dt282x.o +obj-$(CONFIG_COMEDI_DMM32AT) += dmm32at.o +obj-$(CONFIG_COMEDI_FL512) += fl512.o +obj-$(CONFIG_COMEDI_AIO_AIO12_8) += aio_aio12_8.o +obj-$(CONFIG_COMEDI_AIO_IIRO_16) += aio_iiro_16.o +obj-$(CONFIG_COMEDI_C6XDIGIO) += c6xdigio.o +obj-$(CONFIG_COMEDI_MPC624) += mpc624.o +obj-$(CONFIG_COMEDI_ADQ12B) += adq12b.o +obj-$(CONFIG_COMEDI_NI_AT_A2150) += ni_at_a2150.o +obj-$(CONFIG_COMEDI_NI_AT_AO) += ni_at_ao.o +obj-$(CONFIG_COMEDI_NI_ATMIO) += ni_atmio.o +obj-$(CONFIG_COMEDI_NI_ATMIO16D) += ni_atmio16d.o +obj-$(CONFIG_COMEDI_PCMAD) += pcmad.o +obj-$(CONFIG_COMEDI_PCMDA12) += pcmda12.o +obj-$(CONFIG_COMEDI_PCMMIO) += pcmmio.o +obj-$(CONFIG_COMEDI_PCMUIO) += pcmuio.o +obj-$(CONFIG_COMEDI_MULTIQ3) += multiq3.o +obj-$(CONFIG_COMEDI_POC) += poc.o + # Comedi PCI drivers obj-$(CONFIG_COMEDI_PCI_DRIVERS) += 8255.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += acl7225b.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_035.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_1032.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_1500.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_1516.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_1564.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_16xx.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_2016.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_2032.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_2200.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_3001.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_3120.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_3501.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_3xxx.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci6208.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci7296.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci7432.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci8164.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci9111.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci9118.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adq12b.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adv_pci1710.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adv_pci1723.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adv_pci_dio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += aio_aio12_8.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += aio_iiro_16.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += amplc_dio200.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += amplc_pc236.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += amplc_pc263.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += amplc_pci224.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += amplc_pci230.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += c6xdigio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcidas64.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcidas.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcidda.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcidio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcimdas.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcimdda.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += comedi_bond.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += comedi_parport.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += comedi_test.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += contec_pci_dio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += daqboard2000.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das08.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das16m1.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das16.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das1800.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das6402.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das800.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dmm32at.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt2801.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt2811.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt2814.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt2815.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt2817.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt282x.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt3000.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += fl512.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += gsc_hpdi.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += icp_multi.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ii_pci20kc.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += jr3_pci.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ke_counter.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += me4000.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += me_daq.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += mite.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += mpc624.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += multiq3.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_6527.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_65xx.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_660x.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_670x.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_at_a2150.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_at_ao.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_atmio16d.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_atmio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_labpc.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_pcidio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_pcimio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_tiocmd.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_tio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl711.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl724.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl725.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl726.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl730.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl812.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl816.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl818.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcm3724.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcm3730.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcmad.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcmda12.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcmmio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcmuio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += poc.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += rtd520.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += rti800.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += rti802.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += s526.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += s626.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += serial2002.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += skel.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ssv_dnp.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += unioxx5.o +obj-$(CONFIG_COMEDI_ADDI_APCI_035) += addi_apci_035.o +obj-$(CONFIG_COMEDI_ADDI_APCI_1032) += addi_apci_1032.o +obj-$(CONFIG_COMEDI_ADDI_APCI_1500) += addi_apci_1500.o +obj-$(CONFIG_COMEDI_ADDI_APCI_1516) += addi_apci_1516.o +obj-$(CONFIG_COMEDI_ADDI_APCI_1564) += addi_apci_1564.o +obj-$(CONFIG_COMEDI_ADDI_APCI_16XX) += addi_apci_16xx.o +obj-$(CONFIG_COMEDI_ADDI_APCI_2016) += addi_apci_2016.o +obj-$(CONFIG_COMEDI_ADDI_APCI_2032) += addi_apci_2032.o +obj-$(CONFIG_COMEDI_ADDI_APCI_2200) += addi_apci_2200.o +obj-$(CONFIG_COMEDI_ADDI_APCI_3001) += addi_apci_3001.o +obj-$(CONFIG_COMEDI_ADDI_APCI_3120) += addi_apci_3120.o +obj-$(CONFIG_COMEDI_ADDI_APCI_3501) += addi_apci_3501.o +obj-$(CONFIG_COMEDI_ADDI_APCI_3XXX) += addi_apci_3xxx.o +obj-$(CONFIG_COMEDI_ADL_PCI6208) += adl_pci6208.o +obj-$(CONFIG_COMEDI_ADL_PCI7230) += adl_pci7230.o +obj-$(CONFIG_COMEDI_ADL_PCI7296) += adl_pci7296.o +obj-$(CONFIG_COMEDI_ADL_PCI7432) += adl_pci7432.o +obj-$(CONFIG_COMEDI_ADL_PCI8164) += adl_pci8164.o +obj-$(CONFIG_COMEDI_ADL_PCI9111) += adl_pci9111.o +obj-$(CONFIG_COMEDI_ADL_PCI9118) += adl_pci9118.o +obj-$(CONFIG_COMEDI_ADV_PCI1710) += adv_pci1710.o +obj-$(CONFIG_COMEDI_ADV_PCI1723) += adv_pci1723.o +obj-$(CONFIG_COMEDI_ADV_PCI_DIO) += adv_pci_dio.o +obj-$(CONFIG_COMEDI_AMPLC_DIO200) += amplc_dio200.o +obj-$(CONFIG_COMEDI_AMPLC_PC236) += amplc_pc236.o +obj-$(CONFIG_COMEDI_AMPLC_PC263) += amplc_pc263.o +obj-$(CONFIG_COMEDI_AMPLC_PCI224) += amplc_pci224.o +obj-$(CONFIG_COMEDI_AMPLC_PCI230) += amplc_pci230.o +obj-$(CONFIG_COMEDI_CONTEC_PCI_DIO) += contec_pci_dio.o +obj-$(CONFIG_COMEDI_DT3000) += dt3000.o +obj-$(CONFIG_COMEDI_UNIOXX5) += unioxx5.o +obj-$(CONFIG_COMEDI_GSC_HPDI) += gsc_hpdi.o +obj-$(CONFIG_COMEDI_ICP_MULTI) += icp_multi.o +obj-$(CONFIG_COMEDI_II_PCI20KC) += ii_pci20kc.o +obj-$(CONFIG_COMEDI_DAQBOARD2000) += daqboard2000.o +obj-$(CONFIG_COMEDI_JR3_PCI) += jr3_pci.o +obj-$(CONFIG_COMEDI_KE_COUNTER) += ke_counter.o +obj-$(CONFIG_COMEDI_CB_PCIDAS64) += cb_pcidas64.o +obj-$(CONFIG_COMEDI_CB_PCIDAS) += cb_pcidas.o +obj-$(CONFIG_COMEDI_CB_PCIDDA) += cb_pcidda.o +obj-$(CONFIG_COMEDI_CB_PCIDIO) += cb_pcidio.o +obj-$(CONFIG_COMEDI_CB_PCIMDAS) += cb_pcimdas.o +obj-$(CONFIG_COMEDI_CB_PCIMDDA) += cb_pcimdda.o +obj-$(CONFIG_COMEDI_ME4000) += me4000.o +obj-$(CONFIG_COMEDI_ME_DAQ) += me_daq.o +obj-$(CONFIG_COMEDI_NI_6527) += ni_6527.o +obj-$(CONFIG_COMEDI_NI_65XX) += ni_65xx.o +obj-$(CONFIG_COMEDI_NI_660X) += ni_660x.o +obj-$(CONFIG_COMEDI_NI_670X) += ni_670x.o +obj-$(CONFIG_COMEDI_NI_PCIDIO) += ni_pcidio.o +obj-$(CONFIG_COMEDI_NI_PCIMIO) += ni_pcimio.o +obj-$(CONFIG_COMEDI_RTD520) += rtd520.o +obj-$(CONFIG_COMEDI_S526) += s526.o +obj-$(CONFIG_COMEDI_S626) += s626.o +obj-$(CONFIG_COMEDI_SSV_DNP) += ssv_dnp.o # Comedi PCMCIA drivers -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += cb_das16_cs.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += das08_cs.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += ni_daq_700.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += ni_daq_dio24.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += ni_labpc_cs.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += ni_mio_cs.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += quatech_daqp_cs.o +obj-$(CONFIG_COMEDI_CB_DAS16_CS) += cb_das16_cs.o +obj-$(CONFIG_COMEDI_DAS08_CS) += das08_cs.o +obj-$(CONFIG_COMEDI_NI_DAQ_700_CS) += ni_daq_700.o +obj-$(CONFIG_COMEDI_NI_DAQ_DIO24_CS) += ni_daq_dio24.o +obj-$(CONFIG_COMEDI_NI_LABPC_CS) += ni_labpc_cs.o +obj-$(CONFIG_COMEDI_NI_MIO_CS) += ni_mio_cs.o +obj-$(CONFIG_COMEDI_QUATECH_DAQP_CS) += quatech_daqp_cs.o # Comedi USB drivers -obj-$(CONFIG_COMEDI_USB_DRIVERS) += dt9812.o -obj-$(CONFIG_COMEDI_USB_DRIVERS) += usbdux.o -obj-$(CONFIG_COMEDI_USB_DRIVERS) += usbduxfast.o -obj-$(CONFIG_COMEDI_USB_DRIVERS) += vmk80xx.o +obj-$(CONFIG_COMEDI_DT9812) += dt9812.o +obj-$(CONFIG_COMEDI_USBDUX) += usbdux.o +obj-$(CONFIG_COMEDI_USBDUXFAST) += usbduxfast.o +obj-$(CONFIG_COMEDI_VMK80XX) += vmk80xx.o + +# Comedi NI drivers +obj-$(CONFIG_COMEDI_MITE) += mite.o +obj-$(CONFIG_COMEDI_NI_TIO) += ni_tio.o +obj-$(CONFIG_COMEDI_NI_TIO) += ni_tiocmd.o +obj-$(CONFIG_COMEDI_NI_LABPC) += ni_labpc.o +obj-$(CONFIG_COMEDI_FC) += comedi_fc.o diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h index f96b128..c3284eb 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h @@ -212,7 +212,7 @@ struct pcilst_struct { }; /* ptr to root list of all amcc devices */ -struct pcilst_struct *amcc_devices; +static struct pcilst_struct *amcc_devices; static const int i_ADDIDATADeviceID[] = { 0x15B8, 0x10E8 }; @@ -260,12 +260,10 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display) for (i_Count = 0; i_Count < 2; i_Count++) { pci_vendor = i_ADDIDATADeviceID[i_Count]; if (pcidev->vendor == pci_vendor) { - amcc = kmalloc(sizeof(*amcc), GFP_KERNEL); + amcc = kzalloc(sizeof(*amcc), GFP_KERNEL); if (amcc == NULL) continue; - memset(amcc, 0, sizeof(*amcc)); - amcc->pcidev = pcidev; if (last) last->next = amcc; diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 6625fdc..2c98641 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -293,8 +293,8 @@ static const struct addi_board boardtypes[] = { 0, 0, 0, - 0, - 0, + NULL, + NULL, 32, 0, 0, @@ -2527,7 +2527,7 @@ static const struct addi_board boardtypes[] = { #define n_boardtypes (sizeof(boardtypes)/sizeof(struct addi_board)) -struct comedi_driver driver_addi = { +static struct comedi_driver driver_addi = { .driver_name = "addi_common", .module = THIS_MODULE, .attach = i_ADDI_Attach, @@ -2639,9 +2639,8 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->ps_BoardInfo = this_board; devpriv->i_IobaseReserved = (int) io_addr[3]; printk("\nioremap begin"); - devpriv->dw_AiBase = - (unsigned long) ioremap(io_addr[3], - this_board->i_IorangeBase3); + devpriv->dw_AiBase = ioremap(io_addr[3], + this_board->i_IorangeBase3); printk("\nioremap end"); } @@ -2952,7 +2951,7 @@ static int i_ADDI_Detach(struct comedi_device *dev) devpriv->ui_DmaBufferPages[1]); } } else { - iounmap((void *)devpriv->dw_AiBase); + iounmap(devpriv->dw_AiBase); if (devpriv->allocated) { i_pci_card_free(devpriv->amcc); diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index caeb6fd..1a28169 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -351,7 +351,7 @@ struct addi_private { int i_IobaseAmcc; /* base+size for AMCC chip */ int i_IobaseAddon; /* addon base address */ int i_IobaseReserved; - unsigned long dw_AiBase; + void __iomem *dw_AiBase; struct pcilst_struct *amcc; /* ptr too AMCC data */ unsigned char allocated; /* we have blocked card */ unsigned char b_ValidDriver; /* driver is ok */ diff --git a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h index 49141b3..349e93c 100644 --- a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h +++ b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h @@ -253,12 +253,10 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display) pci_for_each_dev(pcidev) { if (pcidev->vendor == pci_vendor) { - amcc = kmalloc(sizeof(*amcc), GFP_KERNEL); + amcc = kzalloc(sizeof(*amcc), GFP_KERNEL); if (amcc == NULL) continue; - memset(amcc, 0, sizeof(*amcc)); - amcc->pcidev = pcidev; if (last) { last->next = amcc; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c index 7912972..1369e22 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c @@ -52,9 +52,9 @@ You should also find the complete GPL in the COPYING file accompanying this sour +----------------------------------------------------------------------------+ */ #include "hwdrv_apci035.h" -int i_WatchdogNbr = 0; -int i_Temp = 0; -int i_Flag = 1; +static int i_WatchdogNbr = 0; +static int i_Temp = 0; +static int i_Flag = 1; /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI035_ConfigTimerWatchdog | diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h index e0023c8..68db9c1 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h @@ -19,22 +19,8 @@ #define APCI035_BOARD_VENDOR_ID 0x15B8 #define APCI035_ADDRESS_RANGE 255 -int i_TW_Number; -struct { - int i_Gain; - int i_Polarity; - int i_OffsetRange; - int i_Coupling; - int i_SingleDiff; - int i_AutoCalibration; - unsigned int ui_ReloadValue; - unsigned int ui_TimeUnitReloadVal; - int i_Interrupt; - int i_ModuleSelection; -} Config_Parameters_Main; - /* ANALOG INPUT RANGE */ -struct comedi_lrange range_apci035_ai = { 8, { +static struct comedi_lrange range_apci035_ai = { 8, { BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(2), diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c index fe06789..faea003 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c @@ -53,8 +53,8 @@ You should also find the complete GPL in the COPYING file accompanying this sour */ #include "hwdrv_apci1032.h" #include <linux/delay.h> -/* Global variables */ -unsigned int ui_InterruptStatus; + +static unsigned int ui_InterruptStatus; /* +----------------------------------------------------------------------------+ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c index d5e06ad..b3b9218 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c @@ -47,16 +47,16 @@ You should also find the complete GPL in the COPYING file accompanying this sour */ #include "hwdrv_apci1500.h" -int i_TimerCounter1Init = 0; -int i_TimerCounter2Init = 0; -int i_WatchdogCounter3Init = 0; -int i_Event1Status = 0, i_Event2Status = 0; -int i_TimerCounterWatchdogInterrupt = 0; -int i_Logic = 0, i_CounterLogic = 0; -int i_InterruptMask = 0; -int i_InputChannel = 0; -int i_TimerCounter1Enabled = 0, i_TimerCounter2Enabled = - 0, i_WatchdogCounter3Enabled = 0; +static int i_TimerCounter1Init = 0; +static int i_TimerCounter2Init = 0; +static int i_WatchdogCounter3Init = 0; +static int i_Event1Status = 0, i_Event2Status = 0; +static int i_TimerCounterWatchdogInterrupt = 0; +static int i_Logic = 0, i_CounterLogic = 0; +static int i_InterruptMask = 0; +static int i_InputChannel = 0; +static int i_TimerCounter1Enabled = 0, i_TimerCounter2Enabled = 0, + i_WatchdogCounter3Enabled = 0; /* +----------------------------------------------------------------------------+ @@ -136,9 +136,10 @@ int i_TimerCounter1Enabled = 0, i_TimerCounter2Enabled = | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_PatternPolarity = 0, i_PatternTransition = 0, i_PatternMask = 0; int i_MaxChannel = 0, i_Count = 0, i_EventMask = 0; @@ -519,8 +520,10 @@ int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_Event1InterruptStatus = 0, i_Event2InterruptStatus = 0, i_RegValue; @@ -784,8 +787,10 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_Initialisation(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_Initialisation(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_DummyRead = 0; /******************/ @@ -956,9 +961,10 @@ int i_APCI1500_Initialisation(struct comedi_device *dev, struct comedi_subdevice | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ReadMoreDigitalInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { unsigned int ui_PortValue = data[1]; unsigned int ui_Mask = 0; @@ -1040,8 +1046,10 @@ int i_APCI1500_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_sub | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { devpriv->b_OutputMemoryStatus = data[0]; return insn->n; @@ -1066,9 +1074,10 @@ int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device *dev, | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_WriteDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { static unsigned int ui_Temp = 0; unsigned int ui_Temp1; @@ -1260,9 +1269,10 @@ int i_APCI1500_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_TimerCounterMode, i_MasterConfiguration; @@ -1860,8 +1870,10 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_CommandAndStatusValue; @@ -2181,9 +2193,10 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device *dev, | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_CommandAndStatusValue; switch (data[0]) { @@ -2370,8 +2383,10 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_ReadInterruptMask(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ReadInterruptMask(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { data[0] = i_InterruptMask; data[1] = i_InputChannel; @@ -2401,8 +2416,10 @@ int i_APCI1500_ReadInterruptMask(struct comedi_device *dev, struct comedi_subdev | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_ConfigureInterrupt(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ConfigureInterrupt(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { unsigned int ui_Status; int i_RegValue; @@ -2821,8 +2838,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_Reset(struct comedi_device *dev) +static int i_APCI1500_Reset(struct comedi_device *dev) { int i_DummyRead = 0; i_TimerCounter1Init = 0; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 4413279..4299ff5 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -56,8 +56,8 @@ You should also find the complete GPL in the COPYING file accompanying this sour #include "hwdrv_apci1564.h" /* Global variables */ -unsigned int ui_InterruptStatus_1564 = 0; -unsigned int ui_InterruptData, ui_Type; +static unsigned int ui_InterruptStatus_1564 = 0; +static unsigned int ui_InterruptData, ui_Type; /* +----------------------------------------------------------------------------+ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c index 2d32516..d7d2223 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c @@ -53,7 +53,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour */ #include "hwdrv_apci2032.h" -unsigned int ui_InterruptData, ui_Type; +static unsigned int ui_InterruptData, ui_Type; /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2032_ConfigDigitalOutput | diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h index c456d75..743523e 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h @@ -32,7 +32,7 @@ #define MODE0 0 #define MODE1 1 /* ANALOG OUTPUT RANGE */ -struct comedi_lrange range_apci3501_ao = { 2, { +static struct comedi_lrange range_apci3501_ao = { 2, { BIP_RANGE(10), UNI_RANGE(10) } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c index 3692326..2e20bc7 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c @@ -67,10 +67,9 @@ You should also find the complete GPL in the COPYING file accompanying this sour | 1 : Conversion started | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev) +static int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev) { - if ((readl((void *)(devpriv->dw_AiBase + 8)) & 0x80000UL) == 0x80000UL) + if ((readl(devpriv->dw_AiBase + 8) & 0x80000UL) == 0x80000UL) return 1; else return 0; @@ -104,9 +103,10 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev) | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_TimeBase = 0; @@ -204,19 +204,14 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, /* Set the convert timing unit */ /*******************************/ - writel((unsigned int) - b_TimeBase, - (void *) - (devpriv-> - dw_AiBase - + - 36)); + writel((unsigned int)b_TimeBase, + devpriv->dw_AiBase + 36); /**************************/ /* Set the convert timing */ /*************************/ - writel(dw_ReloadValue, (void *)(devpriv->dw_AiBase + 32)); + writel(dw_ReloadValue, devpriv->dw_AiBase + 32); } else { /**************************/ /* Any conversion started */ @@ -294,9 +289,10 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; @@ -354,9 +350,10 @@ int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec); @@ -422,26 +419,20 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, /* Clear the FIFO */ /******************/ - writel(0x10000UL, - (void *)(devpriv->dw_AiBase + - 12)); + writel(0x10000UL, devpriv->dw_AiBase + 12); /*******************************/ /* Get and save the delay mode */ /*******************************/ - dw_Temp = - readl((void *)(devpriv-> - dw_AiBase + 4)); + dw_Temp = readl(devpriv->dw_AiBase + 4); dw_Temp = dw_Temp & 0xFFFFFEF0UL; /***********************************/ /* Channel configuration selection */ /***********************************/ - writel(dw_Temp, - (void *)(devpriv->dw_AiBase + - 4)); + writel(dw_Temp, devpriv->dw_AiBase + 4); /**************************/ /* Make the configuration */ @@ -458,35 +449,28 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, /***************************/ writel(dw_Configuration, - (void *)(devpriv->dw_AiBase + - 0)); + devpriv->dw_AiBase + 0); /*********************/ /* Channel selection */ /*********************/ writel(dw_Temp | 0x100UL, - (void *)(devpriv->dw_AiBase + - 4)); + devpriv->dw_AiBase + 4); writel((unsigned int) b_Channel, - (void *)(devpriv->dw_AiBase + - 0)); + devpriv->dw_AiBase + 0); /***********************/ /* Restaure delay mode */ /***********************/ - writel(dw_Temp, - (void *)(devpriv->dw_AiBase + - 4)); + writel(dw_Temp, devpriv->dw_AiBase + 4); /***********************************/ /* Set the number of sequence to 1 */ /***********************************/ - writel(1, - (void *)(devpriv->dw_AiBase + - 48)); + writel(1, devpriv->dw_AiBase + 48); /***************************/ /* Save the interrupt flag */ @@ -514,50 +498,29 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, /* Start the conversion */ /************************/ - writel(0x80000UL, - (void *) - (devpriv-> - dw_AiBase - + 8)); + writel(0x80000UL, devpriv->dw_AiBase + 8); /****************/ /* Wait the EOS */ /****************/ do { - dw_Temp = - readl( - (void *) - (devpriv-> - dw_AiBase - + - 20)); - dw_Temp = - dw_Temp - & 1; + dw_Temp = readl(devpriv->dw_AiBase + 20); + dw_Temp = dw_Temp & 1; } while (dw_Temp != 1); /*************************/ /* Read the analog value */ /*************************/ - data[dw_AcquisitionCpt] - = - (unsigned int) - readl((void - *) - (devpriv-> - dw_AiBase - + 28)); + data[dw_AcquisitionCpt] = (unsigned int)readl(devpriv->dw_AiBase + 28); } } else { /************************/ /* Start the conversion */ /************************/ - writel(0x180000UL, - (void *)(devpriv-> - dw_AiBase + 8)); + writel(0x180000UL, devpriv->dw_AiBase + 8); } } else { /**************************/ @@ -603,7 +566,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, +----------------------------------------------------------------------------+ */ -void v_APCI3XXX_Interrupt(int irq, void *d) +static void v_APCI3XXX_Interrupt(int irq, void *d) { struct comedi_device *dev = d; unsigned char b_CopyCpt = 0; @@ -613,13 +576,13 @@ void v_APCI3XXX_Interrupt(int irq, void *d) /* Test if interrupt occur */ /***************************/ - dw_Status = readl((void *)(devpriv->dw_AiBase + 16)); + dw_Status = readl(devpriv->dw_AiBase + 16); if ( (dw_Status & 0x2UL) == 0x2UL) { /***********************/ /* Reset the interrupt */ /***********************/ - writel(dw_Status, (void *)(devpriv->dw_AiBase + 16)); + writel(dw_Status, devpriv->dw_AiBase + 16); /*****************************/ /* Test if interrupt enabled */ @@ -634,8 +597,7 @@ void v_APCI3XXX_Interrupt(int irq, void *d) b_CopyCpt < devpriv->ui_AiNbrofChannels; b_CopyCpt++) { devpriv->ui_AiReadData[b_CopyCpt] = - (unsigned int) readl((void *)(devpriv-> - dw_AiBase + 28)); + (unsigned int)readl(devpriv->dw_AiBase + 28); } /**************************/ @@ -682,9 +644,10 @@ void v_APCI3XXX_Interrupt(int irq, void *d) | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); @@ -710,24 +673,21 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, /* Set the range selection */ /***************************/ - writel(b_Range, - (void *)(devpriv->dw_AiBase + 96)); + writel(b_Range, devpriv->dw_AiBase + 96); /**************************************************/ /* Write the analog value to the selected channel */ /**************************************************/ writel((data[0] << 8) | b_Channel, - (void *)(devpriv->dw_AiBase + 100)); + devpriv->dw_AiBase + 100); /****************************/ /* Wait the end of transfer */ /****************************/ do { - dw_Status = - readl((void *)(devpriv-> - dw_AiBase + 96)); + dw_Status = readl(devpriv->dw_AiBase + 96); } while ((dw_Status & 0x100) != 0x100); } else { /***************************/ @@ -788,9 +748,10 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Command = 0; @@ -916,9 +877,10 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_ChannelCpt = 0; @@ -1071,9 +1033,10 @@ int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); int i_ReturnValue = insn->n; @@ -1184,9 +1147,10 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); @@ -1296,8 +1260,10 @@ 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) +static int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); @@ -1354,8 +1320,10 @@ int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned int dw_Temp = 0; @@ -1407,8 +1375,10 @@ int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_ChannelCpt = 0; @@ -1503,8 +1473,10 @@ 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) +static int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Channel = CR_CHAN(insn->chanspec); @@ -1578,8 +1550,10 @@ 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) +static int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Channel = CR_CHAN(insn->chanspec); @@ -1636,7 +1610,7 @@ int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_Reset(struct comedi_device *dev) +static int i_APCI3XXX_Reset(struct comedi_device *dev) { unsigned char b_Cpt = 0; @@ -1656,27 +1630,26 @@ int i_APCI3XXX_Reset(struct comedi_device *dev) /* Clear the start command */ /***************************/ - writel(0, (void *)(devpriv->dw_AiBase + 8)); + writel(0, devpriv->dw_AiBase + 8); /*****************************/ /* Reset the interrupt flags */ /*****************************/ - writel(readl((void *)(devpriv->dw_AiBase + 16)), - (void *)(devpriv->dw_AiBase + 16)); + writel(readl(devpriv->dw_AiBase + 16), devpriv->dw_AiBase + 16); /*****************/ /* clear the EOS */ /*****************/ - readl((void *)(devpriv->dw_AiBase + 20)); + readl(devpriv->dw_AiBase + 20); /******************/ /* Clear the FIFO */ /******************/ for (b_Cpt = 0; b_Cpt < 16; b_Cpt++) { - readl((void *)(devpriv->dw_AiBase + 28)); + readl(devpriv->dw_AiBase + 28); } /************************/ diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 6925faa..712b9e0 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -54,7 +54,7 @@ References: #include "../comedidev.h" #include "comedi_pci.h" -#define PCI6208_DRIVER_NAME "adl_pci6208" +#define PCI6208_DRIVER_NAME "adl_pci6208" /* Board descriptions */ struct pci6208_board { @@ -134,10 +134,10 @@ 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_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_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data); */ /* @@ -268,7 +268,7 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, * This allows packed reading/writing of the DIO channels. The * comedi core can convert between insn_bits and insn_read/write */ /* static int pci6208_dio_insn_bits(struct comedi_device *dev, - * struct comedi_subdevice *s, */ + * struct comedi_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data) */ /* { */ /* if(insn->n!=2)return -EINVAL; */ @@ -293,7 +293,7 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, /* } */ /* static int pci6208_dio_insn_config(struct comedi_device *dev, - * struct comedi_subdevice *s, */ + * struct comedi_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data) */ /* { */ /* int chan=CR_CHAN(insn->chanspec); */ diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c new file mode 100644 index 0000000..24a82eb --- /dev/null +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -0,0 +1,206 @@ +/* + comedi/drivers/adl_pci7230.c + + Hardware comedi driver fot PCI7230 Adlink card + Copyright (C) 2010 David Fernandez <dfcastelao@gmail.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 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. + +*/ +/* +Driver: adl_pci7230 +Description: Driver for the Adlink PCI-7230 32 ch. isolated digital io board +Devices: [ADLink] PCI-7230 (adl_pci7230) +Author: David Fernandez <dfcastelao@gmail.com> +Status: experimental +Updated: Mon, 14 Apr 2008 15:08:14 +0100 + +Configuration Options: + [0] - PCI bus of device (optional) + [1] - PCI slot of device (optional) + If bus/slot is not specified, the first supported + PCI device found will be used. +*/ + +#include "../comedidev.h" +#include <linux/kernel.h> +#include "comedi_pci.h" + +#define PCI7230_DI 0x00 +#define PCI7230_DO 0x00 + +#define PCI_DEVICE_ID_PCI7230 0x7230 + +static DEFINE_PCI_DEVICE_TABLE(adl_pci7230_pci_table) = { + { + PCI_VENDOR_ID_ADLINK, + PCI_DEVICE_ID_PCI7230, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + 0 + }, + {0} +}; + +MODULE_DEVICE_TABLE(pci, adl_pci7230_pci_table); + +struct adl_pci7230_private { + int data; + struct pci_dev *pci_dev; +}; + +#define devpriv ((struct adl_pci7230_private *)dev->private) + +static int adl_pci7230_attach(struct comedi_device *dev, + struct comedi_devconfig *it); +static int adl_pci7230_detach(struct comedi_device *dev); +static struct comedi_driver driver_adl_pci7230 = { + .driver_name = "adl_pci7230", + .module = THIS_MODULE, + .attach = adl_pci7230_attach, + .detach = adl_pci7230_detach, +}; + +/* Digital IO */ + +static int adl_pci7230_di_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data); + +static int adl_pci7230_do_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data); + +static int adl_pci7230_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev; + struct comedi_subdevice *s; + int bus, slot; + + printk(KERN_INFO "comedi%d: adl_pci7230\n", dev->minor); + + dev->board_name = "pci7230"; + bus = it->options[0]; + slot = it->options[1]; + + if (alloc_private(dev, sizeof(struct adl_pci7230_private)) < 0) + return -ENOMEM; + + if (alloc_subdevices(dev, 2) < 0) + return -ENOMEM; + + for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); + pcidev != NULL; + pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + + if (pcidev->vendor == PCI_VENDOR_ID_ADLINK && + pcidev->device == PCI_DEVICE_ID_PCI7230) { + if (bus || slot) { + /* requested particular bus/slot */ + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) { + continue; + } + } + devpriv->pci_dev = pcidev; + break; + } + } + if (pcidev == NULL) { + printk(KERN_ERR "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", + dev->minor, bus, slot); + return -EIO; + } + if (comedi_pci_enable(pcidev, "adl_pci7230") < 0) { + printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", + dev->minor); + return -EIO; + } + dev->iobase = pci_resource_start(pcidev, 2); + printk(KERN_DEBUG "comedi: base addr %4lx\n", dev->iobase); + + s = dev->subdevices + 0; + /* Isolated do */ + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = adl_pci7230_do_insn_bits; + + s = dev->subdevices + 1; + /* Isolated di */ + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = adl_pci7230_di_insn_bits; + + printk(KERN_DEBUG "comedi: attached\n"); + + return 1; +} + +static int adl_pci7230_detach(struct comedi_device *dev) +{ + printk(KERN_DEBUG "comedi%d: pci7230: remove\n", dev->minor); + + if (devpriv && devpriv->pci_dev) { + if (dev->iobase) + comedi_pci_disable(devpriv->pci_dev); + pci_dev_put(devpriv->pci_dev); + } + + return 0; +} + +static int adl_pci7230_do_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + if (insn->n != 2) + return -EINVAL; + + if (data[0]) { + s->state &= ~data[0]; + s->state |= (data[0] & data[1]); + + outl((s->state << 16) & 0xffffffff, dev->iobase + PCI7230_DO); + } + + return 2; +} + +static int adl_pci7230_di_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + if (insn->n != 2) + return -EINVAL; + + data[1] = inl(dev->iobase + PCI7230_DI) & 0xffffffff; + + return 2; +} + +COMEDI_PCI_INITCLEANUP(driver_adl_pci7230, adl_pci7230_pci_table); diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index da172a5..36a254c 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -358,8 +358,8 @@ struct pci9111_private_data { int ao_readback; /* Last written analog output data */ - int timer_divisor_1; /* Divisor values for the 8254 timer pacer */ - int timer_divisor_2; + unsigned int timer_divisor_1; /* Divisor values for the 8254 timer pacer */ + unsigned int timer_divisor_2; int is_valid; /* Is device valid */ @@ -585,19 +585,17 @@ pci9111_ai_do_cmd_test(struct comedi_device *dev, (cmd->scan_begin_src != TRIG_EXT)) error++; - if ((cmd->convert_src != TRIG_TIMER) && (cmd->convert_src != TRIG_EXT)) { + if ((cmd->convert_src != TRIG_TIMER) && (cmd->convert_src != TRIG_EXT)) error++; - } if ((cmd->convert_src == TRIG_TIMER) && !((cmd->scan_begin_src == TRIG_TIMER) || - (cmd->scan_begin_src == TRIG_FOLLOW))) { + (cmd->scan_begin_src == TRIG_FOLLOW))) error++; - } if ((cmd->convert_src == TRIG_EXT) && !((cmd->scan_begin_src == TRIG_EXT) || - (cmd->scan_begin_src == TRIG_FOLLOW))) { + (cmd->scan_begin_src == TRIG_FOLLOW))) error++; - } + if (cmd->scan_end_src != TRIG_COUNT) error++; @@ -1067,9 +1065,8 @@ static int pci9111_ai_insn_read(struct comedi_device *dev, pci9111_ai_channel_set(CR_CHAN((&insn->chanspec)[0])); - if ((pci9111_ai_range_get()) != CR_RANGE((&insn->chanspec)[0])) { + if ((pci9111_ai_range_get()) != CR_RANGE((&insn->chanspec)[0])) pci9111_ai_range_set(CR_RANGE((&insn->chanspec)[0])); - } pci9111_fifo_reset(); @@ -1090,11 +1087,10 @@ static int pci9111_ai_insn_read(struct comedi_device *dev, conversion_done: - if (resolution == PCI9111_HR_AI_RESOLUTION) { + if (resolution == PCI9111_HR_AI_RESOLUTION) data[i] = pci9111_hr_ai_get_data(); - } else { + else data[i] = pci9111_ai_get_data(); - } } #ifdef AI_INSN_DEBUG @@ -1131,9 +1127,8 @@ static int pci9111_ao_insn_read(struct comedi_device *dev, { int i; - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = dev_private->ao_readback & PCI9111_AO_RESOLUTION_MASK; - } return i; } @@ -1222,9 +1217,8 @@ static int pci9111_attach(struct comedi_device *dev, int error, i; const struct pci9111_board *board; - if (alloc_private(dev, sizeof(struct pci9111_private_data)) < 0) { + if (alloc_private(dev, sizeof(struct pci9111_private_data)) < 0) return -ENOMEM; - } /* Probe the device to determine what device in the series it is. */ printk("comedi%d: " PCI9111_DRIVER_NAME " driver\n", dev->minor); @@ -1275,9 +1269,6 @@ found: /* TODO: Warn about non-tested boards. */ - switch (board->device_id) { - }; - /* Read local configuration register base address [PCI_BASE_ADDRESS #1]. */ lcr_io_base = pci_resource_start(pci_device, 1); @@ -1387,21 +1378,19 @@ static int pci9111_detach(struct comedi_device *dev) { /* Reset device */ - if (dev->private != 0) { + if (dev->private != NULL) { if (dev_private->is_valid) pci9111_reset(dev); } /* Release previously allocated irq */ - if (dev->irq != 0) { + if (dev->irq != 0) free_irq(dev->irq, dev); - } - if (dev_private != 0 && dev_private->pci_device != 0) { - if (dev->iobase) { + if (dev_private != NULL && dev_private->pci_device != NULL) { + if (dev->iobase) comedi_pci_disable(dev_private->pci_device); - } pci_dev_put(dev_private->pci_device); } diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 944f20a..ccef549 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -44,26 +44,25 @@ c) If isn't used DMA then you can use only mode where Configuration options: [0] - PCI bus of device (optional) [1] - PCI slot of device (optional) - If bus/slot is not specified, then first available PCI - card will be used. + If bus/slot is not specified, then first available PCI + card will be used. [2] - 0= standard 8 DIFF/16 SE channels configuration - n= external multiplexer connected, 1<=n<=256 + n = external multiplexer connected, 1 <= n <= 256 [3] - 0=autoselect DMA or EOC interrupts operation - 1=disable DMA mode - 3=disable DMA and INT, only insn interface will work + 1 = disable DMA mode + 3 = disable DMA and INT, only insn interface will work [4] - sample&hold signal - card can generate signal for external S&H board - 0=use SSHO (pin 45) signal is generated in onboard hardware S&H logic - 0!=use ADCHN7 (pin 23) signal is generated from driver, number - say how long delay is requested in ns and sign polarity of the hold - (in this case external multiplexor can serve only 128 channels) + 0 = use SSHO(pin 45) signal is generated in onboard hardware S&H logic + 0 != use ADCHN7(pin 23) signal is generated from driver, number say how + long delay is requested in ns and sign polarity of the hold + (in this case external multiplexor can serve only 128 channels) [5] - 0=stop measure on all hardware errors - 2|=ignore ADOR - A/D Overrun status + 2 | = ignore ADOR - A/D Overrun status 8|=ignore Bover - A/D Burst Mode Overrun status 256|=ignore nFull - A/D FIFO Full status */ #include "../comedidev.h" -#include "../pci_ids.h" #include <linux/delay.h> #include <linux/gfp.h> @@ -74,10 +73,18 @@ Configuration options: #include "comedi_pci.h" #include "comedi_fc.h" +#define PCI_VENDOR_ID_AMCC 0x10e8 + /* paranoid checks are broken */ -#undef PCI9118_PARANOIDCHECK /* if defined, then is used code which control correct channel number on every 12 bit sample */ +#undef PCI9118_PARANOIDCHECK /* + * if defined, then is used code which control + * correct channel number on every 12 bit sample + */ -#undef PCI9118_EXTDEBUG /* if defined then driver prints a lot of messages */ +#undef PCI9118_EXTDEBUG /* + * if defined then driver prints + * a lot of messages + */ #undef DPRINTK #ifdef PCI9118_EXTDEBUG @@ -87,7 +94,10 @@ Configuration options: #endif #define IORANGE_9118 64 /* I hope */ -#define PCI9118_CHANLEN 255 /* len of chanlist, some source say 256, but reality looks like 255 :-( */ +#define PCI9118_CHANLEN 255 /* + * len of chanlist, some source say 256, + * but reality looks like 255 :-( + */ #define PCI9118_CNT0 0x00 /* R/W: 8254 counter 0 */ #define PCI9118_CNT1 0x04 /* R/W: 8254 counter 0 */ @@ -113,20 +123,47 @@ Configuration options: #define AdControl_UniP 0x80 /* 1=bipolar, 0=unipolar */ #define AdControl_Diff 0x40 /* 1=differential, 0= single end inputs */ #define AdControl_SoftG 0x20 /* 1=8254 counter works, 0=counter stops */ -#define AdControl_ExtG 0x10 /* 1=8254 countrol controlled by TGIN(pin 46), 0=controled by SoftG */ -#define AdControl_ExtM 0x08 /* 1=external hardware trigger (pin 44), 0=internal trigger */ -#define AdControl_TmrTr 0x04 /* 1=8254 is iternal trigger source, 0=software trigger is source (register PCI9118_SOFTTRG) */ +#define AdControl_ExtG 0x10 /* + * 1=8254 countrol controlled by TGIN(pin 46), + * 0=controlled by SoftG + */ +#define AdControl_ExtM 0x08 /* + * 1=external hardware trigger (pin 44), + * 0=internal trigger + */ +#define AdControl_TmrTr 0x04 /* + * 1=8254 is iternal trigger source, + * 0=software trigger is source + * (register PCI9118_SOFTTRG) + */ #define AdControl_Int 0x02 /* 1=enable INT, 0=disable */ #define AdControl_Dma 0x01 /* 1=enable DMA, 0=disable */ /* bits from A/D function register (PCI9118_ADFUNC) */ -#define AdFunction_PDTrg 0x80 /* 1=positive, 0=negative digital trigger (only positive is correct) */ -#define AdFunction_PETrg 0x40 /* 1=positive, 0=negative external trigger (only positive is correct) */ +#define AdFunction_PDTrg 0x80 /* + * 1=positive, + * 0=negative digital trigger + * (only positive is correct) + */ +#define AdFunction_PETrg 0x40 /* + * 1=positive, + * 0=negative external trigger + * (only positive is correct) + */ #define AdFunction_BSSH 0x20 /* 1=with sample&hold, 0=without */ #define AdFunction_BM 0x10 /* 1=burst mode, 0=normal mode */ -#define AdFunction_BS 0x08 /* 1=burst mode start, 0=burst mode stop */ -#define AdFunction_PM 0x04 /* 1=post trigger mode, 0=not post trigger */ -#define AdFunction_AM 0x02 /* 1=about trigger mode, 0=not about trigger */ +#define AdFunction_BS 0x08 /* + * 1=burst mode start, + * 0=burst mode stop + */ +#define AdFunction_PM 0x04 /* + * 1=post trigger mode, + * 0=not post trigger + */ +#define AdFunction_AM 0x02 /* + * 1=about trigger mode, + * 0=not about trigger + */ #define AdFunction_Start 0x01 /* 1=trigger start, 0=trigger stop */ /* bits from A/D status register (PCI9118_ADSTAT) */ @@ -178,30 +215,39 @@ static const struct comedi_lrange range_pci9118hg = { 8, { } }; -#define PCI9118_BIPOLAR_RANGES 4 /* used for test on mixture of BIP/UNI ranges */ +#define PCI9118_BIPOLAR_RANGES 4 /* + * used for test on mixture + * of BIP/UNI ranges + */ static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it); static int pci9118_detach(struct comedi_device *dev); struct boardtype { - const char *name; /* board name */ - int vendor_id; /* PCI vendor a device ID of card */ + const char *name; /* board name */ + int vendor_id; /* PCI vendor a device ID of card */ int device_id; - int iorange_amcc; /* iorange for own S5933 region */ - int iorange_9118; /* pass thru card region size */ - int n_aichan; /* num of A/D chans */ - int n_aichand; /* num of A/D chans in diff mode */ - int mux_aichan; /* num of A/D chans with external multiplexor */ - int n_aichanlist; /* len of chanlist */ - int n_aochan; /* num of D/A chans */ - int ai_maxdata; /* resolution of A/D */ - int ao_maxdata; /* resolution of D/A */ - const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ - const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ - unsigned int ai_ns_min; /* max sample speed of card v ns */ - unsigned int ai_pacer_min; /* minimal pacer value (c1*c2 or c1 in burst) */ - int half_fifo_size; /* size of FIFO/2 */ + int iorange_amcc; /* iorange for own S5933 region */ + int iorange_9118; /* pass thru card region size */ + int n_aichan; /* num of A/D chans */ + int n_aichand; /* num of A/D chans in diff mode */ + int mux_aichan; /* + * num of A/D chans with + * external multiplexor + */ + int n_aichanlist; /* len of chanlist */ + int n_aochan; /* num of D/A chans */ + int ai_maxdata; /* resolution of A/D */ + int ao_maxdata; /* resolution of D/A */ + const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ + const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ + unsigned int ai_ns_min; /* max sample speed of card v ns */ + unsigned int ai_pacer_min; /* + * minimal pacer value + * (c1*c2 or c1 in burst) + */ + int half_fifo_size; /* size of FIFO/2 */ }; @@ -246,63 +292,113 @@ static struct comedi_driver driver_pci9118 = { COMEDI_PCI_INITCLEANUP(driver_pci9118, pci9118_pci_table); struct pci9118_private { - unsigned long iobase_a; /* base+size for AMCC chip */ - unsigned int master; /* master capable */ - struct pci_dev *pcidev; /* ptr to actual pcidev */ - unsigned int usemux; /* we want to use external multiplexor! */ + unsigned long iobase_a; /* base+size for AMCC chip */ + unsigned int master; /* master capable */ + struct pci_dev *pcidev; /* ptr to actual pcidev */ + unsigned int usemux; /* we want to use external multiplexor! */ #ifdef PCI9118_PARANOIDCHECK - unsigned short chanlist[PCI9118_CHANLEN + 1]; /* list of scaned channel */ - unsigned char chanlistlen; /* number of scanlist */ + unsigned short chanlist[PCI9118_CHANLEN + 1]; /* + * list of + * scanned channel + */ + unsigned char chanlistlen; /* number of scanlist */ #endif - unsigned char AdControlReg; /* A/D control register */ - unsigned char IntControlReg; /* Interrupt control register */ - unsigned char AdFunctionReg; /* A/D function register */ - char valid; /* driver is ok */ - char ai_neverending; /* we do unlimited AI */ - unsigned int i8254_osc_base; /* frequence of onboard oscilator */ - unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */ - unsigned int ai_act_scan; /* how many scans we finished */ - unsigned int ai_buf_ptr; /* data buffer ptr in samples */ - unsigned int ai_n_chan; /* how many channels is measured */ - unsigned int ai_n_scanlen; /* len of actual scanlist */ - unsigned int ai_n_realscanlen; /* what we must transfer for one outgoing scan include front/back adds */ - unsigned int ai_act_dmapos; /* position in actual real stream */ - unsigned int ai_add_front; /* how many channels we must add before scan to satisfy S&H? */ - unsigned int ai_add_back; /* how many channels we must add before scan to satisfy DMA? */ - unsigned int *ai_chanlist; /* actaul chanlist */ + unsigned char AdControlReg; /* A/D control register */ + unsigned char IntControlReg; /* Interrupt control register */ + unsigned char AdFunctionReg; /* A/D function register */ + char valid; /* driver is ok */ + char ai_neverending; /* we do unlimited AI */ + unsigned int i8254_osc_base; /* frequence of onboard oscilator */ + unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */ + unsigned int ai_act_scan; /* how many scans we finished */ + unsigned int ai_buf_ptr; /* data buffer ptr in samples */ + unsigned int ai_n_chan; /* how many channels is measured */ + unsigned int ai_n_scanlen; /* len of actual scanlist */ + unsigned int ai_n_realscanlen; /* + * what we must transfer for one + * outgoing scan include front/back adds + */ + unsigned int ai_act_dmapos; /* position in actual real stream */ + unsigned int ai_add_front; /* + * how many channels we must add + * before scan to satisfy S&H? + */ + unsigned int ai_add_back; /* + * how many channels we must add + * before scan to satisfy DMA? + */ + unsigned int *ai_chanlist; /* actual chanlist */ unsigned int ai_timer1; unsigned int ai_timer2; unsigned int ai_flags; - char ai12_startstop; /* measure can start/stop on external trigger */ - unsigned int ai_divisor1, ai_divisor2; /* divisors for start of measure on external start */ + char ai12_startstop; /* + * measure can start/stop + * on external trigger + */ + unsigned int ai_divisor1, ai_divisor2; /* + * divisors for start of measure + * on external start + */ unsigned int ai_data_len; short *ai_data; - short ao_data[2]; /* data output buffer */ - unsigned int ai_scans; /* number of scans to do */ - char dma_doublebuf; /* we can use double buffring */ - unsigned int dma_actbuf; /* which buffer is used now */ - short *dmabuf_virt[2]; /* pointers to begin of DMA buffer */ - unsigned long dmabuf_hw[2]; /* hw address of DMA buff */ - unsigned int dmabuf_size[2]; /* size of dma buffer in bytes */ - unsigned int dmabuf_use_size[2]; /* which size we may now used for transfer */ - unsigned int dmabuf_used_size[2]; /* which size was trully used */ + short ao_data[2]; /* data output buffer */ + unsigned int ai_scans; /* number of scans to do */ + char dma_doublebuf; /* we can use double buffring */ + unsigned int dma_actbuf; /* which buffer is used now */ + short *dmabuf_virt[2]; /* + * pointers to begin of + * DMA buffer + */ + unsigned long dmabuf_hw[2]; /* hw address of DMA buff */ + unsigned int dmabuf_size[2]; /* + * size of dma buffer in bytes + */ + unsigned int dmabuf_use_size[2]; /* + * which size we may now use + * for transfer + */ + unsigned int dmabuf_used_size[2]; /* which size was truly used */ unsigned int dmabuf_panic_size[2]; - unsigned int dmabuf_samples[2]; /* size in samples */ - int dmabuf_pages[2]; /* number of pages in buffer */ - unsigned char cnt0_users; /* bit field of 8254 CNT0 users (0-unused, 1-AO, 2-DI, 3-DO) */ - unsigned char exttrg_users; /* bit field of external trigger users (0-AI, 1-AO, 2-DI, 3-DO) */ - unsigned int cnt0_divisor; /* actual CNT0 divisor */ - void (*int_ai_func) (struct comedi_device *, struct comedi_subdevice *, unsigned short, unsigned int, unsigned short); /* ptr to actual interrupt AI function */ - unsigned char ai16bits; /* =1 16 bit card */ - unsigned char usedma; /* =1 use DMA transfer and not INT */ - unsigned char useeoshandle; /* =1 change WAKE_EOS DMA transfer to fit on every second */ - unsigned char usessh; /* =1 turn on S&H support */ - int softsshdelay; /* >0 use software S&H, numer is requested delay in ns */ - unsigned char softsshsample; /* polarity of S&H signal in sample state */ - unsigned char softsshhold; /* polarity of S&H signal in hold state */ - unsigned int ai_maskerr; /* which warning was printed */ - unsigned int ai_maskharderr; /* on which error bits stops */ - unsigned int ai_inttrig_start; /* TRIG_INT for start */ + unsigned int dmabuf_samples[2]; /* size in samples */ + int dmabuf_pages[2]; /* number of pages in buffer */ + unsigned char cnt0_users; /* + * bit field of 8254 CNT0 users + * (0-unused, 1-AO, 2-DI, 3-DO) + */ + unsigned char exttrg_users; /* + * bit field of external trigger + * users(0-AI, 1-AO, 2-DI, 3-DO) + */ + unsigned int cnt0_divisor; /* actual CNT0 divisor */ + void (*int_ai_func) (struct comedi_device *, struct comedi_subdevice *, + unsigned short, + unsigned int, + unsigned short); /* + * ptr to actual interrupt + * AI function + */ + unsigned char ai16bits; /* =1 16 bit card */ + unsigned char usedma; /* =1 use DMA transfer and not INT */ + unsigned char useeoshandle; /* + * =1 change WAKE_EOS DMA transfer + * to fit on every second + */ + unsigned char usessh; /* =1 turn on S&H support */ + int softsshdelay; /* + * >0 use software S&H, + * numer is requested delay in ns + */ + unsigned char softsshsample; /* + * polarity of S&H signal + * in sample state + */ + unsigned char softsshhold; /* + * polarity of S&H signal + * in hold state + */ + unsigned int ai_maskerr; /* which warning was printed */ + unsigned int ai_maskharderr; /* on which error bits stops */ + unsigned int ai_inttrig_start; /* TRIG_INT for start */ }; #define devpriv ((struct pci9118_private *)dev->private) @@ -346,12 +442,19 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, devpriv->AdControlReg = AdControl_Int & 0xff; devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + /* + * positive triggers, no S&H, + * no burst, burst stop, + * no post trigger, + * no about trigger, + * trigger stop + */ if (!setup_channel_list(dev, s, 1, &insn->chanspec, 0, 0, 0, 0, 0)) return -EINVAL; - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ for (n = 0; n < insn->n; n++) { outw(0, dev->iobase + PCI9118_SOFTTRG); /* start conversion */ @@ -365,7 +468,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, comedi_error(dev, "A/D insn timeout"); data[n] = 0; - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ return -ETIME; conv_finish: @@ -379,7 +482,7 @@ conv_finish: } } - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ return n; } @@ -394,11 +497,11 @@ static int pci9118_insn_write_ao(struct comedi_device *dev, int n, chanreg, ch; ch = CR_CHAN(insn->chanspec); - if (ch) { + if (ch) chanreg = PCI9118_DA2; - } else { + else chanreg = PCI9118_DA1; - } + for (n = 0; n < insn->n; n++) { outl(data[n], dev->iobase + chanreg); @@ -561,11 +664,11 @@ static void pci9118_ai_munge(struct comedi_device *dev, for (i = 0; i < num_samples; i++) { if (devpriv->usedma) array[i] = be16_to_cpu(array[i]); - if (devpriv->ai16bits) { + if (devpriv->ai16bits) array[i] ^= 0x8000; - } else { + else array[i] = (array[i] >> 4) & 0x0fff; - } + } } @@ -590,11 +693,13 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev, #ifdef PCI9118_PARANOIDCHECK if (devpriv->ai16bits == 0) { - if ((sampl & 0x000f) != devpriv->chanlist[s->async->cur_chan]) { /* data dropout! */ + if ((sampl & 0x000f) != devpriv->chanlist[s->async->cur_chan]) { + /* data dropout! */ printk - ("comedi: A/D SAMPL - data dropout: received channel %d, expected %d!\n", - sampl & 0x000f, - devpriv->chanlist[s->async->cur_chan]); + ("comedi: A/D SAMPL - data dropout: " + "received channel %d, expected %d!\n", + sampl & 0x000f, + devpriv->chanlist[s->async->cur_chan]); s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; pci9118_ai_cancel(dev, s); comedi_event(dev, s); @@ -604,11 +709,13 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev, #endif cfc_write_to_buffer(s, sampl); s->async->cur_chan++; - if (s->async->cur_chan >= devpriv->ai_n_scanlen) { /* one scan done */ + if (s->async->cur_chan >= devpriv->ai_n_scanlen) { + /* one scan done */ s->async->cur_chan %= devpriv->ai_n_scanlen; devpriv->ai_act_scan++; if (!(devpriv->ai_neverending)) - if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled */ + if (devpriv->ai_act_scan >= devpriv->ai_scans) { + /* all data sampled */ pci9118_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA; } @@ -644,16 +751,19 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, comedi_event(dev, s); return; } - if (int_adstat & devpriv->ai_maskerr) -/* if (int_adstat & 0x106) */ + /* if (int_adstat & 0x106) */ if (pci9118_decode_error_status(dev, s, int_adstat)) return; - samplesinbuf = devpriv->dmabuf_use_size[devpriv->dma_actbuf] >> 1; /* number of received real samples */ + samplesinbuf = devpriv->dmabuf_use_size[devpriv->dma_actbuf] >> 1; + /* number of received real samples */ /* DPRINTK("dma_actbuf=%d\n",devpriv->dma_actbuf); */ - if (devpriv->dma_doublebuf) { /* switch DMA buffers if is used double buffering */ + if (devpriv->dma_doublebuf) { /* + * switch DMA buffers if is used + * double buffering + */ next_dma_buf = 1 - devpriv->dma_actbuf; outl(devpriv->dmabuf_hw[next_dma_buf], devpriv->iobase_a + AMCC_OP_REG_MWAR); @@ -666,25 +776,32 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, } if (samplesinbuf) { - m = devpriv->ai_data_len >> 1; /* how many samples is to end of buffer */ -/* DPRINTK("samps=%d m=%d %d %d\n",samplesinbuf,m,s->async->buf_int_count,s->async->buf_int_ptr); */ + m = devpriv->ai_data_len >> 1; /* + * how many samples is to + * end of buffer + */ +/* + * DPRINTK("samps=%d m=%d %d %d\n", + * samplesinbuf,m,s->async->buf_int_count,s->async->buf_int_ptr); + */ sampls = m; move_block_from_dma(dev, s, devpriv->dmabuf_virt[devpriv->dma_actbuf], samplesinbuf); - m = m - sampls; /* m= how many samples was transfered */ + m = m - sampls; /* m= how many samples was transfered */ } /* DPRINTK("YYY\n"); */ if (!devpriv->ai_neverending) - if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled */ + if (devpriv->ai_act_scan >= devpriv->ai_scans) { + /* all data sampled */ pci9118_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA; } - if (devpriv->dma_doublebuf) { /* switch dma buffers */ + if (devpriv->dma_doublebuf) { /* switch dma buffers */ devpriv->dma_actbuf = 1 - devpriv->dma_actbuf; - } else { /* restart DMA if is not used double buffering */ + } else { /* restart DMA if is not used double buffering */ outl(devpriv->dmabuf_hw[0], devpriv->iobase_a + AMCC_OP_REG_MWAR); outl(devpriv->dmabuf_use_size[0], @@ -705,39 +822,62 @@ static irqreturn_t interrupt_pci9118(int irq, void *d) unsigned int int_daq = 0, int_amcc, int_adstat; if (!dev->attached) - return IRQ_NONE; /* not fully initialized */ + return IRQ_NONE; /* not fully initialized */ - int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf; /* get IRQ reasons from card */ - int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* get INT register from AMCC chip */ + int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf; + /* get IRQ reasons from card */ + int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* get INT register from AMCC chip */ -/* DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n", int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR), inl(devpriv->iobase_a+AMCC_OP_REG_MWTC), inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do); */ +/* + * DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x + * MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n", + * int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR), + * inl(devpriv->iobase_a+AMCC_OP_REG_MWTC), + * inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do); + */ if ((!int_daq) && (!(int_amcc & ANY_S593X_INT))) - return IRQ_NONE; /* interrupt from other source */ + return IRQ_NONE; /* interrupt from other source */ - outl(int_amcc | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* shutdown IRQ reasons in AMCC */ + outl(int_amcc | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* shutdown IRQ reasons in AMCC */ - int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff; /* get STATUS register */ + int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff; + /* get STATUS register */ if (devpriv->ai_do) { if (devpriv->ai12_startstop) - if ((int_adstat & AdStatus_DTH) && (int_daq & Int_DTrg)) { /* start stop of measure */ + if ((int_adstat & AdStatus_DTH) && + (int_daq & Int_DTrg)) { + /* start stop of measure */ if (devpriv->ai12_startstop & START_AI_EXT) { devpriv->ai12_startstop &= ~START_AI_EXT; if (!(devpriv->ai12_startstop & - STOP_AI_EXT)) - pci9118_exttrg_del(dev, EXTTRG_AI); /* deactivate EXT trigger */ - start_pacer(dev, devpriv->ai_do, devpriv->ai_divisor1, devpriv->ai_divisor2); /* start pacer */ + STOP_AI_EXT)) + pci9118_exttrg_del + (dev, EXTTRG_AI); + /* deactivate EXT trigger */ + start_pacer(dev, devpriv->ai_do, + devpriv->ai_divisor1, + devpriv->ai_divisor2); + /* start pacer */ outl(devpriv->AdControlReg, - dev->iobase + PCI9118_ADCNTRL); + dev->iobase + PCI9118_ADCNTRL); } else { if (devpriv->ai12_startstop & - STOP_AI_EXT) { + STOP_AI_EXT) { devpriv->ai12_startstop &= - ~STOP_AI_EXT; - pci9118_exttrg_del(dev, EXTTRG_AI); /* deactivate EXT trigger */ - devpriv->ai_neverending = 0; /* well, on next interrupt from DMA/EOC measure will stop */ + ~STOP_AI_EXT; + pci9118_exttrg_del + (dev, EXTTRG_AI); + /* deactivate EXT trigger */ + devpriv->ai_neverending = 0; + /* + * well, on next interrupt from + * DMA/EOC measure will stop + */ } } } @@ -781,7 +921,8 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1 = 0, divisor2 = 0; + int tmp; + unsigned int divisor1 = 0, divisor2 = 0; /* step 1: make sure trigger sources are trivially valid */ @@ -791,20 +932,20 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, err++; tmp = cmd->scan_begin_src; - if (devpriv->master) { + if (devpriv->master) cmd->scan_begin_src &= TRIG_TIMER | TRIG_EXT | TRIG_FOLLOW; - } else { + else cmd->scan_begin_src &= TRIG_FOLLOW; - } + if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src) err++; tmp = cmd->convert_src; - if (devpriv->master) { + if (devpriv->master) cmd->convert_src &= TRIG_TIMER | TRIG_EXT | TRIG_NOW; - } else { + else cmd->convert_src &= TRIG_TIMER | TRIG_EXT; - } + if (!cmd->convert_src || tmp != cmd->convert_src) err++; @@ -821,7 +962,11 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* + * step 2: + * make sure trigger sources are + * unique and mutually compatible + */ if (cmd->start_src != TRIG_NOW && cmd->start_src != TRIG_INT && cmd->start_src != TRIG_EXT) { @@ -1026,7 +1171,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, if (cmd->chanlist) if (!check_channel_list(dev, s, cmd->chanlist_len, cmd->chanlist, 0, 0)) - return 5; /* incorrect channels list */ + return 5; /* incorrect channels list */ return 0; } @@ -1043,88 +1188,101 @@ static int Compute_and_setup_dma(struct comedi_device *dev) dmalen1 = devpriv->dmabuf_size[1]; DPRINTK("1 dmalen0=%d dmalen1=%d ai_data_len=%d\n", dmalen0, dmalen1, devpriv->ai_data_len); - /* isn't output buff smaller that our DMA buff? */ + /* isn't output buff smaller that our DMA buff? */ if (dmalen0 > (devpriv->ai_data_len)) { - dmalen0 = devpriv->ai_data_len & ~3L; /* allign to 32bit down */ + dmalen0 = devpriv->ai_data_len & ~3L; /* + * align to 32bit down + */ } if (dmalen1 > (devpriv->ai_data_len)) { - dmalen1 = devpriv->ai_data_len & ~3L; /* allign to 32bit down */ + dmalen1 = devpriv->ai_data_len & ~3L; /* + * align to 32bit down + */ } DPRINTK("2 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); - /* we want wake up every scan? */ + /* we want wake up every scan? */ if (devpriv->ai_flags & TRIG_WAKE_EOS) { if (dmalen0 < (devpriv->ai_n_realscanlen << 1)) { - /* uff, too short DMA buffer, disable EOS support! */ + /* uff, too short DMA buffer, disable EOS support! */ devpriv->ai_flags &= (~TRIG_WAKE_EOS); printk - ("comedi%d: WAR: DMA0 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n", + ("comedi%d: WAR: DMA0 buf too short, can't " + "support TRIG_WAKE_EOS (%d<%d)\n", dev->minor, dmalen0, devpriv->ai_n_realscanlen << 1); } else { - /* short first DMA buffer to one scan */ + /* short first DMA buffer to one scan */ dmalen0 = devpriv->ai_n_realscanlen << 1; DPRINTK - ("21 dmalen0=%d ai_n_realscanlen=%d useeoshandle=%d\n", - dmalen0, devpriv->ai_n_realscanlen, - devpriv->useeoshandle); + ("21 dmalen0=%d ai_n_realscanlen=%d " + "useeoshandle=%d\n", + dmalen0, devpriv->ai_n_realscanlen, + devpriv->useeoshandle); if (devpriv->useeoshandle) dmalen0 += 2; if (dmalen0 < 4) { printk - ("comedi%d: ERR: DMA0 buf len bug? (%d<4)\n", - dev->minor, dmalen0); + ("comedi%d: ERR: DMA0 buf len bug? " + "(%d<4)\n", + dev->minor, dmalen0); dmalen0 = 4; } } } if (devpriv->ai_flags & TRIG_WAKE_EOS) { if (dmalen1 < (devpriv->ai_n_realscanlen << 1)) { - /* uff, too short DMA buffer, disable EOS support! */ + /* uff, too short DMA buffer, disable EOS support! */ devpriv->ai_flags &= (~TRIG_WAKE_EOS); printk - ("comedi%d: WAR: DMA1 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n", + ("comedi%d: WAR: DMA1 buf too short, " + "can't support TRIG_WAKE_EOS (%d<%d)\n", dev->minor, dmalen1, devpriv->ai_n_realscanlen << 1); } else { - /* short second DMA buffer to one scan */ + /* short second DMA buffer to one scan */ dmalen1 = devpriv->ai_n_realscanlen << 1; DPRINTK - ("22 dmalen1=%d ai_n_realscanlen=%d useeoshandle=%d\n", + ("22 dmalen1=%d ai_n_realscanlen=%d " + "useeoshandle=%d\n", dmalen1, devpriv->ai_n_realscanlen, devpriv->useeoshandle); if (devpriv->useeoshandle) dmalen1 -= 2; if (dmalen1 < 4) { printk - ("comedi%d: ERR: DMA1 buf len bug? (%d<4)\n", - dev->minor, dmalen1); + ("comedi%d: ERR: DMA1 buf len bug? " + "(%d<4)\n", + dev->minor, dmalen1); dmalen1 = 4; } } } DPRINTK("3 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); - /* transfer without TRIG_WAKE_EOS */ + /* transfer without TRIG_WAKE_EOS */ if (!(devpriv->ai_flags & TRIG_WAKE_EOS)) { - /* if it's possible then allign DMA buffers to length of scan */ + /* if it's possible then allign DMA buffers to length of scan */ i = dmalen0; dmalen0 = (dmalen0 / (devpriv->ai_n_realscanlen << 1)) * (devpriv->ai_n_realscanlen << 1); dmalen0 &= ~3L; if (!dmalen0) - dmalen0 = i; /* uff. very long scan? */ + dmalen0 = i; /* uff. very long scan? */ i = dmalen1; dmalen1 = (dmalen1 / (devpriv->ai_n_realscanlen << 1)) * (devpriv->ai_n_realscanlen << 1); dmalen1 &= ~3L; if (!dmalen1) - dmalen1 = i; /* uff. very long scan? */ - /* if measure isn't neverending then test, if it whole fits into one or two DMA buffers */ + dmalen1 = i; /* uff. very long scan? */ + /* + * if measure isn't neverending then test, if it fits whole + * into one or two DMA buffers + */ if (!devpriv->ai_neverending) { - /* fits whole measure into one DMA buffer? */ + /* fits whole measure into one DMA buffer? */ if (dmalen0 > ((devpriv->ai_n_realscanlen << 1) * devpriv->ai_scans)) { @@ -1138,7 +1296,10 @@ static int Compute_and_setup_dma(struct comedi_device *dev) DPRINTK("3.1 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); dmalen0 &= ~3L; - } else { /* fits whole measure into two DMA buffer? */ + } else { /* + * fits whole measure into + * two DMA buffer? + */ if (dmalen1 > ((devpriv->ai_n_realscanlen << 1) * devpriv->ai_scans - dmalen0)) @@ -1154,7 +1315,7 @@ static int Compute_and_setup_dma(struct comedi_device *dev) DPRINTK("4 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); - /* these DMA buffer size we'll be used */ + /* these DMA buffer size will be used */ devpriv->dma_actbuf = 0; devpriv->dmabuf_use_size[0] = dmalen0; devpriv->dmabuf_use_size[1] = dmalen1; @@ -1176,10 +1337,11 @@ static int Compute_and_setup_dma(struct comedi_device *dev) } #endif - outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), + devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ outl(devpriv->dmabuf_hw[0], devpriv->iobase_a + AMCC_OP_REG_MWAR); outl(devpriv->dmabuf_use_size[0], devpriv->iobase_a + AMCC_OP_REG_MWTC); - /* init DMA transfer */ + /* init DMA transfer */ outl(0x00000000 | AINT_WRITE_COMPL, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* outl(0x02000000|AINT_WRITE_COMPL, devpriv->iobase_a+AMCC_OP_REG_INTCSR); */ @@ -1187,7 +1349,9 @@ static int Compute_and_setup_dma(struct comedi_device *dev) outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) | RESET_A2P_FLAGS | A2P_HI_PRIORITY | EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_MCSR); - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow bus mastering */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS, + devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* allow bus mastering */ DPRINTK("adl_pci9118 EDBG: END: Compute_and_setup_dma()\n"); return 0; @@ -1220,17 +1384,21 @@ static int pci9118_ai_docmd_sampl(struct comedi_device *dev, return -EIO; }; - devpriv->int_ai_func = interrupt_pci9118_ai_onesample; /* transfer function */ + devpriv->int_ai_func = interrupt_pci9118_ai_onesample; + /* transfer function */ if (devpriv->ai12_startstop) - pci9118_exttrg_add(dev, EXTTRG_AI); /* activate EXT trigger */ + pci9118_exttrg_add(dev, EXTTRG_AI); + /* activate EXT trigger */ if ((devpriv->ai_do == 1) || (devpriv->ai_do == 2)) devpriv->IntControlReg |= Int_Timer; devpriv->AdControlReg |= AdControl_Int; - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, + devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* allow INT in AMCC */ if (!(devpriv->ai12_startstop & (START_AI_EXT | START_AI_INT))) { outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); @@ -1296,10 +1464,12 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev, }; if (devpriv->ai12_startstop) { - pci9118_exttrg_add(dev, EXTTRG_AI); /* activate EXT trigger */ + pci9118_exttrg_add(dev, EXTTRG_AI); + /* activate EXT trigger */ } - devpriv->int_ai_func = interrupt_pci9118_ai_dma; /* transfer function */ + devpriv->int_ai_func = interrupt_pci9118_ai_dma; + /* transfer function */ outl(0x02000000 | AINT_WRITE_COMPL, devpriv->iobase_a + AMCC_OP_REG_INTCSR); @@ -1342,7 +1512,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_add_back = 0; devpriv->ai_maskerr = 0x10e; - /* prepare for start/stop conditions */ + /* prepare for start/stop conditions */ if (cmd->start_src == TRIG_EXT) devpriv->ai12_startstop |= START_AI_EXT; if (cmd->stop_src == TRIG_EXT) { @@ -1369,10 +1539,10 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_scans = 0; } - /* use sample&hold signal? */ + /* use sample&hold signal? */ if (cmd->convert_src == TRIG_NOW) { devpriv->usessh = 1; - } /* yes */ + } /* yes */ else { devpriv->usessh = 0; } /* no */ @@ -1381,7 +1551,10 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_neverending, devpriv->ai_scans, devpriv->usessh, devpriv->ai12_startstop); - /* use additional sample at end of every scan to satisty DMA 32 bit transfer? */ + /* + * use additional sample at end of every scan + * to satisty DMA 32 bit transfer? + */ devpriv->ai_add_front = 0; devpriv->ai_add_back = 0; devpriv->useeoshandle = 0; @@ -1393,27 +1566,44 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_add_back = 1; } if (cmd->convert_src == TRIG_TIMER) { - devpriv->usedma = 0; /* use INT transfer if scanlist have only one channel */ + devpriv->usedma = 0; + /* + * use INT transfer if scanlist + * have only one channel + */ } } if ((cmd->flags & TRIG_WAKE_EOS) && (devpriv->ai_n_scanlen & 1) && (devpriv->ai_n_scanlen > 1)) { if (cmd->scan_begin_src == TRIG_FOLLOW) { - /* vpriv->useeoshandle=1; // change DMA transfer block to fit EOS on every second call */ - devpriv->usedma = 0; /* XXX maybe can be corrected to use 16 bit DMA */ - } else { /* well, we must insert one sample to end of EOS to meet 32 bit transfer */ + /* + * vpriv->useeoshandle=1; // change DMA transfer + * block to fit EOS on every second call + */ + devpriv->usedma = 0; + /* + * XXX maybe can be corrected to use 16 bit DMA + */ + } else { /* + * well, we must insert one sample + * to end of EOS to meet 32 bit transfer + */ devpriv->ai_add_back = 1; } } - } else { /* interrupt transfer don't need any correction */ + } else { /* interrupt transfer don't need any correction */ devpriv->usedma = 0; } - /* we need software S&H signal? It add two samples before every scan as minimum */ + /* + * we need software S&H signal? + * It adds two samples before every scan as minimum + */ if (devpriv->usessh && devpriv->softsshdelay) { devpriv->ai_add_front = 2; - if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) { /* move it to front */ + if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) { + /* move it to front */ devpriv->ai_add_front++; devpriv->ai_add_back = 0; } @@ -1422,17 +1612,22 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) addchans = devpriv->softsshdelay / cmd->convert_arg; if (devpriv->softsshdelay % cmd->convert_arg) addchans++; - if (addchans > (devpriv->ai_add_front - 1)) { /* uff, still short :-( */ + if (addchans > (devpriv->ai_add_front - 1)) { + /* uff, still short */ devpriv->ai_add_front = addchans + 1; if (devpriv->usedma == 1) if ((devpriv->ai_add_front + devpriv->ai_n_chan + devpriv->ai_add_back) & 1) - devpriv->ai_add_front++; /* round up to 32 bit */ + devpriv->ai_add_front++; + /* round up to 32 bit */ } } - /* well, we now know what must be all added */ - devpriv->ai_n_realscanlen = /* what we must take from card in real to have ai_n_scanlen on output? */ + /* well, we now know what must be all added */ + devpriv->ai_n_realscanlen = /* + * what we must take from card in real + * to have ai_n_scanlen on output? + */ (devpriv->ai_add_front + devpriv->ai_n_chan + devpriv->ai_add_back) * (devpriv->ai_n_scanlen / devpriv->ai_n_chan); @@ -1443,7 +1638,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_n_chan, devpriv->ai_add_back, devpriv->ai_n_scanlen); - /* check and setup channel list */ + /* check and setup channel list */ if (!check_channel_list(dev, s, devpriv->ai_n_chan, devpriv->ai_chanlist, devpriv->ai_add_front, devpriv->ai_add_back)) @@ -1454,9 +1649,16 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->useeoshandle)) return -EINVAL; - /* compute timers settings */ - /* simplest way, fr=4Mhz/(tim1*tim2), channel manipulation without timers effect */ - if (((cmd->scan_begin_src == TRIG_FOLLOW) || (cmd->scan_begin_src == TRIG_EXT) || (cmd->scan_begin_src == TRIG_INT)) && (cmd->convert_src == TRIG_TIMER)) { /* both timer is used for one time */ + /* compute timers settings */ + /* + * simplest way, fr=4Mhz/(tim1*tim2), + * channel manipulation without timers effect + */ + if (((cmd->scan_begin_src == TRIG_FOLLOW) || + (cmd->scan_begin_src == TRIG_EXT) || + (cmd->scan_begin_src == TRIG_INT)) && + (cmd->convert_src == TRIG_TIMER)) { + /* both timer is used for one time */ if (cmd->scan_begin_src == TRIG_EXT) { devpriv->ai_do = 4; } else { @@ -1472,10 +1674,14 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_timer2 = cmd->convert_arg; } - if ((cmd->scan_begin_src == TRIG_TIMER) && ((cmd->convert_src == TRIG_TIMER) || (cmd->convert_src == TRIG_NOW))) { /* double timed action */ + if ((cmd->scan_begin_src == TRIG_TIMER) && + ((cmd->convert_src == TRIG_TIMER) || + (cmd->convert_src == TRIG_NOW))) { + /* double timed action */ if (!devpriv->usedma) { comedi_error(dev, - "cmd->scan_begin_src=TRIG_TIMER works only with bus mastering!"); + "cmd->scan_begin_src=TRIG_TIMER works " + "only with bus mastering!"); return -EIO; } @@ -1496,15 +1702,27 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_do = 3; } - start_pacer(dev, -1, 0, 0); /* stop pacer */ + start_pacer(dev, -1, 0, 0); /* stop pacer */ - devpriv->AdControlReg = 0; /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable DMA */ + devpriv->AdControlReg = 0; /* + * bipolar, S.E., use 8254, stop 8354, + * internal trigger, soft trigger, + * disable DMA + */ outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); - devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ + devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; + /* + * positive triggers, no S&H, no burst, + * burst stop, no post trigger, + * no about trigger, trigger stop + */ outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); udelay(1); - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ - inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D and INT status register */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + inl(dev->iobase + PCI9118_ADSTAT); /* + * flush A/D and INT + * status register + */ inl(dev->iobase + PCI9118_INTSRC); devpriv->ai_act_scan = 0; @@ -1537,33 +1755,37 @@ static int check_channel_list(struct comedi_device *dev, } if ((frontadd + n_chan + backadd) > s->len_chanlist) { printk - ("comedi%d: range/channel list is too long for actual configuration (%d>%d)!", + ("comedi%d: range/channel list is too long for " + "actual configuration (%d>%d)!", dev->minor, n_chan, s->len_chanlist - frontadd - backadd); return 0; } if (CR_AREF(chanlist[0]) == AREF_DIFF) - differencial = 1; /* all input must be diff */ + differencial = 1; /* all input must be diff */ if (CR_RANGE(chanlist[0]) < PCI9118_BIPOLAR_RANGES) - bipolar = 1; /* all input must be bipolar */ + bipolar = 1; /* all input must be bipolar */ if (n_chan > 1) - for (i = 1; i < n_chan; i++) { /* check S.E/diff */ + for (i = 1; i < n_chan; i++) { /* check S.E/diff */ if ((CR_AREF(chanlist[i]) == AREF_DIFF) != (differencial)) { comedi_error(dev, - "Differencial and single ended inputs cann't be mixtured!"); + "Differencial and single ended " + "inputs can't be mixtured!"); return 0; } if ((CR_RANGE(chanlist[i]) < PCI9118_BIPOLAR_RANGES) != (bipolar)) { comedi_error(dev, - "Bipolar and unipolar ranges cann't be mixtured!"); + "Bipolar and unipolar ranges " + "can't be mixtured!"); return 0; } if ((!devpriv->usemux) & (differencial) & (CR_CHAN(chanlist[i]) >= this_board->n_aichand)) { comedi_error(dev, - "If AREF_DIFF is used then is available only first 8 channels!"); + "If AREF_DIFF is used then is " + "available only first 8 channels!"); return 0; } } @@ -1583,7 +1805,8 @@ static int setup_channel_list(struct comedi_device *dev, unsigned int scanquad, gain, ssh = 0x00; DPRINTK - ("adl_pci9118 EDBG: BGN: setup_channel_list(%d,.,%d,.,%d,%d,%d,%d)\n", + ("adl_pci9118 EDBG: BGN: setup_channel_list" + "(%d,.,%d,.,%d,%d,%d,%d)\n", dev->minor, n_chan, rot, frontadd, backadd, usedma); if (usedma == 1) { @@ -1592,27 +1815,33 @@ static int setup_channel_list(struct comedi_device *dev, } if (CR_AREF(chanlist[0]) == AREF_DIFF) - differencial = 1; /* all input must be diff */ + differencial = 1; /* all input must be diff */ if (CR_RANGE(chanlist[0]) < PCI9118_BIPOLAR_RANGES) - bipolar = 1; /* all input must be bipolar */ + bipolar = 1; /* all input must be bipolar */ - /* All is ok, so we can setup channel/range list */ + /* All is ok, so we can setup channel/range list */ if (!bipolar) { - devpriv->AdControlReg |= AdControl_UniP; /* set unibipolar */ + devpriv->AdControlReg |= AdControl_UniP; + /* set unibipolar */ } else { - devpriv->AdControlReg &= ((~AdControl_UniP) & 0xff); /* enable bipolar */ + devpriv->AdControlReg &= ((~AdControl_UniP) & 0xff); + /* enable bipolar */ } if (differencial) { - devpriv->AdControlReg |= AdControl_Diff; /* enable diff inputs */ + devpriv->AdControlReg |= AdControl_Diff; + /* enable diff inputs */ } else { - devpriv->AdControlReg &= ((~AdControl_Diff) & 0xff); /* set single ended inputs */ + devpriv->AdControlReg &= ((~AdControl_Diff) & 0xff); + /* set single ended inputs */ } - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* setup mode */ + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + /* setup mode */ - outl(2, dev->iobase + PCI9118_SCANMOD); /* gods know why this sequence! */ + outl(2, dev->iobase + PCI9118_SCANMOD); + /* gods know why this sequence! */ outl(0, dev->iobase + PCI9118_SCANMOD); outl(1, dev->iobase + PCI9118_SCANMOD); @@ -1622,12 +1851,15 @@ static int setup_channel_list(struct comedi_device *dev, devpriv->chanlist[i] = 0x55aa; #endif - if (frontadd) { /* insert channels for S&H */ + if (frontadd) { /* insert channels for S&H */ ssh = devpriv->softsshsample; DPRINTK("FA: %04x: ", ssh); - for (i = 0; i < frontadd; i++) { /* store range list to card */ - scanquad = CR_CHAN(chanlist[0]); /* get channel number; */ - gain = CR_RANGE(chanlist[0]); /* get gain number */ + for (i = 0; i < frontadd; i++) { + /* store range list to card */ + scanquad = CR_CHAN(chanlist[0]); + /* get channel number; */ + gain = CR_RANGE(chanlist[0]); + /* get gain number */ scanquad |= ((gain & 0x03) << 8); outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); DPRINTK("%02x ", scanquad | ssh); @@ -1637,23 +1869,24 @@ static int setup_channel_list(struct comedi_device *dev, } DPRINTK("SL: ", ssh); - for (i = 0; i < n_chan; i++) { /* store range list to card */ - scanquad = CR_CHAN(chanlist[i]); /* get channel number; */ + for (i = 0; i < n_chan; i++) { /* store range list to card */ + scanquad = CR_CHAN(chanlist[i]); /* get channel number */ #ifdef PCI9118_PARANOIDCHECK devpriv->chanlist[i ^ usedma] = (scanquad & 0xf) << rot; #endif - gain = CR_RANGE(chanlist[i]); /* get gain number */ + gain = CR_RANGE(chanlist[i]); /* get gain number */ scanquad |= ((gain & 0x03) << 8); outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); DPRINTK("%02x ", scanquad | ssh); } DPRINTK("\n "); - if (backadd) { /* insert channels for fit onto 32bit DMA */ + if (backadd) { /* insert channels for fit onto 32bit DMA */ DPRINTK("BA: %04x: ", ssh); - for (i = 0; i < backadd; i++) { /* store range list to card */ - scanquad = CR_CHAN(chanlist[0]); /* get channel number; */ - gain = CR_RANGE(chanlist[0]); /* get gain number */ + for (i = 0; i < backadd; i++) { /* store range list to card */ + scanquad = CR_CHAN(chanlist[0]); + /* get channel number */ + gain = CR_RANGE(chanlist[0]); /* get gain number */ scanquad |= ((gain & 0x03) << 8); outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); DPRINTK("%02x ", scanquad | ssh); @@ -1661,30 +1894,33 @@ static int setup_channel_list(struct comedi_device *dev, DPRINTK("\n "); } #ifdef PCI9118_PARANOIDCHECK - devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma]; /* for 32bit oerations */ + devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma]; + /* for 32bit operations */ if (useeos) { - for (i = 1; i < n_chan; i++) { /* store range list to card */ + for (i = 1; i < n_chan; i++) { /* store range list to card */ devpriv->chanlist[(n_chan + i) ^ usedma] = (CR_CHAN(chanlist[i]) & 0xf) << rot; } - devpriv->chanlist[(2 * n_chan) ^ usedma] = devpriv->chanlist[0 ^ usedma]; /* for 32bit oerations */ + devpriv->chanlist[(2 * n_chan) ^ usedma] = + devpriv->chanlist[0 ^ usedma]; + /* for 32bit operations */ useeos = 2; } else { useeos = 1; } #ifdef PCI9118_EXTDEBUG DPRINTK("CHL: "); - for (i = 0; i <= (useeos * n_chan); i++) { + for (i = 0; i <= (useeos * n_chan); i++) DPRINTK("%04x ", devpriv->chanlist[i]); - } + DPRINTK("\n "); #endif #endif - outl(0, dev->iobase + PCI9118_SCANMOD); /* close scan queue */ -/* udelay(100); important delay, or first sample will be cripled */ + outl(0, dev->iobase + PCI9118_SCANMOD); /* close scan queue */ + /* udelay(100); important delay, or first sample will be crippled */ DPRINTK("adl_pci9118 EDBG: END: setup_channel_list()\n"); - return 1; /* we can serve this with scan logic */ + return 1; /* we can serve this with scan logic */ } /* @@ -1699,7 +1935,8 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, char usessh, unsigned int chnsshfront) { DPRINTK - ("adl_pci9118 EDBG: BGN: pci9118_calc_divisors(%d,%d,.,%u,%u,%u,%d,.,.,,%u,%u)\n", + ("adl_pci9118 EDBG: BGN: pci9118_calc_divisors" + "(%d,%d,.,%u,%u,%u,%d,.,.,,%u,%u)\n", mode, dev->minor, *tim1, *tim2, flags, chans, usessh, chnsshfront); switch (mode) { case 1: @@ -1716,17 +1953,18 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, *tim2 = this_board->ai_ns_min; DPRINTK("1 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *div1 = *tim2 / devpriv->i8254_osc_base; /* convert timer (burst) */ + *div1 = *tim2 / devpriv->i8254_osc_base; + /* convert timer (burst) */ DPRINTK("2 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); if (*div1 < this_board->ai_pacer_min) *div1 = this_board->ai_pacer_min; DPRINTK("3 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *div2 = *tim1 / devpriv->i8254_osc_base; /* scan timer */ + *div2 = *tim1 / devpriv->i8254_osc_base; /* scan timer */ DPRINTK("4 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *div2 = *div2 / *div1; /* major timer is c1*c2 */ + *div2 = *div2 / *div1; /* major timer is c1*c2 */ DPRINTK("5 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); if (*div2 < chans) @@ -1734,9 +1972,10 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, DPRINTK("6 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *tim2 = *div1 * devpriv->i8254_osc_base; /* real convert timer */ + *tim2 = *div1 * devpriv->i8254_osc_base; + /* real convert timer */ - if (usessh & (chnsshfront == 0)) /* use BSSH signal */ + if (usessh & (chnsshfront == 0)) /* use BSSH signal */ if (*div2 < (chans + 2)) *div2 = chans + 2; @@ -1776,11 +2015,13 @@ static void start_pacer(struct comedi_device *dev, int mode, static int pci9118_exttrg_add(struct comedi_device *dev, unsigned char source) { if (source > 3) - return -1; /* incorrect source */ + return -1; /* incorrect source */ devpriv->exttrg_users |= (1 << source); devpriv->IntControlReg |= Int_DTrg; outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, + devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* allow INT in AMCC */ return 0; } @@ -1790,12 +2031,15 @@ static int pci9118_exttrg_add(struct comedi_device *dev, unsigned char source) static int pci9118_exttrg_del(struct comedi_device *dev, unsigned char source) { if (source > 3) - return -1; /* incorrect source */ + return -1; /* incorrect source */ devpriv->exttrg_users &= ~(1 << source); - if (!devpriv->exttrg_users) { /* shutdown ext trg intterrupts */ + if (!devpriv->exttrg_users) { /* shutdown ext trg intterrupts */ devpriv->IntControlReg &= ~Int_DTrg; - if (!devpriv->IntControlReg) /* all IRQ disabled */ - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) & (~0x00001f00), devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* disable int in AMCC */ + if (!devpriv->IntControlReg) /* all IRQ disabled */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) & + (~0x00001f00), + devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* disable int in AMCC */ outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); } return 0; @@ -1808,17 +2052,29 @@ static int pci9118_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { if (devpriv->usedma) - outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & + (~EN_A2P_TRANSFERS), + devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ pci9118_exttrg_del(dev, EXTTRG_AI); - start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ + start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + /* + * positive triggers, no S&H, no burst, + * burst stop, no post trigger, + * no about trigger, trigger stop + */ devpriv->AdControlReg = 0x00; - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + /* + * bipolar, S.E., use 8254, stop 8354, + * internal trigger, soft trigger, + * disable INT and DMA + */ outl(0, dev->iobase + PCI9118_BURST); outl(1, dev->iobase + PCI9118_SCANMOD); - outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ devpriv->ai_do = 0; devpriv->usedma = 0; @@ -1832,7 +2088,9 @@ static int pci9118_ai_cancel(struct comedi_device *dev, devpriv->dma_actbuf = 0; if (!devpriv->IntControlReg) - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, + devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* allow INT in AMCC */ return 0; } @@ -1845,31 +2103,52 @@ static int pci9118_reset(struct comedi_device *dev) devpriv->IntControlReg = 0; devpriv->exttrg_users = 0; inl(dev->iobase + PCI9118_INTCTRL); - outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); /* disable interrupts source */ + outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); + /* disable interrupts source */ outl(0x30, dev->iobase + PCI9118_CNTCTRL); /* outl(0xb4, dev->iobase + PCI9118_CNTCTRL); */ - start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ + start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ devpriv->AdControlReg = 0; - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + /* + * bipolar, S.E., use 8254, + * stop 8354, internal trigger, + * soft trigger, + * disable INT and DMA + */ outl(0, dev->iobase + PCI9118_BURST); outl(1, dev->iobase + PCI9118_SCANMOD); - outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ + outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + /* + * positive triggers, no S&H, + * no burst, burst stop, + * no post trigger, + * no about trigger, + * trigger stop + */ devpriv->ao_data[0] = 2047; devpriv->ao_data[1] = 2047; - outl(devpriv->ao_data[0], dev->iobase + PCI9118_DA1); /* reset A/D outs to 0V */ + outl(devpriv->ao_data[0], dev->iobase + PCI9118_DA1); + /* reset A/D outs to 0V */ outl(devpriv->ao_data[1], dev->iobase + PCI9118_DA2); - outl(0, dev->iobase + PCI9118_DO); /* reset digi outs to L */ + outl(0, dev->iobase + PCI9118_DO); /* reset digi outs to L */ udelay(10); inl(dev->iobase + PCI9118_AD_DATA); - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ - outl(0, dev->iobase + PCI9118_INTSRC); /* remove INT requests */ - inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D status register */ - inl(dev->iobase + PCI9118_INTSRC); /* flush INT requests */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + outl(0, dev->iobase + PCI9118_INTSRC); /* remove INT requests */ + inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D status register */ + inl(dev->iobase + PCI9118_INTSRC); /* flush INT requests */ devpriv->AdControlReg = 0; - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + /* + * bipolar, S.E., use 8254, + * stop 8354, internal trigger, + * soft trigger, + * disable INT and DMA + */ devpriv->cnt0_users = 0; devpriv->exttrg_users = 0; @@ -1899,7 +2178,7 @@ static int pci9118_attach(struct comedi_device *dev, opt_bus = it->options[0]; opt_slot = it->options[1]; if (it->options[3] & 1) { - master = 0; /* user don't want use bus master */ + master = 0; /* user don't want use bus master */ } else { master = 1; } @@ -1937,17 +2216,17 @@ static int pci9118_attach(struct comedi_device *dev, if (!pcidev) { if (opt_bus || opt_slot) { - printk(" - Card at b:s %d:%d %s\n", + printk(KERN_ERR " - Card at b:s %d:%d %s\n", opt_bus, opt_slot, errstr); } else { - printk(" - Card %s\n", errstr); + printk(KERN_ERR " - Card %s\n", errstr); } return -EIO; } - if (master) { + if (master) pci_set_master(pcidev); - } + pci_bus = pcidev->bus->number; pci_slot = PCI_SLOT(pcidev->devfn); @@ -1956,8 +2235,8 @@ static int pci9118_attach(struct comedi_device *dev, iobase_a = pci_resource_start(pcidev, 0); iobase_9 = pci_resource_start(pcidev, 2); - printk(", b:s:f=%d:%d:%d, io=0x%4lx, 0x%4lx", pci_bus, pci_slot, - pci_func, iobase_9, iobase_a); + printk(KERN_ERR ", b:s:f=%d:%d:%d, io=0x%4lx, 0x%4lx", pci_bus, + pci_slot, pci_func, iobase_9, iobase_a); dev->iobase = iobase_9; dev->board_name = this_board->name; @@ -1968,7 +2247,7 @@ static int pci9118_attach(struct comedi_device *dev, pci9118_reset(dev); if (it->options[3] & 2) - irq = 0; /* user don't want use IRQ */ + irq = 0; /* user don't want use IRQ */ if (irq > 0) { if (request_irq(irq, interrupt_pci9118, IRQF_SHARED, "ADLink PCI-9118", dev)) { @@ -1984,7 +2263,7 @@ static int pci9118_attach(struct comedi_device *dev, dev->irq = irq; - if (master) { /* alloc DMA buffers */ + if (master) { /* alloc DMA buffers */ devpriv->dma_doublebuf = 0; for (i = 0; i < 2; i++) { for (pages = 4; pages >= 0; pages--) { @@ -2024,16 +2303,18 @@ static int pci9118_attach(struct comedi_device *dev, if (it->options[2] > 0) { devpriv->usemux = it->options[2]; if (devpriv->usemux > 256) - devpriv->usemux = 256; /* max 256 channels! */ + devpriv->usemux = 256; /* max 256 channels! */ if (it->options[4] > 0) if (devpriv->usemux > 128) { - devpriv->usemux = 128; /* max 128 channels with softare S&H! */ + devpriv->usemux = 128; + /* max 128 channels with softare S&H! */ } printk(", ext. mux %d channels", devpriv->usemux); } devpriv->softsshdelay = it->options[4]; - if (devpriv->softsshdelay < 0) { /* select sample&hold signal polarity */ + if (devpriv->softsshdelay < 0) { + /* select sample&hold signal polarity */ devpriv->softsshdelay = -devpriv->softsshdelay; devpriv->softsshsample = 0x80; devpriv->softsshhold = 0x00; @@ -2045,7 +2326,8 @@ static int pci9118_attach(struct comedi_device *dev, printk(".\n"); pci_read_config_word(devpriv->pcidev, PCI_COMMAND, &u16w); - pci_write_config_word(devpriv->pcidev, PCI_COMMAND, u16w | 64); /* Enable parity check for parity error */ + pci_write_config_word(devpriv->pcidev, PCI_COMMAND, u16w | 64); + /* Enable parity check for parity error */ ret = alloc_subdevices(dev, 4); if (ret < 0) @@ -2055,11 +2337,11 @@ static int pci9118_attach(struct comedi_device *dev, dev->read_subdev = s; s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; - if (devpriv->usemux) { + if (devpriv->usemux) s->n_chan = devpriv->usemux; - } else { + else s->n_chan = this_board->n_aichan; - } + s->maxdata = this_board->ai_maxdata; s->len_chanlist = this_board->n_aichanlist; s->range_table = this_board->rangelist_ai; @@ -2103,9 +2385,10 @@ static int pci9118_attach(struct comedi_device *dev, s->insn_bits = pci9118_insn_bits_do; devpriv->valid = 1; - devpriv->i8254_osc_base = 250; /* 250ns=4MHz */ - devpriv->ai_maskharderr = 0x10a; /* default measure crash condition */ - if (it->options[5]) /* disable some requested */ + devpriv->i8254_osc_base = 250; /* 250ns=4MHz */ + devpriv->ai_maskharderr = 0x10a; + /* default measure crash condition */ + if (it->options[5]) /* disable some requested */ devpriv->ai_maskharderr &= ~it->options[5]; switch (this_board->ai_maxdata) { @@ -2130,9 +2413,9 @@ static int pci9118_detach(struct comedi_device *dev) if (dev->irq) free_irq(dev->irq, dev); if (devpriv->pcidev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pcidev); - } + pci_dev_put(devpriv->pcidev); } if (devpriv->dmabuf_virt[0]) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 394d2ea..67c4f11 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -63,6 +63,8 @@ Configuration options: #define DPRINTK(fmt, args...) #endif +#define PCI_VENDOR_ID_ADVANTECH 0x13fe + /* hardware types of the cards */ #define TYPE_PCI171X 0 #define TYPE_PCI1713 2 @@ -657,9 +659,9 @@ static void interrupt_pci1710_every_sample(void *d) #endif ++s->async->cur_chan; - if (s->async->cur_chan >= devpriv->ai_n_chan) { + if (s->async->cur_chan >= devpriv->ai_n_chan) s->async->cur_chan = 0; - } + if (s->async->cur_chan == 0) { /* one scan done */ devpriv->ai_act_scan++; @@ -863,12 +865,12 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device *dev, devpriv->ai_eos = 0; } - if ((devpriv->ai_scans == 0) || (devpriv->ai_scans == -1)) { + if ((devpriv->ai_scans == 0) || (devpriv->ai_scans == -1)) devpriv->neverending_ai = 1; - } /* well, user want neverending */ - else { + /* well, user want neverending */ + else devpriv->neverending_ai = 0; - } + switch (mode) { case 1: case 2: @@ -935,7 +937,8 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1 = 0, divisor2 = 0; + int tmp; + unsigned int divisor1 = 0, divisor2 = 0; DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_cmdtest(...)\n"); #ifdef PCI171X_EXTDEBUG @@ -1109,11 +1112,11 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_timer1 = 0; devpriv->ai_timer2 = 0; - if (cmd->stop_src == TRIG_COUNT) { + if (cmd->stop_src == TRIG_COUNT) devpriv->ai_scans = cmd->stop_arg; - } else { + else 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 */ @@ -1593,9 +1596,9 @@ static int pci1710_detach(struct comedi_device *dev) if (dev->irq) free_irq(dev->irq, dev); if (devpriv->pcidev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pcidev); - } + pci_dev_put(devpriv->pcidev); } } diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index 6b0b7ed..9fe8fcc 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -52,7 +52,7 @@ TODO: #include "comedi_pci.h" -#define ADVANTECH_VENDOR 0x13fe /* Advantech PCI vendor ID */ +#define PCI_VENDOR_ID_ADVANTECH 0x13fe /* Advantech PCI vendor ID */ /* hardware types of the cards */ #define TYPE_PCI1723 0 @@ -60,35 +60,57 @@ TODO: #define IORANGE_1723 0x2A /* all the registers for the pci1723 board */ -#define PCI1723_DA(N) ((N)<<1) /* W: D/A register N (0 to 7) */ - -#define PCI1723_SYN_SET 0x12 /*synchronized set register */ -#define PCI1723_ALL_CHNNELE_SYN_STROBE 0x12 /*synchronized status register */ - -#define PCI1723_RANGE_CALIBRATION_MODE 0x14 /* range and calibration mode */ -#define PCI1723_RANGE_CALIBRATION_STATUS 0x14 /* range and calibration status */ - -#define PCI1723_CONTROL_CMD_CALIBRATION_FUN 0x16 /* SADC control command for calibration function */ -#define PCI1723_STATUS_CMD_CALIBRATION_FUN 0x16 /* SADC control status for calibration function */ - -#define PCI1723_CALIBRATION_PARA_STROBE 0x18 /* Calibration parameter strobe */ +#define PCI1723_DA(N) ((N)<<1) /* W: D/A register N (0 to 7) */ + +#define PCI1723_SYN_SET 0x12 /* synchronized set register */ +#define PCI1723_ALL_CHNNELE_SYN_STROBE 0x12 + /* synchronized status register */ + +#define PCI1723_RANGE_CALIBRATION_MODE 0x14 + /* range and calibration mode */ +#define PCI1723_RANGE_CALIBRATION_STATUS 0x14 + /* range and calibration status */ + +#define PCI1723_CONTROL_CMD_CALIBRATION_FUN 0x16 + /* + * SADC control command for + * calibration function + */ +#define PCI1723_STATUS_CMD_CALIBRATION_FUN 0x16 + /* + * SADC control status for + * calibration function + */ + +#define PCI1723_CALIBRATION_PARA_STROBE 0x18 + /* Calibration parameter strobe */ #define PCI1723_DIGITAL_IO_PORT_SET 0x1A /* Digital I/O port setting */ #define PCI1723_DIGITAL_IO_PORT_MODE 0x1A /* Digital I/O port mode */ -#define PCI1723_WRITE_DIGITAL_OUTPUT_CMD 0x1C /* Write digital output command */ +#define PCI1723_WRITE_DIGITAL_OUTPUT_CMD 0x1C + /* Write digital output command */ #define PCI1723_READ_DIGITAL_INPUT_DATA 0x1C /* Read digital input data */ -#define PCI1723_WRITE_CAL_CMD 0x1E /* Write calibration command */ -#define PCI1723_READ_CAL_STATUS 0x1E /* Read calibration status */ +#define PCI1723_WRITE_CAL_CMD 0x1E /* Write calibration command */ +#define PCI1723_READ_CAL_STATUS 0x1E /* Read calibration status */ -#define PCI1723_SYN_STROBE 0x20 /* Synchronized strobe */ +#define PCI1723_SYN_STROBE 0x20 /* Synchronized strobe */ -#define PCI1723_RESET_ALL_CHN_STROBE 0x22 /* Reset all D/A channels strobe */ +#define PCI1723_RESET_ALL_CHN_STROBE 0x22 + /* Reset all D/A channels strobe */ -#define PCI1723_RESET_CAL_CONTROL_STROBE 0x24 /* Reset the calibration controller strobe */ +#define PCI1723_RESET_CAL_CONTROL_STROBE 0x24 + /* + * Reset the calibration + * controller strobe + */ -#define PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE 0x26 /* Change D/A channels output type strobe */ +#define PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE 0x26 + /* + * Change D/A channels output + * type strobe + */ #define PCI1723_SELECT_CALIBRATION 0x28 /* Select the calibration Ref_V */ @@ -104,20 +126,20 @@ static const struct comedi_lrange range_pci1723 = { 1, { */ struct pci1723_board { const char *name; - int vendor_id; /* PCI vendor a device ID of card */ + int vendor_id; /* PCI vendor a device ID of card */ int device_id; int iorange; char cardtype; - int n_aochan; /* num of D/A chans */ - int n_diochan; /* num of DIO chans */ - int ao_maxdata; /* resolution of D/A */ - const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ + int n_aochan; /* num of D/A chans */ + int n_diochan; /* num of DIO chans */ + int ao_maxdata; /* resolution of D/A */ + const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ }; static const struct pci1723_board boardtypes[] = { { .name = "pci1723", - .vendor_id = ADVANTECH_VENDOR, + .vendor_id = PCI_VENDOR_ID_ADVANTECH, .device_id = 0x1723, .iorange = IORANGE_1723, .cardtype = TYPE_PCI1723, @@ -128,8 +150,10 @@ static const struct pci1723_board boardtypes[] = { }, }; -/* This is used by modprobe to translate PCI IDs to drivers. Should - * only be used for PCI and ISA-PnP devices */ +/* + * This is used by modprobe to translate PCI IDs to drivers. + * Should only be used for PCI and ISA-PnP devices + */ static DEFINE_PCI_DEVICE_TABLE(pci1723_pci_table) = { { PCI_VENDOR_ID_ADVANTECH, 0x1723, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { @@ -157,47 +181,47 @@ static struct comedi_driver driver_pci1723 = { .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 { int valid; /* card is usable; */ struct pci_dev *pcidev; - unsigned char da_range[8]; /* D/A output range for each channel */ + unsigned char da_range[8]; /* D/A output range for each channel */ - short ao_data[8]; /* data output buffer */ + short ao_data[8]; /* data output buffer */ }; -/*the following macro to make it easy to -* access the private structure. -*/ +/* The following macro to make it easy to access the private structure. */ #define devpriv ((struct pci1723_private *)dev->private) #define this_board boardtypes /* - * the pci1723 card reset; + * The pci1723 card reset; */ static int pci1723_reset(struct comedi_device *dev) { int i; DPRINTK("adv_pci1723 EDBG: BGN: pci1723_reset(...)\n"); - outw(0x01, dev->iobase + PCI1723_SYN_SET); /* set synchronous output mode */ + outw(0x01, dev->iobase + PCI1723_SYN_SET); + /* set synchronous output mode */ for (i = 0; i < 8; i++) { - /* set all outputs to 0V */ + /* set all outputs to 0V */ devpriv->ao_data[i] = 0x8000; outw(devpriv->ao_data[i], dev->iobase + PCI1723_DA(i)); - /* set all ranges to +/- 10V */ + /* set all ranges to +/- 10V */ devpriv->da_range[i] = 0; outw(((devpriv->da_range[i] << 4) | i), PCI1723_RANGE_CALIBRATION_MODE); } - outw(0, dev->iobase + PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE); /* update ranges */ - outw(0, dev->iobase + PCI1723_SYN_STROBE); /* update outputs */ + outw(0, dev->iobase + PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE); + /* update ranges */ + outw(0, dev->iobase + PCI1723_SYN_STROBE); /* update outputs */ - /* set asynchronous output mode */ + /* set asynchronous output mode */ outw(0, dev->iobase + PCI1723_SYN_SET); DPRINTK("adv_pci1723 EDBG: END: pci1723_reset(...)\n"); @@ -251,11 +275,11 @@ static int pci1723_dio_insn_config(struct comedi_device *dev, unsigned short dio_mode; mask = 1 << CR_CHAN(insn->chanspec); - if (mask & 0x00FF) { + if (mask & 0x00FF) bits = 0x00FF; - } else { + else bits = 0xFF00; - } + switch (data[0]) { case INSN_CONFIG_DIO_INPUT: s->io_bits &= ~bits; @@ -270,12 +294,12 @@ static int pci1723_dio_insn_config(struct comedi_device *dev, return -EINVAL; } - /* update hardware DIO mode */ - dio_mode = 0x0000; /* low byte output, high byte output */ + /* update hardware DIO mode */ + dio_mode = 0x0000; /* low byte output, high byte output */ if ((s->io_bits & 0x00FF) == 0) - dio_mode |= 0x0001; /* low byte input */ + dio_mode |= 0x0001; /* low byte input */ if ((s->io_bits & 0xFF00) == 0) - dio_mode |= 0x0002; /* high byte input */ + dio_mode |= 0x0002; /* high byte input */ outw(dio_mode, dev->iobase + PCI1723_DIGITAL_IO_PORT_SET); return 1; } @@ -311,7 +335,8 @@ static int pci1723_attach(struct comedi_device *dev, int opt_bus, opt_slot; const char *errstr; - printk("comedi%d: adv_pci1723: board=%s", dev->minor, this_board->name); + printk(KERN_ERR "comedi%d: adv_pci1723: board=%s", + dev->minor, this_board->name); opt_bus = it->options[0]; opt_slot = it->options[1]; @@ -349,10 +374,10 @@ static int pci1723_attach(struct comedi_device *dev, if (!pcidev) { if (opt_bus || opt_slot) { - printk(" - Card at b:s %d:%d %s\n", - opt_bus, opt_slot, errstr); + printk(KERN_ERR " - Card at b:s %d:%d %s\n", + opt_bus, opt_slot, errstr); } else { - printk(" - Card %s\n", errstr); + printk(KERN_ERR " - Card %s\n", errstr); } return -EIO; } @@ -362,8 +387,8 @@ static int pci1723_attach(struct comedi_device *dev, pci_func = PCI_FUNC(pcidev->devfn); iobase = pci_resource_start(pcidev, 2); - printk(", b:s:f=%d:%d:%d, io=0x%4x", pci_bus, pci_slot, pci_func, - iobase); + printk(KERN_ERR ", b:s:f=%d:%d:%d, io=0x%4x", + pci_bus, pci_slot, pci_func, iobase); dev->iobase = iobase; @@ -398,22 +423,23 @@ static int pci1723_attach(struct comedi_device *dev, s->insn_write = pci1723_ao_write_winsn; s->insn_read = pci1723_insn_read_ao; - /* read DIO config */ - switch (inw(dev->iobase + PCI1723_DIGITAL_IO_PORT_MODE) & 0x03) { - case 0x00: /* low byte output, high byte output */ + /* read DIO config */ + switch (inw(dev->iobase + PCI1723_DIGITAL_IO_PORT_MODE) + & 0x03) { + case 0x00: /* low byte output, high byte output */ s->io_bits = 0xFFFF; break; - case 0x01: /* low byte input, high byte output */ + case 0x01: /* low byte input, high byte output */ s->io_bits = 0xFF00; break; - case 0x02: /* low byte output, high byte input */ + case 0x02: /* low byte output, high byte input */ s->io_bits = 0x00FF; break; - case 0x03: /* low byte input, high byte input */ + case 0x03: /* low byte input, high byte input */ s->io_bits = 0x0000; break; } - /* read DIO port state */ + /* read DIO port state */ s->state = inw(dev->iobase + PCI1723_READ_DIGITAL_INPUT_DATA); subdev++; @@ -450,16 +476,15 @@ static int pci1723_attach(struct comedi_device *dev, */ static int pci1723_detach(struct comedi_device *dev) { - printk("comedi%d: pci1723: remove\n", dev->minor); + printk(KERN_ERR "comedi%d: pci1723: remove\n", dev->minor); if (dev->private) { if (devpriv->valid) pci1723_reset(dev); if (devpriv->pcidev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pcidev); - } pci_dev_put(devpriv->pcidev); } } diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 61d35fe..40eeecf 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -45,6 +45,8 @@ Configuration options: #define DPRINTK(fmt, args...) #endif +#define PCI_VENDOR_ID_ADVANTECH 0x13fe + /* hardware types of the cards */ enum hw_cards_id { TYPE_PCI1730, TYPE_PCI1733, TYPE_PCI1734, TYPE_PCI1736, @@ -367,9 +369,9 @@ static int pci_dio_insn_bits_di_b(struct comedi_device *dev, int i; data[1] = 0; - for (i = 0; i < d->regs; i++) { + for (i = 0; i < d->regs; i++) data[1] |= inb(dev->iobase + d->addr + i) << (8 * i); - } + return 2; } @@ -882,9 +884,9 @@ static int CheckAndAllocCard(struct comedi_device *dev, struct pci_dio_private *pr, *prev; for (pr = pci_priv, prev = NULL; pr != NULL; prev = pr, pr = pr->next) { - if (pr->pcidev == pcidev) { + if (pr->pcidev == pcidev) return 0; /* this card is used, look for another */ - } + } if (prev) { @@ -1040,22 +1042,22 @@ static int pci_dio_detach(struct comedi_device *dev) int subdev; if (dev->private) { - if (devpriv->valid) { + if (devpriv->valid) pci_dio_reset(dev); - } + /* This shows the silliness of using this kind of * scheme for numbering subdevices. Don't do it. --ds */ subdev = 0; for (i = 0; i < MAX_DI_SUBDEVS; i++) { - if (this_board->sdi[i].chans) { + if (this_board->sdi[i].chans) subdev++; - } + } for (i = 0; i < MAX_DO_SUBDEVS; i++) { - if (this_board->sdo[i].chans) { + if (this_board->sdo[i].chans) subdev++; - } + } for (i = 0; i < MAX_DIO_SUBDEVG; i++) { for (j = 0; j < this_board->sdio[i].regs; j++) { @@ -1071,20 +1073,20 @@ static int pci_dio_detach(struct comedi_device *dev) } if (devpriv->pcidev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pcidev); - } + pci_dev_put(devpriv->pcidev); } - if (devpriv->prev) { + if (devpriv->prev) devpriv->prev->next = devpriv->next; - } else { + else pci_priv = devpriv->next; - } - if (devpriv->next) { + + if (devpriv->next) devpriv->next->prev = devpriv->prev; - } + } return 0; diff --git a/drivers/staging/comedi/drivers/aio_aio12_8.c b/drivers/staging/comedi/drivers/aio_aio12_8.c index c4cac66..7a1c636 100644 --- a/drivers/staging/comedi/drivers/aio_aio12_8.c +++ b/drivers/staging/comedi/drivers/aio_aio12_8.c @@ -110,7 +110,7 @@ static int aio_aio12_8_ai_read(struct comedi_device *dev, while (timeout && !(inb(dev->iobase + AIO12_8_STATUS) & STATUS_ADC_EOC)) { timeout--; - printk("timeout %d\n", timeout); + printk(KERN_ERR "timeout %d\n", timeout); udelay(1); } if (timeout == 0) { @@ -172,7 +172,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev, iobase = it->options[0]; if (!request_region(iobase, 24, "aio_aio12_8")) { - printk("I/O port conflict"); + printk(KERN_ERR "I/O port conflict"); return -EIO; } diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 92bcc205..8eb6765 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -218,7 +218,7 @@ order they appear in the channel list. #define DIO200_DRIVER_NAME "amplc_dio200" /* PCI IDs */ -/* #define PCI_VENDOR_ID_AMPLICON 0x14dc */ +#define PCI_VENDOR_ID_AMPLICON 0x14dc #define PCI_DEVICE_ID_AMPLICON_PCI272 0x000a #define PCI_DEVICE_ID_AMPLICON_PCI215 0x000b #define PCI_DEVICE_ID_INVALID 0xffff @@ -661,7 +661,7 @@ dio200_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s, subpriv = s->private; spin_lock_irqsave(&subpriv->spinlock, flags); - s->async->inttrig = 0; + s->async->inttrig = NULL; if (subpriv->active) event = dio200_start_intr(dev, s); @@ -1364,7 +1364,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) break; case sd_8255: /* digital i/o subdevice (8255) */ - ret = subdev_8255_init(dev, s, 0, + ret = subdev_8255_init(dev, s, NULL, iobase + layout->sdinfo[n]); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index c54cca8..c486a87 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -118,7 +118,7 @@ Caveats: /* * PCI IDs. */ -/* #define PCI_VENDOR_ID_AMPLICON 0x14dc */ +#define PCI_VENDOR_ID_AMPLICON 0x14dc #define PCI_DEVICE_ID_AMPLICON_PCI224 0x0007 #define PCI_DEVICE_ID_AMPLICON_PCI234 0x0008 #define PCI_DEVICE_ID_INVALID 0xffff @@ -496,9 +496,9 @@ pci224_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, /* Writing a list of values to an AO channel is probably not * very useful, but that's how the interface is defined. */ - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) pci224_ao_set_data(dev, chan, range, data[i]); - } + return i; } @@ -519,9 +519,9 @@ pci224_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, chan = CR_CHAN(insn->chanspec); - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = devpriv->ao_readback[chan]; - } + return i; } @@ -544,9 +544,9 @@ static void pci224_ao_stop(struct comedi_device *dev, { unsigned long flags; - if (!test_and_clear_bit(AO_CMD_STARTED, &devpriv->state)) { + if (!test_and_clear_bit(AO_CMD_STARTED, &devpriv->state)) return; - } + spin_lock_irqsave(&devpriv->ao_spinlock, flags); /* Kill the interrupts. */ @@ -597,11 +597,11 @@ static void pci224_ao_start(struct comedi_device *dev, } else { /* Enable interrupts. */ spin_lock_irqsave(&devpriv->ao_spinlock, flags); - if (cmd->stop_src == TRIG_EXT) { + if (cmd->stop_src == TRIG_EXT) devpriv->intsce = PCI224_INTR_EXT | PCI224_INTR_DAC; - } else { + else devpriv->intsce = PCI224_INTR_DAC; - } + outb(devpriv->intsce, devpriv->iobase1 + PCI224_INT_SCE); spin_unlock_irqrestore(&devpriv->ao_spinlock, flags); } @@ -630,9 +630,9 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, num_scans = comedi_buf_read_n_available(s->async) / bytes_per_scan; if (!devpriv->ao_stop_continuous) { /* Fixed number of scans. */ - if (num_scans > devpriv->ao_stop_count) { + if (num_scans > devpriv->ao_stop_count) num_scans = devpriv->ao_stop_count; - } + } /* Determine how much room is in the FIFO (in samples). */ @@ -669,13 +669,13 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, } } /* Determine how many new scans can be put in the FIFO. */ - if (cmd->chanlist_len) { + if (cmd->chanlist_len) room /= cmd->chanlist_len; - } + /* Determine how many scans to process. */ - if (num_scans > room) { + if (num_scans > room) num_scans = room; - } + /* Process scans. */ for (n = 0; n < num_scans; n++) { cfc_read_array_from_buffer(s, &devpriv->ao_scan_vals[0], @@ -718,19 +718,19 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, trig = PCI224_DACCON_TRIG_Z2CT0; } else { /* cmd->scan_begin_src == TRIG_EXT */ - if (cmd->scan_begin_arg & CR_INVERT) { + if (cmd->scan_begin_arg & CR_INVERT) trig = PCI224_DACCON_TRIG_EXTN; - } else { + else trig = PCI224_DACCON_TRIG_EXTP; - } + } devpriv->daccon = COMBINE(devpriv->daccon, trig, PCI224_DACCON_TRIG_MASK); outw(devpriv->daccon, dev->iobase + PCI224_DACCON); } - if (s->async->events) { + if (s->async->events) comedi_event(dev, s); - } + } /* @@ -855,9 +855,9 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, err++; } tmp = cmd->chanlist_len * CONVERT_PERIOD; - if (tmp < MIN_SCAN_PERIOD) { + if (tmp < MIN_SCAN_PERIOD) tmp = MIN_SCAN_PERIOD; - } + if (cmd->scan_begin_arg < tmp) { cmd->scan_begin_arg = tmp; err++; @@ -966,9 +966,9 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, devpriv->cached_div1 = div1; devpriv->cached_div2 = div2; } - if (tmp != cmd->scan_begin_arg) { + if (tmp != cmd->scan_begin_arg) err++; - } + } if (err) @@ -994,13 +994,13 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, tmp = 0; for (n = 0; n < cmd->chanlist_len; n++) { ch = CR_CHAN(cmd->chanlist[n]); - if (tmp & (1U << ch)) { + if (tmp & (1U << ch)) errors |= dupchan_err; - } + tmp |= (1U << ch); - if (CR_RANGE(cmd->chanlist[n]) != range) { + if (CR_RANGE(cmd->chanlist[n]) != range) errors |= range_err; - } + } if (errors) { if (errors & dupchan_err) { @@ -1038,9 +1038,9 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) unsigned long flags; /* Cannot handle null/empty chanlist. */ - if (cmd->chanlist == NULL || cmd->chanlist_len == 0) { + if (cmd->chanlist == NULL || cmd->chanlist_len == 0) return -EINVAL; - } + /* Determine which channels are enabled and their load order. */ devpriv->ao_enab = 0; @@ -1050,9 +1050,9 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ao_enab |= 1U << ch; rank = 0; for (j = 0; j < cmd->chanlist_len; j++) { - if (CR_CHAN(cmd->chanlist[j]) < ch) { + if (CR_CHAN(cmd->chanlist[j]) < ch) rank++; - } + } devpriv->ao_scan_order[rank] = i; } @@ -1221,9 +1221,9 @@ pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, offset = 32768; } /* Munge the data. */ - for (i = 0; i < length; i++) { + for (i = 0; i < length; i++) array[i] = (array[i] << shift) - offset; - } + } /* @@ -1254,15 +1254,15 @@ static irqreturn_t pci224_interrupt(int irq, void *d) cmd = &s->async->cmd; if (valid_intstat & PCI224_INTR_EXT) { devpriv->intsce &= ~PCI224_INTR_EXT; - if (cmd->start_src == TRIG_EXT) { + if (cmd->start_src == TRIG_EXT) pci224_ao_start(dev, s); - } else if (cmd->stop_src == TRIG_EXT) { + else if (cmd->stop_src == TRIG_EXT) pci224_ao_stop(dev, s); - } + } - if (valid_intstat & PCI224_INTR_DAC) { + if (valid_intstat & PCI224_INTR_DAC) pci224_ao_handle_fifo(dev, s); - } + } /* Reenable interrupt sources. */ spin_lock_irqsave(&devpriv->ao_spinlock, flags); @@ -1381,23 +1381,23 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Allocate readback buffer for AO channels. */ devpriv->ao_readback = kmalloc(sizeof(devpriv->ao_readback[0]) * thisboard->ao_chans, GFP_KERNEL); - if (!devpriv->ao_readback) { + if (!devpriv->ao_readback) return -ENOMEM; - } + /* Allocate buffer to hold values for AO channel scan. */ devpriv->ao_scan_vals = kmalloc(sizeof(devpriv->ao_scan_vals[0]) * thisboard->ao_chans, GFP_KERNEL); - if (!devpriv->ao_scan_vals) { + if (!devpriv->ao_scan_vals) return -ENOMEM; - } + /* Allocate buffer to hold AO channel scan order. */ devpriv->ao_scan_order = kmalloc(sizeof(devpriv->ao_scan_order[0]) * thisboard->ao_chans, GFP_KERNEL); - if (!devpriv->ao_scan_order) { + if (!devpriv->ao_scan_order) return -ENOMEM; - } + /* Disable interrupt sources. */ devpriv->intsce = 0; @@ -1445,9 +1445,9 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->range_table_list = range_table_list = kmalloc(sizeof(struct comedi_lrange *) * s->n_chan, GFP_KERNEL); - if (!s->range_table_list) { + if (!s->range_table_list) return -ENOMEM; - } + for (n = 2; n < 3 + s->n_chan; n++) { if (it->options[n] < 0 || it->options[n] > 1) { printk(KERN_WARNING "comedi%d: %s: warning! " @@ -1459,11 +1459,11 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) for (n = 0; n < s->n_chan; n++) { if (n < COMEDI_NDEVCONFOPTS - 3 && it->options[3 + n] == 1) { - if (it->options[2] == 1) { + if (it->options[2] == 1) range_table_list[n] = &range_pci234_ext; - } else { + else range_table_list[n] = &range_bipolar5; - } + } else { if (it->options[2] == 1) { range_table_list[n] = @@ -1506,11 +1506,11 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); printk("(pci %s) ", pci_name(pci_dev)); - if (irq) { + if (irq) printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); - } else { + else printk("(no irq) "); - } + printk("attached\n"); @@ -1529,9 +1529,9 @@ static int pci224_detach(struct comedi_device *dev) { printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor, DRIVER_NAME); - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } + if (dev->subdevices) { struct comedi_subdevice *s; @@ -1544,9 +1544,9 @@ static int pci224_detach(struct comedi_device *dev) kfree(devpriv->ao_scan_vals); kfree(devpriv->ao_scan_order); if (devpriv->pci_dev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); - } + pci_dev_put(devpriv->pci_dev); } } diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 091a1a5..7fffd96 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -669,9 +669,9 @@ static short pci230_ai_read(struct comedi_device *dev) /* If a bipolar range was specified, mangle it (twos * complement->straight binary). */ - if (devpriv->ai_bipolar) { + if (devpriv->ai_bipolar) data ^= 1 << (thisboard->ai_bits - 1); - } + return data; } @@ -680,9 +680,9 @@ static inline unsigned short pci230_ao_mangle_datum(struct comedi_device *dev, { /* If a bipolar range was specified, mangle it (straight binary->twos * complement). */ - if (devpriv->ao_bipolar) { + if (devpriv->ao_bipolar) datum ^= 1 << (thisboard->ao_bits - 1); - } + /* PCI230 is 12 bit - stored in upper bits of 16 bit register (lower * four bits reserved for expansion). */ @@ -734,9 +734,9 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Allocate the private structure area using alloc_private(). * Macro defined in comedidev.h - memsets struct fields to 0. */ - if ((alloc_private(dev, sizeof(struct pci230_private))) < 0) { + if ((alloc_private(dev, sizeof(struct pci230_private))) < 0) return -ENOMEM; - } + spin_lock_init(&devpriv->isr_spinlock); spin_lock_init(&devpriv->res_spinlock); spin_lock_init(&devpriv->ai_stop_spinlock); @@ -991,9 +991,9 @@ static int pci230_detach(struct comedi_device *dev) if (devpriv) { if (devpriv->pci_dev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); - } + pci_dev_put(devpriv->pci_dev); } } @@ -1055,9 +1055,9 @@ static void put_resources(struct comedi_device *dev, unsigned int res_mask, && (res_mask != 0); b <<= 1, i++) { if ((res_mask & b) != 0) { res_mask &= ~b; - if (devpriv->res_owner[i] == owner) { + if (devpriv->res_owner[i] == owner) devpriv->res_owner[i] = OWNER_NONE; - } + } } spin_unlock_irqrestore(&devpriv->res_spinlock, irqflags); @@ -1132,11 +1132,11 @@ static int pci230_ai_rinsn(struct comedi_device *dev, } devpriv->adcg = (devpriv->adcg & ~(3 << gainshift)) | (pci230_ai_gain[range] << gainshift); - if (devpriv->ai_bipolar) { + if (devpriv->ai_bipolar) adccon |= PCI230_ADC_IR_BIP; - } else { + else adccon |= PCI230_ADC_IR_UNI; - } + /* Enable only this channel in the scan list - otherwise by default * we'll get one sample from each channel. */ @@ -1408,13 +1408,13 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, chan = CR_CHAN(cmd->chanlist[n]); range = CR_RANGE(cmd->chanlist[n]); /* Channel numbers must strictly increase. */ - if (chan < prev_chan) { + if (chan < prev_chan) errors |= seq_err; - } + /* Ranges must be the same. */ - if (range != first_range) { + if (range != first_range) errors |= range_err; - } + prev_chan = chan; } if (errors != 0) { @@ -1583,9 +1583,9 @@ static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->scan_begin_src == TRIG_TIMER) { /* Claim Z2-CT1. */ - if (!get_one_resource(dev, RES_Z2CT1, OWNER_AOCMD)) { + if (!get_one_resource(dev, RES_Z2CT1, OWNER_AOCMD)) return -EBUSY; - } + } /* Get number of scans required. */ @@ -1609,9 +1609,9 @@ static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) unsigned int i; dacen = 0; - for (i = 0; i < cmd->chanlist_len; i++) { + for (i = 0; i < cmd->chanlist_len; i++) dacen |= 1 << CR_CHAN(cmd->chanlist[i]); - } + /* Set channel scan list. */ outw(dacen, dev->iobase + PCI230P2_DACEN); /* @@ -1656,9 +1656,9 @@ static int pci230_ai_check_scan_period(struct comedi_cmd *cmd) int err = 0; chanlist_len = cmd->chanlist_len; - if (cmd->chanlist_len == 0) { + if (cmd->chanlist_len == 0) chanlist_len = 1; - } + min_scan_period = chanlist_len * cmd->convert_arg; if ((min_scan_period < chanlist_len) || (min_scan_period < cmd->convert_arg)) { @@ -1777,11 +1777,11 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, * single-ended or pseudo-differential. */ if (cmd->chanlist && (cmd->chanlist_len > 0)) { /* Peek analogue reference of first channel. */ - if (CR_AREF(cmd->chanlist[0]) == AREF_DIFF) { + if (CR_AREF(cmd->chanlist[0]) == AREF_DIFF) max_speed_ai = MAX_SPEED_AI_DIFF; - } else { + else max_speed_ai = MAX_SPEED_AI_SE; - } + } else { /* No channel list. Assume single-ended. */ max_speed_ai = MAX_SPEED_AI_SE; @@ -1871,9 +1871,9 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, } } else if (cmd->scan_begin_src == TRIG_TIMER) { /* N.B. cmd->convert_arg is also TRIG_TIMER */ - if (!pci230_ai_check_scan_period(cmd)) { + if (!pci230_ai_check_scan_period(cmd)) err++; - } + } else { if (cmd->scan_begin_arg != 0) { cmd->scan_begin_arg = 0; @@ -1961,13 +1961,13 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, errors |= seq_err; } /* Channels must have same AREF. */ - if (aref != prev_aref) { + if (aref != prev_aref) errors |= aref_err; - } + /* Channel ranges must have same polarity. */ - if (polarity != prev_polarity) { + if (polarity != prev_polarity) errors |= polarity_err; - } + /* Single-ended channel pairs must have same * range. */ if ((aref != AREF_DIFF) @@ -1987,9 +1987,9 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, } /* If channel list is a repeating subsequence, need a whole * number of repeats. */ - if ((n % subseq_len) != 0) { + if ((n % subseq_len) != 0) errors |= seq_err; - } + if ((devpriv->hwver > 0) && (devpriv->hwver < 4)) { /* * Buggy PCI230+ or PCI260+ requires channel 0 to be @@ -2228,9 +2228,9 @@ static void pci230_ai_start(struct comedi_device *dev, devpriv->adccon = (devpriv->adccon & ~PCI230_ADC_TRIG_MASK) | conv; outw(devpriv->adccon, dev->iobase + PCI230_ADCCON); - if (cmd->convert_src == TRIG_INT) { + if (cmd->convert_src == TRIG_INT) async->inttrig = pci230_ai_inttrig_convert; - } + /* Update FIFO interrupt trigger level, which is currently * set to "full". */ pci230_ai_update_fifo_trigger_level(dev, s); @@ -2345,9 +2345,9 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } } /* Claim resources. */ - if (!get_resources(dev, res_mask, OWNER_AICMD)) { + if (!get_resources(dev, res_mask, OWNER_AICMD)) return -EBUSY; - } + /* Get number of scans required. */ if (cmd->stop_src == TRIG_COUNT) { @@ -2392,11 +2392,11 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) range = CR_RANGE(cmd->chanlist[0]); devpriv->ai_bipolar = pci230_ai_bipolar[range]; - if (devpriv->ai_bipolar) { + if (devpriv->ai_bipolar) adccon |= PCI230_ADC_IR_BIP; - } else { + else adccon |= PCI230_ADC_IR_UNI; - } + for (i = 0; i < cmd->chanlist_len; i++) { unsigned int gainshift; @@ -2543,9 +2543,9 @@ static unsigned int pci230_choose_clk_count(uint64_t ns, unsigned int *count, for (clk_src = CLK_10MHZ;; clk_src++) { cnt = divide_ns(ns, pci230_timebase[clk_src], round_mode); - if ((cnt <= 65536) || (clk_src == CLK_1KHZ)) { + if ((cnt <= 65536) || (clk_src == CLK_1KHZ)) break; - } + } *count = cnt; return clk_src; @@ -2575,9 +2575,9 @@ static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct, /* Program clock source. */ outb(CLK_CONFIG(ct, clk_src), devpriv->iobase1 + PCI230_ZCLK_SCE); /* Set initial count. */ - if (count >= 65536) { + if (count >= 65536) count = 0; - } + i8254_write(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, count); } @@ -2599,9 +2599,9 @@ static irqreturn_t pci230_interrupt(int irq, void *d) /* Read interrupt status/enable register. */ status_int = inb(devpriv->iobase1 + PCI230_INT_STAT); - if (status_int == PCI230_INT_DISABLE) { + if (status_int == PCI230_INT_DISABLE) return IRQ_NONE; - } + spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); valid_status_int = devpriv->int_en & status_int; @@ -2660,9 +2660,9 @@ static void pci230_handle_ao_nofifo(struct comedi_device *dev, struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; - if (!devpriv->ao_continuous && (devpriv->ao_scan_count == 0)) { + if (!devpriv->ao_continuous && (devpriv->ao_scan_count == 0)) return; - } + for (i = 0; i < cmd->chanlist_len; i++) { /* Read sample from Comedi's circular buffer. */ @@ -2711,9 +2711,9 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev, num_scans = comedi_buf_read_n_available(async) / bytes_per_scan; if (!devpriv->ao_continuous) { /* Fixed number of scans. */ - if (num_scans > devpriv->ao_scan_count) { + if (num_scans > devpriv->ao_scan_count) num_scans = devpriv->ao_scan_count; - } + if (devpriv->ao_scan_count == 0) { /* End of acquisition. */ events |= COMEDI_CB_EOA; @@ -2736,21 +2736,21 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev, } if (events == 0) { /* Determine how much room is in the FIFO (in samples). */ - if ((dacstat & PCI230P2_DAC_FIFO_FULL) != 0) { + if ((dacstat & PCI230P2_DAC_FIFO_FULL) != 0) room = PCI230P2_DAC_FIFOROOM_FULL; - } else if ((dacstat & PCI230P2_DAC_FIFO_HALF) != 0) { + else if ((dacstat & PCI230P2_DAC_FIFO_HALF) != 0) room = PCI230P2_DAC_FIFOROOM_HALFTOFULL; - } else if ((dacstat & PCI230P2_DAC_FIFO_EMPTY) != 0) { + else if ((dacstat & PCI230P2_DAC_FIFO_EMPTY) != 0) room = PCI230P2_DAC_FIFOROOM_EMPTY; - } else { + else room = PCI230P2_DAC_FIFOROOM_ONETOHALF; - } + /* Convert room to number of scans that can be added. */ room /= cmd->chanlist_len; /* Determine number of scans to process. */ - if (num_scans > room) { + if (num_scans > room) num_scans = room; - } + /* Process scans. */ for (n = 0; n < num_scans; n++) { for (i = 0; i < cmd->chanlist_len; i++) { @@ -2817,14 +2817,14 @@ static void pci230_handle_ai(struct comedi_device *dev, } else { todo = (devpriv->ai_scan_count * scanlen) - devpriv->ai_scan_pos; - if (todo > PCI230_ADC_FIFOLEVEL_HALFFULL) { + if (todo > PCI230_ADC_FIFOLEVEL_HALFFULL) todo = PCI230_ADC_FIFOLEVEL_HALFFULL; - } + } - if (todo == 0) { + if (todo == 0) return; - } + fifoamount = 0; for (i = 0; i < todo; i++) { @@ -2906,9 +2906,9 @@ static void pci230_ao_stop(struct comedi_device *dev, spin_lock_irqsave(&devpriv->ao_stop_spinlock, irqflags); started = test_and_clear_bit(AO_CMD_STARTED, &devpriv->state); spin_unlock_irqrestore(&devpriv->ao_stop_spinlock, irqflags); - if (!started) { + if (!started) return; - } + cmd = &s->async->cmd; if (cmd->scan_begin_src == TRIG_TIMER) { @@ -2968,9 +2968,9 @@ static void pci230_ai_stop(struct comedi_device *dev, spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags); started = test_and_clear_bit(AI_CMD_STARTED, &devpriv->state); spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, irqflags); - if (!started) { + if (!started) return; - } + cmd = &s->async->cmd; if (cmd->convert_src == TRIG_TIMER) { diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 30b522c..cfeb11f 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -175,17 +175,18 @@ static int das16cs_attach(struct comedi_device *dev, printk("I/O base=0x%04lx ", dev->iobase); printk("fingerprint:\n"); - for (i = 0; i < 48; i += 2) { + for (i = 0; i < 48; i += 2) printk("%04x ", inw(dev->iobase + i)); - } + printk("\n"); ret = request_irq(link->irq, das16cs_interrupt, IRQF_SHARED, "cb_das16_cs", dev); - if (ret < 0) { + if (ret < 0) return ret; - } + dev->irq = link->irq; + printk("irq=%u ", dev->irq); dev->board_ptr = das16cs_probe(dev, link); @@ -262,9 +263,9 @@ static int das16cs_detach(struct comedi_device *dev) { printk("comedi%d: das16cs: remove\n", dev->minor); - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } + return 0; } @@ -834,6 +835,9 @@ static struct pcmcia_device_id das16cs_id_table[] = { }; MODULE_DEVICE_TABLE(pcmcia, das16cs_id_table); +MODULE_AUTHOR("David A. Schleef <ds@schleef.org>"); +MODULE_DESCRIPTION("Comedi driver for Computer Boards PC-CARD DAS16/16"); +MODULE_LICENSE("GPL"); struct pcmcia_driver das16cs_driver = { .probe = das16cs_pcmcia_attach, diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 82295e0..79aa286 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -107,6 +107,8 @@ TODO: #define PRESCALED_TIMER_BASE 10000 /* 100kHz 'prescaled' clock for slow aquisition, maybe I'll support this someday */ #define DMA_BUFFER_SIZE 0x1000 +#define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307 + /* maximum value that can be loaded into board's 24-bit counters*/ static const int max_counter_value = 0xffffff; @@ -1099,9 +1101,9 @@ struct pcidas64_private { resource_size_t main_phys_iobase; resource_size_t dio_counter_phys_iobase; /* base addresses (ioremapped) */ - void *plx9080_iobase; - void *main_iobase; - void *dio_counter_iobase; + void __iomem *plx9080_iobase; + void __iomem *main_iobase; + void __iomem *dio_counter_iobase; /* local address (used by dma controller) */ uint32_t local0_iobase; uint32_t local1_iobase; @@ -1314,7 +1316,7 @@ static inline int ao_cmd_is_supported(const struct pcidas64_board *board) static void init_plx9080(struct comedi_device *dev) { uint32_t bits; - void *plx_iobase = priv(dev)->plx9080_iobase; + void __iomem *plx_iobase = priv(dev)->plx9080_iobase; priv(dev)->plx_control_bits = readl(priv(dev)->plx9080_iobase + PLX_CONTROL_REG); @@ -1404,7 +1406,7 @@ static void init_plx9080(struct comedi_device *dev) static int setup_subdevices(struct comedi_device *dev) { struct comedi_subdevice *s; - void *dio_8255_iobase; + void __iomem *dio_8255_iobase; int i; if (alloc_subdevices(dev, 10) < 0) @@ -1430,7 +1432,6 @@ static int setup_subdevices(struct comedi_device *dev) s->do_cmdtest = ai_cmdtest; s->cancel = ai_cancel; if (board(dev)->layout == LAYOUT_4020) { - unsigned int i; uint8_t data; /* set adc to read from inputs (not internal calibration sources) */ priv(dev)->i2c_cal_range_bits = adc_src_4020_bits(4); @@ -1612,7 +1613,7 @@ static void init_stc_registers(struct comedi_device *dev) disable_ai_pacing(dev); }; -int alloc_and_init_dma_members(struct comedi_device *dev) +static int alloc_and_init_dma_members(struct comedi_device *dev) { int i; @@ -1621,9 +1622,9 @@ int alloc_and_init_dma_members(struct comedi_device *dev) priv(dev)->ai_buffer[i] = pci_alloc_consistent(priv(dev)->hw_dev, DMA_BUFFER_SIZE, &priv(dev)->ai_buffer_bus_addr[i]); - if (priv(dev)->ai_buffer[i] == NULL) { + if (priv(dev)->ai_buffer[i] == NULL) return -ENOMEM; - } + } for (i = 0; i < AO_DMA_RING_COUNT; i++) { if (ao_cmd_is_supported(board(dev))) { @@ -1632,9 +1633,9 @@ int alloc_and_init_dma_members(struct comedi_device *dev) DMA_BUFFER_SIZE, &priv(dev)-> ao_buffer_bus_addr[i]); - if (priv(dev)->ao_buffer[i] == NULL) { + if (priv(dev)->ao_buffer[i] == NULL) return -ENOMEM; - } + } } /* allocate dma descriptors */ @@ -1643,9 +1644,9 @@ int alloc_and_init_dma_members(struct comedi_device *dev) sizeof(struct plx_dma_desc) * ai_dma_ring_count(board(dev)), &priv(dev)->ai_dma_desc_bus_addr); - if (priv(dev)->ai_dma_desc == NULL) { + if (priv(dev)->ai_dma_desc == NULL) return -ENOMEM; - } + DEBUG_PRINT("ai dma descriptors start at bus addr 0x%x\n", priv(dev)->ai_dma_desc_bus_addr); if (ao_cmd_is_supported(board(dev))) { @@ -1654,9 +1655,9 @@ int alloc_and_init_dma_members(struct comedi_device *dev) sizeof(struct plx_dma_desc) * AO_DMA_RING_COUNT, &priv(dev)->ao_dma_desc_bus_addr); - if (priv(dev)->ao_dma_desc == NULL) { + if (priv(dev)->ao_dma_desc == NULL) return -ENOMEM; - } + DEBUG_PRINT("ao dma descriptors start at bus addr 0x%x\n", priv(dev)->ao_dma_desc_bus_addr); } @@ -1848,9 +1849,9 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(" irq %u\n", dev->irq); retval = setup_subdevices(dev); - if (retval < 0) { + if (retval < 0) return retval; - } + return 0; } @@ -1875,12 +1876,12 @@ static int detach(struct comedi_device *dev) if (priv(dev)->hw_dev) { if (priv(dev)->plx9080_iobase) { disable_plx_interrupts(dev); - iounmap((void *)priv(dev)->plx9080_iobase); + iounmap(priv(dev)->plx9080_iobase); } if (priv(dev)->main_iobase) - iounmap((void *)priv(dev)->main_iobase); + iounmap(priv(dev)->main_iobase); if (priv(dev)->dio_counter_iobase) - iounmap((void *)priv(dev)->dio_counter_iobase); + iounmap(priv(dev)->dio_counter_iobase); /* free pci dma buffers */ for (i = 0; i < ai_dma_ring_count(board(dev)); i++) { if (priv(dev)->ai_buffer[i]) @@ -1919,9 +1920,9 @@ static int detach(struct comedi_device *dev) priv(dev)->ao_dma_desc, priv(dev)-> ao_dma_desc_bus_addr); - if (priv(dev)->main_phys_iobase) { + if (priv(dev)->main_phys_iobase) comedi_pci_disable(priv(dev)->hw_dev); - } + pci_dev_put(priv(dev)->hw_dev); } } @@ -2902,9 +2903,9 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev) if (cmd->stop_src == TRIG_COUNT) { if (priv(dev)->ai_count == 0) break; - if (num_samples > priv(dev)->ai_count) { + if (num_samples > priv(dev)->ai_count) num_samples = priv(dev)->ai_count; - } + priv(dev)->ai_count -= num_samples; } @@ -2943,9 +2944,9 @@ static void pio_drain_ai_fifo_32(struct comedi_device *dev) readw(priv(dev)->main_iobase + ADC_READ_PNTR_REG) & 0x7fff; if (cmd->stop_src == TRIG_COUNT) { - if (max_transfer > priv(dev)->ai_count) { + if (max_transfer > priv(dev)->ai_count) max_transfer = priv(dev)->ai_count; - } + } for (i = 0; read_code != write_code && i < max_transfer;) { fifo_data = readl(priv(dev)->dio_counter_iobase + ADC_FIFO_REG); @@ -2964,9 +2965,9 @@ static void pio_drain_ai_fifo_32(struct comedi_device *dev) /* empty fifo */ static void pio_drain_ai_fifo(struct comedi_device *dev) { - if (board(dev)->layout == LAYOUT_4020) { + if (board(dev)->layout == LAYOUT_4020) pio_drain_ai_fifo_32(dev); - } else + else pio_drain_ai_fifo_16(dev); } @@ -2976,7 +2977,7 @@ static void drain_dma_buffers(struct comedi_device *dev, unsigned int channel) uint32_t next_transfer_addr; int j; int num_samples = 0; - void *pci_addr_reg; + void __iomem *pci_addr_reg; if (channel) pci_addr_reg = @@ -3016,8 +3017,9 @@ static void drain_dma_buffers(struct comedi_device *dev, unsigned int channel) * unused buffer) */ } -void handle_ai_interrupt(struct comedi_device *dev, unsigned short status, - unsigned int plx_status) +static void handle_ai_interrupt(struct comedi_device *dev, + unsigned short status, + unsigned int plx_status) { struct comedi_subdevice *s = dev->read_subdev; struct comedi_async *async = s->async; @@ -3038,9 +3040,9 @@ void handle_ai_interrupt(struct comedi_device *dev, unsigned short status, priv(dev)->plx9080_iobase + PLX_DMA1_CS_REG); DEBUG_PRINT("dma1 status 0x%x\n", dma1_status); - if (dma1_status & PLX_DMA_EN_BIT) { + if (dma1_status & PLX_DMA_EN_BIT) drain_dma_buffers(dev, 1); - } + DEBUG_PRINT(" cleared dma ch1 interrupt\n"); } spin_unlock_irqrestore(&dev->spinlock, flags); @@ -3227,7 +3229,7 @@ static irqreturn_t handle_interrupt(int irq, void *d) return IRQ_HANDLED; } -void abort_dma(struct comedi_device *dev, unsigned int channel) +static void abort_dma(struct comedi_device *dev, unsigned int channel) { unsigned long flags; @@ -3422,7 +3424,7 @@ static void load_ao_dma(struct comedi_device *dev, const struct comedi_cmd *cmd) { unsigned int num_bytes; unsigned int next_transfer_addr; - void *pci_addr_reg = + void __iomem *pci_addr_reg = priv(dev)->plx9080_iobase + PLX_DMA0_PCI_ADDRESS_REG; unsigned int buffer_index; @@ -3656,24 +3658,26 @@ static int ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } -static int dio_callback(int dir, int port, int data, unsigned long iobase) +static int dio_callback(int dir, int port, int data, unsigned long arg) { + void __iomem *iobase = (void __iomem *)arg; if (dir) { - writeb(data, (void *)(iobase + port)); + writeb(data, iobase + port); DEBUG_PRINT("wrote 0x%x to port %i\n", data, port); return 0; } else { - return readb((void *)(iobase + port)); + return readb(iobase + port); } } -static int dio_callback_4020(int dir, int port, int data, unsigned long iobase) +static int dio_callback_4020(int dir, int port, int data, unsigned long arg) { + void __iomem *iobase = (void __iomem *)arg; if (dir) { - writew(data, (void *)(iobase + 2 * port)); + writew(data, iobase + 2 * port); return 0; } else { - return readw((void *)(iobase + 2 * port)); + return readw(iobase + 2 * port); } } @@ -3860,7 +3864,7 @@ static uint16_t read_eeprom(struct comedi_device *dev, uint8_t address) static const int read_command = 0x6; unsigned int bitstream = (read_command << 8) | address; unsigned int bit; - void *const plx_control_addr = + void __iomem * const plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; uint16_t value; static const int value_length = 16; @@ -4183,7 +4187,8 @@ static const int i2c_low_udelay = 10; static void i2c_set_sda(struct comedi_device *dev, int state) { static const int data_bit = CTL_EE_W; - void *plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; + void __iomem *plx_control_addr = priv(dev)->plx9080_iobase + + PLX_CONTROL_REG; if (state) { /* set data line high */ @@ -4202,7 +4207,8 @@ static void i2c_set_sda(struct comedi_device *dev, int state) static void i2c_set_scl(struct comedi_device *dev, int state) { static const int clock_bit = CTL_USERO; - void *plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; + void __iomem *plx_control_addr = priv(dev)->plx9080_iobase + + PLX_CONTROL_REG; if (state) { /* set clock line high */ diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 2e61727..49dccbb 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -52,6 +52,8 @@ See http://www.measurementcomputing.com/PDFManuals/pcim-das1602_16.pdf for more /* #define CBPCIMDAS_DEBUG */ #undef CBPCIMDAS_DEBUG +#define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307 + /* Registers for the PCIM-DAS1602/16 */ /* sizes of io regions (bytes) */ diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c index e32a317..f404ec77 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdda.c +++ b/drivers/staging/comedi/drivers/cb_pcimdda.c @@ -91,7 +91,8 @@ Configuration Options: #include "8255.h" /* device ids of the cards we support -- currently only 1 card supported */ -#define PCI_ID_PCIM_DDA06_16 0x0053 +#define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307 +#define PCI_ID_PCIM_DDA06_16 0x0053 /* * This is straight from skel.c -- I did this in case this source file diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c index 41311d9..7016222 100644 --- a/drivers/staging/comedi/drivers/comedi_bond.c +++ b/drivers/staging/comedi/drivers/comedi_bond.c @@ -87,18 +87,17 @@ Configuration Options: * options that are used with comedi_config. */ -#include "../comedilib.h" -#include "../comedidev.h" #include <linux/string.h> #include <linux/slab.h> +#include "../comedi.h" +#include "../comedilib.h" +#include "../comedidev.h" /* The maxiumum number of channels per subdevice. */ #define MAX_CHANS 256 #define MODULE_NAME "comedi_bond" -#ifdef MODULE_LICENSE MODULE_LICENSE("GPL"); -#endif #ifndef STR # define STR1(x) #x # define STR(x) STR1(x) @@ -143,7 +142,7 @@ static const struct BondingBoard bondingBoards[] = { #define thisboard ((const struct BondingBoard *)dev->board_ptr) struct BondedDevice { - void *dev; + struct comedi_device *dev; unsigned minor; unsigned subdev; unsigned subdev_type; @@ -405,7 +404,7 @@ static void *Realloc(const void *oldmem, size_t newlen, size_t oldlen) static int doDevConfig(struct comedi_device *dev, struct comedi_devconfig *it) { int i; - void *devs_opened[COMEDI_NUM_BOARD_MINORS]; + struct comedi_device *devs_opened[COMEDI_NUM_BOARD_MINORS]; memset(devs_opened, 0, sizeof(devs_opened)); devpriv->name[0] = 0;; @@ -414,7 +413,7 @@ static int doDevConfig(struct comedi_device *dev, struct comedi_devconfig *it) for (i = 0; i < COMEDI_NDEVCONFOPTS && (!i || it->options[i]); ++i) { char file[] = "/dev/comediXXXXXX"; int minor = it->options[i]; - void *d; + struct comedi_device *d; int sdev = -1, nchans, tmp; struct BondedDevice *bdev = NULL; diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 043afe4..fcd7721 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -309,18 +309,18 @@ static int parport_attach(struct comedi_device *dev, iobase = it->options[0]; printk(KERN_INFO "comedi%d: parport: 0x%04lx ", dev->minor, iobase); if (!request_region(iobase, PARPORT_SIZE, "parport (comedi)")) { - printk("I/O port conflict\n"); + printk(KERN_ERR "I/O port conflict\n"); return -EIO; } dev->iobase = iobase; irq = it->options[1]; if (irq) { - printk(" irq=%u", irq); + printk(KERN_INFO " irq=%u", irq); ret = request_irq(irq, parport_interrupt, 0, "comedi_parport", dev); if (ret < 0) { - printk(" irq not available\n"); + printk(KERN_ERR " irq not available\n"); return -EINVAL; } dev->irq = irq; @@ -380,13 +380,13 @@ static int parport_attach(struct comedi_device *dev, devpriv->c_data = 0; outb(devpriv->c_data, dev->iobase + PARPORT_C); - printk("\n"); + printk(KERN_INFO "\n"); return 1; } static int parport_detach(struct comedi_device *dev) { - printk("comedi%d: parport: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: parport: remove\n", dev->minor); if (dev->iobase) release_region(dev->iobase, PARPORT_SIZE); diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index f425833..9cb144f 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -1,55 +1,55 @@ /* - comedi/drivers/das08.c - DAS08 driver - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 2000 David A. Schleef <ds@schleef.org> - Copyright (C) 2001,2002,2003 Frank Mori Hess <fmhess@users.sourceforge.net> - Copyright (C) 2004 Salvador E. Tropea <set@users.sf.net> <set@ieee.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. - -***************************************************************** + * comedi/drivers/das08.c + * DAS08 driver + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2000 David A. Schleef <ds@schleef.org> + * Copyright (C) 2001,2002,2003 Frank Mori Hess <fmhess@users.sourceforge.net> + * Copyright (C) 2004 Salvador E. Tropea <set@users.sf.net> <set@ieee.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. + * + ***************************************************************** + */ -*/ /* -Driver: das08 -Description: DAS-08 compatible boards -Author: Warren Jasper, ds, Frank Hess -Devices: [Keithley Metrabyte] DAS08 (isa-das08), [ComputerBoards] DAS08 (isa-das08), - DAS08-PGM (das08-pgm), - DAS08-PGH (das08-pgh), DAS08-PGL (das08-pgl), DAS08-AOH (das08-aoh), - DAS08-AOL (das08-aol), DAS08-AOM (das08-aom), DAS08/JR-AO (das08/jr-ao), - DAS08/JR-16-AO (das08jr-16-ao), PCI-DAS08 (das08), - PC104-DAS08 (pc104-das08), DAS08/JR/16 (das08jr/16) -Status: works - -This is a rewrite of the das08 and das08jr drivers. - -Options (for ISA cards): - [0] - base io address - -Options (for pci-das08): - [0] - bus (optional) - [1] = slot (optional) - -The das08 driver doesn't support asynchronous commands, since -the cheap das08 hardware doesn't really support them. The -comedi_rt_timer driver can be used to emulate commands for this -driver. -*/ + * Driver: das08 + * Description: DAS-08 compatible boards + * Author: Warren Jasper, ds, Frank Hess + * Devices: [Keithley Metrabyte] DAS08 (isa-das08), + * [ComputerBoards] DAS08 (isa-das08), DAS08-PGM (das08-pgm), + * DAS08-PGH (das08-pgh), DAS08-PGL (das08-pgl), DAS08-AOH (das08-aoh), + * DAS08-AOL (das08-aol), DAS08-AOM (das08-aom), DAS08/JR-AO (das08/jr-ao), + * DAS08/JR-16-AO (das08jr-16-ao), PCI-DAS08 (das08), + * PC104-DAS08 (pc104-das08), DAS08/JR/16 (das08jr/16) + * Status: works + * + * This is a rewrite of the das08 and das08jr drivers. + * + * Options (for ISA cards): + * [0] - base io address + * + * Options (for pci-das08): + * [0] - bus (optional) + * [1] = slot (optional) + * + * The das08 driver doesn't support asynchronous commands, since + * the cheap das08 hardware doesn't really support them. The + * comedi_rt_timer driver can be used to emulate commands for this + * driver. + */ #include "../comedidev.h" @@ -122,8 +122,8 @@ driver. */ #define DAS08JR_DIO 3 -#define DAS08JR_AO_LSB(x) ((x)?6:4) -#define DAS08JR_AO_MSB(x) ((x)?7:5) +#define DAS08JR_AO_LSB(x) ((x) ? 6 : 4) +#define DAS08JR_AO_MSB(x) ((x) ? 7 : 5) /* cio-das08_aox.pdf @@ -148,8 +148,8 @@ driver. #define DAS08AO_GAIN_CONTROL 3 #define DAS08AO_GAIN_STATUS 3 -#define DAS08AO_AO_LSB(x) ((x)?0xa:8) -#define DAS08AO_AO_MSB(x) ((x)?0xb:9) +#define DAS08AO_AO_LSB(x) ((x) ? 0xa : 8) +#define DAS08AO_AO_MSB(x) ((x) ? 0xb : 9) #define DAS08AO_AO_UPDATE 8 /* gainlist same as _pgx_ below */ @@ -239,8 +239,9 @@ static const struct comedi_lrange *const das08_ai_lranges[] = { &range_das08_pgm, }; -static const int das08_pgh_gainlist[] = - { 8, 0, 10, 2, 12, 4, 14, 6, 1, 3, 5, 7 }; +static const int das08_pgh_gainlist[] = { + 8, 0, 10, 2, 12, 4, 14, 6, 1, 3, 5, 7 +}; static const int das08_pgl_gainlist[] = { 8, 0, 2, 4, 6, 1, 3, 5, 7 }; static const int das08_pgm_gainlist[] = { 8, 0, 10, 12, 14, 9, 11, 13, 15 }; @@ -535,7 +536,8 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, inb(dev->iobase + DAS08_MSB); /* set multiplexer */ - spin_lock(&dev->spinlock); /* lock to prevent race with digital output */ + /* lock to prevent race with digital output */ + spin_lock(&dev->spinlock); devpriv->do_mux_bits &= ~DAS08_MUX_MASK; devpriv->do_mux_bits |= DAS08_MUX(chan); outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL); @@ -552,7 +554,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, /* clear over-range bits for 16-bit boards */ if (thisboard->ai_nbits == 16) if (inb(dev->iobase + DAS08_MSB) & 0x80) - printk("das08: over-range\n"); + printk(KERN_INFO "das08: over-range\n"); /* trigger conversion */ outb_p(0, dev->iobase + DAS08_TRIG_12BIT); @@ -562,7 +564,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, break; } if (i == TIMEOUT) { - printk("das08: timeout\n"); + printk(KERN_ERR "das08: timeout\n"); return -ETIME; } msb = inb(dev->iobase + DAS08_MSB); @@ -607,7 +609,8 @@ static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, /* set new bit values */ wbits |= data[0] & data[1]; /* remember digital output bits */ - spin_lock(&dev->spinlock); /* prevent race with setting of analog input mux */ + /* prevent race with setting of analog input mux */ + spin_lock(&dev->spinlock); devpriv->do_mux_bits &= ~DAS08_DO_MASK; devpriv->do_mux_bits |= DAS08_OP(wbits); outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL); @@ -860,9 +863,9 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) /* allocate ioports for non-pcmcia, non-pci boards */ if ((thisboard->bustype != pcmcia) && (thisboard->bustype != pci)) { - printk(" iobase 0x%lx\n", iobase); + printk(KERN_INFO " iobase 0x%lx\n", iobase); if (!request_region(iobase, thisboard->iosize, DRV_NAME)) { - printk(" I/O port conflict\n"); + printk(KERN_ERR " I/O port conflict\n"); return -EIO; } } @@ -878,8 +881,11 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) /* ai */ if (thisboard->ai) { s->type = COMEDI_SUBD_AI; - /* XXX some boards actually have differential inputs instead of single ended. - * The driver does nothing with arefs though, so it's no big deal. */ + /* XXX some boards actually have differential + * inputs instead of single ended. + * The driver does nothing with arefs though, + * so it's no big deal. + */ s->subdev_flags = SDF_READABLE | SDF_GROUND; s->n_chan = 8; s->maxdata = (1 << thisboard->ai_nbits) - 1; @@ -966,6 +972,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) return 0; } +EXPORT_SYMBOL_GPL(das08_common_attach); static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -980,7 +987,7 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; - printk("comedi%d: das08: ", dev->minor); + printk(KERN_INFO "comedi%d: das08: ", dev->minor); /* deal with a pci board */ if (thisboard->bustype == pci) { #ifdef CONFIG_COMEDI_PCI @@ -1007,20 +1014,21 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) } } if (!pdev) { - printk("No pci das08 cards found\n"); + printk(KERN_ERR "No pci das08 cards found\n"); return -EIO; } devpriv->pdev = pdev; /* enable PCI device and reserve I/O spaces */ if (comedi_pci_enable(pdev, DRV_NAME)) { - printk - (" Error enabling PCI device and requesting regions\n"); + printk(KERN_ERR " Error enabling PCI device and " + "requesting regions\n"); return -EIO; } /* read base addresses */ pci_iobase = pci_resource_start(pdev, 1); iobase = pci_resource_start(pdev, 2); - printk("pcibase 0x%lx iobase 0x%lx\n", pci_iobase, iobase); + printk(KERN_INFO "pcibase 0x%lx iobase 0x%lx\n", + pci_iobase, iobase); devpriv->pci_iobase = pci_iobase; #if 0 /* We could enable to pci-das08's interrupt here to make it possible @@ -1034,17 +1042,18 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) outw(INTR1_ENABLE | PCI_INTR_ENABLE, pci_iobase + INTCSR); #endif #else /* CONFIG_COMEDI_PCI */ - printk("this driver has not been built with PCI support.\n"); + printk(KERN_ERR "this driver has not been built with PCI support.\n"); return -EINVAL; #endif /* CONFIG_COMEDI_PCI */ } else { iobase = it->options[0]; } - printk("\n"); + printk(KERN_INFO "\n"); return das08_common_attach(dev, iobase); } + int das08_common_detach(struct comedi_device *dev) { printk(KERN_INFO "comedi%d: das08: remove\n", dev->minor); @@ -1060,9 +1069,9 @@ int das08_common_detach(struct comedi_device *dev) #ifdef CONFIG_COMEDI_PCI if (devpriv) { if (devpriv->pdev) { - if (devpriv->pci_iobase) { + if (devpriv->pci_iobase) comedi_pci_disable(devpriv->pdev); - } + pci_dev_put(devpriv->pdev); } } @@ -1070,6 +1079,7 @@ int das08_common_detach(struct comedi_device *dev) return 0; } +EXPORT_SYMBOL_GPL(das08_common_detach); #ifdef CONFIG_COMEDI_PCI COMEDI_PCI_INITCLEANUP(driver_das08, das08_pci_table); @@ -1077,8 +1087,6 @@ COMEDI_PCI_INITCLEANUP(driver_das08, das08_pci_table); COMEDI_INITCLEANUP(driver_das08); #endif -EXPORT_SYMBOL_GPL(das08_common_attach); -EXPORT_SYMBOL_GPL(das08_common_detach); #ifdef CONFIG_COMEDI_PCMCIA EXPORT_SYMBOL_GPL(das08_cs_boards); #endif diff --git a/drivers/staging/comedi/drivers/das08.h b/drivers/staging/comedi/drivers/das08.h index 35d2660..2a30d76 100644 --- a/drivers/staging/comedi/drivers/das08.h +++ b/drivers/staging/comedi/drivers/das08.h @@ -62,7 +62,7 @@ struct i8254_struct { #define I8254_CTRL 3 struct das08_private_struct { - unsigned int do_mux_bits; /* bits for do/mux register on boards without seperate do register */ + unsigned int do_mux_bits; /* bits for do/mux register on boards without separate do register */ unsigned int do_bits; /* bits for do register on boards with register dedicated to digital out only */ const unsigned int *pg_gainlist; struct pci_dev *pdev; /* struct for pci-das08 */ diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 896d25bc..8761a6d 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -350,6 +350,10 @@ static struct pcmcia_device_id das08_cs_id_table[] = { }; MODULE_DEVICE_TABLE(pcmcia, das08_cs_id_table); +MODULE_AUTHOR("David A. Schleef <ds@schleef.org>, " + "Frank Mori Hess <fmhess@users.sourceforge.net>"); +MODULE_DESCRIPTION("Comedi driver for ComputerBoards DAS-08 PCMCIA boards"); +MODULE_LICENSE("GPL"); struct pcmcia_driver das08_cs_driver = { .probe = das08_pcmcia_attach, @@ -392,6 +396,5 @@ static void __exit das08_cs_exit_module(void) comedi_driver_unregister(&driver_das08_cs); } -MODULE_LICENSE("GPL"); module_init(das08_cs_init_module); module_exit(das08_cs_exit_module); diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index f2aadda..ccee4f1 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -74,7 +74,8 @@ Keithley Manuals: 4922.PDF (das-1400) 4923.PDF (das1200, 1400, 1600) -Computer boards manuals also available from their website www.measurementcomputing.com +Computer boards manuals also available from their website +www.measurementcomputing.com */ @@ -92,7 +93,8 @@ Computer boards manuals also available from their website www.measurementcomputi /* #define DEBUG */ #ifdef DEBUG -#define DEBUG_PRINT(format, args...) printk("das16: " format, ## args) +#define DEBUG_PRINT(format, args...) \ + printk(KERN_DEBUG "das16: " format, ## args) #else #define DEBUG_PRINT(format, args...) #endif @@ -186,15 +188,16 @@ Computer boards manuals also available from their website www.measurementcomputi */ -static const int sample_size = 2; /* size in bytes of a sample from board */ +/* size in bytes of a sample from board */ +static const int sample_size = 2; #define DAS16_TRIG 0 #define DAS16_AI_LSB 0 #define DAS16_AI_MSB 1 #define DAS16_MUX 2 #define DAS16_DIO 3 -#define DAS16_AO_LSB(x) ((x)?6:4) -#define DAS16_AO_MSB(x) ((x)?7:5) +#define DAS16_AO_LSB(x) ((x) ? 6 : 4) +#define DAS16_AO_MSB(x) ((x) ? 7 : 5) #define DAS16_STATUS 8 #define BUSY (1<<7) #define UNIPOLAR (1<<6) @@ -271,7 +274,7 @@ static const struct comedi_lrange range_das1x02_unip = { 4, { }; static const struct comedi_lrange range_das16jr = { 9, { - /* also used by 16/330 */ + /* also used by 16/330 */ BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(2.5), @@ -547,7 +550,8 @@ static const struct das16_board das16_boards[] = { .id = 0x20, }, { - .name = "das-1401", /* 4919.pdf and 4922.pdf (keithley user's manual) */ + /* 4919.pdf and 4922.pdf (keithley user's manual) */ + .name = "das-1401", .ai = das16_ai_rinsn, .ai_nbits = 12, .ai_speed = 10000, @@ -558,10 +562,11 @@ static const struct das16_board das16_boards[] = { .i8255_offset = 0x0, .i8254_offset = 0x0c, .size = 0x408, - .id = 0xc0 /* 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 */ + .id = 0xc0 /* 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 */ }, { - .name = "das-1402", /* 4919.pdf and 4922.pdf (keithley user's manual) */ + /* 4919.pdf and 4922.pdf (keithley user's manual) */ + .name = "das-1402", .ai = das16_ai_rinsn, .ai_nbits = 12, .ai_speed = 10000, @@ -572,7 +577,7 @@ static const struct das16_board das16_boards[] = { .i8255_offset = 0x0, .i8254_offset = 0x0c, .size = 0x408, - .id = 0xc0 /* 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 */ + .id = 0xc0 /* 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 */ }, { .name = "das-1601", /* 4919.pdf */ @@ -704,7 +709,8 @@ static const struct das16_board das16_boards[] = { .name = "das16/jr/ctr5", /* ? */ }, { - .name = "cio-das16/m1/16", /* cio-das16_m1_16.pdf, this board is a bit quirky, no dma */ + /* cio-das16_m1_16.pdf, this board is a bit quirky, no dma */ + .name = "cio-das16/m1/16", }, #endif }; @@ -736,14 +742,19 @@ struct das16_private_struct { unsigned int clockbase; /* master clock speed in ns */ volatile unsigned int control_state; /* dma, interrupt and trigger control bits */ volatile unsigned long adc_byte_count; /* number of bytes remaining */ - unsigned int divisor1; /* divisor dividing master clock to get conversion frequency */ - unsigned int divisor2; /* divisor dividing master clock to get conversion frequency */ + /* divisor dividing master clock to get conversion frequency */ + unsigned int divisor1; + /* divisor dividing master clock to get conversion frequency */ + unsigned int divisor2; unsigned int dma_chan; /* dma channel */ uint16_t *dma_buffer[2]; dma_addr_t dma_buffer_addr[2]; unsigned int current_buffer; volatile unsigned int dma_transfer_size; /* target number of bytes to transfer per dma shot */ - /* user-defined analog input and output ranges defined from config options */ + /** + * user-defined analog input and output ranges + * defined from config options + */ struct comedi_lrange *user_ai_range_table; struct comedi_lrange *user_ao_range_table; @@ -798,7 +809,10 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /** + * step 2: make sure trigger sources are unique and + * mutually compatible + */ if (cmd->scan_begin_src != TRIG_TIMER && cmd->scan_begin_src != TRIG_EXT && cmd->scan_begin_src != TRIG_FOLLOW) @@ -893,12 +907,15 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, if (CR_CHAN(cmd->chanlist[i]) != (start_chan + i) % s->n_chan) { comedi_error(dev, - "entries in chanlist must be consecutive channels, counting upwards\n"); + "entries in chanlist must be " + "consecutive channels, " + "counting upwards\n"); err++; } if (CR_RANGE(cmd->chanlist[i]) != gain) { comedi_error(dev, - "entries in chanlist must all have the same gain\n"); + "entries in chanlist must all " + "have the same gain\n"); err++; } } @@ -920,12 +937,13 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->dma_chan == 0 || (dev->irq == 0 && devpriv->timer_mode == 0)) { comedi_error(dev, - "irq (or use of 'timer mode') dma required to execute comedi_cmd"); + "irq (or use of 'timer mode') dma required to " + "execute comedi_cmd"); return -1; } if (cmd->flags & TRIG_RT) { - comedi_error(dev, - "isa dma transfers cannot be performed with TRIG_RT, aborting"); + comedi_error(dev, "isa dma transfers cannot be performed with " + "TRIG_RT, aborting"); return -1; } @@ -933,16 +951,17 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) cmd->stop_arg * cmd->chanlist_len * sizeof(uint16_t); /* disable conversions for das1600 mode */ - if (thisboard->size > 0x400) { + if (thisboard->size > 0x400) outb(DAS1600_CONV_DISABLE, dev->iobase + DAS1600_CONV); - } + /* set scan limits */ byte = CR_CHAN(cmd->chanlist[0]); byte |= CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1]) << 4; outb(byte, dev->iobase + DAS16_MUX); /* set gain (this is also burst rate register but according to - * computer boards manual, burst rate does nothing, even on keithley cards) */ + * computer boards manual, burst rate does nothing, even on + * keithley cards) */ if (thisboard->ai_pg != das16_pg_none) { range = CR_RANGE(cmd->chanlist[0]); outb((das16_gainlists[thisboard->ai_pg])[range], @@ -1005,9 +1024,9 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) outb(devpriv->control_state, dev->iobase + DAS16_CONTROL); /* Enable conversions if using das1600 mode */ - if (thisboard->size > 0x400) { + if (thisboard->size > 0x400) outb(0, dev->iobase + DAS1600_CONV); - } + return 0; } @@ -1030,9 +1049,9 @@ static int das16_cancel(struct comedi_device *dev, struct comedi_subdevice *s) } /* disable burst mode */ - if (thisboard->size > 0x400) { + if (thisboard->size > 0x400) outb(0, dev->iobase + DAS1600_BURST); - } + spin_unlock_irqrestore(&dev->spinlock, flags); @@ -1085,11 +1104,11 @@ static int das16_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, } msb = inb(dev->iobase + DAS16_AI_MSB); lsb = inb(dev->iobase + DAS16_AI_LSB); - if (thisboard->ai_nbits == 12) { + if (thisboard->ai_nbits == 12) data[n] = ((lsb >> 4) & 0xf) | (msb << 4); - } else { + else data[n] = lsb | (msb << 8); - } + } return n; @@ -1207,8 +1226,8 @@ static int disable_dma_on_even(struct comedi_device *dev) residue = get_dma_residue(devpriv->dma_chan); } if (i == disable_limit) { - comedi_error(dev, - "failed to get an even dma transfer, could be trouble."); + comedi_error(dev, "failed to get an even dma transfer, " + "could be trouble."); } return residue; } @@ -1254,7 +1273,8 @@ static void das16_interrupt(struct comedi_device *dev) } else num_bytes = devpriv->dma_transfer_size - residue; - if (cmd->stop_src == TRIG_COUNT && num_bytes >= devpriv->adc_byte_count) { + if (cmd->stop_src == TRIG_COUNT && + num_bytes >= devpriv->adc_byte_count) { num_bytes = devpriv->adc_byte_count; async->events |= COMEDI_CB_EOA; } @@ -1275,9 +1295,9 @@ static void das16_interrupt(struct comedi_device *dev) set_dma_count(devpriv->dma_chan, devpriv->dma_transfer_size); enable_dma(devpriv->dma_chan); /* reenable conversions for das1600 mode, (stupid hardware) */ - if (thisboard->size > 0x400 && devpriv->timer_mode == 0) { + if (thisboard->size > 0x400 && devpriv->timer_mode == 0) outb(0x00, dev->iobase + DAS1600_CONV); - } + } release_dma_lock(dma_flags); @@ -1330,25 +1350,25 @@ static int das16_probe(struct comedi_device *dev, struct comedi_devconfig *it) status = inb(dev->iobase + DAS16_STATUS); - if ((status & UNIPOLAR)) { + if ((status & UNIPOLAR)) devpriv->ai_unipolar = 1; - } else { + else devpriv->ai_unipolar = 0; - } - if ((status & DAS16_MUXBIT)) { + + if ((status & DAS16_MUXBIT)) devpriv->ai_singleended = 1; - } else { + else devpriv->ai_singleended = 0; - } + /* diobits indicates boards */ diobits = inb(dev->iobase + DAS16_DIO) & 0xf0; - printk(" id bits are 0x%02x\n", diobits); + printk(KERN_INFO " id bits are 0x%02x\n", diobits); if (thisboard->id != diobits) { - printk(" requested board's id bits are 0x%x (ignore)\n", + printk(KERN_INFO " requested board's id bits are 0x%x (ignore)\n", thisboard->id); } @@ -1363,10 +1383,10 @@ static int das1600_mode_detect(struct comedi_device *dev) if (status & DAS1600_CLK_10MHZ) { devpriv->clockbase = 100; - printk(" 10MHz pacer clock\n"); + printk(KERN_INFO " 10MHz pacer clock\n"); } else { devpriv->clockbase = 1000; - printk(" 1MHz pacer clock\n"); + printk(KERN_INFO " 1MHz pacer clock\n"); } reg_dump(dev); @@ -1406,14 +1426,15 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (timer_mode) irq = 0; - printk("comedi%d: das16:", dev->minor); + printk(KERN_INFO "comedi%d: das16:", dev->minor); /* check that clock setting is valid */ if (it->options[3]) { if (it->options[3] != 0 && it->options[3] != 1 && it->options[3] != 10) { printk - ("\n Invalid option. Master clock must be set to 1 or 10 (MHz)\n"); + ("\n Invalid option. Master clock must be set " + "to 1 or 10 (MHz)\n"); return -EINVAL; } } @@ -1425,23 +1446,23 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (thisboard->size < 0x400) { printk(" 0x%04lx-0x%04lx\n", iobase, iobase + thisboard->size); if (!request_region(iobase, thisboard->size, "das16")) { - printk(" I/O port conflict\n"); + printk(KERN_ERR " I/O port conflict\n"); return -EIO; } } else { - printk(" 0x%04lx-0x%04lx 0x%04lx-0x%04lx\n", + printk(KERN_INFO " 0x%04lx-0x%04lx 0x%04lx-0x%04lx\n", iobase, iobase + 0x0f, iobase + 0x400, iobase + 0x400 + (thisboard->size & 0x3ff)); if (!request_region(iobase, 0x10, "das16")) { - printk(" I/O port conflict: 0x%04lx-0x%04lx\n", + printk(KERN_ERR " I/O port conflict: 0x%04lx-0x%04lx\n", iobase, iobase + 0x0f); return -EIO; } if (!request_region(iobase + 0x400, thisboard->size & 0x3ff, "das16")) { release_region(iobase, 0x10); - printk(" I/O port conflict: 0x%04lx-0x%04lx\n", + printk(KERN_ERR " I/O port conflict: 0x%04lx-0x%04lx\n", iobase + 0x400, iobase + 0x400 + (thisboard->size & 0x3ff)); return -EIO; @@ -1452,7 +1473,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* probe id bits to make sure they are consistent */ if (das16_probe(dev, it)) { - printk(" id bits do not match selected board, aborting\n"); + printk(KERN_ERR " id bits do not match selected board, aborting\n"); return -EINVAL; } dev->board_name = thisboard->name; @@ -1474,7 +1495,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; dev->irq = irq; - printk(" ( irq = %u )", irq); + printk(KERN_INFO " ( irq = %u )", irq); } else if (irq == 0) { printk(" ( no irq )"); } else { @@ -1488,16 +1509,15 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* allocate dma buffers */ int i; for (i = 0; i < 2; i++) { - devpriv->dma_buffer[i] = pci_alloc_consistent(NULL, - DAS16_DMA_SIZE, - &devpriv-> - dma_buffer_addr - [i]); + devpriv->dma_buffer[i] = pci_alloc_consistent( + NULL, DAS16_DMA_SIZE, + &devpriv->dma_buffer_addr[i]); + if (devpriv->dma_buffer[i] == NULL) return -ENOMEM; } if (request_dma(dma_chan, "das16")) { - printk(" failed to allocate dma channel %i\n", + printk(KERN_ERR " failed to allocate dma channel %i\n", dma_chan); return -EINVAL; } @@ -1506,11 +1526,11 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) disable_dma(devpriv->dma_chan); set_dma_mode(devpriv->dma_chan, DMA_MODE_READ); release_dma_lock(flags); - printk(" ( dma = %u)\n", dma_chan); + printk(KERN_INFO " ( dma = %u)\n", dma_chan); } else if (dma_chan == 0) { - printk(" ( no dma )\n"); + printk(KERN_INFO " ( no dma )\n"); } else { - printk(" invalid dma channel\n"); + printk(KERN_ERR " invalid dma channel\n"); return -EINVAL; } @@ -1569,7 +1589,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->subdev_flags |= SDF_DIFF; } s->maxdata = (1 << thisboard->ai_nbits) - 1; - if (devpriv->user_ai_range_table) { /* user defined ai range */ + if (devpriv->user_ai_range_table) { /* user defined ai range */ s->range_table = devpriv->user_ai_range_table; } else if (devpriv->ai_unipolar) { s->range_table = das16_ai_uni_lranges[thisboard->ai_pg]; @@ -1592,11 +1612,12 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->subdev_flags = SDF_WRITABLE; s->n_chan = 2; s->maxdata = (1 << thisboard->ao_nbits) - 1; - if (devpriv->user_ao_range_table) { /* user defined ao range */ + /* user defined ao range */ + if (devpriv->user_ao_range_table) s->range_table = devpriv->user_ao_range_table; - } else { + else s->range_table = &range_unknown; - } + s->insn_write = thisboard->ao; } else { s->type = COMEDI_SUBD_UNUSED; @@ -1656,7 +1677,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int das16_detach(struct comedi_device *dev) { - printk("comedi%d: das16: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: das16: remove\n", dev->minor); das16_reset(dev); @@ -1750,8 +1771,8 @@ static void das16_ai_munge(struct comedi_device *dev, for (i = 0; i < num_samples; i++) { data[i] = le16_to_cpu(data[i]); - if (thisboard->ai_nbits == 12) { + if (thisboard->ai_nbits == 12) data[i] = (data[i] >> 4) & 0xfff; - } + } } diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 3c3e045..de5e82f 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -797,10 +797,8 @@ static int das1800_detach(struct comedi_device *dev) free_dma(devpriv->dma0); if (devpriv->dma1) free_dma(devpriv->dma1); - if (devpriv->ai_buf0) - kfree(devpriv->ai_buf0); - if (devpriv->ai_buf1) - kfree(devpriv->ai_buf1); + kfree(devpriv->ai_buf0); + kfree(devpriv->ai_buf1); } printk("comedi%d: %s: remove\n", dev->minor, @@ -1639,7 +1637,8 @@ static int das1800_ai_rinsn(struct comedi_device *dev, } if (i == timeout) { comedi_error(dev, "timeout"); - return -ETIME; + n = -ETIME; + goto exit; } dpnt = inw(dev->iobase + DAS1800_FIFO); /* shift data to offset binary for bipolar ranges */ @@ -1647,6 +1646,7 @@ static int das1800_ai_rinsn(struct comedi_device *dev, dpnt += 1 << (thisboard->resolution - 1); data[n] = dpnt; } +exit: spin_unlock_irqrestore(&dev->spinlock, irq_flags); return n; diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index 3f365ae..83fb6e5 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -472,7 +472,7 @@ static const struct comedi_lrange *dac_range_table[] = { static const struct comedi_lrange *dac_range_lkup(int opt) { - if (opt < 0 || opt > 5) + if (opt < 0 || opt >= 5) return &range_unknown; return dac_range_table[opt]; } diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 51ef695..ea9bfb7 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -34,13 +34,13 @@ Configuration options: [0] - I/O port base address [1] - IRQ, although this is currently unused [2] - A/D reference - 0 = signle-ended - 1 = differential + 0 = signle-ended + 1 = differential 2 = pseudo-differential (common reference) [3] - A/D range - 0 = [-5,5] - 1 = [-2.5,2.5] - 2 = [0,5] + 0 = [-5, 5] + 1 = [-2.5, 2.5] + 2 = [0, 5] [4] - D/A 0 range (same choices) [4] - D/A 1 range (same choices) */ @@ -52,96 +52,58 @@ Configuration options: static const char *driver_name = "dt2811"; -static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { 4, { - RANGE - (0, 5), - RANGE - (0, - 2.5), - RANGE - (0, - 1.25), - RANGE - (0, - 0.625) - } +static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { + 4, { + RANGE(0, 5), + RANGE(0, 2.5), + RANGE(0, 1.25), + RANGE(0, 0.625) + } }; -static const struct comedi_lrange range_dt2811_pgh_ai_2_5_bipolar = { 4, { - RANGE - (-2.5, - 2.5), - RANGE - (-1.25, - 1.25), - RANGE - (-0.625, - 0.625), - RANGE - (-0.3125, - 0.3125) - } +static const struct comedi_lrange range_dt2811_pgh_ai_2_5_bipolar = { + 4, { + RANGE(-2.5, 2.5), + RANGE(-1.25, 1.25), + RANGE(-0.625, 0.625), + RANGE(-0.3125, 0.3125) + } }; -static const struct comedi_lrange range_dt2811_pgh_ai_5_bipolar = { 4, { - RANGE - (-5, 5), - RANGE - (-2.5, - 2.5), - RANGE - (-1.25, - 1.25), - RANGE - (-0.625, - 0.625) - } +static const struct comedi_lrange range_dt2811_pgh_ai_5_bipolar = { + 4, { + RANGE(-5, 5), + RANGE(-2.5, 2.5), + RANGE(-1.25, 1.25), + RANGE(-0.625, 0.625) + } }; -static const struct comedi_lrange range_dt2811_pgl_ai_5_unipolar = { 4, { - RANGE - (0, 5), - RANGE - (0, - 0.5), - RANGE - (0, - 0.05), - RANGE - (0, - 0.01) - } +static const struct comedi_lrange range_dt2811_pgl_ai_5_unipolar = { + 4, { + RANGE(0, 5), + RANGE(0, 0.5), + RANGE(0, 0.05), + RANGE(0, 0.01) + } }; -static const struct comedi_lrange range_dt2811_pgl_ai_2_5_bipolar = { 4, { - RANGE - (-2.5, - 2.5), - RANGE - (-0.25, - 0.25), - RANGE - (-0.025, - 0.025), - RANGE - (-0.005, - 0.005) - } +static const struct comedi_lrange range_dt2811_pgl_ai_2_5_bipolar = { + 4, { + RANGE(-2.5, 2.5), + RANGE(-0.25, 0.25), + RANGE(-0.025, 0.025), + RANGE(-0.005, 0.005) + } }; -static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { 4, { - RANGE - (-5, 5), - RANGE - (-0.5, - 0.5), - RANGE - (-0.05, - 0.05), - RANGE - (-0.01, - 0.01) - } +static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { + 4, { + RANGE(-5, 5), + RANGE(-0.5, 0.5), + RANGE(-0.05, 0.05), + RANGE(-0.01, 0.01) + } }; /* @@ -348,21 +310,21 @@ static irqreturn_t dt2811_interrupt(int irq, void *d) options[0] Board base address options[1] IRQ options[2] Input configuration - 0 == single-ended - 1 == differential - 2 == pseudo-differential + 0 == single-ended + 1 == differential + 2 == pseudo-differential options[3] Analog input range configuration - 0 == bipolar 5 (-5V -- +5V) - 1 == bipolar 2.5V (-2.5V -- +2.5V) - 2 == unipolar 5V (0V -- +5V) + 0 == bipolar 5 (-5V -- +5V) + 1 == bipolar 2.5V (-2.5V -- +2.5V) + 2 == unipolar 5V (0V -- +5V) options[4] Analog output 0 range configuration - 0 == bipolar 5 (-5V -- +5V) - 1 == bipolar 2.5V (-2.5V -- +2.5V) - 2 == unipolar 5V (0V -- +5V) + 0 == bipolar 5 (-5V -- +5V) + 1 == bipolar 2.5V (-2.5V -- +2.5V) + 2 == unipolar 5V (0V -- +5V) options[5] Analog output 1 range configuration - 0 == bipolar 5 (-5V -- +5V) - 1 == bipolar 2.5V (-2.5V -- +2.5V) - 2 == unipolar 5V (0V -- +5V) + 0 == bipolar 5 (-5V -- +5V) + 1 == bipolar 2.5V (-2.5V -- +2.5V) + 2 == unipolar 5V (0V -- +5V) */ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) @@ -377,10 +339,10 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) iobase = it->options[0]; - printk("comedi%d: dt2811: base=0x%04lx\n", dev->minor, iobase); + printk(KERN_INFO "comedi%d: dt2811:base=0x%04lx\n", dev->minor, iobase); if (!request_region(iobase, DT2811_SIZE, driver_name)) { - printk("I/O port conflict\n"); + printk(KERN_ERR "I/O port conflict\n"); return -EIO; } @@ -410,25 +372,25 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) irq = probe_irq_off(irqs); restore_flags(flags); - /*outb(DT2811_CLRERROR|DT2811_INTENB,dev->iobase+DT2811_ADCSR); */ + /*outb(DT2811_CLRERROR|DT2811_INTENB, + dev->iobase+DT2811_ADCSR);*/ - if (inb(dev->iobase + DT2811_ADCSR) & DT2811_ADERROR) { - printk("error probing irq (bad) \n"); - } + if (inb(dev->iobase + DT2811_ADCSR) & DT2811_ADERROR) + printk(KERN_ERR "error probing irq (bad)\n"); dev->irq = 0; if (irq > 0) { i = inb(dev->iobase + DT2811_ADDATLO); i = inb(dev->iobase + DT2811_ADDATHI); - printk("(irq = %d)\n", irq); + printk(KERN_INFO "(irq = %d)\n", irq); ret = request_irq(irq, dt2811_interrupt, 0, driver_name, dev); if (ret < 0) return -EIO; dev->irq = irq; } else if (irq == 0) { - printk("(no irq)\n"); + printk(KERN_INFO "(no irq)\n"); } else { - printk("( multiple irq's -- this is bad! )\n"); + printk(KERN_ERR "( multiple irq's -- this is bad! )\n"); } } #endif @@ -540,14 +502,12 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int dt2811_detach(struct comedi_device *dev) { - printk("comedi%d: dt2811: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: dt2811: remove\n", dev->minor); - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } - if (dev->iobase) { + if (dev->iobase) release_region(dev->iobase, DT2811_SIZE); - } return 0; } @@ -579,7 +539,7 @@ static int dt2811_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, #if 0 /* Wow. This is code from the Comedi stone age. But it hasn't been * replaced, so I'll let it stay. */ -int dt2811_adtrig(kdev_t minor, comedi_adtrig * adtrig) +int dt2811_adtrig(kdev_t minor, comedi_adtrig *adtrig) { struct comedi_device *dev = comedi_devices + minor; @@ -589,8 +549,10 @@ int dt2811_adtrig(kdev_t minor, comedi_adtrig * adtrig) switch (dev->i_admode) { case COMEDI_MDEMAND: dev->ntrig = adtrig->n - 1; + /* not neccessary */ /*printk("dt2811: AD soft trigger\n"); */ - /*outb(DT2811_CLRERROR|DT2811_INTENB,dev->iobase+DT2811_ADCSR); *//* not neccessary */ + /*outb(DT2811_CLRERROR|DT2811_INTENB, + dev->iobase+DT2811_ADCSR); */ outb(dev->curadchan, dev->iobase + DT2811_ADGCR); do_gettimeofday(&trigtime); break; @@ -630,9 +592,8 @@ static int dt2811_ao_insn_read(struct comedi_device *dev, chan = CR_CHAN(insn->chanspec); - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = devpriv->ao_readback[chan]; - } return i; } diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index e1b7375..16fde06 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -99,13 +99,13 @@ static int dt2814_ai_insn_read(struct comedi_device *dev, outb(chan, dev->iobase + DT2814_CSR); for (i = 0; i < DT2814_TIMEOUT; i++) { status = inb(dev->iobase + DT2814_CSR); - printk("dt2814: status: %02x\n", status); + printk(KERN_INFO "dt2814: status: %02x\n", status); udelay(10); if (status & DT2814_FINISH) break; } if (i >= DT2814_TIMEOUT) { - printk("dt2814: status: %02x\n", status); + printk(KERN_INFO "dt2814: status: %02x\n", status); return -ETIMEDOUT; } @@ -173,7 +173,8 @@ static int dt2814_ai_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* step 2: make sure trigger sources are + * unique and mutually compatible */ /* note that mutual compatibility is not an issue here */ if (cmd->stop_src != TRIG_TIMER && cmd->stop_src != TRIG_EXT) @@ -256,9 +257,9 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) unsigned long iobase; iobase = it->options[0]; - printk("comedi%d: dt2814: 0x%04lx ", dev->minor, iobase); + printk(KERN_INFO "comedi%d: dt2814: 0x%04lx ", dev->minor, iobase); if (!request_region(iobase, DT2814_SIZE, "dt2814")) { - printk("I/O port conflict\n"); + printk(KERN_ERR "I/O port conflict\n"); return -EIO; } dev->iobase = iobase; @@ -267,7 +268,7 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) outb(0, dev->iobase + DT2814_CSR); udelay(100); if (inb(dev->iobase + DT2814_CSR) & DT2814_ERR) { - printk("reset error (fatal)\n"); + printk(KERN_ERR "reset error (fatal)\n"); return -EIO; } i = inb(dev->iobase + DT2814_DATA); @@ -286,9 +287,9 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) irq = probe_irq_off(irqs); restore_flags(flags); - if (inb(dev->iobase + DT2814_CSR) & DT2814_ERR) { - printk("error probing irq (bad) \n"); - } + if (inb(dev->iobase + DT2814_CSR) & DT2814_ERR) + printk(KERN_DEBUG "error probing irq (bad)\n"); + i = inb(dev->iobase + DT2814_DATA); i = inb(dev->iobase + DT2814_DATA); @@ -297,18 +298,18 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->irq = 0; if (irq > 0) { if (request_irq(irq, dt2814_interrupt, 0, "dt2814", dev)) { - printk("(irq %d unavailable)\n", irq); + printk(KERN_WARNING "(irq %d unavailable)\n", irq); } else { - printk("( irq = %d )\n", irq); + printk(KERN_INFO "( irq = %d )\n", irq); dev->irq = irq; } } else if (irq == 0) { - printk("(no irq)\n"); + printk(KERN_WARNING "(no irq)\n"); } else { #if 0 - printk("(probe returned multiple irqs--bad)\n"); + printk(KERN_DEBUG "(probe returned multiple irqs--bad)\n"); #else - printk("(irq probe not implemented)\n"); + printk(KERN_WARNING "(irq probe not implemented)\n"); #endif } @@ -337,14 +338,13 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int dt2814_detach(struct comedi_device *dev) { - printk("comedi%d: dt2814: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: dt2814: remove\n", dev->minor); - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } - if (dev->iobase) { + + if (dev->iobase) release_region(dev->iobase, DT2814_SIZE); - } return 0; } diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index e548763..fd8728c 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -45,9 +45,9 @@ Configuration options: [7] - AO 1 jumpered for 0=straight binary, 1=2's complement [8] - AI jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5] [9] - AO 0 jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5], - 4=[-2.5,2.5] + 4=[-2.5,2.5] [10]- A0 1 jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5], - 4=[-2.5,2.5] + 4=[-2.5,2.5] Notes: - AO commands might be broken. @@ -155,79 +155,58 @@ Notes: #define DT2821_XCLK 0x0002 /* (R/W) external clock enable */ #define DT2821_BDINIT 0x0001 /* (W) initialize board */ -static const struct comedi_lrange range_dt282x_ai_lo_bipolar = { 4, { - RANGE(-10, - 10), - RANGE(-5, - 5), - RANGE(-2.5, - 2.5), - RANGE - (-1.25, - 1.25) - } +static const struct comedi_lrange range_dt282x_ai_lo_bipolar = { + 4, { + RANGE(-10, 10), + RANGE(-5, 5), + RANGE(-2.5, 2.5), + RANGE(-1.25, 1.25) + } }; -static const struct comedi_lrange range_dt282x_ai_lo_unipolar = { 4, { - RANGE(0, - 10), - RANGE(0, - 5), - RANGE(0, - 2.5), - RANGE(0, - 1.25) - } +static const struct comedi_lrange range_dt282x_ai_lo_unipolar = { + 4, { + RANGE(0, 10), + RANGE(0, 5), + RANGE(0, 2.5), + RANGE(0, 1.25) + } }; -static const struct comedi_lrange range_dt282x_ai_5_bipolar = { 4, { - RANGE(-5, - 5), - RANGE(-2.5, - 2.5), - RANGE(-1.25, - 1.25), - RANGE - (-0.625, - 0.625), - } +static const struct comedi_lrange range_dt282x_ai_5_bipolar = { + 4, { + RANGE(-5, 5), + RANGE(-2.5, 2.5), + RANGE(-1.25, 1.25), + RANGE(-0.625, 0.625) + } }; -static const struct comedi_lrange range_dt282x_ai_5_unipolar = { 4, { - RANGE(0, - 5), - RANGE(0, - 2.5), - RANGE(0, - 1.25), - RANGE(0, - 0.625), - } +static const struct comedi_lrange range_dt282x_ai_5_unipolar = { + 4, { + RANGE(0, 5), + RANGE(0, 2.5), + RANGE(0, 1.25), + RANGE(0, 0.625), + } }; -static const struct comedi_lrange range_dt282x_ai_hi_bipolar = { 4, { - RANGE(-10, - 10), - RANGE(-1, - 1), - RANGE(-0.1, - 0.1), - RANGE - (-0.02, - 0.02) - } +static const struct comedi_lrange range_dt282x_ai_hi_bipolar = { + 4, { + RANGE(-10, 10), + RANGE(-1, 1), + RANGE(-0.1, 0.1), + RANGE(-0.02, 0.02) + } }; -static const struct comedi_lrange range_dt282x_ai_hi_unipolar = { 4, { - RANGE(0, - 10), - RANGE(0, - 1), - RANGE(0, - 0.1), - RANGE(0, - 0.02) - } +static const struct comedi_lrange range_dt282x_ai_hi_unipolar = { + 4, { + RANGE(0, 10), + RANGE(0, 1), + RANGE(0, 0.1), + RANGE(0, 0.02) + } }; struct dt282x_board { @@ -370,7 +349,7 @@ static const struct dt282x_board boardtypes[] = { }, }; -#define n_boardtypes sizeof(boardtypes)/sizeof(struct dt282x_board) +#define n_boardtypes (sizeof(boardtypes)/sizeof(struct dt282x_board)) #define this_board ((const struct dt282x_board *)dev->board_ptr) struct dt282x_private { @@ -411,21 +390,25 @@ struct dt282x_private { #define update_adcsr(a) outw(devpriv->adcsr|(a), dev->iobase+DT2821_ADCSR) #define mux_busy() (inw(dev->iobase+DT2821_ADCSR)&DT2821_MUXBUSY) #define ad_done() (inw(dev->iobase+DT2821_ADCSR)&DT2821_ADDONE) -#define update_supcsr(a) outw(devpriv->supcsr|(a), dev->iobase+DT2821_SUPCSR) +#define update_supcsr(a) outw(devpriv->supcsr|(a), dev->iobase+DT2821_SUPCSR) /* * danger! macro abuse... a is the expression to wait on, and b is * the statement(s) to execute if it doesn't happen. */ -#define wait_for(a, b) \ - do{ \ - int _i; \ - for (_i=0;_i<DT2821_TIMEOUT;_i++){ \ - if (a){_i=0;break;} \ - udelay(5); \ - } \ - if (_i){b} \ - }while (0) +#define wait_for(a, b) \ + do { \ + int _i; \ + for (_i = 0; _i < DT2821_TIMEOUT; _i++) { \ + if (a) { \ + _i = 0; \ + break; \ + } \ + udelay(5); \ + } \ + if (_i) \ + b \ + } while (0) static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it); @@ -462,18 +445,16 @@ static void dt282x_munge(struct comedi_device *dev, short *buf, unsigned short sign = 1 << (boardtype.adbits - 1); int n; - if (devpriv->ad_2scomp) { + if (devpriv->ad_2scomp) sign = 1 << (boardtype.adbits - 1); - } else { + else sign = 0; - } if (nbytes % 2) comedi_error(dev, "bug! odd number of bytes from dma xfer"); n = nbytes / 2; - for (i = 0; i < n; i++) { + for (i = 0; i < n; i++) buf[i] = (buf[i] & mask) ^ sign; - } } static void dt282x_ao_dma_interrupt(struct comedi_device *dev) @@ -486,7 +467,7 @@ static void dt282x_ao_dma_interrupt(struct comedi_device *dev) update_supcsr(DT2821_CLRDMADNE); if (!s->async->prealloc_buf) { - printk("async->data disappeared. dang!\n"); + printk(KERN_ERR "async->data disappeared. dang!\n"); return; } @@ -499,7 +480,7 @@ static void dt282x_ao_dma_interrupt(struct comedi_device *dev) size = cfc_read_array_from_buffer(s, ptr, devpriv->dma_maxsize); if (size == 0) { - printk("dt282x: AO underrun\n"); + printk(KERN_ERR "dt282x: AO underrun\n"); dt282x_ao_cancel(dev, s); s->async->events |= COMEDI_CB_OVERFLOW; return; @@ -519,7 +500,7 @@ static void dt282x_ai_dma_interrupt(struct comedi_device *dev) update_supcsr(DT2821_CLRDMADNE); if (!s->async->prealloc_buf) { - printk("async->data disappeared. dang!\n"); + printk(KERN_ERR "async->data disappeared. dang!\n"); return; } @@ -540,7 +521,7 @@ static void dt282x_ai_dma_interrupt(struct comedi_device *dev) devpriv->nread -= size / 2; if (devpriv->nread < 0) { - printk("dt282x: off by one\n"); + printk(KERN_INFO "dt282x: off by one\n"); devpriv->nread = 0; } if (!devpriv->nread) { @@ -651,7 +632,7 @@ static irqreturn_t dt282x_interrupt(int irq, void *d) static int warn = 5; if (--warn <= 0) { disable_irq(dev->irq); - printk("disabling irq\n"); + printk(KERN_INFO "disabling irq\n"); } #endif comedi_error(dev, "D/A error"); @@ -666,13 +647,13 @@ static irqreturn_t dt282x_interrupt(int irq, void *d) data = (short)inw(dev->iobase + DT2821_ADDAT); data &= (1 << boardtype.adbits) - 1; - if (devpriv->ad_2scomp) { + + if (devpriv->ad_2scomp) data ^= 1 << (boardtype.adbits - 1); - } ret = comedi_buf_put(s->async, data); - if (ret == 0) { + + if (ret == 0) s->async->events |= COMEDI_CB_OVERFLOW; - } devpriv->nread--; if (!devpriv->nread) { @@ -685,7 +666,8 @@ static irqreturn_t dt282x_interrupt(int irq, void *d) } #endif comedi_event(dev, s); - /* printk("adcsr=0x%02x dacsr-0x%02x supcsr=0x%02x\n", adcsr, dacsr, supcsr); */ + /* printk("adcsr=0x%02x dacsr-0x%02x supcsr=0x%02x\n", + adcsr, dacsr, supcsr); */ return IRQ_RETVAL(handled); } @@ -776,7 +758,10 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* + * step 2: make sure trigger sources are unique + * and mutually compatible + */ /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_FOLLOW && @@ -859,7 +844,8 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->usedma == 0) { comedi_error(dev, - "driver requires 2 dma channels to execute command"); + "driver requires 2 dma channels" + " to execute command"); return -EIO; } @@ -1049,7 +1035,10 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* + * step 2: make sure trigger sources are unique + * and mutually compatible + */ /* note that mutual compatibility is not an issue here */ if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE) @@ -1064,7 +1053,7 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev, cmd->start_arg = 0; err++; } - if (cmd->scan_begin_arg < 5000 /* XXX unknown */ ) { + if (cmd->scan_begin_arg < 5000 /* XXX unknown */) { cmd->scan_begin_arg = 5000; err++; } @@ -1115,7 +1104,7 @@ static int dt282x_ao_inttrig(struct comedi_device *dev, size = cfc_read_array_from_buffer(s, devpriv->dma[0].buf, devpriv->dma_maxsize); if (size == 0) { - printk("dt282x: AO underrun\n"); + printk(KERN_ERR "dt282x: AO underrun\n"); return -EPIPE; } prep_ao_dma(dev, 0, size); @@ -1123,7 +1112,7 @@ static int dt282x_ao_inttrig(struct comedi_device *dev, size = cfc_read_array_from_buffer(s, devpriv->dma[1].buf, devpriv->dma_maxsize); if (size == 0) { - printk("dt282x: AO underrun\n"); + printk(KERN_ERR "dt282x: AO underrun\n"); return -EPIPE; } prep_ao_dma(dev, 1, size); @@ -1141,7 +1130,8 @@ static int dt282x_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->usedma == 0) { comedi_error(dev, - "driver requires 2 dma channels to execute command"); + "driver requires 2 dma channels" + " to execute command"); return -EIO; } @@ -1262,7 +1252,8 @@ static const struct comedi_lrange *opt_ao_range_lkup(int x) return ao_range_table[x]; } -enum { opt_iobase = 0, opt_irq, opt_dma1, opt_dma2, /* i/o base, irq, dma channels */ +enum { /* i/o base, irq, dma channels */ + opt_iobase = 0, opt_irq, opt_dma1, opt_dma2, opt_diff, /* differential */ opt_ai_twos, opt_ao0_twos, opt_ao1_twos, /* twos comp */ opt_ai_range, opt_ao0_range, opt_ao1_range, /* range */ @@ -1295,9 +1286,9 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (!iobase) iobase = 0x240; - printk("comedi%d: dt282x: 0x%04lx", dev->minor, iobase); + printk(KERN_INFO "comedi%d: dt282x: 0x%04lx", dev->minor, iobase); if (!request_region(iobase, DT2821_SIZE, "dt282x")) { - printk(" I/O port conflict\n"); + printk(KERN_INFO " I/O port conflict\n"); return -EBUSY; } dev->iobase = iobase; @@ -1305,7 +1296,7 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) outw(DT2821_BDINIT, dev->iobase + DT2821_SUPCSR); i = inw(dev->iobase + DT2821_ADCSR); #ifdef DEBUG - printk(" fingerprint=%x,%x,%x,%x,%x", + printk(KERN_DEBUG " fingerprint=%x,%x,%x,%x,%x", inw(dev->iobase + DT2821_ADCSR), inw(dev->iobase + DT2821_CHANCSR), inw(dev->iobase + DT2821_DACSR), @@ -1323,7 +1314,7 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) != DT2821_SUPCSR_VAL) || ((inw(dev->iobase + DT2821_TMRCTR) & DT2821_TMRCTR_MASK) != DT2821_TMRCTR_VAL)) { - printk(" board not found"); + printk(KERN_ERR " board not found"); return -EIO; } /* should do board test */ @@ -1344,26 +1335,25 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) irq = probe_irq_off(irqs); restore_flags(flags); - if (0 /* error */ ) { - printk(" error probing irq (bad)"); - } + if (0 /* error */) + printk(KERN_ERR " error probing irq (bad)"); } #endif if (irq > 0) { - printk(" ( irq = %d )", irq); + printk(KERN_INFO " ( irq = %d )", irq); ret = request_irq(irq, dt282x_interrupt, 0, "dt282x", dev); if (ret < 0) { - printk(" failed to get irq\n"); + printk(KERN_ERR " failed to get irq\n"); return -EIO; } dev->irq = irq; } else if (irq == 0) { - printk(" (no irq)"); + printk(KERN_INFO " (no irq)"); } else { #if 0 - printk(" (probe returned multiple irqs--bad)"); + printk(KERN_INFO " (probe returned multiple irqs--bad)"); #else - printk(" (irq probe not implemented)"); + printk(KERN_INFO " (irq probe not implemented)"); #endif } @@ -1435,16 +1425,15 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->maxdata = 1; s->range_table = &range_digital; - printk("\n"); + printk(KERN_INFO "\n"); return 0; } static void free_resources(struct comedi_device *dev) { - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } if (dev->iobase) release_region(dev->iobase, DT2821_SIZE); if (dev->private) { @@ -1461,7 +1450,7 @@ static void free_resources(struct comedi_device *dev) static int dt282x_detach(struct comedi_device *dev) { - printk("comedi%d: dt282x: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: dt282x: remove\n", dev->minor); free_resources(dev); @@ -1475,7 +1464,7 @@ static int dt282x_grab_dma(struct comedi_device *dev, int dma1, int dma2) devpriv->usedma = 0; if (!dma1 && !dma2) { - printk(" (no dma)"); + printk(KERN_ERR " (no dma)"); return 0; } @@ -1503,11 +1492,11 @@ static int dt282x_grab_dma(struct comedi_device *dev, int dma1, int dma2) devpriv->dma[0].buf = (void *)__get_free_page(GFP_KERNEL | GFP_DMA); devpriv->dma[1].buf = (void *)__get_free_page(GFP_KERNEL | GFP_DMA); if (!devpriv->dma[0].buf || !devpriv->dma[1].buf) { - printk(" can't get DMA memory"); + printk(KERN_ERR " can't get DMA memory"); return -ENOMEM; } - printk(" (dma=%d,%d)", dma1, dma2); + printk(KERN_INFO " (dma=%d,%d)", dma1, dma2); devpriv->usedma = 1; diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index bbbef79..ca68789 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -314,9 +314,8 @@ static int dt3k_send_cmd(struct comedi_device *dev, unsigned int cmd) break; udelay(1); } - if ((status & DT3000_COMPLETION_MASK) == DT3000_NOERROR) { + if ((status & DT3000_COMPLETION_MASK) == DT3000_NOERROR) return 0; - } printk("dt3k_send_cmd() timeout/error status=0x%04x\n", status); @@ -359,9 +358,8 @@ static irqreturn_t dt3k_interrupt(int irq, void *d) struct comedi_subdevice *s; unsigned int status; - if (!dev->attached) { + if (!dev->attached) return IRQ_NONE; - } s = dev->subdevices + 0; status = readw(devpriv->io_addr + DPR_Intr_Flag); @@ -374,9 +372,8 @@ static irqreturn_t dt3k_interrupt(int irq, void *d) s->async->events |= COMEDI_CB_BLOCK; } - if (status & (DT3000_ADSWERR | DT3000_ADHWERR)) { + if (status & (DT3000_ADSWERR | DT3000_ADHWERR)) s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; - } debug_n_ints++; if (debug_n_ints >= 10) { @@ -399,9 +396,8 @@ static void debug_intr_flags(unsigned int flags) int i; printk("dt3k: intr_flags:"); for (i = 0; i < 8; i++) { - if (flags & (1 << i)) { + if (flags & (1 << i)) printk(" %s", intr_flags[i]); - } } printk("\n"); } @@ -690,9 +686,8 @@ static int dt3k_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, /* XXX docs don't explain how to select aref */ aref = CR_AREF(insn->chanspec); - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = dt3k_readsingle(dev, SUBS_AI, chan, gain); - } return i; } @@ -720,9 +715,8 @@ static int dt3k_ao_insn_read(struct comedi_device *dev, unsigned int chan; chan = CR_CHAN(insn->chanspec); - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = devpriv->ao_readback[chan]; - } return i; } @@ -911,9 +905,8 @@ static int dt3000_detach(struct comedi_device *dev) if (devpriv) { if (devpriv->pci_dev) { - if (devpriv->phys_addr) { + if (devpriv->phys_addr) comedi_pci_disable(devpriv->pci_dev); - } pci_dev_put(devpriv->pci_dev); } if (devpriv->io_addr) diff --git a/drivers/staging/comedi/drivers/icp_multi.h b/drivers/staging/comedi/drivers/icp_multi.h index 8caadc6..2bb96b1 100644 --- a/drivers/staging/comedi/drivers/icp_multi.h +++ b/drivers/staging/comedi/drivers/icp_multi.h @@ -73,14 +73,13 @@ static void pci_card_list_init(unsigned short pci_vendor, char display) pcidev != NULL; pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { if (pcidev->vendor == pci_vendor) { - inova = kmalloc(sizeof(*inova), GFP_KERNEL); + inova = kzalloc(sizeof(*inova), GFP_KERNEL); if (!inova) { printk ("icp_multi: pci_card_list_init: allocation failed\n"); pci_dev_put(pcidev); break; } - memset(inova, 0, sizeof(*inova)); inova->pcidev = pci_dev_get(pcidev); if (last) { diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index 80e192d..c8484ae 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -60,6 +60,7 @@ from http://www.comedi.org #define ME_DRIVER_NAME "me_daq" +#define PCI_VENDOR_ID_MEILHAUS 0x1402 #define ME2000_DEVICE_ID 0x2000 #define ME2600_DEVICE_ID 0x2600 diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 188f580..99d9985 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -76,7 +76,7 @@ void mite_init(void) for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL; pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { - if (pcidev->vendor == PCI_VENDOR_ID_NATINST) { + if (pcidev->vendor == PCI_VENDOR_ID_NI) { unsigned i; mite = kzalloc(sizeof(*mite), GFP_KERNEL); diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h index 9d5049f..999551f 100644 --- a/drivers/staging/comedi/drivers/mite.h +++ b/drivers/staging/comedi/drivers/mite.h @@ -27,8 +27,6 @@ #include <linux/pci.h> #include "../comedidev.h" -#define PCI_VENDOR_ID_NATINST 0x1093 - /* #define DEBUG_MITE */ #define PCIMIO_COMPAT diff --git a/drivers/staging/comedi/drivers/mpc624.c b/drivers/staging/comedi/drivers/mpc624.c index 12e72c8..9874ac3 100644 --- a/drivers/staging/comedi/drivers/mpc624.c +++ b/drivers/staging/comedi/drivers/mpc624.c @@ -40,20 +40,20 @@ Status: working Configuration Options: [0] - I/O base address [1] - convertion rate - Convertion rate RMS noise Effective Number Of Bits - 0 3.52kHz 23uV 17 - 1 1.76kHz 3.5uV 20 - 2 880Hz 2uV 21.3 - 3 440Hz 1.4uV 21.8 - 4 220Hz 1uV 22.4 - 5 110Hz 750uV 22.9 - 6 55Hz 510nV 23.4 - 7 27.5Hz 375nV 24 - 8 13.75Hz 250nV 24.4 - 9 6.875Hz 200nV 24.6 - [2] - voltage range - 0 -1.01V .. +1.01V - 1 -10.1V .. +10.1V + Convertion rate RMS noise Effective Number Of Bits + 0 3.52kHz 23uV 17 + 1 1.76kHz 3.5uV 20 + 2 880Hz 2uV 21.3 + 3 440Hz 1.4uV 21.8 + 4 220Hz 1uV 22.4 + 5 110Hz 750uV 22.9 + 6 55Hz 510nV 23.4 + 7 27.5Hz 375nV 24 + 8 13.75Hz 250nV 24.4 + 9 6.875Hz 200nV 24.6 + [2] - voltage range + 0 -1.01V .. +1.01V + 1 -10.1V .. +10.1V */ #include "../comedidev.h" @@ -65,13 +65,13 @@ Configuration Options: #define MPC624_SIZE 16 /* Offsets of different ports */ -#define MPC624_MASTER_CONTROL 0 /* not used */ -#define MPC624_GNMUXCH 1 /* Gain, Mux, Channel of ADC */ -#define MPC624_ADC 2 /* read/write to/from ADC */ -#define MPC624_EE 3 /* read/write to/from serial EEPROM via I2C */ -#define MPC624_LEDS 4 /* write to LEDs */ -#define MPC624_DIO 5 /* read/write to/from digital I/O ports */ -#define MPC624_IRQ_MASK 6 /* IRQ masking enable/disable */ +#define MPC624_MASTER_CONTROL 0 /* not used */ +#define MPC624_GNMUXCH 1 /* Gain, Mux, Channel of ADC */ +#define MPC624_ADC 2 /* read/write to/from ADC */ +#define MPC624_EE 3 /* read/write to/from serial EEPROM via I2C */ +#define MPC624_LEDS 4 /* write to LEDs */ +#define MPC624_DIO 5 /* read/write to/from digital I/O ports */ +#define MPC624_IRQ_MASK 6 /* IRQ masking enable/disable */ /* Register bits' names */ #define MPC624_ADBUSY (1<<5) @@ -109,24 +109,27 @@ Configuration Options: * ^ - Effective Number Of Bits */ -#define MPC624_SPEED_3_52_kHz (MPC624_OSR4 | MPC624_OSR0) -#define MPC624_SPEED_1_76_kHz (MPC624_OSR4 | MPC624_OSR1) -#define MPC624_SPEED_880_Hz (MPC624_OSR4 | MPC624_OSR1 | MPC624_OSR0) -#define MPC624_SPEED_440_Hz (MPC624_OSR4 | MPC624_OSR2) -#define MPC624_SPEED_220_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR0) -#define MPC624_SPEED_110_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR1) -#define MPC624_SPEED_55_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0) -#define MPC624_SPEED_27_5_Hz (MPC624_OSR4 | MPC624_OSR3) -#define MPC624_SPEED_13_75_Hz (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR0) -#define MPC624_SPEED_6_875_Hz (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0) -/* ---------------------------------------------------------------------------- */ +#define MPC624_SPEED_3_52_kHz (MPC624_OSR4 | MPC624_OSR0) +#define MPC624_SPEED_1_76_kHz (MPC624_OSR4 | MPC624_OSR1) +#define MPC624_SPEED_880_Hz (MPC624_OSR4 | MPC624_OSR1 | MPC624_OSR0) +#define MPC624_SPEED_440_Hz (MPC624_OSR4 | MPC624_OSR2) +#define MPC624_SPEED_220_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR0) +#define MPC624_SPEED_110_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR1) +#define MPC624_SPEED_55_Hz \ + (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0) +#define MPC624_SPEED_27_5_Hz (MPC624_OSR4 | MPC624_OSR3) +#define MPC624_SPEED_13_75_Hz (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR0) +#define MPC624_SPEED_6_875_Hz \ + (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0) +/* -------------------------------------------------------------------------- */ struct skel_private { - unsigned long int ulConvertionRate; /* set by mpc624_attach() from driver's parameters */ + /* set by mpc624_attach() from driver's parameters */ + unsigned long int ulConvertionRate; }; #define devpriv ((struct skel_private *)dev->private) -/* ---------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ static const struct comedi_lrange range_mpc624_bipolar1 = { 1, { @@ -145,11 +148,11 @@ static const struct comedi_lrange range_mpc624_bipolar10 = { } }; -/* ---------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it); static int mpc624_detach(struct comedi_device *dev); -/* ---------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ static struct comedi_driver driver_mpc624 = { .driver_name = "mpc624", .module = THIS_MODULE, @@ -157,20 +160,20 @@ static struct comedi_driver driver_mpc624 = { .detach = mpc624_detach }; -/* ---------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ static int mpc624_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -/* ---------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; unsigned long iobase; iobase = it->options[0]; - printk("comedi%d: mpc624 [0x%04lx, ", dev->minor, iobase); + printk(KERN_INFO "comedi%d: mpc624 [0x%04lx, ", dev->minor, iobase); if (request_region(iobase, MPC624_SIZE, "mpc624") == NULL) { - printk("I/O port(s) in use\n"); + printk(KERN_ERR "I/O port(s) in use\n"); return -EIO; } @@ -184,47 +187,48 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it) switch (it->options[1]) { case 0: devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz; - printk("3.52 kHz, "); + printk(KERN_INFO "3.52 kHz, "); break; case 1: devpriv->ulConvertionRate = MPC624_SPEED_1_76_kHz; - printk("1.76 kHz, "); + printk(KERN_INFO "1.76 kHz, "); break; case 2: devpriv->ulConvertionRate = MPC624_SPEED_880_Hz; - printk("880 Hz, "); + printk(KERN_INFO "880 Hz, "); break; case 3: devpriv->ulConvertionRate = MPC624_SPEED_440_Hz; - printk("440 Hz, "); + printk(KERN_INFO "440 Hz, "); break; case 4: devpriv->ulConvertionRate = MPC624_SPEED_220_Hz; - printk("220 Hz, "); + printk(KERN_INFO "220 Hz, "); break; case 5: devpriv->ulConvertionRate = MPC624_SPEED_110_Hz; - printk("110 Hz, "); + printk(KERN_INFO "110 Hz, "); break; case 6: devpriv->ulConvertionRate = MPC624_SPEED_55_Hz; - printk("55 Hz, "); + printk(KERN_INFO "55 Hz, "); break; case 7: devpriv->ulConvertionRate = MPC624_SPEED_27_5_Hz; - printk("27.5 Hz, "); + printk(KERN_INFO "27.5 Hz, "); break; case 8: devpriv->ulConvertionRate = MPC624_SPEED_13_75_Hz; - printk("13.75 Hz, "); + printk(KERN_INFO "13.75 Hz, "); break; case 9: devpriv->ulConvertionRate = MPC624_SPEED_6_875_Hz; - printk("6.875 Hz, "); + printk(KERN_INFO "6.875 Hz, "); break; default: printk - ("illegal convertion rate setting! Valid numbers are 0..9. Using 9 => 6.875 Hz, "); + (KERN_ERR "illegal convertion rate setting!" + " Valid numbers are 0..9. Using 9 => 6.875 Hz, "); devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz; } @@ -239,29 +243,29 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it) switch (it->options[1]) { default: s->maxdata = 0x3FFFFFFF; - printk("30 bit, "); + printk(KERN_INFO "30 bit, "); } switch (it->options[1]) { case 0: s->range_table = &range_mpc624_bipolar1; - printk("1.01V]: "); + printk(KERN_INFO "1.01V]: "); break; default: s->range_table = &range_mpc624_bipolar10; - printk("10.1V]: "); + printk(KERN_INFO "10.1V]: "); } s->len_chanlist = 1; s->insn_read = mpc624_ai_rinsn; - printk("attached\n"); + printk(KERN_INFO "attached\n"); return 1; } static int mpc624_detach(struct comedi_device *dev) { - printk("comedi%d: mpc624: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: mpc624: remove\n", dev->minor); if (dev->iobase) release_region(dev->iobase, MPC624_SIZE); @@ -280,11 +284,14 @@ static int mpc624_ai_rinsn(struct comedi_device *dev, unsigned long int data_in, data_out; unsigned char ucPort; - /* WARNING: We always write 0 to GNSWA bit, so the channel range is +-/10.1Vdc */ + /* + * WARNING: + * We always write 0 to GNSWA bit, so the channel range is +-/10.1Vdc + */ outb(insn->chanspec, dev->iobase + MPC624_GNMUXCH); -/* printk("Channel %d: \n", insn->chanspec); */ +/* printk("Channel %d:\n", insn->chanspec); */ if (!insn->n) { - printk("MPC624: Warning, no data to acquire\n"); + printk(KERN_INFO "MPC624: Warning, no data to acquire\n"); return 0; } @@ -306,7 +313,7 @@ static int mpc624_ai_rinsn(struct comedi_device *dev, break; } if (i == TIMEOUT) { - printk("MPC624: timeout (%dms)\n", TIMEOUT); + printk(KERN_ERR "MPC624: timeout (%dms)\n", TIMEOUT); data[n] = 0; return -ETIMEDOUT; } @@ -319,7 +326,7 @@ static int mpc624_ai_rinsn(struct comedi_device *dev, outb(0, dev->iobase + MPC624_ADC); udelay(1); - if (data_out & (1 << 31)) { /* the next bit is a 1 */ + if (data_out & (1 << 31)) { /* the next bit is a 1 */ /* Set the ADSDI line (send to MPC624) */ outb(MPC624_ADSDI, dev->iobase + MPC624_ADC); udelay(1); @@ -344,31 +351,47 @@ static int mpc624_ai_rinsn(struct comedi_device *dev, data_out <<= 1; } - /* Received 32-bit long value consist of: */ - /* 31: EOC (End Of Transmission) bit - should be 0 */ - /* 30: DMY (Dummy) bit - should be 0 */ - /* 29: SIG (Sign) bit - 1 if the voltage is positive, 0 if negative */ - /* 28: MSB (Most Significant Bit) - the first bit of convertion result */ - /* .... */ - /* 05: LSB (Least Significant Bit) - the last bit of convertion result */ - /* 04: sub-LSB - sub-LSBs are basically noise, but when */ - /* 03: sub-LSB averaged properly, they can increase convertion */ - /* 02: sub-LSB precision up to 29 bits; they can be discarded */ - /* 01: sub-LSB without loss of resolution. */ - /* 00: sub-LSB */ + /* + * Received 32-bit long value consist of: + * 31: EOC - + * (End Of Transmission) bit - should be 0 + * 30: DMY + * (Dummy) bit - should be 0 + * 29: SIG + * (Sign) bit- 1 if the voltage is positive, + * 0 if negative + * 28: MSB + * (Most Significant Bit) - the first bit of + * the conversion result + * .... + * 05: LSB + * (Least Significant Bit)- the last bit of the + * conversion result + * 04-00: sub-LSB + * - sub-LSBs are basically noise, but when + * averaged properly, they can increase conversion + * precision up to 29 bits; they can be discarded + * without loss of resolution. + */ if (data_in & MPC624_EOC_BIT) - printk("MPC624: EOC bit is set (data_in=%lu)!", + printk(KERN_INFO "MPC624:EOC bit is set (data_in=%lu)!", data_in); if (data_in & MPC624_DMY_BIT) - printk("MPC624: DMY bit is set (data_in=%lu)!", + printk(KERN_INFO "MPC624:DMY bit is set (data_in=%lu)!", data_in); - if (data_in & MPC624_SGN_BIT) { /* check the sign bit *//* The voltage is positive */ - data_in &= 0x3FFFFFFF; /* EOC and DMY should be 0, but we will mask them out just to be sure */ - data[n] = data_in; /* comedi operates on unsigned numbers, so we don't clear the SGN bit */ - /* SGN bit is still set! It's correct, since we're converting to unsigned. */ - } else { /* The voltage is negative */ - /* data_in contains a number in 30-bit two's complement code and we must deal with it */ + if (data_in & MPC624_SGN_BIT) { /* Volatge is positive */ + /* + * comedi operates on unsigned numbers, so mask off EOC + * and DMY and don't clear the SGN bit + */ + data_in &= 0x3FFFFFFF; + data[n] = data_in; + } else { /* The voltage is negative */ + /* + * data_in contains a number in 30-bit two's complement + * code and we must deal with it + */ data_in |= MPC624_SGN_BIT; data_in = ~data_in; data_in += 1; diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index 653b4c8..1fc76cc 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -107,10 +107,9 @@ static const struct ni6527_board ni6527_boards[] = { #define this_board ((const struct ni6527_board *)dev->board_ptr) static DEFINE_PCI_DEVICE_TABLE(ni6527_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x2b10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2b10)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2b20)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni6527_pci_table); diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 9a4fffe..d793f5a 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -266,30 +266,29 @@ static inline unsigned ni_65xx_total_num_ports(const struct ni_65xx_board } static DEFINE_PCI_DEVICE_TABLE(ni_65xx_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x1710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7085, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7086, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7087, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7088, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70a9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70c3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70c8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70c9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70cc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70d1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70d2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70d3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7125, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7126, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7127, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7128, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x718b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x718c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x71c5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1710)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7085)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7086)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7087)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7088)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70a9)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70c3)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70c8)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70c9)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70cc)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70CD)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70d1)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70d2)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70d3)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7124)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7125)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7126)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7127)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7128)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x718b)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x718c)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x71c5)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni_65xx_pci_table); diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 017630f..6a6fae5 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -420,12 +420,11 @@ static const struct ni_660x_board ni_660x_boards[] = { #define NI_660X_MAX_NUM_COUNTERS (NI_660X_MAX_NUM_CHIPS * counters_per_chip) static DEFINE_PCI_DEVICE_TABLE(ni_660x_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x2c60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1310, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2cc0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2c60)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1310)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1360)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2cc0)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni_660x_pci_table); diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index 68221bf..44ae836 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -47,8 +47,6 @@ Commands are not supported. #include "mite.h" -#define PCI_VENDOR_ID_NATINST 0x1093 - #define AO_VALUE_OFFSET 0x00 #define AO_CHAN_OFFSET 0x0c #define AO_STATUS_OFFSET 0x10 @@ -91,12 +89,9 @@ static const struct ni_670x_board ni_670x_boards[] = { }; static DEFINE_PCI_DEVICE_TABLE(ni_670x_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x2c90, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - /*{ PCI_VENDOR_ID_NATINST, 0x0000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },*/ - { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2c90)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1920)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni_670x_pci_table); diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c b/drivers/staging/comedi/drivers/ni_at_ao.c index 3778565..ce60224 100644 --- a/drivers/staging/comedi/drivers/ni_at_ao.c +++ b/drivers/staging/comedi/drivers/ni_at_ao.c @@ -226,7 +226,7 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) iobase = 0x1c0; ao_unipolar = it->options[3]; - printk("comedi%d: ni_at_ao: 0x%04lx", dev->minor, iobase); + printk(KERN_INFO "comedi%d: ni_at_ao: 0x%04lx", dev->minor, iobase); if (!request_region(iobase, ATAO_SIZE, "ni_at_ao")) { printk(" I/O port conflict\n"); @@ -283,14 +283,14 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) atao_reset(dev); - printk("\n"); + printk(KERN_INFO "\n"); return 0; } static int atao_detach(struct comedi_device *dev) { - printk("comedi%d: atao: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: atao: remove\n", dev->minor); if (dev->iobase) release_region(dev->iobase, ATAO_SIZE); diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 06dd44f..6ec77bf 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -145,6 +145,7 @@ void subdev_700_interrupt(struct comedi_device *dev, struct comedi_subdevice *s) comedi_event(dev, s); } +EXPORT_SYMBOL(subdev_700_interrupt); static int subdev_700_cb(int dir, int port, int data, unsigned long arg) { @@ -326,6 +327,7 @@ int subdev_700_init(struct comedi_device *dev, struct comedi_subdevice *s, return 0; } +EXPORT_SYMBOL(subdev_700_init); int subdev_700_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, int (*cb) (int, int, int, unsigned long), @@ -345,6 +347,7 @@ int subdev_700_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, return 0; } +EXPORT_SYMBOL(subdev_700_init_irq); void subdev_700_cleanup(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -353,11 +356,7 @@ void subdev_700_cleanup(struct comedi_device *dev, struct comedi_subdevice *s) kfree(s->private); } - -EXPORT_SYMBOL(subdev_700_init); -EXPORT_SYMBOL(subdev_700_init_irq); EXPORT_SYMBOL(subdev_700_cleanup); -EXPORT_SYMBOL(subdev_700_interrupt); static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -709,8 +708,12 @@ static struct pcmcia_device_id dio700_cs_ids[] = { PCMCIA_DEVICE_NULL }; -MODULE_LICENSE("GPL"); + MODULE_DEVICE_TABLE(pcmcia, dio700_cs_ids); +MODULE_AUTHOR("Fred Brooks <nsaspook@nsaspook.com>"); +MODULE_DESCRIPTION("Comedi driver for National Instruments " + "PCMCIA DAQCard-700 DIO"); +MODULE_LICENSE("GPL"); struct pcmcia_driver dio700_cs_driver = { .probe = dio700_cs_attach, diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 7bfe08b..e4865b1 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -461,6 +461,10 @@ static struct pcmcia_device_id dio24_cs_ids[] = { }; MODULE_DEVICE_TABLE(pcmcia, dio24_cs_ids); +MODULE_AUTHOR("Daniel Vecino Castel <dvecino@able.es>"); +MODULE_DESCRIPTION("Comedi driver for National Instruments " + "PCMCIA DAQ-Card DIO-24"); +MODULE_LICENSE("GPL"); struct pcmcia_driver dio24_cs_driver = { .probe = dio24_cs_attach, diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 558e525..67c8a53 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -499,9 +499,8 @@ static struct comedi_driver driver_labpc = { #ifdef CONFIG_COMEDI_PCI static DEFINE_PCI_DEVICE_TABLE(labpc_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x161, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x161)}, + {0} }; MODULE_DEVICE_TABLE(pci, labpc_pci_table); @@ -536,7 +535,7 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase, printk("\n"); if (iobase == 0) { - printk("io base address is zero!\n"); + printk(KERN_ERR "io base address is zero!\n"); return -EINVAL; } /* request io regions for isa boards */ diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index fd8d3e9..163245e 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -437,6 +437,9 @@ static struct pcmcia_device_id labpc_cs_ids[] = { }; MODULE_DEVICE_TABLE(pcmcia, labpc_cs_ids); +MODULE_AUTHOR("Frank Mori Hess <fmhess@users.sourceforge.net>"); +MODULE_DESCRIPTION("Comedi driver for National Instruments Lab-PC"); +MODULE_LICENSE("GPL"); struct pcmcia_driver labpc_cs_driver = { .probe = labpc_cs_attach, @@ -478,6 +481,5 @@ void __exit labpc_exit_module(void) comedi_driver_unregister(&driver_labpc_cs); } -MODULE_LICENSE("GPL"); module_init(labpc_init_module); module_exit(labpc_exit_module); diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index 1e8aeba..cedb02d 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -428,8 +428,6 @@ static int ni_getboardtype(struct comedi_device *dev, #ifdef MODULE -MODULE_LICENSE("GPL"); - static struct pcmcia_device_id ni_mio_cs_ids[] = { PCMCIA_DEVICE_MANF_CARD(0x010b, 0x010d), /* DAQCard-ai-16xe-50 */ PCMCIA_DEVICE_MANF_CARD(0x010b, 0x010c), /* DAQCard-ai-16e-4 */ @@ -440,6 +438,9 @@ static struct pcmcia_device_id ni_mio_cs_ids[] = { }; MODULE_DEVICE_TABLE(pcmcia, ni_mio_cs_ids); +MODULE_AUTHOR("David A. Schleef <ds@schleef.org>"); +MODULE_DESCRIPTION("Comedi driver for National Instruments DAQCard E series"); +MODULE_LICENSE("GPL"); struct pcmcia_driver ni_mio_cs_driver = { .probe = &cs_attach, diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 9d33751..b126638 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -83,8 +83,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org #define DPRINTK(format, args...) #endif -#define PCI_VENDOR_ID_NATINST 0x1093 - #define PCI_DIO_SIZE 4096 #define PCI_MITE_SIZE 4096 @@ -379,18 +377,17 @@ static const struct nidio_board nidio_boards[] = { #define this_board ((const struct nidio_board *)dev->board_ptr) static DEFINE_PCI_DEVICE_TABLE(ni_pcidio_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x1150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1320, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x12b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x0160, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1630, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x13c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x0400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1250, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x17d0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1150)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1320)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x12b0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x0160)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1630)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x13c0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x0400)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1250)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x17d0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1800)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni_pcidio_pci_table); diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 24c8b8e..577fda8 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -130,60 +130,59 @@ Bugs: /* The following two tables must be in the same order */ static DEFINE_PCI_DEVICE_TABLE(ni_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x0162, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1170, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1190, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x11b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x11c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x11d0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1270, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1330, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1350, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x14e0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x14f0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x15b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1870, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x18b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x18c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2420, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2430, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2890, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x28c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2a60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2a70, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2a80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2ab0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2b80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2b90, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2c80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2ca0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70aa, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70ab, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70ac, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70af, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70b4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70b6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70b7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70b8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70bc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70bd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70bf, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70f2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x710d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x716c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x716d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x717f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x71bc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x717d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x0162)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1170)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1180)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1190)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x11b0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x11c0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x11d0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1270)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1330)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1340)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1350)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x14e0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x14f0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1580)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x15b0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1880)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1870)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x18b0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x18c0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2410)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2420)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2430)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2890)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x28c0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2a60)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2a70)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2a80)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2ab0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2b80)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2b90)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2c80)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2ca0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70aa)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70ab)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70ac)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70af)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70b0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70b4)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70b6)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70b7)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70b8)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70bc)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70bd)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70bf)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70c0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70f2)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x710d)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x716c)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x716d)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x717f)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x71bc)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x717d)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni_pci_table); diff --git a/drivers/staging/comedi/drivers/plx9080.h b/drivers/staging/comedi/drivers/plx9080.h index 53bcdb7..485d63f 100644 --- a/drivers/staging/comedi/drivers/plx9080.h +++ b/drivers/staging/comedi/drivers/plx9080.h @@ -380,9 +380,9 @@ enum bigend_bits { #define MBX_ADDR_SPACE_360 0x80 /* wanXL100s/200/400 */ #define MBX_ADDR_MASK_360 (MBX_ADDR_SPACE_360-1) -static inline int plx9080_abort_dma(void *iobase, unsigned int channel) +static inline int plx9080_abort_dma(void __iomem *iobase, unsigned int channel) { - void *dma_cs_addr; + void __iomem *dma_cs_addr; uint8_t dma_status; const int timeout = 10000; unsigned int i; diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 8b274b7..a91db6c 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -56,6 +56,8 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 #include <pcmcia/cisreg.h> #include <pcmcia/ds.h> +#include <linux/completion.h> + /* Maximum number of separate DAQP devices we'll allow */ #define MAX_DEV 4 @@ -67,7 +69,7 @@ struct local_info_t { enum { semaphore, buffer } interrupt_mode; - struct semaphore eos; + struct completion eos; struct comedi_device *dev; struct comedi_subdevice *s; @@ -238,14 +240,13 @@ static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) /* Interrupt handler * * Operates in one of two modes. If local->interrupt_mode is - * 'semaphore', just signal the local->eos semaphore and return + * 'semaphore', just signal the local->eos completion and return * (one-shot mode). Otherwise (continuous mode), read data in from * the card, transfer it to the buffer provided by the higher-level * comedi kernel module, and signal various comedi callback routines, * which run pretty quick. */ - -static void daqp_interrupt(int irq, void *dev_id) +static enum irqreturn daqp_interrupt(int irq, void *dev_id) { struct local_info_t *local = (struct local_info_t *)dev_id; struct comedi_device *dev; @@ -256,39 +257,39 @@ static void daqp_interrupt(int irq, void *dev_id) if (local == NULL) { printk(KERN_WARNING "daqp_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } dev = local->dev; if (dev == NULL) { printk(KERN_WARNING "daqp_interrupt(): NULL comedi_device.\n"); - return; + return IRQ_NONE; } if (!dev->attached) { printk(KERN_WARNING "daqp_interrupt(): struct comedi_device not yet attached.\n"); - return; + return IRQ_NONE; } s = local->s; if (s == NULL) { printk(KERN_WARNING "daqp_interrupt(): NULL comedi_subdevice.\n"); - return; + return IRQ_NONE; } if ((struct local_info_t *)s->private != local) { printk(KERN_WARNING "daqp_interrupt(): invalid comedi_subdevice.\n"); - return; + return IRQ_NONE; } switch (local->interrupt_mode) { case semaphore: - up(&local->eos); + complete(&local->eos); break; case buffer: @@ -340,6 +341,7 @@ static void daqp_interrupt(int irq, void *dev_id) comedi_event(dev, s); } + return IRQ_HANDLED; } /* One-shot analog data acquisition routine */ @@ -401,8 +403,7 @@ static int daqp_ai_insn_read(struct comedi_device *dev, return -1; } - /* Make sure semaphore is blocked */ - sema_init(&local->eos, 0); + init_completion(&local->eos); local->interrupt_mode = semaphore; local->dev = dev; local->s = s; @@ -413,9 +414,9 @@ static int daqp_ai_insn_read(struct comedi_device *dev, outb(DAQP_COMMAND_ARM | DAQP_COMMAND_FIFO_DATA, dev->iobase + DAQP_COMMAND); - /* Wait for interrupt service routine to unblock semaphore */ + /* Wait for interrupt service routine to unblock completion */ /* Maybe could use a timeout here, but it's interruptible */ - if (down_interruptible(&local->eos)) + if (wait_for_completion_interruptible(&local->eos)) return -EINTR; data[i] = inb(dev->iobase + DAQP_FIFO); @@ -580,7 +581,7 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct local_info_t *local = (struct local_info_t *)s->private; struct comedi_cmd *cmd = &s->async->cmd; - int counter = 100; + int counter; int scanlist_start_on_every_entry; int threshold; @@ -613,14 +614,14 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) */ if (cmd->convert_src == TRIG_TIMER) { - int counter = daqp_ns_to_timer(&cmd->convert_arg, + counter = daqp_ns_to_timer(&cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); outb(counter & 0xff, dev->iobase + DAQP_PACER_LOW); outb((counter >> 8) & 0xff, dev->iobase + DAQP_PACER_MID); outb((counter >> 16) & 0xff, dev->iobase + DAQP_PACER_HIGH); scanlist_start_on_every_entry = 1; } else { - int counter = daqp_ns_to_timer(&cmd->scan_begin_arg, + counter = daqp_ns_to_timer(&cmd->scan_begin_arg, cmd->flags & TRIG_ROUND_MASK); outb(counter & 0xff, dev->iobase + DAQP_PACER_LOW); outb((counter >> 8) & 0xff, dev->iobase + DAQP_PACER_MID); @@ -755,7 +756,7 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* Reset any pending interrupts (my card has a tendancy to require * require multiple reads on the status register to achieve this) */ - + counter = 100; while (--counter && (inb(dev->iobase + DAQP_STATUS) & DAQP_STATUS_EVENTS)) ; if (!counter) { @@ -1215,8 +1216,11 @@ static struct pcmcia_device_id daqp_cs_id_table[] = { }; MODULE_DEVICE_TABLE(pcmcia, daqp_cs_id_table); +MODULE_AUTHOR("Brent Baccala <baccala@freesoft.org>"); +MODULE_DESCRIPTION("Comedi driver for Quatech DAQP PCMCIA data capture cards"); +MODULE_LICENSE("GPL"); -struct pcmcia_driver daqp_cs_driver = { +static struct pcmcia_driver daqp_cs_driver = { .probe = daqp_cs_attach, .remove = daqp_cs_detach, .suspend = daqp_cs_suspend, diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index aba57d9..490753b 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -131,7 +131,8 @@ MODULE_DEVICE_TABLE(pci, skel_pci_table); /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, - feel free to suggest moving the variable to the struct comedi_device struct. */ + feel free to suggest moving the variable to the struct comedi_device struct. + */ struct skel_private { int data; @@ -211,7 +212,7 @@ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; - printk("comedi%d: skel: ", dev->minor); + pr_info("comedi%d: skel: ", dev->minor); /* * If you can probe the device to determine what device in a series @@ -282,7 +283,7 @@ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->type = COMEDI_SUBD_UNUSED; } - printk("attached\n"); + pr_info("attached\n"); return 0; } @@ -297,7 +298,7 @@ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) */ static int skel_detach(struct comedi_device *dev) { - printk("comedi%d: skel: remove\n", dev->minor); + pr_info("comedi%d: skel: remove\n", dev->minor); return 0; } @@ -336,7 +337,7 @@ static int skel_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, if (i == TIMEOUT) { /* printk() should be used instead of printk() * whenever the code can be called from real-time. */ - printk("timeout\n"); + pr_info("timeout\n"); return -ETIMEDOUT; } @@ -397,7 +398,8 @@ static int skel_ai_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* step 2: make sure trigger sources are unique and mutually compatible + */ /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_TIMER && @@ -529,7 +531,7 @@ static int skel_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, int i; int chan = CR_CHAN(insn->chanspec); - printk("skel_ao_winsn\n"); + pr_info("skel_ao_winsn\n"); /* Writing a list of values to an AO channel is probably not * very useful, but that's how the interface is defined. */ for (i = 0; i < insn->n; i++) { @@ -623,6 +625,7 @@ static int skel_dio_insn_config(struct comedi_device *dev, * as necessary. */ COMEDI_INITCLEANUP(driver_skel); -/* If you are writing a PCI driver you should use COMEDI_PCI_INITCLEANUP instead. -*/ +/* If you are writing a PCI driver you should use COMEDI_PCI_INITCLEANUP + * instead. + */ /* COMEDI_PCI_INITCLEANUP(driver_skel, skel_pci_table) */ diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index 17c92a5..18b0a83 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -41,14 +41,14 @@ Status: unknown /* 0..3 remain unchanged! For details about Port C Mode Register see */ /* the remarks in dnp_insn_config() below. */ -#define CSCIR 0x22 /* Chip Setup and Control Index Register */ -#define CSCDR 0x23 /* Chip Setup and Control Data Register */ -#define PAMR 0xa5 /* Port A Mode Register */ -#define PADR 0xa9 /* Port A Data Register */ -#define PBMR 0xa4 /* Port B Mode Register */ -#define PBDR 0xa8 /* Port B Data Register */ -#define PCMR 0xa3 /* Port C Mode Register */ -#define PCDR 0xa7 /* Port C Data Register */ +#define CSCIR 0x22 /* Chip Setup and Control Index Register */ +#define CSCDR 0x23 /* Chip Setup and Control Data Register */ +#define PAMR 0xa5 /* Port A Mode Register */ +#define PADR 0xa9 /* Port A Data Register */ +#define PBMR 0xa4 /* Port B Mode Register */ +#define PBDR 0xa8 /* Port B Data Register */ +#define PCMR 0xa3 /* Port C Mode Register */ +#define PCDR 0xa7 /* Port C Data Register */ /* This data structure holds information about the supported boards -------- */ @@ -59,8 +59,9 @@ struct dnp_board { int have_dio; }; -static const struct dnp_board dnp_boards[] = { /* we only support one DNP 'board' */ - { /* variant at the moment */ +/* We only support one DNP 'board' variant at the moment */ +static const struct dnp_board dnp_boards[] = { +{ .name = "dnp-1486", .ai_chans = 16, .ai_bits = 12, @@ -80,9 +81,9 @@ struct dnp_private_data { #define devpriv ((dnp_private *)dev->private) /* ------------------------------------------------------------------------- */ -/* The struct comedi_driver structure tells the Comedi core module which functions */ -/* to call to configure/deconfigure (attach/detach) the board, and also */ -/* about the kernel module that contains the device code. */ +/* The struct comedi_driver structure tells the Comedi core module which */ +/* functions to call to configure/deconfigure (attach/detach) the board, and */ +/* also about the kernel module that contains the device code. */ /* */ /* In the following section we define the API of this driver. */ /* ------------------------------------------------------------------------- */ @@ -97,7 +98,7 @@ static struct comedi_driver driver_dnp = { .detach = dnp_detach, .board_name = &dnp_boards[0].name, /* only necessary for non-PnP devs */ - .offset = sizeof(struct dnp_board), /* like ISA-PnP, PCI or PCMCIA. */ + .offset = sizeof(struct dnp_board), /* like ISA-PnP, PCI or PCMCIA */ .num_names = ARRAY_SIZE(dnp_boards), }; @@ -122,28 +123,30 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; - printk("comedi%d: dnp: ", dev->minor); + printk(KERN_INFO "comedi%d: dnp: ", dev->minor); - /* Autoprobing: this should find out which board we have. Currently only */ - /* the 1486 board is supported and autoprobing is not implemented :-) */ + /* Autoprobing: this should find out which board we have. Currently */ + /* only the 1486 board is supported and autoprobing is not */ + /* implemented :-) */ /* dev->board_ptr = dnp_probe(dev); */ - /* Initialize the name of the board. We can use the "thisboard" macro now. */ + /* Initialize the name of the board. */ + /* We can use the "thisboard" macro now. */ dev->board_name = thisboard->name; - /* Allocate the private structure area. alloc_private() is a convenient */ - /* macro defined in comedidev.h. */ + /* Allocate the private structure area. alloc_private() is a */ + /* convenient macro defined in comedidev.h. */ if (alloc_private(dev, sizeof(struct dnp_private_data)) < 0) return -ENOMEM; - /* Allocate the subdevice structures. alloc_subdevice() is a convenient */ - /* macro defined in comedidev.h. */ + /* Allocate the subdevice structures. alloc_subdevice() is a */ + /* convenient macro defined in comedidev.h. */ if (alloc_subdevices(dev, 1) < 0) return -ENOMEM; s = dev->subdevices + 0; - /* digital i/o subdevice */ + /* digital i/o subdevice */ s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; s->n_chan = 20; @@ -158,7 +161,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) * allocated for the primary 8259, so we don't need to allocate them * ourselves. */ - /* configure all ports as input (default) */ + /* configure all ports as input (default) */ outb(PAMR, CSCIR); outb(0x00, CSCDR); outb(PBMR, CSCIR); @@ -181,7 +184,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int dnp_detach(struct comedi_device *dev) { - /* configure all ports as input (default) */ + /* configure all ports as input (default) */ outb(PAMR, CSCIR); outb(0x00, CSCDR); outb(PBMR, CSCIR); @@ -189,8 +192,8 @@ static int dnp_detach(struct comedi_device *dev) outb(PCMR, CSCIR); outb((inb(CSCDR) & 0xAA), CSCDR); - /* announce that we are finished */ - printk("comedi%d: dnp: remove\n", dev->minor); + /* announce that we are finished */ + printk(KERN_INFO "comedi%d: dnp: remove\n", dev->minor); return 0; @@ -210,12 +213,12 @@ static int dnp_dio_insn_bits(struct comedi_device *dev, if (insn->n != 2) return -EINVAL; /* insn uses data[0] and data[1] */ - /* The insn data is a mask in data[0] and the new data in data[1], each */ - /* channel cooresponding to a bit. */ + /* The insn data is a mask in data[0] and the new data in data[1], */ + /* each channel cooresponding to a bit. */ - /* Ports A and B are straight forward: each bit corresponds to an output */ - /* pin with the same order. Port C is different: bits 0...3 correspond to */ - /* bits 4...7 of the output register (PCDR). */ + /* Ports A and B are straight forward: each bit corresponds to an */ + /* output pin with the same order. Port C is different: bits 0...3 */ + /* correspond to bits 4...7 of the output register (PCDR). */ if (data[0]) { @@ -235,7 +238,7 @@ static int dnp_dio_insn_bits(struct comedi_device *dev, | (u8) ((data[1] & 0x0F0000) >> 12), CSCDR); } - /* on return, data[1] contains the value of the digital input lines. */ + /* on return, data[1] contains the value of the digital input lines. */ outb(PADR, CSCIR); data[0] = inb(CSCDR); outb(PBDR, CSCIR); @@ -260,7 +263,8 @@ static int dnp_dio_insn_config(struct comedi_device *dev, u8 register_buffer; - int chan = CR_CHAN(insn->chanspec); /* reduces chanspec to lower 16 bits */ + /* reduces chanspec to lower 16 bits */ + int chan = CR_CHAN(insn->chanspec); switch (data[0]) { case INSN_CONFIG_DIO_OUTPUT: @@ -275,11 +279,11 @@ static int dnp_dio_insn_config(struct comedi_device *dev, return -EINVAL; break; } - /* Test: which port does the channel belong to? */ + /* Test: which port does the channel belong to? */ - /* We have to pay attention with port C: this is the meaning of PCMR: */ - /* Bit in PCMR: 7 6 5 4 3 2 1 0 */ - /* Corresponding port C pin: d 3 d 2 d 1 d 0 d= don't touch */ + /* We have to pay attention with port C: this is the meaning of PCMR: */ + /* Bit in PCMR: 7 6 5 4 3 2 1 0 */ + /* Corresponding port C pin: d 3 d 2 d 1 d 0 d= don't touch */ if ((chan >= 0) && (chan <= 7)) { /* this is port A */ @@ -289,8 +293,8 @@ static int dnp_dio_insn_config(struct comedi_device *dev, chan -= 8; outb(PBMR, CSCIR); } else if ((chan >= 16) && (chan <= 19)) { - /* this is port C; multiplication with 2 brings bits into correct */ - /* position for PCMR! */ + /* this is port C; multiplication with 2 brings bits into */ + /* correct position for PCMR! */ chan -= 16; chan *= 2; outb(PCMR, CSCIR); @@ -298,7 +302,7 @@ static int dnp_dio_insn_config(struct comedi_device *dev, return -EINVAL; } - /* read 'old' direction of the port and set bits (out=1, in=0) */ + /* read 'old' direction of the port and set bits (out=1, in=0) */ register_buffer = inb(CSCDR); if (data[0] == COMEDI_OUTPUT) register_buffer |= (1 << chan); diff --git a/drivers/staging/comedi/drivers/unioxx5.c b/drivers/staging/comedi/drivers/unioxx5.c index be1d83d..16d4c9f 100644 --- a/drivers/staging/comedi/drivers/unioxx5.c +++ b/drivers/staging/comedi/drivers/unioxx5.c @@ -285,7 +285,7 @@ static int __unioxx5_subdev_init(struct comedi_subdevice *subdev, return -EIO; } - usp = (struct unioxx5_subd_priv *)kzalloc(sizeof(*usp), GFP_KERNEL); + usp = kzalloc(sizeof(*usp), GFP_KERNEL); if (usp == NULL) { printk(KERN_ERR "comedi%d: erorr! --> out of memory!\n", minor); diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 8942ae4..86f035d 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -793,7 +793,7 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub) } static int usbduxsub_upload(struct usbduxsub *usbduxsub, - uint8_t * local_transfer_buffer, + uint8_t *local_transfer_buffer, unsigned int startAddr, unsigned int len) { int errcode; @@ -825,7 +825,7 @@ static int usbduxsub_upload(struct usbduxsub *usbduxsub, #define FIRMWARE_MAX_LEN 0x2000 static int firmwareUpload(struct usbduxsub *usbduxsub, - const u8 * firmwareBinary, int sizeFirmware) + const u8 *firmwareBinary, int sizeFirmware) { int ret; uint8_t *fwBuf; @@ -835,18 +835,17 @@ static int firmwareUpload(struct usbduxsub *usbduxsub, if (sizeFirmware > FIRMWARE_MAX_LEN) { dev_err(&usbduxsub->interface->dev, - "comedi_: usbdux firmware binary it too large for FX2.\n"); + "usbdux firmware binary it too large for FX2.\n"); return -ENOMEM; } /* we generate a local buffer for the firmware */ - fwBuf = kzalloc(sizeFirmware, GFP_KERNEL); + fwBuf = kmemdup(firmwareBinary, sizeFirmware, GFP_KERNEL); if (!fwBuf) { dev_err(&usbduxsub->interface->dev, "comedi_: mem alloc for firmware failed\n"); return -ENOMEM; } - memcpy(fwBuf, firmwareBinary, sizeFirmware); ret = usbduxsub_stop(usbduxsub); if (ret < 0) { @@ -1264,8 +1263,8 @@ static int usbdux_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) (this_usbduxsub->ai_interval) * 2; } this_usbduxsub->ai_timer = cmd->scan_begin_arg / (125000 * - (this_usbduxsub-> - ai_interval)); + (this_usbduxsub-> + ai_interval)); } else { /* interval always 1ms */ this_usbduxsub->ai_interval = 1; diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index e89b818..29c3c01 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -177,8 +177,8 @@ struct usbduxfastsub_s { int16_t *insnBuffer; /* input buffer for single insn */ int ifnum; /* interface number */ struct usb_interface *interface; /* interface structure */ - struct comedi_device *comedidev; /* comedi device for the interrupt - context */ + /* comedi device for the interrupt context */ + struct comedi_device *comedidev; short int ai_cmd_running; /* asynchronous command is running */ short int ai_continous; /* continous aquisition */ long int ai_sample_count; /* number of samples to acquire */ @@ -271,7 +271,8 @@ static int usbduxfast_ai_stop(struct usbduxfastsub_s *udfs, int do_unlink) udfs->ai_cmd_running = 0; if (do_unlink) - ret = usbduxfastsub_unlink_InURBs(udfs); /* stop aquistion */ + /* stop aquistion */ + ret = usbduxfastsub_unlink_InURBs(udfs); return ret; } @@ -451,13 +452,15 @@ static int usbduxfastsub_start(struct usbduxfastsub_s *udfs) /* 7f92 to zero */ local_transfer_buffer[0] = 0; - ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, /* bRequest, "Firmware" */ - VENDOR_DIR_OUT, /* bmRequestType */ - USBDUXFASTSUB_CPUCS, /* Value */ - 0x0000, /* Index */ - local_transfer_buffer, /* address of the transfer buffer */ - 1, /* Length */ - EZTIMEOUT); /* Timeout */ + /* bRequest, "Firmware" */ + ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, + VENDOR_DIR_OUT, /* bmRequestType */ + USBDUXFASTSUB_CPUCS, /* Value */ + 0x0000, /* Index */ + /* address of the transfer buffer */ + local_transfer_buffer, + 1, /* Length */ + EZTIMEOUT); /* Timeout */ if (ret < 0) { printk("comedi_: usbduxfast_: control msg failed (start)\n"); return ret; @@ -473,7 +476,8 @@ static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs) /* 7f92 to one */ local_transfer_buffer[0] = 1; - ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, /* bRequest, "Firmware" */ + /* bRequest, "Firmware" */ + ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, VENDOR_DIR_OUT, /* bmRequestType */ USBDUXFASTSUB_CPUCS, /* Value */ 0x0000, /* Index */ @@ -499,13 +503,15 @@ static int usbduxfastsub_upload(struct usbduxfastsub_s *udfs, printk(KERN_DEBUG " to addr %d, first byte=%d.\n", startAddr, local_transfer_buffer[0]); #endif - ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, /* brequest, firmware */ - VENDOR_DIR_OUT, /* bmRequestType */ - startAddr, /* value */ - 0x0000, /* index */ - local_transfer_buffer, /* our local safe buffer */ - len, /* length */ - EZTIMEOUT); /* timeout */ + /* brequest, firmware */ + ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, + VENDOR_DIR_OUT, /* bmRequestType */ + startAddr, /* value */ + 0x0000, /* index */ + /* our local safe buffer */ + local_transfer_buffer, + len, /* length */ + EZTIMEOUT); /* timeout */ #ifdef CONFIG_COMEDI_DEBUG printk(KERN_DEBUG "comedi_: usbduxfast: result=%d\n", ret); @@ -519,7 +525,7 @@ static int usbduxfastsub_upload(struct usbduxfastsub_s *udfs, return 0; } -int usbduxfastsub_submit_InURBs(struct usbduxfastsub_s *udfs) +static int usbduxfastsub_submit_InURBs(struct usbduxfastsub_s *udfs) { int ret; @@ -1347,7 +1353,7 @@ static int usbduxfast_ai_insn_read(struct comedi_device *dev, #define FIRMWARE_MAX_LEN 0x2000 static int firmwareUpload(struct usbduxfastsub_s *usbduxfastsub, - const u8 * firmwareBinary, int sizeFirmware) + const u8 *firmwareBinary, int sizeFirmware) { int ret; uint8_t *fwBuf; @@ -1362,13 +1368,12 @@ static int firmwareUpload(struct usbduxfastsub_s *usbduxfastsub, } /* we generate a local buffer for the firmware */ - fwBuf = kzalloc(sizeFirmware, GFP_KERNEL); + fwBuf = kmemdup(firmwareBinary, sizeFirmware, GFP_KERNEL); if (!fwBuf) { dev_err(&usbduxfastsub->interface->dev, "comedi_: mem alloc for firmware failed\n"); return -ENOMEM; } - memcpy(fwBuf, firmwareBinary, sizeFirmware); ret = usbduxfastsub_stop(usbduxfastsub); if (ret < 0) { |