diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 12:18:17 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 12:18:17 -0800 |
commit | 12e55508921865aefdd80fd17afe70c191afbd1b (patch) | |
tree | 476b3226fd9602b36bed0934409959bdd24a7eb5 /drivers/staging/comedi | |
parent | 55b81e6f2795484ea8edf5805c95c007cacfa736 (diff) | |
parent | 4d447c9a6ebc0142d320f075c5bac6d202a79fd4 (diff) |
Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (466 commits)
net/hyperv: Add support for jumbo frame up to 64KB
net/hyperv: Add NETVSP protocol version negotiation
net/hyperv: Remove unnecessary kmap_atomic in netvsc driver
staging/rtl8192e: Register against lib80211
staging/rtl8192e: Convert to lib80211_crypt_info
staging/rtl8192e: Convert to lib80211_crypt_data and lib80211_crypt_ops
staging/rtl8192e: Add lib80211.h to rtllib.h
staging/mei: add watchdog device registration wrappers
drm/omap: GEM, deal with cache
staging: vt6656: int.c, int.h: Change return of function to void
staging: usbip: removed unused definitions from header
staging: usbip: removed dead code from receive function
staging:iio: Drop {mark,unmark}_in_use callbacks
staging:iio: Drop buffer mark_param_change callback
staging:iio: Drop the unused buffer enable() and is_enabled() callbacks
staging:iio: Drop buffer busy flag
staging:iio: Make sure a device is only opened once at a time
staging:iio: Disallow modifying buffer size when buffer is enabled
staging:iio: Disallow changing scan elements in all buffered modes
staging:iio: Use iio_buffer_enabled instead of open coding it
...
Fix up conflict in drivers/staging/iio/adc/ad799x_core.c (removal of
module_init due to using module_i2c_driver() helper, next to removal of
MODULE_ALIAS due to using MODULE_DEVICE_TABLE instead).
Diffstat (limited to 'drivers/staging/comedi')
43 files changed, 556 insertions, 671 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 5e78c77d5a0..0d18d80bcd2 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1479,10 +1479,10 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) dev_file_info = comedi_get_device_file_info(minor); if (dev_file_info == NULL) - return -ENODEV; + return -ENODEV; dev = dev_file_info->device; if (dev == NULL) - return -ENODEV; + return -ENODEV; mutex_lock(&dev->mutex); if (!dev->attached) { @@ -1556,10 +1556,10 @@ static unsigned int comedi_poll(struct file *file, poll_table * wait) dev_file_info = comedi_get_device_file_info(minor); if (dev_file_info == NULL) - return -ENODEV; + return -ENODEV; dev = dev_file_info->device; if (dev == NULL) - return -ENODEV; + return -ENODEV; mutex_lock(&dev->mutex); if (!dev->attached) { @@ -1610,10 +1610,10 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, dev_file_info = comedi_get_device_file_info(minor); if (dev_file_info == NULL) - return -ENODEV; + return -ENODEV; dev = dev_file_info->device; if (dev == NULL) - return -ENODEV; + return -ENODEV; if (!dev->attached) { DPRINTK("no driver configured on comedi%i\n", dev->minor); @@ -1721,10 +1721,10 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, dev_file_info = comedi_get_device_file_info(minor); if (dev_file_info == NULL) - return -ENODEV; + return -ENODEV; dev = dev_file_info->device; if (dev == NULL) - return -ENODEV; + return -ENODEV; if (!dev->attached) { DPRINTK("no driver configured on comedi%i\n", dev->minor); @@ -1931,10 +1931,10 @@ static int comedi_close(struct inode *inode, struct file *file) dev_file_info = comedi_get_device_file_info(minor); if (dev_file_info == NULL) - return -ENODEV; + return -ENODEV; dev = dev_file_info->device; if (dev == NULL) - return -ENODEV; + return -ENODEV; mutex_lock(&dev->mutex); @@ -1973,10 +1973,10 @@ static int comedi_fasync(int fd, struct file *file, int on) dev_file_info = comedi_get_device_file_info(minor); if (dev_file_info == NULL) - return -ENODEV; + return -ENODEV; dev = dev_file_info->device; if (dev == NULL) - return -ENODEV; + return -ENODEV; return fasync_helper(fd, file, on, &dev->async_queue); } @@ -2479,18 +2479,18 @@ static ssize_t store_max_read_buffer_kb(struct device *dev, const char *buf, size_t count) { struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned long new_max_size_kb; - uint64_t new_max_size; + unsigned int new_max_size_kb; + unsigned int new_max_size; + int ret; struct comedi_subdevice *const read_subdevice = comedi_get_read_subdevice(info); - if (strict_strtoul(buf, 10, &new_max_size_kb)) - return -EINVAL; - if (new_max_size_kb != (uint32_t) new_max_size_kb) - return -EINVAL; - new_max_size = ((uint64_t) new_max_size_kb) * bytes_per_kibi; - if (new_max_size != (uint32_t) new_max_size) + ret = kstrtouint(buf, 10, &new_max_size_kb); + if (ret) + return ret; + if (new_max_size_kb > (UINT_MAX / bytes_per_kibi)) return -EINVAL; + new_max_size = new_max_size_kb * bytes_per_kibi; mutex_lock(&info->device->mutex); if (read_subdevice == NULL || @@ -2540,19 +2540,19 @@ static ssize_t store_read_buffer_kb(struct device *dev, const char *buf, size_t count) { struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned long new_size_kb; - uint64_t new_size; + unsigned int new_size_kb; + unsigned int new_size; int retval; + int ret; struct comedi_subdevice *const read_subdevice = comedi_get_read_subdevice(info); - if (strict_strtoul(buf, 10, &new_size_kb)) - return -EINVAL; - if (new_size_kb != (uint32_t) new_size_kb) - return -EINVAL; - new_size = ((uint64_t) new_size_kb) * bytes_per_kibi; - if (new_size != (uint32_t) new_size) + ret = kstrtouint(buf, 10, &new_size_kb); + if (ret) + return ret; + if (new_size_kb > (UINT_MAX / bytes_per_kibi)) return -EINVAL; + new_size = new_size_kb * bytes_per_kibi; mutex_lock(&info->device->mutex); if (read_subdevice == NULL || @@ -2606,18 +2606,18 @@ static ssize_t store_max_write_buffer_kb(struct device *dev, const char *buf, size_t count) { struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned long new_max_size_kb; - uint64_t new_max_size; + unsigned int new_max_size_kb; + unsigned int new_max_size; + int ret; struct comedi_subdevice *const write_subdevice = comedi_get_write_subdevice(info); - if (strict_strtoul(buf, 10, &new_max_size_kb)) - return -EINVAL; - if (new_max_size_kb != (uint32_t) new_max_size_kb) - return -EINVAL; - new_max_size = ((uint64_t) new_max_size_kb) * bytes_per_kibi; - if (new_max_size != (uint32_t) new_max_size) + ret = kstrtouint(buf, 10, &new_max_size_kb); + if (ret) + return ret; + if (new_max_size_kb > (UINT_MAX / bytes_per_kibi)) return -EINVAL; + new_max_size = new_max_size_kb * bytes_per_kibi; mutex_lock(&info->device->mutex); if (write_subdevice == NULL || @@ -2667,19 +2667,19 @@ static ssize_t store_write_buffer_kb(struct device *dev, const char *buf, size_t count) { struct comedi_device_file_info *info = dev_get_drvdata(dev); - unsigned long new_size_kb; - uint64_t new_size; + unsigned int new_size_kb; + unsigned int new_size; int retval; + int ret; struct comedi_subdevice *const write_subdevice = comedi_get_write_subdevice(info); - if (strict_strtoul(buf, 10, &new_size_kb)) - return -EINVAL; - if (new_size_kb != (uint32_t) new_size_kb) + ret = kstrtouint(buf, 10, &new_size_kb); + if (ret) + return ret; + if (new_size_kb > (UINT_MAX / bytes_per_kibi)) return -EINVAL; new_size = ((uint64_t) new_size_kb) * bytes_per_kibi; - if (new_size != (uint32_t) new_size) - return -EINVAL; mutex_lock(&info->device->mutex); if (write_subdevice == NULL || diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 6fb7594319c..ca5bd9b8704 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -145,78 +145,77 @@ void fpu_end(void) static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { #ifdef CONFIG_APCI_3120 - {APCI3120_BOARD_VENDOR_ID, 0x818D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI3120_BOARD_VENDOR_ID, 0x818D)}, #endif #ifdef CONFIG_APCI_1032 - {APCI1032_BOARD_VENDOR_ID, 0x1003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI1032_BOARD_VENDOR_ID, 0x1003)}, #endif #ifdef CONFIG_APCI_1516 - {APCI1516_BOARD_VENDOR_ID, 0x1001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI1516_BOARD_VENDOR_ID, 0x1001)}, #endif #ifdef CONFIG_APCI_2016 - {APCI2016_BOARD_VENDOR_ID, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI2016_BOARD_VENDOR_ID, 0x1002)}, #endif #ifdef CONFIG_APCI_2032 - {APCI2032_BOARD_VENDOR_ID, 0x1004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI2032_BOARD_VENDOR_ID, 0x1004)}, #endif #ifdef CONFIG_APCI_2200 - {APCI2200_BOARD_VENDOR_ID, 0x1005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI2200_BOARD_VENDOR_ID, 0x1005)}, #endif #ifdef CONFIG_APCI_1564 - {APCI1564_BOARD_VENDOR_ID, 0x1006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI1564_BOARD_VENDOR_ID, 0x1006)}, #endif #ifdef CONFIG_APCI_1500 - {APCI1500_BOARD_VENDOR_ID, 0x80fc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI1500_BOARD_VENDOR_ID, 0x80fc)}, #endif #ifdef CONFIG_APCI_3001 - {APCI3120_BOARD_VENDOR_ID, 0x828D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI3120_BOARD_VENDOR_ID, 0x828D)}, #endif #ifdef CONFIG_APCI_3501 - {APCI3501_BOARD_VENDOR_ID, 0x3001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI3501_BOARD_VENDOR_ID, 0x3001)}, #endif #ifdef CONFIG_APCI_035 - {APCI035_BOARD_VENDOR_ID, 0x0300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI035_BOARD_VENDOR_ID, 0x0300)}, #endif #ifdef CONFIG_APCI_3200 - {APCI3200_BOARD_VENDOR_ID, 0x3000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI3200_BOARD_VENDOR_ID, 0x3000)}, #endif #ifdef CONFIG_APCI_3300 - {APCI3200_BOARD_VENDOR_ID, 0x3007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI3200_BOARD_VENDOR_ID, 0x3007)}, #endif #ifdef CONFIG_APCI_1710 - {APCI1710_BOARD_VENDOR_ID, APCI1710_BOARD_DEVICE_ID, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(APCI1710_BOARD_VENDOR_ID, APCI1710_BOARD_DEVICE_ID)}, #endif #ifdef CONFIG_APCI_16XX - {0x15B8, 0x1009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x100A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1009)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x100A)}, #endif #ifdef CONFIG_APCI_3XXX - {0x15B8, 0x3010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x300F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x300E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3013, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3014, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3015, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3016, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3017, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3018, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x301A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x301B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x301C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x301D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x301E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x301F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3020, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3023, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x300B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0x15B8, 0x3024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3010)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x300F)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x300E)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3013)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3014)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3015)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3016)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3017)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3018)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3019)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301A)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301B)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301C)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301D)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301E)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x301F)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3020)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3021)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3022)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3023)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x300B)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3002)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3003)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3004)}, + {PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3024)}, #endif {0} }; @@ -1019,7 +1018,7 @@ static const struct addi_board boardtypes[] = { #endif #ifdef CONFIG_APCI_16XX {"apci1648", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x1009, 128, 0, @@ -1075,7 +1074,7 @@ static const struct addi_board boardtypes[] = { i_APCI16XX_InsnBitsWriteTTLIO}, {"apci1696", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x100A, 128, 0, @@ -1132,7 +1131,7 @@ static const struct addi_board boardtypes[] = { #endif #ifdef CONFIG_APCI_3XXX {"apci3000-16", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3010, 256, 256, @@ -1188,7 +1187,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3000-8", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x300F, 256, 256, @@ -1244,7 +1243,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3000-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x300E, 256, 256, @@ -1300,7 +1299,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3006-16", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3013, 256, 256, @@ -1356,7 +1355,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3006-8", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3014, 256, 256, @@ -1412,7 +1411,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3006-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3015, 256, 256, @@ -1468,7 +1467,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3010-16", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3016, 256, 256, @@ -1524,7 +1523,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3010-8", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3017, 256, 256, @@ -1580,7 +1579,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3010-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3018, 256, 256, @@ -1636,7 +1635,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3016-16", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3019, 256, 256, @@ -1692,7 +1691,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3016-8", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x301A, 256, 256, @@ -1748,7 +1747,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3016-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x301B, 256, 256, @@ -1804,7 +1803,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3100-16-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x301C, 256, 256, @@ -1860,7 +1859,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3100-8-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x301D, 256, 256, @@ -1916,7 +1915,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3106-16-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x301E, 256, 256, @@ -1972,7 +1971,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3106-8-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x301F, 256, 256, @@ -2028,7 +2027,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3110-16-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3020, 256, 256, @@ -2084,7 +2083,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3110-8-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3021, 256, 256, @@ -2140,7 +2139,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3116-16-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3022, 256, 256, @@ -2196,7 +2195,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3116-8-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3023, 256, 256, @@ -2252,7 +2251,7 @@ static const struct addi_board boardtypes[] = { i_APCI3XXX_InsnWriteTTLIO}, {"apci3003", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x300B, 256, 256, @@ -2307,7 +2306,7 @@ static const struct addi_board boardtypes[] = { NULL}, {"apci3002-16", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3002, 256, 256, @@ -2362,7 +2361,7 @@ static const struct addi_board boardtypes[] = { NULL}, {"apci3002-8", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3003, 256, 256, @@ -2417,7 +2416,7 @@ static const struct addi_board boardtypes[] = { NULL}, {"apci3002-4", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3004, 256, 256, @@ -2472,7 +2471,7 @@ static const struct addi_board boardtypes[] = { NULL}, {"apci3500", - 0x15B8, + PCI_VENDOR_ID_ADDIDATA, 0x3024, 256, 256, diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c index 72a7258b5b9..20d570554fa 100644 --- a/drivers/staging/comedi/drivers/adl_pci7230.c +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -44,15 +44,7 @@ Configuration Options: #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 - }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7230) }, {0} }; diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c index f28fe6bec05..9a2320537bd 100644 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ b/drivers/staging/comedi/drivers/adl_pci7296.c @@ -49,10 +49,8 @@ Configuration Options: #define PCI_DEVICE_ID_PCI7296 0x7296 static DEFINE_PCI_DEVICE_TABLE(adl_pci7296_pci_table) = { - { - PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296) }, + {0} }; MODULE_DEVICE_TABLE(pci, adl_pci7296_pci_table); diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c index 262da7b29b2..86ee2197604 100644 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ b/drivers/staging/comedi/drivers/adl_pci7432.c @@ -44,10 +44,8 @@ Configuration Options: #define PCI_DEVICE_ID_PCI7432 0x7432 static DEFINE_PCI_DEVICE_TABLE(adl_pci7432_pci_table) = { - { - PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7432, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7432) }, + {0} }; MODULE_DEVICE_TABLE(pci, adl_pci7432_pci_table); diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index 767a594935c..3b83d65bc1b 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -57,10 +57,8 @@ Configuration Options: #define PCI_DEVICE_ID_PCI8164 0x8164 static DEFINE_PCI_DEVICE_TABLE(adl_pci8164_pci_table) = { - { - PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI8164, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI8164) }, + {0} }; MODULE_DEVICE_TABLE(pci, adl_pci8164_pci_table); diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index fc48bae42ab..2a9bd88a4ab 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -311,10 +311,8 @@ static const struct comedi_lrange pci9111_hr_ai_range = { }; static DEFINE_PCI_DEVICE_TABLE(pci9111_pci_table) = { - { PCI_VENDOR_ID_ADLINK, PCI9111_HR_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, - 0, 0, 0 }, - /* { PCI_VENDOR_ID_ADLINK, PCI9111_HG_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, - * 0, 0, 0 }, */ + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI9111_HR_DEVICE_ID) }, + /* { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI9111_HG_DEVICE_ID) }, */ { 0 } }; diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index da2b75b15d4..8318c82a555 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -1382,16 +1382,14 @@ static int pci1710_attach(struct comedi_device *dev, int i; int board_index; - printk("comedi%d: adv_pci1710: ", dev->minor); + dev_info(dev->hw_dev, "comedi%d: adv_pci1710:\n", dev->minor); opt_bus = it->options[0]; opt_slot = it->options[1]; ret = alloc_private(dev, sizeof(struct pci1710_private)); - if (ret < 0) { - printk(" - Allocation failed!\n"); + if (ret < 0) return -ENOMEM; - } /* Look for matching PCI device */ errstr = "not found!"; @@ -1436,10 +1434,10 @@ static int pci1710_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); + dev_err(dev->hw_dev, "- Card at b:s %d:%d %s\n", + opt_bus, opt_slot, errstr); } else { - printk(" - Card %s\n", errstr); + dev_err(dev->hw_dev, "- Card %s\n", errstr); } return -EIO; } @@ -1450,8 +1448,8 @@ static int pci1710_attach(struct comedi_device *dev, irq = pcidev->irq; iobase = pci_resource_start(pcidev, 2); - printk(", b:s:f=%d:%d:%d, io=0x%4lx", pci_bus, pci_slot, pci_func, - iobase); + dev_dbg(dev->hw_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", pci_bus, pci_slot, + pci_func, iobase); dev->iobase = iobase; @@ -1471,10 +1469,8 @@ static int pci1710_attach(struct comedi_device *dev, n_subdevices++; ret = alloc_subdevices(dev, n_subdevices); - if (ret < 0) { - printk(" - Allocation failed!\n"); + if (ret < 0) return ret; - } pci1710_reset(dev); @@ -1483,24 +1479,20 @@ static int pci1710_attach(struct comedi_device *dev, if (request_irq(irq, interrupt_service_pci1710, IRQF_SHARED, "Advantech PCI-1710", dev)) { - printk - (", unable to allocate IRQ %d, DISABLING IT", - irq); + dev_dbg(dev->hw_dev, "unable to allocate IRQ %d, DISABLING IT", + irq); irq = 0; /* Can't use IRQ */ } else { - printk(", irq=%u", irq); + dev_dbg(dev->hw_dev, "irq=%u", irq); } } else { - printk(", IRQ disabled"); + dev_dbg(dev->hw_dev, "IRQ disabled"); } } else { irq = 0; } dev->irq = irq; - - printk(".\n"); - subdev = 0; if (this_board->n_aichan) { diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 69334f6f64e..537e5853427 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -1106,13 +1106,10 @@ static int pci_dio_attach(struct comedi_device *dev, unsigned long iobase; struct pci_dev *pcidev = NULL; - printk("comedi%d: adv_pci_dio: ", dev->minor); ret = alloc_private(dev, sizeof(struct pci_dio_private)); - if (ret < 0) { - printk(", Error: Cann't allocate private memory!\n"); + if (ret < 0) return -ENOMEM; - } for_each_pci_dev(pcidev) { /* loop through cards supported by this driver */ @@ -1140,19 +1137,18 @@ static int pci_dio_attach(struct comedi_device *dev, } if (!dev->board_ptr) { - printk(", Error: Requested type of the card was not found!\n"); + dev_err(dev->hw_dev, "Error: Requested type of the card was not found!\n"); return -EIO; } if (comedi_pci_enable(pcidev, driver_pci_dio.driver_name)) { - printk - (", Error: Can't enable PCI device and request regions!\n"); + dev_err(dev->hw_dev, "Error: Can't enable PCI device and request regions!\n"); return -EIO; } iobase = pci_resource_start(pcidev, this_board->main_pci_region); - printk(", b:s:f=%d:%d:%d, io=0x%4lx", - pcidev->bus->number, PCI_SLOT(pcidev->devfn), - PCI_FUNC(pcidev->devfn), iobase); + dev_dbg(dev->hw_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", + pcidev->bus->number, PCI_SLOT(pcidev->devfn), + PCI_FUNC(pcidev->devfn), iobase); dev->iobase = iobase; dev->board_name = this_board->name; @@ -1177,15 +1173,10 @@ static int pci_dio_attach(struct comedi_device *dev, } ret = alloc_subdevices(dev, n_subdevices); - if (ret < 0) { - printk(", Error: Cann't allocate subdevice memory!\n"); + if (ret < 0) return ret; - } - - printk(".\n"); subdev = 0; - for (i = 0; i < MAX_DI_SUBDEVS; i++) if (this_board->sdi[i].chans) { s = dev->subdevices + subdev; diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 93bbe4ec318..566cc441145 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -421,12 +421,9 @@ static const struct dio200_layout_struct dio200_layouts[] = { #ifdef CONFIG_COMEDI_PCI static DEFINE_PCI_DEVICE_TABLE(dio200_pci_table) = { - { - PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272) }, + {0} }; MODULE_DEVICE_TABLE(pci, dio200_pci_table); diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 48246cd50d4..7972cadd403 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -134,10 +134,8 @@ static const struct pc236_board pc236_boards[] = { #ifdef CONFIG_COMEDI_PCI static DEFINE_PCI_DEVICE_TABLE(pc236_pci_table) = { - { - PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236) }, + {0} }; MODULE_DEVICE_TABLE(pci, pc236_pci_table); diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 8a338807909..191ac0d23ce 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -101,10 +101,8 @@ static const struct pc263_board pc263_boards[] = { #ifdef CONFIG_COMEDI_PCI static DEFINE_PCI_DEVICE_TABLE(pc263_pci_table) = { - { - PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI263, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI263) }, + {0} }; MODULE_DEVICE_TABLE(pci, pc263_pci_table); diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 1b5ba1c2725..b278917cec2 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -384,12 +384,9 @@ static const struct pci224_board pci224_boards[] = { */ static DEFINE_PCI_DEVICE_TABLE(pci224_pci_table) = { - { - PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI224, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI234, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI224) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI234) }, + {0} }; MODULE_DEVICE_TABLE(pci, pci224_pci_table); diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 7edeb1103dc..538979551c8 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -501,12 +501,9 @@ static const struct pci230_board pci230_boards[] = { }; static DEFINE_PCI_DEVICE_TABLE(pci230_pci_table) = { - { - PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI230, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI260, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI230) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI260) }, + {0} }; MODULE_DEVICE_TABLE(pci, pci230_pci_table); diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index e171c56112d..49404f49f7b 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -99,7 +99,7 @@ static struct comedi_driver driver_das16cs = { .detach = das16cs_detach, }; -static struct pcmcia_device *cur_dev = NULL; +static struct pcmcia_device *cur_dev; static const struct comedi_lrange das16cs_ai_range = { 4, { RANGE(-10, 10), @@ -150,7 +150,7 @@ static const struct das16cs_board *das16cs_probe(struct comedi_device *dev, return das16cs_boards + i; } - printk("unknown board!\n"); + dev_dbg(dev->hw_dev, "unknown board!\n"); return NULL; } @@ -163,20 +163,19 @@ static int das16cs_attach(struct comedi_device *dev, int ret; int i; - printk("comedi%d: cb_das16_cs: ", dev->minor); + dev_dbg(dev->hw_dev, "comedi%d: cb_das16_cs: attached\n", dev->minor); link = cur_dev; /* XXX hack */ if (!link) return -EIO; dev->iobase = link->resource[0]->start; - printk("I/O base=0x%04lx ", dev->iobase); + dev_dbg(dev->hw_dev, "I/O base=0x%04lx\n", dev->iobase); - printk("fingerprint:\n"); + dev_dbg(dev->hw_dev, "fingerprint:\n"); for (i = 0; i < 48; i += 2) - printk("%04x ", inw(dev->iobase + i)); + dev_dbg(dev->hw_dev, "%04x\n", inw(dev->iobase + i)); - printk("\n"); ret = request_irq(link->irq, das16cs_interrupt, IRQF_SHARED, "cb_das16_cs", dev); @@ -185,7 +184,7 @@ static int das16cs_attach(struct comedi_device *dev, dev->irq = link->irq; - printk("irq=%u ", dev->irq); + dev_dbg(dev->hw_dev, "irq=%u\n", dev->irq); dev->board_ptr = das16cs_probe(dev, link); if (!dev->board_ptr) @@ -252,14 +251,13 @@ static int das16cs_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_UNUSED; } - printk("attached\n"); return 1; } static int das16cs_detach(struct comedi_device *dev) { - printk("comedi%d: das16cs: remove\n", dev->minor); + dev_dbg(dev->hw_dev, "comedi%d: das16cs: remove\n", dev->minor); if (dev->irq) free_irq(dev->irq, dev); @@ -312,7 +310,7 @@ static int das16cs_ai_rinsn(struct comedi_device *dev, break; } if (to == TIMEOUT) { - printk("cb_das16_cs: ai timeout\n"); + dev_dbg(dev->hw_dev, "cb_das16_cs: ai timeout\n"); return -ETIME; } data[i] = (unsigned short)inw(dev->iobase + 0); diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 61968a505f2..7e4ffcfdac6 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -565,8 +565,6 @@ static int cb_pcidas_attach(struct comedi_device *dev, int index; int i; - printk("comedi%d: cb_pcidas: ", dev->minor); - /* * Allocate the private structure area. */ @@ -576,7 +574,6 @@ static int cb_pcidas_attach(struct comedi_device *dev, /* * Probe the device to determine what device in the series it is. */ - printk("\n"); for_each_pci_dev(pcidev) { /* is it not a computer boards card? */ @@ -600,20 +597,20 @@ static int cb_pcidas_attach(struct comedi_device *dev, } } - printk("No supported ComputerBoards/MeasurementComputing card found on " - "requested position\n"); + dev_err(dev->hw_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); return -EIO; found: - printk("Found %s on bus %i, slot %i\n", cb_pcidas_boards[index].name, - pcidev->bus->number, PCI_SLOT(pcidev->devfn)); + dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n", + cb_pcidas_boards[index].name, pcidev->bus->number, + PCI_SLOT(pcidev->devfn)); /* * Enable PCI device and reserve I/O ports. */ if (comedi_pci_enable(pcidev, "cb_pcidas")) { - printk(" Failed to enable PCI device and request regions\n"); + dev_err(dev->hw_dev, "Failed to enable PCI device and request regions\n"); return -EIO; } /* @@ -639,7 +636,8 @@ found: /* get irq */ if (request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt, IRQF_SHARED, "cb_pcidas", dev)) { - printk(" unable to allocate irq %d\n", devpriv->pci_dev->irq); + dev_dbg(dev->hw_dev, "unable to allocate irq %d\n", + devpriv->pci_dev->irq); return -EINVAL; } dev->irq = devpriv->pci_dev->irq; @@ -768,7 +766,6 @@ found: */ static int cb_pcidas_detach(struct comedi_device *dev) { - printk("comedi%d: cb_pcidas: remove\n", dev->minor); if (devpriv) { if (devpriv->s5933_config) { @@ -776,8 +773,8 @@ static int cb_pcidas_detach(struct comedi_device *dev) outl(INTCSR_INBOX_INTR_STATUS, devpriv->s5933_config + AMCC_OP_REG_INTCSR); #ifdef CB_PCIDAS_DEBUG - printk("detaching, incsr is 0x%x\n", - inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR)); + dev_dbg(dev->hw_dev, "detaching, incsr is 0x%x\n", + inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR)); #endif } } @@ -858,7 +855,8 @@ static int ai_config_calibration_source(struct comedi_device *dev, unsigned int source = data[1]; if (source >= num_calibration_sources) { - printk("invalid calibration source: %i\n", source); + dev_err(dev->hw_dev, "invalid calibration source: %i\n", + source); return -EINVAL; } @@ -1279,7 +1277,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, outw(bits, devpriv->control_status + ADCMUX_CONT); #ifdef CB_PCIDAS_DEBUG - printk("comedi: sent 0x%x to adcmux control\n", bits); + dev_dbg(dev->hw_dev, "comedi: sent 0x%x to adcmux control\n", bits); #endif /* load counters */ @@ -1306,7 +1304,8 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, devpriv->adc_fifo_bits |= INT_FHF; /* interrupt fifo half full */ } #ifdef CB_PCIDAS_DEBUG - printk("comedi: adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits); + dev_dbg(dev->hw_dev, "comedi: adc_fifo_bits are 0x%x\n", + devpriv->adc_fifo_bits); #endif /* enable (and clear) interrupts */ outw(devpriv->adc_fifo_bits | EOAI | INT | LADFUL, @@ -1332,7 +1331,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, bits |= BURSTE; outw(bits, devpriv->control_status + TRIG_CONTSTAT); #ifdef CB_PCIDAS_DEBUG - printk("comedi: sent 0x%x to trig control\n", bits); + dev_dbg(dev->hw_dev, "comedi: sent 0x%x to trig control\n", bits); #endif return 0; @@ -1549,7 +1548,8 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, spin_lock_irqsave(&dev->spinlock, flags); devpriv->adc_fifo_bits |= DAEMIE | DAHFIE; #ifdef CB_PCIDAS_DEBUG - printk("comedi: adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits); + dev_dbg(dev->hw_dev, "comedi: adc_fifo_bits are 0x%x\n", + devpriv->adc_fifo_bits); #endif /* enable and clear interrupts */ outw(devpriv->adc_fifo_bits | DAEMI | DAHFI, @@ -1559,7 +1559,8 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY; outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); #ifdef CB_PCIDAS_DEBUG - printk("comedi: sent 0x%x to dac control\n", devpriv->ao_control_bits); + dev_dbg(dev->hw_dev, "comedi: sent 0x%x to dac control\n", + devpriv->ao_control_bits); #endif spin_unlock_irqrestore(&dev->spinlock, flags); @@ -1587,8 +1588,9 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) s5933_status = inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR); #ifdef CB_PCIDAS_DEBUG - printk("intcsr 0x%x\n", s5933_status); - printk("mbef 0x%x\n", inl(devpriv->s5933_config + AMCC_OP_REG_MBEF)); + dev_dbg(dev->hw_dev, "intcsr 0x%x\n", s5933_status); + dev_dbg(dev->hw_dev, "mbef 0x%x\n", + inl(devpriv->s5933_config + AMCC_OP_REG_MBEF)); #endif if ((INTCSR_INTR_ASSERTED & s5933_status) == 0) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 1e324198996..c9e8c478576 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1739,8 +1739,6 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) uint32_t local_range, local_decode; int retval; - printk("comedi%d: cb_pcidas64\n", dev->minor); - /* * Allocate the private structure area. */ @@ -1781,12 +1779,11 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) return -EIO; } - printk("Found %s on bus %i, slot %i\n", board(dev)->name, - pcidev->bus->number, PCI_SLOT(pcidev->devfn)); + dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n", board(dev)->name, + pcidev->bus->number, PCI_SLOT(pcidev->devfn)); if (comedi_pci_enable(pcidev, driver_cb_pcidas.driver_name)) { - printk(KERN_WARNING - " failed to enable PCI device and request regions\n"); + dev_warn(dev->hw_dev, "failed to enable PCI device and request regions\n"); return -EIO; } pci_set_master(pcidev); @@ -1814,7 +1811,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) if (!priv(dev)->plx9080_iobase || !priv(dev)->main_iobase || !priv(dev)->dio_counter_iobase) { - printk(" failed to remap io memory\n"); + dev_warn(dev->hw_dev, "failed to remap io memory\n"); return -ENOMEM; } @@ -1850,17 +1847,19 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) priv(dev)->hw_revision = hw_revision(dev, readw(priv(dev)->main_iobase + HW_STATUS_REG)); - printk(" stc hardware revision %i\n", priv(dev)->hw_revision); + dev_dbg(dev->hw_dev, "stc hardware revision %i\n", + priv(dev)->hw_revision); init_plx9080(dev); init_stc_registers(dev); /* get irq */ if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, "cb_pcidas64", dev)) { - printk(" unable to allocate irq %u\n", pcidev->irq); + dev_dbg(dev->hw_dev, "unable to allocate irq %u\n", + pcidev->irq); return -EINVAL; } dev->irq = pcidev->irq; - printk(" irq %u\n", dev->irq); + dev_dbg(dev->hw_dev, "irq %u\n", dev->irq); retval = setup_subdevices(dev); if (retval < 0) @@ -1882,8 +1881,6 @@ static int detach(struct comedi_device *dev) { unsigned int i; - printk("comedi%d: cb_pcidas: remove\n", dev->minor); - if (dev->irq) free_irq(dev->irq, dev); if (priv(dev)) { @@ -2093,7 +2090,8 @@ static int ai_config_calibration_source(struct comedi_device *dev, else num_calibration_sources = 8; if (source >= num_calibration_sources) { - printk("invalid calibration source: %i\n", source); + dev_dbg(dev->hw_dev, "invalid calibration source: %i\n", + source); return -EINVAL; } @@ -2924,7 +2922,7 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev) } if (num_samples < 0) { - printk(" cb_pcidas64: bug! num_samples < 0\n"); + dev_err(dev->hw_dev, "cb_pcidas64: bug! num_samples < 0\n"); break; } diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index 49102b3a6c4..abba220a767 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -282,7 +282,6 @@ static int cb_pcidda_attach(struct comedi_device *dev, struct pci_dev *pcidev = NULL; int index; - printk("comedi%d: cb_pcidda: ", dev->minor); /* * Allocate the private structure area. @@ -293,7 +292,6 @@ static int cb_pcidda_attach(struct comedi_device *dev, /* * Probe the device to determine what device in the series it is. */ - printk("\n"); for_each_pci_dev(pcidev) { if (pcidev->vendor == PCI_VENDOR_ID_CB) { @@ -312,22 +310,21 @@ static int cb_pcidda_attach(struct comedi_device *dev, } } if (!pcidev) { - printk - ("Not a ComputerBoards/MeasurementComputing card on requested position\n"); + dev_err(dev->hw_dev, "Not a ComputerBoards/MeasurementComputing card on requested position\n"); return -EIO; } found: devpriv->pci_dev = pcidev; dev->board_ptr = cb_pcidda_boards + index; /* "thisboard" macro can be used from here. */ - printk("Found %s at requested position\n", thisboard->name); + dev_dbg(dev->hw_dev, "Found %s at requested position\n", + thisboard->name); /* * Enable PCI device and request regions. */ if (comedi_pci_enable(pcidev, thisboard->name)) { - printk - ("cb_pcidda: failed to enable PCI device and request regions\n"); + dev_err(dev->hw_dev, "cb_pcidda: failed to enable PCI device and request regions\n"); return -EIO; } @@ -377,12 +374,11 @@ found: s = dev->subdevices + 2; subdev_8255_init(dev, s, NULL, devpriv->digitalio + PORT2A); - printk(" eeprom:"); + dev_dbg(dev->hw_dev, "eeprom:\n"); for (index = 0; index < EEPROM_SIZE; index++) { devpriv->eeprom_data[index] = cb_pcidda_read_eeprom(dev, index); - printk(" %i:0x%x ", index, devpriv->eeprom_data[index]); + dev_dbg(dev->hw_dev, "%i:0x%x\n", index, devpriv->eeprom_data[index]); } - printk("\n"); /* set calibrations dacs */ for (index = 0; index < thisboard->ao_chans; index++) @@ -417,8 +413,6 @@ static int cb_pcidda_detach(struct comedi_device *dev) subdev_8255_cleanup(dev, dev->subdevices + 2); } - printk("comedi%d: cb_pcidda: remove\n", dev->minor); - return 0; } diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index 79477a595ef..8f3215239a1 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -184,8 +184,6 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) int index; int i; - printk("comedi%d: cb_pcidio: \n", dev->minor); - /* * Allocate the private structure area. alloc_private() is a * convenient macro defined in comedidev.h. @@ -223,8 +221,7 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) } } - printk("No supported ComputerBoards/MeasurementComputing card found on " - "requested position\n"); + dev_err(dev->hw_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); return -EIO; found: @@ -236,14 +233,12 @@ found: dev->board_name = thisboard->name; devpriv->pci_dev = pcidev; - printk("Found %s on bus %i, slot %i\n", thisboard->name, - devpriv->pci_dev->bus->number, - PCI_SLOT(devpriv->pci_dev->devfn)); - if (comedi_pci_enable(pcidev, thisboard->name)) { - printk - ("cb_pcidio: failed to enable PCI device and request regions\n"); + dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n", thisboard->name, + devpriv->pci_dev->bus->number, + PCI_SLOT(devpriv->pci_dev->devfn)); + if (comedi_pci_enable(pcidev, thisboard->name)) return -EIO; - } + devpriv->dio_reg_base = pci_resource_start(devpriv->pci_dev, @@ -259,11 +254,10 @@ found: for (i = 0; i < thisboard->n_8255; i++) { subdev_8255_init(dev, dev->subdevices + i, NULL, devpriv->dio_reg_base + i * 4); - printk(" subdev %d: base = 0x%lx\n", i, - devpriv->dio_reg_base + i * 4); + dev_dbg(dev->hw_dev, "subdev %d: base = 0x%lx\n", i, + devpriv->dio_reg_base + i * 4); } - printk("attached\n"); return 1; } @@ -277,7 +271,6 @@ found: */ static int pcidio_detach(struct comedi_device *dev) { - printk("comedi%d: cb_pcidio: remove\n", dev->minor); if (devpriv) { if (devpriv->pci_dev) { if (devpriv->dio_reg_base) diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index b1b832b65bc..8ba694263bd 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -212,8 +212,6 @@ static int cb_pcimdas_attach(struct comedi_device *dev, int index; /* int i; */ - printk("comedi%d: cb_pcimdas: ", dev->minor); - /* * Allocate the private structure area. */ @@ -223,7 +221,6 @@ static int cb_pcimdas_attach(struct comedi_device *dev, /* * Probe the device to determine what device in the series it is. */ - printk("\n"); for_each_pci_dev(pcidev) { /* is it not a computer boards card? */ @@ -248,26 +245,26 @@ static int cb_pcimdas_attach(struct comedi_device *dev, } } - printk("No supported ComputerBoards/MeasurementComputing card found on " - "requested position\n"); + dev_err(dev->hw_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n"); return -EIO; found: - printk("Found %s on bus %i, slot %i\n", cb_pcimdas_boards[index].name, - pcidev->bus->number, PCI_SLOT(pcidev->devfn)); + dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n", + cb_pcimdas_boards[index].name, pcidev->bus->number, + PCI_SLOT(pcidev->devfn)); /* Warn about non-tested features */ switch (thisboard->device_id) { case 0x56: break; default: - printk("THIS CARD IS UNSUPPORTED.\n" - "PLEASE REPORT USAGE TO <mocelet@sucs.org>\n"); + dev_dbg(dev->hw_dev, "THIS CARD IS UNSUPPORTED.\n" + "PLEASE REPORT USAGE TO <mocelet@sucs.org>\n"); } if (comedi_pci_enable(pcidev, "cb_pcimdas")) { - printk(" Failed to enable PCI device and request regions\n"); + dev_err(dev->hw_dev, "Failed to enable PCI device and request regions\n"); return -EIO; } @@ -277,13 +274,11 @@ found: devpriv->BADR3 = pci_resource_start(devpriv->pci_dev, 3); devpriv->BADR4 = pci_resource_start(devpriv->pci_dev, 4); -#ifdef CBPCIMDAS_DEBUG - printk("devpriv->BADR0 = 0x%lx\n", devpriv->BADR0); - printk("devpriv->BADR1 = 0x%lx\n", devpriv->BADR1); - printk("devpriv->BADR2 = 0x%lx\n", devpriv->BADR2); - printk("devpriv->BADR3 = 0x%lx\n", devpriv->BADR3); - printk("devpriv->BADR4 = 0x%lx\n", devpriv->BADR4); -#endif + dev_dbg(dev->hw_dev, "devpriv->BADR0 = 0x%lx\n", devpriv->BADR0); + dev_dbg(dev->hw_dev, "devpriv->BADR1 = 0x%lx\n", devpriv->BADR1); + dev_dbg(dev->hw_dev, "devpriv->BADR2 = 0x%lx\n", devpriv->BADR2); + dev_dbg(dev->hw_dev, "devpriv->BADR3 = 0x%lx\n", devpriv->BADR3); + dev_dbg(dev->hw_dev, "devpriv->BADR4 = 0x%lx\n", devpriv->BADR4); /* Dont support IRQ yet */ /* get irq */ @@ -333,8 +328,6 @@ found: else s->type = COMEDI_SUBD_UNUSED; - printk("attached\n"); - return 1; } @@ -348,16 +341,19 @@ found: */ static int cb_pcimdas_detach(struct comedi_device *dev) { -#ifdef CBPCIMDAS_DEBUG if (devpriv) { - printk("devpriv->BADR0 = 0x%lx\n", devpriv->BADR0); - printk("devpriv->BADR1 = 0x%lx\n", devpriv->BADR1); - printk("devpriv->BADR2 = 0x%lx\n", devpriv->BADR2); - printk("devpriv->BADR3 = 0x%lx\n", devpriv->BADR3); - printk("devpriv->BADR4 = 0x%lx\n", devpriv->BADR4); + dev_dbg(dev->hw_dev, "devpriv->BADR0 = 0x%lx\n", + devpriv->BADR0); + dev_dbg(dev->hw_dev, "devpriv->BADR1 = 0x%lx\n", + devpriv->BADR1); + dev_dbg(dev->hw_dev, "devpriv->BADR2 = 0x%lx\n", + devpriv->BADR2); + dev_dbg(dev->hw_dev, "devpriv->BADR3 = 0x%lx\n", + devpriv->BADR3); + dev_dbg(dev->hw_dev, "devpriv->BADR4 = 0x%lx\n", + devpriv->BADR4); } -#endif - printk("comedi%d: cb_pcimdas: remove\n", dev->minor); + if (dev->irq) free_irq(dev->irq, dev); if (devpriv) { diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c index 8c981a89ab6..40bddfa2222 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdda.c +++ b/drivers/staging/comedi/drivers/cb_pcimdda.c @@ -105,7 +105,8 @@ struct board_struct { int ao_bits; int dio_chans; int dio_method; - int dio_offset; /* how many bytes into the BADR are the DIO ports */ + /* how many bytes into the BADR are the DIO ports */ + int dio_offset; int regs_badrindex; /* IO Region for the control, analog output, and DIO registers */ int reg_sz; /* number of bytes of registers in io region */ @@ -144,17 +145,18 @@ static const struct board_struct boards[] = { /* Please add your PCI vendor ID to comedidev.h, and it will be forwarded * upstream. */ static DEFINE_PCI_DEVICE_TABLE(pci_table) = { - { - PCI_VENDOR_ID_COMPUTERBOARDS, PCI_ID_PCIM_DDA06_16, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_ID_PCIM_DDA06_16) }, + {0} }; MODULE_DEVICE_TABLE(pci, 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. */ +/* + * 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. + */ struct board_private_struct { unsigned long registers; /* set by probe */ unsigned long dio_registers; @@ -335,7 +337,10 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) if (thisboard->dio_chans) { switch (thisboard->dio_method) { case DIO_8255: - /* this is a straight 8255, so register us with the 8255 driver */ + /* + * this is a straight 8255, so register us with + * the 8255 driver + */ subdev_8255_init(dev, s, NULL, devpriv->dio_registers); devpriv->attached_to_8255 = 1; break; @@ -436,8 +441,11 @@ static int ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, for (i = 0; i < insn->n; i++) { inw(devpriv->registers + chan * 2); - /* should I set data[i] to the result of the actual read on the register - or the cached unsigned int in devpriv->ao_readback[]? */ + /* + * should I set data[i] to the result of the actual read + * on the register or the cached unsigned int in + * devpriv->ao_readback[]? + */ data[i] = devpriv->ao_readback[chan]; } diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index 871f109bcfa..e3659bd6e85 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -57,10 +57,9 @@ static const struct contec_board contec_boards[] = { #define PCI_DEVICE_ID_PIO1616L 0x8172 static DEFINE_PCI_DEVICE_TABLE(contec_pci_table) = { - { - PCI_VENDOR_ID_CONTEC, PCI_DEVICE_ID_PIO1616L, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, PIO1616L}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_CONTEC, PCI_DEVICE_ID_PIO1616L), + .driver_data = PIO1616L }, + {0} }; MODULE_DEVICE_TABLE(pci, contec_pci_table); @@ -197,8 +196,8 @@ static int contec_do_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - printk("contec_do_insn_bits called\n"); - printk(" data: %d %d\n", data[0], data[1]); + dev_dbg(dev->hw_dev, "contec_do_insn_bits called\n"); + dev_dbg(dev->hw_dev, "data: %d %d\n", data[0], data[1]); if (insn->n != 2) return -EINVAL; @@ -206,8 +205,8 @@ static int contec_do_insn_bits(struct comedi_device *dev, if (data[0]) { s->state &= ~data[0]; s->state |= data[0] & data[1]; - printk(" out: %d on %lx\n", s->state, - dev->iobase + thisboard->out_offs); + dev_dbg(dev->hw_dev, "out: %d on %lx\n", s->state, + dev->iobase + thisboard->out_offs); outw(s->state, dev->iobase + thisboard->out_offs); } return 2; @@ -218,8 +217,8 @@ static int contec_di_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - printk("contec_di_insn_bits called\n"); - printk(" data: %d %d\n", data[0], data[1]); + dev_dbg(dev->hw_dev, "contec_di_insn_bits called\n"); + dev_dbg(dev->hw_dev, "data: %d %d\n", data[0], data[1]); if (insn->n != 2) return -EINVAL; diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index 82be77daa7d..e61c6a8f285 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -325,9 +325,8 @@ static const struct daq200_boardtype boardtypes[] = { #define this_board ((const struct daq200_boardtype *)dev->board_ptr) static DEFINE_PCI_DEVICE_TABLE(daqboard2000_pci_table) = { - { - 0x1616, 0x0409, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(0x1616, 0x0409) }, + {0} }; MODULE_DEVICE_TABLE(pci, daqboard2000_pci_table); @@ -430,16 +429,14 @@ static int daqboard2000_ai_insn_read(struct comedi_device *dev, /* Enable reading from the scanlist FIFO */ fpga->acqControl = DAQBOARD2000_SeqStartScanList; for (timeout = 0; timeout < 20; timeout++) { - if (fpga->acqControl & DAQBOARD2000_AcqConfigPipeFull) { + if (fpga->acqControl & DAQBOARD2000_AcqConfigPipeFull) break; - } /* udelay(2); */ } fpga->acqControl = DAQBOARD2000_AdcPacerEnable; for (timeout = 0; timeout < 20; timeout++) { - if (fpga->acqControl & DAQBOARD2000_AcqLogicScanning) { + if (fpga->acqControl & DAQBOARD2000_AcqLogicScanning) break; - } /* udelay(2); */ } for (timeout = 0; timeout < 20; timeout++) { @@ -465,9 +462,8 @@ static int daqboard2000_ao_insn_read(struct comedi_device *dev, int i; int 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; } @@ -490,9 +486,8 @@ static int daqboard2000_ao_insn_write(struct comedi_device *dev, /* fpga->dacControl = (chan + 2) * 0x0010 | 0x0001; udelay(1000); */ fpga->dacSetting[chan] = data[i]; for (timeout = 0; timeout < 20; timeout++) { - if ((fpga->dacControl & ((chan + 1) * 0x0010)) == 0) { + if ((fpga->dacControl & ((chan + 1) * 0x0010)) == 0) break; - } /* udelay(2); */ } devpriv->ao_readback[chan] = data[i]; @@ -507,7 +502,7 @@ static int daqboard2000_ao_insn_write(struct comedi_device *dev, static void daqboard2000_resetLocalBus(struct comedi_device *dev) { - printk("daqboard2000_resetLocalBus\n"); + dev_dbg(dev->hw_dev, "daqboard2000_resetLocalBus\n"); writel(DAQBOARD2000_SECRLocalBusHi, devpriv->plx + 0x6c); udelay(10000); writel(DAQBOARD2000_SECRLocalBusLo, devpriv->plx + 0x6c); @@ -516,7 +511,7 @@ static void daqboard2000_resetLocalBus(struct comedi_device *dev) static void daqboard2000_reloadPLX(struct comedi_device *dev) { - printk("daqboard2000_reloadPLX\n"); + dev_dbg(dev->hw_dev, "daqboard2000_reloadPLX\n"); writel(DAQBOARD2000_SECRReloadLo, devpriv->plx + 0x6c); udelay(10000); writel(DAQBOARD2000_SECRReloadHi, devpriv->plx + 0x6c); @@ -527,7 +522,7 @@ static void daqboard2000_reloadPLX(struct comedi_device *dev) static void daqboard2000_pulseProgPin(struct comedi_device *dev) { - printk("daqboard2000_pulseProgPin 1\n"); + dev_dbg(dev->hw_dev, "daqboard2000_pulseProgPin 1\n"); writel(DAQBOARD2000_SECRProgPinHi, devpriv->plx + 0x6c); udelay(10000); writel(DAQBOARD2000_SECRProgPinLo, devpriv->plx + 0x6c); @@ -579,14 +574,14 @@ static int initialize_daqboard2000(struct comedi_device *dev, secr = readl(devpriv->plx + 0x6c); if (!(secr & DAQBOARD2000_EEPROM_PRESENT)) { #ifdef DEBUG_EEPROM - printk("no serial eeprom\n"); + dev_dbg(dev->hw_dev, "no serial eeprom\n"); #endif return -EIO; } for (retry = 0; retry < 3; retry++) { #ifdef DEBUG_EEPROM - printk("Programming EEPROM try %x\n", retry); + dev_dbg(dev->hw_dev, "Programming EEPROM try %x\n", retry); #endif daqboard2000_resetLocalBus(dev); @@ -597,7 +592,8 @@ static int initialize_daqboard2000(struct comedi_device *dev, if (cpld_array[i] == 0xff && cpld_array[i + 1] == 0x20) { #ifdef DEBUG_EEPROM - printk("Preamble found at %d\n", i); + dev_dbg(dev->hw_dev, "Preamble found at %d\n", + i); #endif break; } @@ -605,13 +601,12 @@ static int initialize_daqboard2000(struct comedi_device *dev, for (; i < len; i += 2) { int data = (cpld_array[i] << 8) + cpld_array[i + 1]; - if (!daqboard2000_writeCPLD(dev, data)) { + if (!daqboard2000_writeCPLD(dev, data)) break; - } } if (i >= len) { #ifdef DEBUG_EEPROM - printk("Programmed\n"); + dev_dbg(dev->hw_dev, "Programmed\n"); #endif daqboard2000_resetLocalBus(dev); daqboard2000_reloadPLX(dev); @@ -658,9 +653,8 @@ static void daqboard2000_activateReferenceDacs(struct comedi_device *dev) /* Set the + reference dac value in the FPGA */ fpga->refDacs = 0x80 | DAQBOARD2000_PosRefDacSelect; for (timeout = 0; timeout < 20; timeout++) { - if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) { + if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) break; - } udelay(2); } /* printk("DAQBOARD2000_PosRefDacSelect %d\n", timeout);*/ @@ -668,9 +662,8 @@ static void daqboard2000_activateReferenceDacs(struct comedi_device *dev) /* Set the - reference dac value in the FPGA */ fpga->refDacs = 0x80 | DAQBOARD2000_NegRefDacSelect; for (timeout = 0; timeout < 20; timeout++) { - if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) { + if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) break; - } udelay(2); } /* printk("DAQBOARD2000_NegRefDacSelect %d\n", timeout);*/ @@ -737,15 +730,13 @@ static int daqboard2000_attach(struct comedi_device *dev, unsigned int aux_len; int bus, slot; - printk("comedi%d: daqboard2000:", dev->minor); - bus = it->options[0]; slot = it->options[1]; result = alloc_private(dev, sizeof(struct daqboard2000_private)); - if (result < 0) { + if (result < 0) return -ENOMEM; - } + for (card = pci_get_device(0x1616, 0x0409, NULL); card != NULL; card = pci_get_device(0x1616, 0x0409, card)) { if (bus || slot) { @@ -759,10 +750,10 @@ static int daqboard2000_attach(struct comedi_device *dev, } if (!card) { if (bus || slot) - printk(" no daqboard2000 found at bus/slot: %d/%d\n", - bus, slot); + dev_err(dev->hw_dev, "no daqboard2000 found at bus/slot: %d/%d\n", + bus, slot); else - printk(" no daqboard2000 found\n"); + dev_err(dev->hw_dev, "no daqboard2000 found\n"); return -EIO; } else { u32 id; @@ -772,7 +763,8 @@ static int daqboard2000_attach(struct comedi_device *dev, subsystem_device << 16) | card->subsystem_vendor; for (i = 0; i < n_boardtypes; i++) { if (boardtypes[i].id == id) { - printk(" %s", boardtypes[i].name); + dev_dbg(dev->hw_dev, "%s\n", + boardtypes[i].name); dev->board_ptr = boardtypes + i; } } @@ -786,7 +778,7 @@ static int daqboard2000_attach(struct comedi_device *dev, result = comedi_pci_enable(card, "daqboard2000"); if (result < 0) { - printk(" failed to enable PCI device and request regions\n"); + dev_err(dev->hw_dev, "failed to enable PCI device and request regions\n"); return -EIO; } devpriv->got_regions = 1; @@ -794,9 +786,8 @@ static int daqboard2000_attach(struct comedi_device *dev, ioremap(pci_resource_start(card, 0), DAQBOARD2000_PLX_SIZE); devpriv->daq = ioremap(pci_resource_start(card, 2), DAQBOARD2000_DAQ_SIZE); - if (!devpriv->plx || !devpriv->daq) { + if (!devpriv->plx || !devpriv->daq) return -ENOMEM; - } result = alloc_subdevices(dev, 3); if (result < 0) @@ -817,7 +808,7 @@ static int daqboard2000_attach(struct comedi_device *dev, if (aux_data && aux_len) { result = initialize_daqboard2000(dev, aux_data, aux_len); } else { - printk("no FPGA initialization code, aborting\n"); + dev_dbg(dev->hw_dev, "no FPGA initialization code, aborting\n"); result = -EIO; } if (result < 0) @@ -857,30 +848,26 @@ static int daqboard2000_attach(struct comedi_device *dev, result = subdev_8255_init(dev, s, daqboard2000_8255_cb, (unsigned long)(dev->iobase + 0x40)); - printk("\n"); out: return result; } static int daqboard2000_detach(struct comedi_device *dev) { - printk("comedi%d: daqboard2000: remove\n", dev->minor); - if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 2); - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } + if (devpriv) { if (devpriv->daq) iounmap(devpriv->daq); if (devpriv->plx) iounmap(devpriv->plx); if (devpriv->pci_dev) { - if (devpriv->got_regions) { + if (devpriv->got_regions) comedi_pci_disable(devpriv->pci_dev); - } pci_dev_put(devpriv->pci_dev); } } diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 3141dc80fe7..c2dd0ed36a7 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -506,10 +506,8 @@ struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = { #ifdef CONFIG_COMEDI_PCI static DEFINE_PCI_DEVICE_TABLE(das08_pci_table) = { - { - PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08) }, + {0} }; MODULE_DEVICE_TABLE(pci, das08_pci_table); diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 6d91d302817..4ad398aad72 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -79,22 +79,20 @@ static int das08_cs_attach(struct comedi_device *dev, if (ret < 0) return ret; - printk("comedi%d: das08_cs: ", dev->minor); + dev_info(dev->hw_dev, "comedi%d: das08_cs:\n", dev->minor); /* deal with a pci board */ if (thisboard->bustype == pcmcia) { if (link == NULL) { - printk(" no pcmcia cards found\n"); + dev_err(dev->hw_dev, "no pcmcia cards found\n"); return -EIO; } iobase = link->resource[0]->start; } else { - printk(" bug! board does not have PCMCIA bustype\n"); + dev_err(dev->hw_dev, "bug! board does not have PCMCIA bustype\n"); return -EINVAL; } - printk("\n"); - return das08_common_attach(dev, iobase); } diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index a5ce3b2abe4..5376e718e3d 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -384,20 +384,20 @@ static int das16m1_cmd_exec(struct comedi_device *dev, byte = 0; /* if we are using external start trigger (also board dislikes having * both start and conversion triggers external simultaneously) */ - if (cmd->start_src == TRIG_EXT && cmd->convert_src != TRIG_EXT) { + if (cmd->start_src == TRIG_EXT && cmd->convert_src != TRIG_EXT) byte |= EXT_TRIG_BIT; - } + outb(byte, dev->iobase + DAS16M1_CS); /* clear interrupt bit */ outb(0, dev->iobase + DAS16M1_CLEAR_INTR); /* enable interrupts and internal pacer */ devpriv->control_state &= ~PACER_MASK; - if (cmd->convert_src == TRIG_TIMER) { + if (cmd->convert_src == TRIG_TIMER) devpriv->control_state |= INT_PACER; - } else { + else devpriv->control_state |= EXT_PACER; - } + devpriv->control_state |= INTE; outb(devpriv->control_state, dev->iobase + DAS16M1_INTR_CONTROL); @@ -531,9 +531,8 @@ static void munge_sample_array(short *array, unsigned int num_elements) { unsigned int i; - for (i = 0; i < num_elements; i++) { + for (i = 0; i < num_elements; i++) array[i] = munge_sample(array[i]); - } } static void das16m1_handler(struct comedi_device *dev, unsigned int status) @@ -668,25 +667,20 @@ static int das16m1_attach(struct comedi_device *dev, iobase = it->options[0]; - printk("comedi%d: das16m1:", dev->minor); - ret = alloc_private(dev, sizeof(struct das16m1_private_struct)); if (ret < 0) return ret; dev->board_name = thisboard->name; - printk(" io 0x%lx-0x%lx 0x%lx-0x%lx", - iobase, iobase + DAS16M1_SIZE, - iobase + DAS16M1_82C55, iobase + DAS16M1_82C55 + DAS16M1_SIZE2); if (!request_region(iobase, DAS16M1_SIZE, driver_das16m1.driver_name)) { - printk(" I/O port conflict\n"); + comedi_error(dev, "I/O port conflict\n"); return -EIO; } if (!request_region(iobase + DAS16M1_82C55, DAS16M1_SIZE2, driver_das16m1.driver_name)) { release_region(iobase, DAS16M1_SIZE); - printk(" I/O port conflict\n"); + comedi_error(dev, "I/O port conflict\n"); return -EIO; } dev->iobase = iobase; @@ -697,17 +691,17 @@ static int das16m1_attach(struct comedi_device *dev, if (das16m1_irq_bits(irq) >= 0) { ret = request_irq(irq, das16m1_interrupt, 0, driver_das16m1.driver_name, dev); - if (ret < 0) { - printk(", irq unavailable\n"); + if (ret < 0) return ret; - } dev->irq = irq; - printk(", irq %u\n", irq); + printk + ("irq %u\n", irq); } else if (irq == 0) { - printk(", no irq\n"); + printk + (", no irq\n"); } else { - printk(", invalid irq\n" - " valid irqs are 2, 3, 5, 7, 10, 11, 12, or 15\n"); + comedi_error(dev, "invalid irq\n" + " valid irqs are 2, 3, 5, 7, 10, 11, 12, or 15\n"); return -EINVAL; } @@ -771,7 +765,6 @@ static int das16m1_attach(struct comedi_device *dev, static int das16m1_detach(struct comedi_device *dev) { - printk("comedi%d: das16m1: remove\n", dev->minor); /* das16m1_reset(dev); */ diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index a6df30b7fd7..99ada5a53b9 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -573,22 +573,23 @@ static int das1800_init_dma(struct comedi_device *dev, unsigned int dma0, devpriv->dma_bits |= DMA_CH7_CH5; break; default: - printk(" only supports dma channels 5 through 7\n" - " Dual dma only allows the following combinations:\n" - " dma 5,6 / 6,7 / or 7,5\n"); + dev_err(dev->hw_dev, " only supports dma channels 5 through 7\n" + " Dual dma only allows the following combinations:\n" + " dma 5,6 / 6,7 / or 7,5\n"); return -EINVAL; break; } if (request_dma(dma0, driver_das1800.driver_name)) { - printk(" failed to allocate dma channel %i\n", dma0); + dev_err(dev->hw_dev, "failed to allocate dma channel %i\n", + dma0); return -EINVAL; } devpriv->dma0 = dma0; devpriv->dma_current = dma0; if (dma1) { if (request_dma(dma1, driver_das1800.driver_name)) { - printk(" failed to allocate dma channel %i\n", - dma1); + dev_err(dev->hw_dev, "failed to allocate dma channel %i\n", + dma1); return -EINVAL; } devpriv->dma1 = dma1; @@ -631,20 +632,20 @@ static int das1800_attach(struct comedi_device *dev, if (alloc_private(dev, sizeof(struct das1800_private)) < 0) return -ENOMEM; - printk("comedi%d: %s: io 0x%lx", dev->minor, driver_das1800.driver_name, - iobase); + printk(KERN_DEBUG "comedi%d: %s: io 0x%lx", dev->minor, + driver_das1800.driver_name, iobase); if (irq) { - printk(", irq %u", irq); + printk(KERN_CONT ", irq %u", irq); if (dma0) { - printk(", dma %u", dma0); + printk(KERN_CONT ", dma %u", dma0); if (dma1) - printk(" and %u", dma1); + printk(KERN_CONT " and %u", dma1); } } - printk("\n"); + printk(KERN_CONT "\n"); if (iobase == 0) { - printk(" io base address required\n"); + dev_err(dev->hw_dev, "io base address required\n"); return -EINVAL; } @@ -659,7 +660,7 @@ static int das1800_attach(struct comedi_device *dev, board = das1800_probe(dev); if (board < 0) { - printk(" unable to determine board type\n"); + dev_err(dev->hw_dev, "unable to determine board type\n"); return -ENODEV; } @@ -683,7 +684,8 @@ static int das1800_attach(struct comedi_device *dev, if (irq) { if (request_irq(irq, das1800_interrupt, 0, driver_das1800.driver_name, dev)) { - printk(" unable to allocate irq %u\n", irq); + dev_dbg(dev->hw_dev, "unable to allocate irq %u\n", + irq); return -EINVAL; } } @@ -712,7 +714,7 @@ static int das1800_attach(struct comedi_device *dev, devpriv->irq_dma_bits |= 0x38; break; default: - printk(" irq out of range\n"); + dev_err(dev->hw_dev, "irq out of range\n"); return -EINVAL; break; } @@ -813,8 +815,8 @@ static int das1800_detach(struct comedi_device *dev) kfree(devpriv->ai_buf1); } - printk("comedi%d: %s: remove\n", dev->minor, - driver_das1800.driver_name); + dev_dbg(dev->hw_dev, "comedi%d: %s: remove\n", dev->minor, + driver_das1800.driver_name); return 0; }; @@ -833,8 +835,8 @@ static int das1800_probe(struct comedi_device *dev) case 0x3: if (board == das1801st_da || board == das1802st_da || board == das1701st_da || board == das1702st_da) { - printk(" Board model: %s\n", - das1800_boards[board].name); + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); return board; } printk @@ -843,8 +845,8 @@ static int das1800_probe(struct comedi_device *dev) break; case 0x4: if (board == das1802hr_da || board == das1702hr_da) { - printk(" Board model: %s\n", - das1800_boards[board].name); + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); return board; } printk @@ -854,8 +856,8 @@ static int das1800_probe(struct comedi_device *dev) case 0x5: if (board == das1801ao || board == das1802ao || board == das1701ao || board == das1702ao) { - printk(" Board model: %s\n", - das1800_boards[board].name); + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); return board; } printk @@ -864,18 +866,19 @@ static int das1800_probe(struct comedi_device *dev) break; case 0x6: if (board == das1802hr || board == das1702hr) { - printk(" Board model: %s\n", - das1800_boards[board].name); + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); return board; } - printk(" Board model (probed, not recommended): das-1802hr\n"); + printk + (" Board model (probed, not recommended): das-1802hr\n"); return das1802hr; break; case 0x7: if (board == das1801st || board == das1802st || board == das1701st || board == das1702st) { - printk(" Board model: %s\n", - das1800_boards[board].name); + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); return board; } printk @@ -884,8 +887,8 @@ static int das1800_probe(struct comedi_device *dev) break; case 0x8: if (board == das1801hc || board == das1802hc) { - printk(" Board model: %s\n", - das1800_boards[board].name); + dev_dbg(dev->hw_dev, "Board model: %s\n", + das1800_boards[board].name); return board; } printk diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c index 6328f5280b6..f25684145e8 100644 --- a/drivers/staging/comedi/drivers/das6402.c +++ b/drivers/staging/comedi/drivers/das6402.c @@ -171,7 +171,7 @@ static irqreturn_t intr_handler(int irq, void *d) struct comedi_subdevice *s = dev->subdevices; if (!dev->attached || devpriv->das6402_ignoreirq) { - printk("das6402: BUG: spurious interrupt\n"); + dev_warn(dev->hw_dev, "BUG: spurious interrupt\n"); return IRQ_HANDLED; } #ifdef DEBUG @@ -228,9 +228,7 @@ static int das6402_ai_cancel(struct comedi_device *dev, */ devpriv->das6402_ignoreirq = 1; -#ifdef DEBUG - printk("das6402: Stopping acquisition\n"); -#endif + dev_dbg(dev->hw_dev, "Stopping acquisition\n"); devpriv->das6402_ignoreirq = 1; outb_p(0x02, dev->iobase + 10); /* disable external trigging */ outw_p(SCANL, dev->iobase + 2); /* resets the card fifo */ @@ -246,10 +244,7 @@ static int das6402_ai_mode2(struct comedi_device *dev, struct comedi_subdevice *s, comedi_trig * it) { devpriv->das6402_ignoreirq = 1; - -#ifdef DEBUG - printk("das6402: Starting acquisition\n"); -#endif + dev_dbg(dev->hw_dev, "Starting acquisition\n"); outb_p(0x03, dev->iobase + 10); /* enable external trigging */ outw_p(SCANL, dev->iobase + 2); /* resets the card fifo */ outb_p(IRQ | CONVSRC | BURSTEN | INTE, dev->iobase + 9); @@ -329,10 +324,8 @@ static int das6402_attach(struct comedi_device *dev, if (iobase == 0) iobase = 0x300; - printk("comedi%d: das6402: 0x%04lx", dev->minor, iobase); - if (!request_region(iobase, DAS6402_SIZE, "das6402")) { - printk(" I/O port conflict\n"); + dev_err(dev->hw_dev, "I/O port conflict\n"); return -EIO; } dev->iobase = iobase; @@ -340,14 +333,12 @@ static int das6402_attach(struct comedi_device *dev, /* should do a probe here */ irq = it->options[0]; - printk(" ( irq = %u )", irq); + dev_dbg(dev->hw_dev, "( irq = %u )\n", irq); ret = request_irq(irq, intr_handler, 0, "das6402", dev); - if (ret < 0) { - printk("irq conflict\n"); + if (ret < 0) return ret; - } - dev->irq = irq; + dev->irq = irq; ret = alloc_private(dev, sizeof(struct das6402_private)); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index 96d41ad7695..6e347b40fe6 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -296,47 +296,47 @@ static int das800_probe(struct comedi_device *dev) switch (id_bits) { case 0x0: if (board == das800) { - printk(" Board model: DAS-800\n"); + dev_dbg(dev->hw_dev, "Board model: DAS-800\n"); return board; } if (board == ciodas800) { - printk(" Board model: CIO-DAS800\n"); + dev_dbg(dev->hw_dev, "Board model: CIO-DAS800\n"); return board; } - printk(" Board model (probed): DAS-800\n"); + dev_dbg(dev->hw_dev, "Board model (probed): DAS-800\n"); return das800; break; case 0x2: if (board == das801) { - printk(" Board model: DAS-801\n"); + dev_dbg(dev->hw_dev, "Board model: DAS-801\n"); return board; } if (board == ciodas801) { - printk(" Board model: CIO-DAS801\n"); + dev_dbg(dev->hw_dev, "Board model: CIO-DAS801\n"); return board; } - printk(" Board model (probed): DAS-801\n"); + dev_dbg(dev->hw_dev, "Board model (probed): DAS-801\n"); return das801; break; case 0x3: if (board == das802) { - printk(" Board model: DAS-802\n"); + dev_dbg(dev->hw_dev, "Board model: DAS-802\n"); return board; } if (board == ciodas802) { - printk(" Board model: CIO-DAS802\n"); + dev_dbg(dev->hw_dev, "Board model: CIO-DAS802\n"); return board; } if (board == ciodas80216) { - printk(" Board model: CIO-DAS802/16\n"); + dev_dbg(dev->hw_dev, "Board model: CIO-DAS802/16\n"); return board; } - printk(" Board model (probed): DAS-802\n"); + dev_dbg(dev->hw_dev, "Board model (probed): DAS-802\n"); return das802; break; default: - printk(" Board model: probe returned 0x%x (unknown)\n", - id_bits); + dev_dbg(dev->hw_dev, "Board model: probe returned 0x%x (unknown)\n", + id_bits); return board; break; } @@ -466,42 +466,43 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) unsigned long irq_flags; int board; - printk("comedi%d: das800: io 0x%lx", dev->minor, iobase); + dev_info(dev->hw_dev, "comedi%d: das800: io 0x%lx\n", dev->minor, + iobase); if (irq) - printk(", irq %u", irq); - printk("\n"); + dev_dbg(dev->hw_dev, "irq %u\n", irq); /* allocate and initialize dev->private */ if (alloc_private(dev, sizeof(struct das800_private)) < 0) return -ENOMEM; if (iobase == 0) { - printk("io base address required for das800\n"); + dev_err(dev->hw_dev, "io base address required for das800\n"); return -EINVAL; } /* check if io addresses are available */ if (!request_region(iobase, DAS800_SIZE, "das800")) { - printk("I/O port conflict\n"); + dev_err(dev->hw_dev, "I/O port conflict\n"); return -EIO; } dev->iobase = iobase; board = das800_probe(dev); if (board < 0) { - printk("unable to determine board type\n"); + dev_dbg(dev->hw_dev, "unable to determine board type\n"); return -ENODEV; } dev->board_ptr = das800_boards + board; /* grab our IRQ */ if (irq == 1 || irq > 7) { - printk("irq out of range\n"); + dev_err(dev->hw_dev, "irq out of range\n"); return -EINVAL; } if (irq) { if (request_irq(irq, das800_interrupt, 0, "das800", dev)) { - printk("unable to allocate irq %u\n", irq); + dev_err(dev->hw_dev, "unable to allocate irq %u\n", + irq); return -EINVAL; } } @@ -557,7 +558,7 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int das800_detach(struct comedi_device *dev) { - printk("comedi%d: das800: remove\n", dev->minor); + dev_info(dev->hw_dev, "comedi%d: das800: remove\n", dev->minor); /* only free stuff if it has been allocated by _attach */ if (dev->iobase) diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 6170f7bac46..0a7979e5299 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -352,7 +352,8 @@ static int dt3k_send_cmd(struct comedi_device *dev, unsigned int cmd) if ((status & DT3000_COMPLETION_MASK) == DT3000_NOERROR) return 0; - printk("dt3k_send_cmd() timeout/error status=0x%04x\n", status); + dev_dbg(dev->hw_dev, "dt3k_send_cmd() timeout/error status=0x%04x\n", + status); return -ETIME; } @@ -383,7 +384,7 @@ static void dt3k_writesingle(struct comedi_device *dev, unsigned int subsys, dt3k_send_cmd(dev, CMD_WRITESINGLE); } -static int debug_n_ints = 0; +static int debug_n_ints; /* FIXME! Assumes shared interrupt is for this card. */ /* What's this debug_n_ints stuff? Obviously needs some work... */ @@ -429,12 +430,12 @@ static char *intr_flags[] = { static void debug_intr_flags(unsigned int flags) { int i; - printk("dt3k: intr_flags:"); + printk(KERN_DEBUG "dt3k: intr_flags:"); for (i = 0; i < 8; i++) { if (flags & (1 << i)) - printk(" %s", intr_flags[i]); + printk(KERN_CONT " %s", intr_flags[i]); } - printk("\n"); + printk(KERN_CONT "\n"); } #endif @@ -452,7 +453,7 @@ static void dt3k_ai_empty_fifo(struct comedi_device *dev, if (count < 0) count += AI_FIFO_DEPTH; - printk("reading %d samples\n", count); + dev_dbg(dev->hw_dev, "reading %d samples\n", count); rear = devpriv->ai_rear; @@ -640,7 +641,7 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) int ret; unsigned int mode; - printk("dt3k_ai_cmd:\n"); + dev_dbg(dev->hw_dev, "dt3k_ai_cmd:\n"); for (i = 0; i < cmd->chanlist_len; i++) { chan = CR_CHAN(cmd->chanlist[i]); range = CR_RANGE(cmd->chanlist[i]); @@ -651,15 +652,15 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) aref = CR_AREF(cmd->chanlist[0]); writew(cmd->scan_end_arg, devpriv->io_addr + DPR_Params(0)); - printk("param[0]=0x%04x\n", cmd->scan_end_arg); + dev_dbg(dev->hw_dev, "param[0]=0x%04x\n", cmd->scan_end_arg); if (cmd->convert_src == TRIG_TIMER) { divider = dt3k_ns_to_timer(50, &cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); writew((divider >> 16), devpriv->io_addr + DPR_Params(1)); - printk("param[1]=0x%04x\n", divider >> 16); + dev_dbg(dev->hw_dev, "param[1]=0x%04x\n", divider >> 16); writew((divider & 0xffff), devpriv->io_addr + DPR_Params(2)); - printk("param[2]=0x%04x\n", divider & 0xffff); + dev_dbg(dev->hw_dev, "param[2]=0x%04x\n", divider & 0xffff); } else { /* not supported */ } @@ -668,21 +669,21 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) tscandiv = dt3k_ns_to_timer(100, &cmd->scan_begin_arg, cmd->flags & TRIG_ROUND_MASK); writew((tscandiv >> 16), devpriv->io_addr + DPR_Params(3)); - printk("param[3]=0x%04x\n", tscandiv >> 16); + dev_dbg(dev->hw_dev, "param[3]=0x%04x\n", tscandiv >> 16); writew((tscandiv & 0xffff), devpriv->io_addr + DPR_Params(4)); - printk("param[4]=0x%04x\n", tscandiv & 0xffff); + dev_dbg(dev->hw_dev, "param[4]=0x%04x\n", tscandiv & 0xffff); } else { /* not supported */ } mode = DT3000_AD_RETRIG_INTERNAL | 0 | 0; writew(mode, devpriv->io_addr + DPR_Params(5)); - printk("param[5]=0x%04x\n", mode); + dev_dbg(dev->hw_dev, "param[5]=0x%04x\n", mode); writew(aref == AREF_DIFF, devpriv->io_addr + DPR_Params(6)); - printk("param[6]=0x%04x\n", aref == AREF_DIFF); + dev_dbg(dev->hw_dev, "param[6]=0x%04x\n", aref == AREF_DIFF); writew(AI_FIFO_DEPTH / 2, devpriv->io_addr + DPR_Params(7)); - printk("param[7]=0x%04x\n", AI_FIFO_DEPTH / 2); + dev_dbg(dev->hw_dev, "param[7]=0x%04x\n", AI_FIFO_DEPTH / 2); writew(SUBS_AI, devpriv->io_addr + DPR_SubSys); ret = dt3k_send_cmd(dev, CMD_CONFIG); @@ -848,7 +849,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) int bus, slot; int ret = 0; - printk("dt3000:"); + dev_dbg(dev->hw_dev, "dt3000:\n"); bus = it->options[0]; slot = it->options[1]; @@ -860,7 +861,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; if (ret == 0) { - printk(" no DT board found\n"); + dev_warn(dev->hw_dev, "no DT board found\n"); return -ENODEV; } @@ -868,7 +869,8 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (request_irq(devpriv->pci_dev->irq, dt3k_interrupt, IRQF_SHARED, "dt3000", dev)) { - printk(" unable to allocate IRQ %u\n", devpriv->pci_dev->irq); + dev_err(dev->hw_dev, "unable to allocate IRQ %u\n", + devpriv->pci_dev->irq); return -EINVAL; } dev->irq = devpriv->pci_dev->irq; diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index 8d98cf41270..6a79ba10630 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c @@ -71,18 +71,12 @@ static struct comedi_driver driver_jr3_pci = { }; static DEFINE_PCI_DEVICE_TABLE(jr3_pci_pci_table) = { - { - PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL_NEW, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_4_CHANNEL, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL) }, + { PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL_NEW) }, + { PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL) }, + { PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL) }, + { PCI_DEVICE(PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_4_CHANNEL) }, + {0} }; MODULE_DEVICE_TABLE(pci, jr3_pci_pci_table); @@ -378,14 +372,14 @@ static int jr3_pci_open(struct comedi_device *dev) int i; struct jr3_pci_dev_private *devpriv = dev->private; - printk("jr3_pci_open\n"); + dev_dbg(dev->hw_dev, "jr3_pci_open\n"); for (i = 0; i < devpriv->n_channels; i++) { struct jr3_pci_subdev_private *p; p = dev->subdevices[i].private; if (p) { - printk("serial: %p %d (%d)\n", p, p->serial_no, - p->channel_no); + dev_dbg(dev->hw_dev, "serial: %p %d (%d)\n", p, + p->serial_no, p->channel_no); } } return 0; @@ -463,8 +457,8 @@ static int jr3_download_firmware(struct comedi_device *dev, const u8 * data, break; more = more && read_idm_word(data, size, &pos, &addr); - printk("Loading#%d %4.4x bytes at %4.4x\n", i, - count, addr); + dev_dbg(dev->hw_dev, "Loading#%d %4.4x bytes at %4.4x\n", + i, count, addr); while (more && count > 0) { if (addr & 0x4000) { /* 16 bit data, never seen in real life!! */ @@ -599,24 +593,24 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice *s) min_full_scale = get_min_full_scales(channel); printk("Obtained Min. Full Scales:\n"); - printk("%i ", (min_full_scale).fx); - printk("%i ", (min_full_scale).fy); - printk("%i ", (min_full_scale).fz); - printk("%i ", (min_full_scale).mx); - printk("%i ", (min_full_scale).my); - printk("%i ", (min_full_scale).mz); - printk("\n"); + printk(KERN_DEBUG "%i ", (min_full_scale).fx); + printk(KERN_CONT "%i ", (min_full_scale).fy); + printk(KERN_CONT "%i ", (min_full_scale).fz); + printk(KERN_CONT "%i ", (min_full_scale).mx); + printk(KERN_CONT "%i ", (min_full_scale).my); + printk(KERN_CONT "%i ", (min_full_scale).mz); + printk(KERN_CONT "\n"); max_full_scale = get_max_full_scales(channel); printk("Obtained Max. Full Scales:\n"); - printk("%i ", (max_full_scale).fx); - printk("%i ", (max_full_scale).fy); - printk("%i ", (max_full_scale).fz); - printk("%i ", (max_full_scale).mx); - printk("%i ", (max_full_scale).my); - printk("%i ", (max_full_scale).mz); - printk("\n"); + printk(KERN_DEBUG "%i ", (max_full_scale).fx); + printk(KERN_CONT "%i ", (max_full_scale).fy); + printk(KERN_CONT "%i ", (max_full_scale).fz); + printk(KERN_CONT "%i ", (max_full_scale).mx); + printk(KERN_CONT "%i ", (max_full_scale).my); + printk(KERN_CONT "%i ", (max_full_scale).mz); + printk(KERN_CONT "\n"); set_full_scales(channel, max_full_scale); @@ -779,14 +773,12 @@ static int jr3_pci_attach(struct comedi_device *dev, int opt_bus, opt_slot, i; struct jr3_pci_dev_private *devpriv; - printk("comedi%d: jr3_pci\n", dev->minor); - opt_bus = it->options[0]; opt_slot = it->options[1]; if (sizeof(struct jr3_channel) != 0xc00) { - printk("sizeof(struct jr3_channel) = %x [expected %x]\n", - (unsigned)sizeof(struct jr3_channel), 0xc00); + dev_err(dev->hw_dev, "sizeof(struct jr3_channel) = %x [expected %x]\n", + (unsigned)sizeof(struct jr3_channel), 0xc00); return -EINVAL; } @@ -840,7 +832,7 @@ static int jr3_pci_attach(struct comedi_device *dev, } } if (!card) { - printk(" no jr3_pci found\n"); + dev_err(dev->hw_dev, "no jr3_pci found\n"); return -EIO; } else { devpriv->pci_dev = card; @@ -875,10 +867,10 @@ static int jr3_pci_attach(struct comedi_device *dev, p = dev->subdevices[i].private; p->channel = &devpriv->iobase->channel[i].data; - printk("p->channel %p %p (%tx)\n", - p->channel, devpriv->iobase, - ((char *)(p->channel) - - (char *)(devpriv->iobase))); + dev_dbg(dev->hw_dev, "p->channel %p %p (%tx)\n", + p->channel, devpriv->iobase, + ((char *)(p->channel) - + (char *)(devpriv->iobase))); p->channel_no = i; for (j = 0; j < 8; j++) { int k; @@ -916,7 +908,7 @@ static int jr3_pci_attach(struct comedi_device *dev, devpriv->iobase->channel[0].reset = 0; result = comedi_load_firmware(dev, "jr3pci.idm", jr3_download_firmware); - printk("Firmare load %d\n", result); + dev_dbg(dev->hw_dev, "Firmare load %d\n", result); if (result < 0) goto out; @@ -934,9 +926,9 @@ static int jr3_pci_attach(struct comedi_device *dev, */ msleep_interruptible(25); for (i = 0; i < 0x18; i++) { - printk("%c", - get_u16(&devpriv->iobase->channel[0]. - data.copyright[i]) >> 8); + dev_dbg(dev->hw_dev, "%c\n", + get_u16(&devpriv->iobase->channel[0]. + data.copyright[i]) >> 8); } /* Start card timer */ @@ -963,7 +955,6 @@ static int jr3_pci_detach(struct comedi_device *dev) int i; struct jr3_pci_dev_private *devpriv = dev->private; - printk("comedi%d: jr3_pci: remove\n", dev->minor); if (devpriv) { del_timer_sync(&devpriv->timer); diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index 286093bca3f..4e9e9a07865 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -52,10 +52,8 @@ static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it); static int cnt_detach(struct comedi_device *dev); static DEFINE_PCI_DEVICE_TABLE(cnt_pci_table) = { - { - PCI_VENDOR_ID_KOLTER, CNT_CARD_DEVICE_ID, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_KOLTER, CNT_CARD_DEVICE_ID) }, + {0} }; MODULE_DEVICE_TABLE(pci, cnt_pci_table); diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index cda4b224b30..8b812e41c52 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -188,12 +188,9 @@ static const struct comedi_lrange me2600_ao_range = { }; static DEFINE_PCI_DEVICE_TABLE(me_pci_table) = { - { - PCI_VENDOR_ID_MEILHAUS, ME2600_DEVICE_ID, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_MEILHAUS, ME2000_DEVICE_ID, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, { - 0} + { PCI_DEVICE(PCI_VENDOR_ID_MEILHAUS, ME2600_DEVICE_ID) }, + { PCI_DEVICE(PCI_VENDOR_ID_MEILHAUS, ME2000_DEVICE_ID) }, + {0} }; MODULE_DEVICE_TABLE(pci, me_pci_table); diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c index 32e675e3f0b..c25e44c1905 100644 --- a/drivers/staging/comedi/drivers/ni_at_a2150.c +++ b/drivers/staging/comedi/drivers/ni_at_a2150.c @@ -731,9 +731,8 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) outw(trigger_bits, dev->iobase + TRIGGER_REG); /* start acquisition for soft trigger */ - if (cmd->start_src == TRIG_NOW) { + if (cmd->start_src == TRIG_NOW) outw(0, dev->iobase + FIFO_START_REG); - } #ifdef A2150_DEBUG ni_dump_regs(dev); #endif @@ -860,11 +859,10 @@ static int a2150_get_timing(struct comedi_device *dev, unsigned int *period, case TRIG_ROUND_NEAREST: default: /* if least upper bound is better approximation */ - if (lub - *period < *period - glb) { + if (lub - *period < *period - glb) *period = lub; - } else { + else *period = glb; - } break; case TRIG_ROUND_UP: *period = lub; diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 49b824c7bd2..c0423a8c3e3 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -52,7 +52,7 @@ the PCMCIA interface. #include <pcmcia/cisreg.h> #include <pcmcia/ds.h> -static struct pcmcia_device *pcmcia_cur_dev = NULL; +static struct pcmcia_device *pcmcia_cur_dev; #define DIO24_SIZE 4 /* size of io region used by board */ @@ -133,22 +133,19 @@ static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it) #endif break; default: - printk("bug! couldn't determine board type\n"); + pr_err("bug! couldn't determine board type\n"); return -EINVAL; break; } - printk("comedi%d: ni_daq_dio24: %s, io 0x%lx", dev->minor, - thisboard->name, iobase); + pr_debug("comedi%d: ni_daq_dio24: %s, io 0x%lx", dev->minor, + thisboard->name, iobase); #ifdef incomplete - if (irq) { - printk(", irq %u", irq); - } + if (irq) + pr_debug("irq %u\n", irq); #endif - printk("\n"); - if (iobase == 0) { - printk("io base address is zero!\n"); + pr_err("io base address is zero!\n"); return -EINVAL; } @@ -173,7 +170,7 @@ static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int dio24_detach(struct comedi_device *dev) { - printk("comedi%d: ni_daq_dio24: remove\n", dev->minor); + dev_info(dev->hw_dev, "comedi%d: ni_daq_dio24: remove\n", dev->minor); if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 0); diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 832a5178b63..ff3840544dd 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -145,7 +145,7 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it) irq = link->irq; break; default: - printk("bug! couldn't determine board type\n"); + pr_err("bug! couldn't determine board type\n"); return -EINVAL; break; } diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 9148abdad07..0f0d995f137 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -1470,7 +1470,7 @@ static void m_series_stc_writew(struct comedi_device *dev, uint16_t data, /* FIXME: DIO_Output_Register (16 bit reg) is replaced by M_Offset_Static_Digital_Output (32 bit) and M_Offset_SCXI_Serial_Data_Out (8 bit) */ default: - printk("%s: bug! unhandled register=0x%x in switch.\n", + printk(KERN_WARNING "%s: bug! unhandled register=0x%x in switch.\n", __func__, reg); BUG(); return; @@ -1505,7 +1505,7 @@ static uint16_t m_series_stc_readw(struct comedi_device *dev, int reg) offset = M_Offset_G01_Status; break; default: - printk("%s: bug! unhandled register=0x%x in switch.\n", + printk(KERN_WARNING "%s: bug! unhandled register=0x%x in switch.\n", __func__, reg); BUG(); return 0; @@ -1547,7 +1547,7 @@ static void m_series_stc_writel(struct comedi_device *dev, uint32_t data, offset = M_Offset_G1_Load_B; break; default: - printk("%s: bug! unhandled register=0x%x in switch.\n", + printk(KERN_WARNING "%s: bug! unhandled register=0x%x in switch.\n", __func__, reg); BUG(); return; @@ -1573,7 +1573,7 @@ static uint32_t m_series_stc_readl(struct comedi_device *dev, int reg) offset = M_Offset_G1_Save; break; default: - printk("%s: bug! unhandled register=0x%x in switch.\n", + printk(KERN_WARNING "%s: bug! unhandled register=0x%x in switch.\n", __func__, reg); BUG(); return 0; @@ -1632,9 +1632,8 @@ static void m_series_init_eeprom_buffer(struct comedi_device *dev) } devpriv->serial_number = be32_to_cpu(devpriv->serial_number); - for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i) { + for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i) devpriv->eeprom_buffer[i] = ni_readb(Start_Cal_EEPROM + i); - } writel(old_iodwbsr1_bits, devpriv->mite->mite_io_addr + MITE_IODWBSR_1); writel(old_iodwbsr_bits, devpriv->mite->mite_io_addr + MITE_IODWBSR); @@ -1665,9 +1664,9 @@ static void init_6143(struct comedi_device *dev) static int pcimio_detach(struct comedi_device *dev) { mio_common_detach(dev); - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } + if (dev->private) { mite_free_ring(devpriv->ai_mite_ring); mite_free_ring(devpriv->ao_mite_ring); @@ -1685,7 +1684,7 @@ static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it) { int ret; - printk("comedi%d: ni_pcimio:", dev->minor); + dev_info(dev->hw_dev, "comedi%d: ni_pcimio:\n", dev->minor); ret = ni_alloc_private(dev); if (ret < 0) @@ -1695,7 +1694,7 @@ static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; - printk(" %s", boardtype.name); + dev_dbg(dev->hw_dev, "%s\n", boardtype.name); dev->board_name = boardtype.name; if (boardtype.reg_type & ni_reg_m_series_mask) { @@ -1712,7 +1711,7 @@ static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = mite_setup(devpriv->mite); if (ret < 0) { - printk(" error setting up mite\n"); + pr_warn("error setting up mite\n"); return ret; } comedi_set_hw_dev(dev, &devpriv->mite->pcidev->dev); @@ -1740,13 +1739,13 @@ static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->irq = mite_irq(devpriv->mite); if (dev->irq == 0) { - printk(" unknown irq (bad)\n"); + pr_warn("unknown irq (bad)\n"); } else { - printk(" ( irq = %u )", dev->irq); + pr_debug("( irq = %u )\n", dev->irq); ret = request_irq(dev->irq, ni_E_interrupt, NI_E_IRQ_FLAGS, DRV_NAME, dev); if (ret < 0) { - printk(" irq not available\n"); + pr_warn("irq not available\n"); dev->irq = 0; } } @@ -1787,7 +1786,7 @@ static int pcimio_find_device(struct comedi_device *dev, int bus, int slot) } } } - printk("no device found\n"); + pr_warn("no device found\n"); mite_list_devices(); return -EIO; } diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 0b9bee36eb5..96cd7ec2ad5 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -155,8 +155,8 @@ static int pcl816_attach(struct comedi_device *dev, static int pcl816_detach(struct comedi_device *dev); #ifdef unused -static int RTC_lock = 0; /* RTC lock */ -static int RTC_timer_lock = 0; /* RTC int lock */ +static int RTC_lock; /* RTC lock */ +static int RTC_timer_lock; /* RTC int lock */ #endif static struct comedi_driver driver_pcl816 = { diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index b45a9bd8b48..7344a53a81c 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -252,8 +252,8 @@ static int pcl818_attach(struct comedi_device *dev, static int pcl818_detach(struct comedi_device *dev); #ifdef unused -static int RTC_lock = 0; /* RTC lock */ -static int RTC_timer_lock = 0; /* RTC int lock */ +static int RTC_lock; /* RTC lock */ +static int RTC_timer_lock; /* RTC int lock */ #endif struct pcl818_board { @@ -463,9 +463,8 @@ static int pcl818_ao_insn_read(struct comedi_device *dev, int n; int chan = CR_CHAN(insn->chanspec); - for (n = 0; n < insn->n; n++) { + for (n = 0; n < insn->n; n++) data[n] = devpriv->ao_readback[chan]; - } return n; } @@ -571,9 +570,9 @@ conv_finish: return IRQ_HANDLED; } devpriv->act_chanlist_pos++; - if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) { + if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) devpriv->act_chanlist_pos = 0; - } + s->async->cur_chan++; if (s->async->cur_chan >= devpriv->ai_n_chan) { /* printk("E"); */ @@ -645,9 +644,9 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d) comedi_buf_put(s->async, ptr[bufptr++] >> 4); /* get one sample */ devpriv->act_chanlist_pos++; - if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) { + if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) devpriv->act_chanlist_pos = 0; - } + s->async->cur_chan++; if (s->async->cur_chan >= devpriv->ai_n_chan) { s->async->cur_chan = 0; @@ -805,11 +804,10 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d) return IRQ_HANDLED; } - if (lo & 2) { + if (lo & 2) len = 512; - } else { + else len = 0; - } for (i = 0; i < len; i++) { lo = inb(dev->iobase + PCL818_FI_DATALO); @@ -827,9 +825,9 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d) comedi_buf_put(s->async, (lo >> 4) | (inb(dev->iobase + PCL818_FI_DATAHI) << 4)); /* get one sample */ devpriv->act_chanlist_pos++; - if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) { + if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) devpriv->act_chanlist_pos = 0; - } + s->async->cur_chan++; if (s->async->cur_chan >= devpriv->ai_n_chan) { s->async->cur_chan = 0; @@ -1009,7 +1007,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev, int divisor1 = 0, divisor2 = 0; unsigned int seglen; - printk("pcl818_ai_cmd_mode()\n"); + dev_dbg(dev->hw_dev, "pcl818_ai_cmd_mode()\n"); if ((!dev->irq) && (!devpriv->dma_rtc)) { comedi_error(dev, "IRQ not defined!"); return -EINVAL; @@ -1112,7 +1110,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev, break; } #endif - printk("pcl818_ai_cmd_mode() end\n"); + dev_dbg(dev->hw_dev, "pcl818_ai_cmd_mode() end\n"); return 0; } @@ -1309,11 +1307,9 @@ static void setup_channel_list(struct comedi_device *dev, */ static int check_single_ended(unsigned int port) { - if (inb(port + PCL818_STATUS) & 0x20) { + if (inb(port + PCL818_STATUS) & 0x20) return 1; - } else { - return 0; - } + return 0; } /* @@ -1352,9 +1348,8 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (!cmd->stop_src || tmp != cmd->stop_src) err++; - if (err) { + if (err) return 1; - } /* step 2: make sure trigger sources are unique and mutually compatible */ @@ -1377,9 +1372,8 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (cmd->stop_src != TRIG_NONE && cmd->stop_src != TRIG_COUNT) err++; - if (err) { + if (err) return 2; - } /* step 3: make sure arguments are trivially compatible */ @@ -1421,9 +1415,8 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, } } - if (err) { + if (err) return 3; - } /* step 4: fix up any arguments */ @@ -1438,9 +1431,8 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, err++; } - if (err) { + if (err) return 4; - } /* step 5: complain about special chanlist considerations */ @@ -1461,7 +1453,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) struct comedi_cmd *cmd = &s->async->cmd; int retval; - printk("pcl818_ai_cmd()\n"); + dev_dbg(dev->hw_dev, "pcl818_ai_cmd()\n"); devpriv->ai_n_chan = cmd->chanlist_len; devpriv->ai_chanlist = cmd->chanlist; devpriv->ai_flags = cmd->flags; @@ -1470,17 +1462,16 @@ static int 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, 3 */ if (cmd->convert_src == TRIG_TIMER) { /* mode 1 */ devpriv->ai_timer1 = cmd->convert_arg; retval = pcl818_ai_cmd_mode(1, dev, s); - printk("pcl818_ai_cmd() end\n"); + dev_dbg(dev->hw_dev, "pcl818_ai_cmd() end\n"); return retval; } if (cmd->convert_src == TRIG_EXT) { /* mode 3 */ @@ -1499,7 +1490,7 @@ static int pcl818_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { if (devpriv->irq_blocked > 0) { - printk("pcl818_ai_cancel()\n"); + dev_dbg(dev->hw_dev, "pcl818_ai_cancel()\n"); devpriv->irq_was_now_closed = 1; switch (devpriv->ai_mode) { @@ -1549,7 +1540,7 @@ static int pcl818_ai_cancel(struct comedi_device *dev, } end: - printk("pcl818_ai_cancel() end\n"); + dev_dbg(dev->hw_dev, "pcl818_ai_cancel() end\n"); return 0; } @@ -1633,11 +1624,11 @@ static int set_rtc_irq_bit(unsigned char bit) save_flags(flags); cli(); val = CMOS_READ(RTC_CONTROL); - if (bit) { + if (bit) val |= RTC_PIE; - } else { + else val &= ~RTC_PIE; - } + CMOS_WRITE(val, RTC_CONTROL); CMOS_READ(RTC_INTR_FLAGS); restore_flags(flags); @@ -1754,22 +1745,23 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* claim our I/O space */ iobase = it->options[0]; - printk("comedi%d: pcl818: board=%s, ioport=0x%03lx", - dev->minor, this_board->name, iobase); + printk + ("comedi%d: pcl818: board=%s, ioport=0x%03lx", + dev->minor, this_board->name, iobase); devpriv->io_range = this_board->io_range; if ((this_board->fifo) && (it->options[2] == -1)) { /* we've board with FIFO and we want to use FIFO */ devpriv->io_range = PCLx1xFIFO_RANGE; devpriv->usefifo = 1; } if (!request_region(iobase, devpriv->io_range, "pcl818")) { - printk("I/O port conflict\n"); + comedi_error(dev, "I/O port conflict\n"); return -EIO; } dev->iobase = iobase; if (pcl818_check(iobase)) { - printk(", I can't detect board. FAIL!\n"); + comedi_error(dev, "I can't detect board. FAIL!\n"); return -EIO; } @@ -1793,19 +1785,18 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) irq); irq = 0; /* Can't use IRQ */ } else { - printk(", irq=%u", irq); + printk(KERN_DEBUG "irq=%u", irq); } } } } dev->irq = irq; - if (irq) { - devpriv->irq_free = 1; - } /* 1=we have allocated irq */ - else { + if (irq) + devpriv->irq_free = 1; /* 1=we have allocated irq */ + else devpriv->irq_free = 0; - } + devpriv->irq_blocked = 0; /* number of subdevice which use IRQ */ devpriv->ai_mode = 0; /* mode of irq */ @@ -1825,7 +1816,7 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) "pcl818 DMA (RTC)", dev)) { devpriv->dma_rtc = 1; devpriv->rtc_irq = RTC_IRQ; - printk(", dma_irq=%u", devpriv->rtc_irq); + printk(KERN_DEBUG "dma_irq=%u", devpriv->rtc_irq); } else { RTC_lock--; if (RTC_lock == 0) { @@ -1850,34 +1841,26 @@ no_rtc: if (dma < 1) goto no_dma; /* DMA disabled */ if (((1 << dma) & this_board->DMAbits) == 0) { - printk(", DMA is out of allowed range, FAIL!\n"); + printk(KERN_ERR "DMA is out of allowed range, FAIL!\n"); return -EINVAL; /* Bad DMA */ } ret = request_dma(dma, "pcl818"); - if (ret) { - printk(", unable to allocate DMA %u, FAIL!\n", dma); + if (ret) return -EBUSY; /* DMA isn't free */ - } devpriv->dma = dma; - printk(", dma=%u", dma); pages = 2; /* we need 16KB */ devpriv->dmabuf[0] = __get_dma_pages(GFP_KERNEL, pages); - if (!devpriv->dmabuf[0]) { - printk(", unable to allocate DMA buffer, FAIL!\n"); + if (!devpriv->dmabuf[0]) /* maybe experiment with try_to_free_pages() will help .... */ return -EBUSY; /* no buffer :-( */ - } devpriv->dmapages[0] = pages; devpriv->hwdmaptr[0] = virt_to_bus((void *)devpriv->dmabuf[0]); devpriv->hwdmasize[0] = (1 << pages) * PAGE_SIZE; /* printk("%d %d %ld, ",devpriv->dmapages[0],devpriv->hwdmasize[0],PAGE_SIZE); */ if (devpriv->dma_rtc == 0) { /* we must do duble buff :-( */ devpriv->dmabuf[1] = __get_dma_pages(GFP_KERNEL, pages); - if (!devpriv->dmabuf[1]) { - printk - (", unable to allocate DMA buffer, FAIL!\n"); + if (!devpriv->dmabuf[1]) return -EBUSY; - } devpriv->dmapages[1] = pages; devpriv->hwdmaptr[1] = virt_to_bus((void *)devpriv->dmabuf[1]); @@ -2017,11 +2000,10 @@ no_dma: } /* select 1/10MHz oscilator */ - if ((it->options[3] == 0) || (it->options[3] == 10)) { + if ((it->options[3] == 0) || (it->options[3] == 10)) devpriv->i8253_osc_base = 100; - } else { + else devpriv->i8253_osc_base = 1000; - } /* max sampling speed */ devpriv->ns_min = this_board->ns_min; diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 3ad04aaa1e3..eddac00e4e2 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -371,15 +371,15 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) iobase = it->options[0]; irq[0] = it->options[1]; - printk(KERN_INFO "comedi%d: %s: io: %lx ", dev->minor, driver.driver_name, - iobase); + printk(KERN_INFO "comedi%d: %s: io: %lx attaching...\n", dev->minor, + driver.driver_name, iobase); dev->iobase = iobase; if (!iobase || !request_region(iobase, thisboard->total_iosize, driver.driver_name)) { - printk(KERN_ERR "I/O port conflict\n"); + printk(KERN_ERR "comedi%d: I/O port conflict\n", dev->minor); return -EIO; } @@ -394,7 +394,8 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) * convenient macro defined in comedidev.h. */ if (alloc_private(dev, sizeof(struct pcmmio_private)) < 0) { - printk(KERN_ERR "cannot allocate private data structure\n"); + printk(KERN_ERR "comedi%d: cannot allocate private data structure\n", + dev->minor); return -ENOMEM; } @@ -417,7 +418,8 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) kcalloc(n_subdevs, sizeof(struct pcmmio_subdev_private), GFP_KERNEL); if (!devpriv->sprivs) { - printk(KERN_ERR "cannot allocate subdevice private data structures\n"); + printk(KERN_ERR "comedi%d: cannot allocate subdevice private data structures\n", + dev->minor); return -ENOMEM; } /* @@ -427,7 +429,8 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Allocate 1 AI + 1 AO + 2 DIO subdevs (24 lines per DIO) */ if (alloc_subdevices(dev, n_subdevs) < 0) { - printk(KERN_ERR "cannot allocate subdevice data structures\n"); + printk(KERN_ERR "comedi%d: cannot allocate subdevice data structures\n", + dev->minor); return -ENOMEM; } @@ -557,14 +560,15 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) */ if (irq[0]) { - printk(KERN_DEBUG "irq: %u ", irq[0]); + printk(KERN_DEBUG "comedi%d: irq: %u\n", dev->minor, irq[0]); if (thisboard->dio_num_asics == 2 && irq[1]) - printk(KERN_DEBUG "second ASIC irq: %u ", irq[1]); + printk(KERN_DEBUG "comedi%d: second ASIC irq: %u\n", + dev->minor, irq[1]); } else { - printk(KERN_INFO "(IRQ mode disabled) "); + printk(KERN_INFO "comedi%d: (IRQ mode disabled)\n", dev->minor); } - printk(KERN_INFO "attached\n"); + printk(KERN_INFO "comedi%d: attached\n", dev->minor); return 1; } @@ -663,7 +667,7 @@ static int pcmmio_dio_insn_bits(struct comedi_device *dev, } #ifdef DAMMIT_ITS_BROKEN /* DEBUG */ - printk(KERN_DEBUG "data_out_byte %02x\n", (unsigned)byte); + printk("data_out_byte %02x\n", (unsigned)byte); #endif /* save the digital input lines for this byte.. */ s->state |= ((unsigned int)byte) << offset; diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index b2c2c8971a3..661ba2e0389 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -295,15 +295,15 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) irq[0] = it->options[1]; irq[1] = it->options[2]; - printk("comedi%d: %s: io: %lx ", dev->minor, driver.driver_name, - iobase); + dev_dbg(dev->hw_dev, "comedi%d: %s: io: %lx attached\n", dev->minor, + driver.driver_name, iobase); dev->iobase = iobase; if (!iobase || !request_region(iobase, thisboard->num_asics * ASIC_IOSIZE, driver.driver_name)) { - printk("I/O port conflict\n"); + dev_err(dev->hw_dev, "I/O port conflict\n"); return -EIO; } @@ -318,7 +318,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) * convenient macro defined in comedidev.h. */ if (alloc_private(dev, sizeof(struct pcmuio_private)) < 0) { - printk("cannot allocate private data structure\n"); + dev_warn(dev->hw_dev, "cannot allocate private data structure\n"); return -ENOMEM; } @@ -337,7 +337,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) kcalloc(n_subdevs, sizeof(struct pcmuio_subdev_private), GFP_KERNEL); if (!devpriv->sprivs) { - printk("cannot allocate subdevice private data structures\n"); + dev_warn(dev->hw_dev, "cannot allocate subdevice private data structures\n"); return -ENOMEM; } /* @@ -348,7 +348,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) * 96-channel version of the board. */ if (alloc_subdevices(dev, n_subdevs) < 0) { - printk("cannot allocate subdevice data structures\n"); + dev_dbg(dev->hw_dev, "cannot allocate subdevice data structures\n"); return -ENOMEM; } @@ -436,14 +436,13 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) irqs.. */ if (irq[0]) { - printk("irq: %u ", irq[0]); + dev_dbg(dev->hw_dev, "irq: %u\n", irq[0]); if (irq[1] && thisboard->num_asics == 2) - printk("second ASIC irq: %u ", irq[1]); + dev_dbg(dev->hw_dev, "second ASIC irq: %u\n", irq[1]); } else { - printk("(IRQ mode disabled) "); + dev_dbg(dev->hw_dev, "(IRQ mode disabled)\n"); } - printk("attached\n"); return 1; } @@ -460,7 +459,8 @@ static int pcmuio_detach(struct comedi_device *dev) { int i; - printk("comedi%d: %s: remove\n", dev->minor, driver.driver_name); + dev_dbg(dev->hw_dev, "comedi%d: %s: remove\n", dev->minor, + driver.driver_name); if (dev->iobase) release_region(dev->iobase, ASIC_IOSIZE * thisboard->num_asics); @@ -501,7 +501,8 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev, #ifdef DAMMIT_ITS_BROKEN /* DEBUG */ - printk("write mask: %08x data: %08x\n", data[0], data[1]); + dev_dbg(dev->hw_dev, "write mask: %08x data: %08x\n", data[0], + data[1]); #endif s->state = 0; @@ -537,7 +538,7 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev, } #ifdef DAMMIT_ITS_BROKEN /* DEBUG */ - printk("data_out_byte %02x\n", (unsigned)byte); + dev_dbg(dev->hw_dev, "data_out_byte %02x\n", (unsigned)byte); #endif /* save the digital input lines for this byte.. */ s->state |= ((unsigned int)byte) << offset; @@ -548,7 +549,8 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev, #ifdef DAMMIT_ITS_BROKEN /* DEBUG */ - printk("s->state %08x data_out %08x\n", s->state, data[1]); + dev_dbg(dev->hw_dev, "s->state %08x data_out %08x\n", s->state, + data[1]); #endif return 2; @@ -951,14 +953,13 @@ pcmuio_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s, spin_lock_irqsave(&subpriv->intr.spinlock, flags); s->async->inttrig = 0; - if (subpriv->intr.active) { + if (subpriv->intr.active) event = pcmuio_start_intr(dev, s); - } + spin_unlock_irqrestore(&subpriv->intr.spinlock, flags); - if (event) { + if (event) comedi_event(dev, s); - } return 1; } @@ -1000,9 +1001,8 @@ static int pcmuio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } spin_unlock_irqrestore(&subpriv->intr.spinlock, flags); - if (event) { + if (event) comedi_event(dev, s); - } return 0; } diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index ade2202b623..d880c2f6fbc 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -824,7 +824,7 @@ static int serial2002_attach(struct comedi_device *dev, { struct comedi_subdevice *s; - printk("comedi%d: serial2002: ", dev->minor); + dev_dbg(dev->hw_dev, "comedi%d: attached\n", dev->minor); dev->board_name = thisboard->name; if (alloc_private(dev, sizeof(struct serial2002_private)) < 0) return -ENOMEM; @@ -832,7 +832,8 @@ static int serial2002_attach(struct comedi_device *dev, dev->close = serial_2002_close; devpriv->port = it->options[0]; devpriv->speed = it->options[1]; - printk("/dev/ttyS%d @ %d\n", devpriv->port, devpriv->speed); + dev_dbg(dev->hw_dev, "/dev/ttyS%d @ %d\n", devpriv->port, + devpriv->speed); if (alloc_subdevices(dev, 5) < 0) return -ENOMEM; @@ -891,7 +892,7 @@ static int serial2002_detach(struct comedi_device *dev) struct comedi_subdevice *s; int i; - printk("comedi%d: serial2002: remove\n", dev->minor); + dev_dbg(dev->hw_dev, "comedi%d: remove\n", dev->minor); for (i = 0; i < 5; i++) { s = &dev->subdevices[i]; kfree(s->maxdata_list); diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 6144afb8cba..ca6bcf8b023 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1524,15 +1524,17 @@ static int usbdux_ao_inttrig(struct comedi_device *dev, return -EFAULT; down(&this_usbduxsub->sem); + if (!(this_usbduxsub->probed)) { - up(&this_usbduxsub->sem); - return -ENODEV; + ret = -ENODEV; + goto out; } if (trignum != 0) { dev_err(&this_usbduxsub->interface->dev, "comedi%d: usbdux_ao_inttrig: invalid trignum\n", dev->minor); - return -EINVAL; + ret = -EINVAL; + goto out; } if (!(this_usbduxsub->ao_cmd_running)) { this_usbduxsub->ao_cmd_running = 1; @@ -1542,8 +1544,7 @@ static int usbdux_ao_inttrig(struct comedi_device *dev, "comedi%d: usbdux_ao_inttrig: submitURB: " "err=%d\n", dev->minor, ret); this_usbduxsub->ao_cmd_running = 0; - up(&this_usbduxsub->sem); - return ret; + goto out; } s->async->inttrig = NULL; } else { @@ -1551,8 +1552,10 @@ static int usbdux_ao_inttrig(struct comedi_device *dev, "comedi%d: ao_inttrig but acqu is already running.\n", dev->minor); } + ret = 1; +out: up(&this_usbduxsub->sem); - return 1; + return ret; } static int usbdux_ao_cmdtest(struct comedi_device *dev, @@ -2689,6 +2692,7 @@ static int usbduxsigma_attach(struct comedi_device *dev, if (ret < 0) { dev_err(&udev->interface->dev, "comedi%d: no space for subdev\n", dev->minor); + up(&udev->sem); up(&start_stop_sem); return ret; } |