Commit 82675f35 authored by Bill Pemberton's avatar Bill Pemberton Committed by Greg Kroah-Hartman

Staging: comedi: Remove curly braces where they are not needed

Changes as suggested by checkpatch.pl.
Signed-off-by: default avatarBill Pemberton <wfp5p@virginia.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent dedd1325
...@@ -98,15 +98,14 @@ typedef struct comedi32_insnlist_struct { ...@@ -98,15 +98,14 @@ typedef struct comedi32_insnlist_struct {
static int translated_ioctl(struct file *file, unsigned int cmd, static int translated_ioctl(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
if (!file->f_op) { if (!file->f_op)
return -ENOTTY; return -ENOTTY;
}
#ifdef HAVE_UNLOCKED_IOCTL #ifdef HAVE_UNLOCKED_IOCTL
if (file->f_op->unlocked_ioctl) { if (file->f_op->unlocked_ioctl) {
int rc = (int)(*file->f_op->unlocked_ioctl)(file, cmd, arg); int rc = (int)(*file->f_op->unlocked_ioctl)(file, cmd, arg);
if (rc == -ENOIOCTLCMD) { if (rc == -ENOIOCTLCMD)
rc = -ENOTTY; rc = -ENOTTY;
}
return rc; return rc;
} }
#endif #endif
...@@ -150,9 +149,8 @@ static int compat_chaninfo(struct file *file, unsigned long arg) ...@@ -150,9 +149,8 @@ static int compat_chaninfo(struct file *file, unsigned long arg)
err |= __put_user(compat_ptr(temp.uptr), &chaninfo->flaglist); err |= __put_user(compat_ptr(temp.uptr), &chaninfo->flaglist);
err |= __get_user(temp.uptr, &chaninfo32->rangelist); err |= __get_user(temp.uptr, &chaninfo32->rangelist);
err |= __put_user(compat_ptr(temp.uptr), &chaninfo->rangelist); err |= __put_user(compat_ptr(temp.uptr), &chaninfo->rangelist);
if (err) { if (err)
return -EFAULT; return -EFAULT;
}
return translated_ioctl(file, COMEDI_CHANINFO, (unsigned long)chaninfo); return translated_ioctl(file, COMEDI_CHANINFO, (unsigned long)chaninfo);
} }
...@@ -182,9 +180,8 @@ static int compat_rangeinfo(struct file *file, unsigned long arg) ...@@ -182,9 +180,8 @@ static int compat_rangeinfo(struct file *file, unsigned long arg)
err |= __put_user(temp.uint, &rangeinfo->range_type); err |= __put_user(temp.uint, &rangeinfo->range_type);
err |= __get_user(temp.uptr, &rangeinfo32->range_ptr); err |= __get_user(temp.uptr, &rangeinfo32->range_ptr);
err |= __put_user(compat_ptr(temp.uptr), &rangeinfo->range_ptr); err |= __put_user(compat_ptr(temp.uptr), &rangeinfo->range_ptr);
if (err) { if (err)
return -EFAULT; return -EFAULT;
}
return translated_ioctl(file, COMEDI_RANGEINFO, return translated_ioctl(file, COMEDI_RANGEINFO,
(unsigned long)rangeinfo); (unsigned long)rangeinfo);
...@@ -300,9 +297,8 @@ static int compat_cmd(struct file *file, unsigned long arg) ...@@ -300,9 +297,8 @@ static int compat_cmd(struct file *file, unsigned long arg)
cmd = compat_alloc_user_space(sizeof(*cmd)); cmd = compat_alloc_user_space(sizeof(*cmd));
rc = get_compat_cmd(cmd, cmd32); rc = get_compat_cmd(cmd, cmd32);
if (rc) { if (rc)
return rc; return rc;
}
return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd); return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
} }
...@@ -318,19 +314,17 @@ static int compat_cmdtest(struct file *file, unsigned long arg) ...@@ -318,19 +314,17 @@ static int compat_cmdtest(struct file *file, unsigned long arg)
cmd = compat_alloc_user_space(sizeof(*cmd)); cmd = compat_alloc_user_space(sizeof(*cmd));
rc = get_compat_cmd(cmd, cmd32); rc = get_compat_cmd(cmd, cmd32);
if (rc) { if (rc)
return rc; return rc;
}
rc = translated_ioctl(file, COMEDI_CMDTEST, (unsigned long)cmd); rc = translated_ioctl(file, COMEDI_CMDTEST, (unsigned long)cmd);
if (rc < 0) { if (rc < 0)
return rc; return rc;
}
err = put_compat_cmd(cmd32, cmd); err = put_compat_cmd(cmd32, cmd);
if (err) { if (err)
rc = err; rc = err;
}
return rc; return rc;
} }
...@@ -347,9 +341,9 @@ static int get_compat_insn(comedi_insn __user *insn, ...@@ -347,9 +341,9 @@ static int get_compat_insn(comedi_insn __user *insn,
/* Copy insn structure. Ignore the unused members. */ /* Copy insn structure. Ignore the unused members. */
err = 0; err = 0;
if (!access_ok(VERIFY_READ, insn32, sizeof(*insn32)) if (!access_ok(VERIFY_READ, insn32, sizeof(*insn32))
|| !access_ok(VERIFY_WRITE, insn, sizeof(*insn))) { || !access_ok(VERIFY_WRITE, insn, sizeof(*insn)))
return -EFAULT; return -EFAULT;
}
err |= __get_user(temp.uint, &insn32->insn); err |= __get_user(temp.uint, &insn32->insn);
err |= __put_user(temp.uint, &insn->insn); err |= __put_user(temp.uint, &insn->insn);
err |= __get_user(temp.uint, &insn32->n); err |= __get_user(temp.uint, &insn32->n);
...@@ -386,9 +380,8 @@ static int compat_insnlist(struct file *file, unsigned long arg) ...@@ -386,9 +380,8 @@ static int compat_insnlist(struct file *file, unsigned long arg)
err |= __get_user(n_insns, &insnlist32->n_insns); err |= __get_user(n_insns, &insnlist32->n_insns);
err |= __get_user(uptr, &insnlist32->insns); err |= __get_user(uptr, &insnlist32->insns);
insn32 = compat_ptr(uptr); insn32 = compat_ptr(uptr);
if (err) { if (err)
return -EFAULT; return -EFAULT;
}
/* Allocate user memory to copy insnlist and insns into. */ /* Allocate user memory to copy insnlist and insns into. */
s = compat_alloc_user_space(offsetof(struct combined_insnlist, s = compat_alloc_user_space(offsetof(struct combined_insnlist,
...@@ -400,17 +393,15 @@ static int compat_insnlist(struct file *file, unsigned long arg) ...@@ -400,17 +393,15 @@ static int compat_insnlist(struct file *file, unsigned long arg)
} }
err |= __put_user(n_insns, &s->insnlist.n_insns); err |= __put_user(n_insns, &s->insnlist.n_insns);
err |= __put_user(&s->insn[0], &s->insnlist.insns); err |= __put_user(&s->insn[0], &s->insnlist.insns);
if (err) { if (err)
return -EFAULT; return -EFAULT;
}
/* Copy insn structures. */ /* Copy insn structures. */
for (n = 0; n < n_insns; n++) { for (n = 0; n < n_insns; n++) {
rc = get_compat_insn(&s->insn[n], &insn32[n]); rc = get_compat_insn(&s->insn[n], &insn32[n]);
if (rc) { if (rc)
return rc; return rc;
} }
}
return translated_ioctl(file, COMEDI_INSNLIST, return translated_ioctl(file, COMEDI_INSNLIST,
(unsigned long)&s->insnlist); (unsigned long)&s->insnlist);
...@@ -427,9 +418,8 @@ static int compat_insn(struct file *file, unsigned long arg) ...@@ -427,9 +418,8 @@ static int compat_insn(struct file *file, unsigned long arg)
insn = compat_alloc_user_space(sizeof(*insn)); insn = compat_alloc_user_space(sizeof(*insn));
rc = get_compat_insn(insn, insn32); rc = get_compat_insn(insn, insn32);
if (rc) { if (rc)
return rc; return rc;
}
return translated_ioctl(file, COMEDI_INSN, (unsigned long)insn); return translated_ioctl(file, COMEDI_INSN, (unsigned long)insn);
} }
...@@ -512,14 +502,14 @@ static int mapped_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, ...@@ -512,14 +502,14 @@ static int mapped_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
int rc; int rc;
/* Make sure we are dealing with a Comedi device. */ /* Make sure we are dealing with a Comedi device. */
if (imajor(file->f_dentry->d_inode) != COMEDI_MAJOR) { if (imajor(file->f_dentry->d_inode) != COMEDI_MAJOR)
return -ENOTTY; return -ENOTTY;
}
rc = raw_ioctl(file, cmd, arg); rc = raw_ioctl(file, cmd, arg);
/* Do not return -ENOIOCTLCMD. */ /* Do not return -ENOIOCTLCMD. */
if (rc == -ENOIOCTLCMD) { if (rc == -ENOIOCTLCMD)
rc = -ENOTTY; rc = -ENOTTY;
}
return rc; return rc;
} }
......
...@@ -1080,9 +1080,8 @@ static int icp_multi_detach(comedi_device *dev) ...@@ -1080,9 +1080,8 @@ static int icp_multi_detach(comedi_device *dev)
if (dev->private && devpriv->card) if (dev->private && devpriv->card)
pci_card_free(devpriv->card); pci_card_free(devpriv->card);
if (--pci_list_builded == 0) { if (--pci_list_builded == 0)
pci_card_list_cleanup(PCI_VENDOR_ID_ICP); pci_card_list_cleanup(PCI_VENDOR_ID_ICP);
}
return 0; return 0;
} }
...@@ -378,9 +378,9 @@ static int me4000_probe(comedi_device *dev, comedi_devconfig *it) ...@@ -378,9 +378,9 @@ static int me4000_probe(comedi_device *dev, comedi_devconfig *it)
CALL_PDEBUG("In me4000_probe()\n"); CALL_PDEBUG("In me4000_probe()\n");
/* Allocate private memory */ /* Allocate private memory */
if (alloc_private(dev, sizeof(me4000_info_t)) < 0) { if (alloc_private(dev, sizeof(me4000_info_t)) < 0)
return -ENOMEM; return -ENOMEM;
}
/* /*
* Probe the device to determine what device in the series it is. * Probe the device to determine what device in the series it is.
*/ */
...@@ -576,15 +576,13 @@ static int init_board_info(comedi_device *dev, struct pci_dev *pci_dev_p) ...@@ -576,15 +576,13 @@ static int init_board_info(comedi_device *dev, struct pci_dev *pci_dev_p)
/* Get the serial number */ /* Get the serial number */
result = pci_read_config_dword(pci_dev_p, 0x2C, &info->serial_no); result = pci_read_config_dword(pci_dev_p, 0x2C, &info->serial_no);
if (result != PCIBIOS_SUCCESSFUL) { if (result != PCIBIOS_SUCCESSFUL)
return result; return result;
}
/* Get the hardware revision */ /* Get the hardware revision */
result = pci_read_config_byte(pci_dev_p, 0x08, &info->hw_revision); result = pci_read_config_byte(pci_dev_p, 0x08, &info->hw_revision);
if (result != PCIBIOS_SUCCESSFUL) { if (result != PCIBIOS_SUCCESSFUL)
return result; return result;
}
/* Get the vendor id */ /* Get the vendor id */
info->vendor_id = pci_dev_p->vendor; info->vendor_id = pci_dev_p->vendor;
...@@ -902,9 +900,8 @@ static int me4000_detach(comedi_device *dev) ...@@ -902,9 +900,8 @@ static int me4000_detach(comedi_device *dev)
if (info) { if (info) {
if (info->pci_dev_p) { if (info->pci_dev_p) {
reset_board(dev); reset_board(dev);
if (info->plx_regbase) { if (info->plx_regbase)
comedi_pci_disable(info->pci_dev_p); comedi_pci_disable(info->pci_dev_p);
}
pci_dev_put(info->pci_dev_p); pci_dev_put(info->pci_dev_p);
} }
} }
...@@ -1163,9 +1160,8 @@ static int ai_round_cmd_args(comedi_device *dev, ...@@ -1163,9 +1160,8 @@ static int ai_round_cmd_args(comedi_device *dev,
rest = (cmd->start_arg * 33) % 1000; rest = (cmd->start_arg * 33) % 1000;
if (cmd->flags & TRIG_ROUND_NEAREST) { if (cmd->flags & TRIG_ROUND_NEAREST) {
if (rest > 33) { if (rest > 33)
(*init_ticks)++; (*init_ticks)++;
}
} else if (cmd->flags & TRIG_ROUND_UP) { } else if (cmd->flags & TRIG_ROUND_UP) {
if (rest) if (rest)
(*init_ticks)++; (*init_ticks)++;
...@@ -1177,9 +1173,8 @@ static int ai_round_cmd_args(comedi_device *dev, ...@@ -1177,9 +1173,8 @@ static int ai_round_cmd_args(comedi_device *dev,
rest = (cmd->scan_begin_arg * 33) % 1000; rest = (cmd->scan_begin_arg * 33) % 1000;
if (cmd->flags & TRIG_ROUND_NEAREST) { if (cmd->flags & TRIG_ROUND_NEAREST) {
if (rest > 33) { if (rest > 33)
(*scan_ticks)++; (*scan_ticks)++;
}
} else if (cmd->flags & TRIG_ROUND_UP) { } else if (cmd->flags & TRIG_ROUND_UP) {
if (rest) if (rest)
(*scan_ticks)++; (*scan_ticks)++;
...@@ -1191,9 +1186,8 @@ static int ai_round_cmd_args(comedi_device *dev, ...@@ -1191,9 +1186,8 @@ static int ai_round_cmd_args(comedi_device *dev,
rest = (cmd->convert_arg * 33) % 1000; rest = (cmd->convert_arg * 33) % 1000;
if (cmd->flags & TRIG_ROUND_NEAREST) { if (cmd->flags & TRIG_ROUND_NEAREST) {
if (rest > 33) { if (rest > 33)
(*chan_ticks)++; (*chan_ticks)++;
}
} else if (cmd->flags & TRIG_ROUND_UP) { } else if (cmd->flags & TRIG_ROUND_UP) {
if (rest) if (rest)
(*chan_ticks)++; (*chan_ticks)++;
...@@ -1503,9 +1497,8 @@ static int me4000_ai_do_cmd_test(comedi_device *dev, ...@@ -1503,9 +1497,8 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
cmd->stop_src = TRIG_NONE; cmd->stop_src = TRIG_NONE;
err++; err++;
} }
if (err) { if (err)
return 1; return 1;
}
/* /*
* Stage 2. Check for trigger source conflicts. * Stage 2. Check for trigger source conflicts.
...@@ -1553,9 +1546,8 @@ static int me4000_ai_do_cmd_test(comedi_device *dev, ...@@ -1553,9 +1546,8 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
cmd->scan_end_src = TRIG_NONE; cmd->scan_end_src = TRIG_NONE;
err++; err++;
} }
if (err) { if (err)
return 2; return 2;
}
/* /*
* Stage 3. Check if arguments are generally valid. * Stage 3. Check if arguments are generally valid.
...@@ -1588,9 +1580,9 @@ static int me4000_ai_do_cmd_test(comedi_device *dev, ...@@ -1588,9 +1580,9 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
cmd->convert_arg = 2000; cmd->convert_arg = 2000;
err++; err++;
} }
if (err) {
if (err)
return 3; return 3;
}
/* /*
* Stage 4. Check for argument conflicts. * Stage 4. Check for argument conflicts.
...@@ -1735,9 +1727,9 @@ static int me4000_ai_do_cmd_test(comedi_device *dev, ...@@ -1735,9 +1727,9 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
err++; err++;
} }
} }
if (err) {
if (err)
return 4; return 4;
}
/* /*
* Stage 5. Check the channel list. * Stage 5. Check the channel list.
...@@ -1997,9 +1989,9 @@ static int me4000_dio_insn_bits(comedi_device *dev, ...@@ -1997,9 +1989,9 @@ static int me4000_dio_insn_bits(comedi_device *dev,
CALL_PDEBUG("In me4000_dio_insn_bits()\n"); CALL_PDEBUG("In me4000_dio_insn_bits()\n");
/* Length of data must be 2 (mask and new data, see below) */ /* Length of data must be 2 (mask and new data, see below) */
if (insn->n == 0) { if (insn->n == 0)
return 0; return 0;
}
if (insn->n != 2) { if (insn->n != 2) {
printk("comedi%d: me4000: me4000_dio_insn_bits(): Invalid instruction length\n", dev->minor); printk("comedi%d: me4000: me4000_dio_insn_bits(): Invalid instruction length\n", dev->minor);
return -EINVAL; return -EINVAL;
...@@ -2274,9 +2266,9 @@ static int me4000_cnt_insn_read(comedi_device *dev, ...@@ -2274,9 +2266,9 @@ static int me4000_cnt_insn_read(comedi_device *dev,
CALL_PDEBUG("In me4000_cnt_insn_read()\n"); CALL_PDEBUG("In me4000_cnt_insn_read()\n");
if (insn->n == 0) { if (insn->n == 0)
return 0; return 0;
}
if (insn->n > 1) { if (insn->n > 1) {
printk(KERN_ERR printk(KERN_ERR
"comedi%d: me4000: me4000_cnt_insn_read(): Invalid instruction length %d\n", "comedi%d: me4000: me4000_cnt_insn_read(): Invalid instruction length %d\n",
......
...@@ -331,9 +331,9 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring, comedi_async * async) ...@@ -331,9 +331,9 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring, comedi_async * async)
ring->descriptors_dma_addr = 0; ring->descriptors_dma_addr = 0;
ring->n_links = 0; ring->n_links = 0;
if (async->prealloc_bufsz == 0) { if (async->prealloc_bufsz == 0)
return 0; return 0;
}
n_links = async->prealloc_bufsz >> PAGE_SHIFT; n_links = async->prealloc_bufsz >> PAGE_SHIFT;
MDPRINTK("ring->hw_dev=%p, n_links=0x%04x\n", ring->hw_dev, n_links); MDPRINTK("ring->hw_dev=%p, n_links=0x%04x\n", ring->hw_dev, n_links);
...@@ -395,9 +395,9 @@ void mite_prep_dma(struct mite_channel *mite_chan, ...@@ -395,9 +395,9 @@ void mite_prep_dma(struct mite_channel *mite_chan,
on e-series boards. */ on e-series boards. */
chcr |= CHCR_BYTE_SWAP_DEVICE | CHCR_BYTE_SWAP_MEMORY; chcr |= CHCR_BYTE_SWAP_DEVICE | CHCR_BYTE_SWAP_MEMORY;
} }
if (mite_chan->dir == COMEDI_INPUT) { if (mite_chan->dir == COMEDI_INPUT)
chcr |= CHCR_DEV_TO_MEM; chcr |= CHCR_DEV_TO_MEM;
}
writel(chcr, mite->mite_io_addr + MITE_CHCR(mite_chan->channel)); writel(chcr, mite->mite_io_addr + MITE_CHCR(mite_chan->channel));
/* to/from memory */ /* to/from memory */
...@@ -547,9 +547,9 @@ int mite_sync_input_dma(struct mite_channel *mite_chan, comedi_async * async) ...@@ -547,9 +547,9 @@ int mite_sync_input_dma(struct mite_channel *mite_chan, comedi_async * async)
count = nbytes - async->buf_write_count; count = nbytes - async->buf_write_count;
/* it's possible count will be negative due to /* it's possible count will be negative due to
* conservative value returned by mite_bytes_written_to_memory_lb */ * conservative value returned by mite_bytes_written_to_memory_lb */
if (count <= 0) { if (count <= 0)
return 0; return 0;
}
comedi_buf_write_free(async, count); comedi_buf_write_free(async, count);
async->scan_progress += count; async->scan_progress += count;
...@@ -586,9 +586,9 @@ int mite_sync_output_dma(struct mite_channel *mite_chan, comedi_async * async) ...@@ -586,9 +586,9 @@ int mite_sync_output_dma(struct mite_channel *mite_chan, comedi_async * async)
return -1; return -1;
} }
count = nbytes_lb - async->buf_read_count; count = nbytes_lb - async->buf_read_count;
if (count <= 0) { if (count <= 0)
return 0; return 0;
}
if (count) { if (count) {
comedi_buf_read_free(async, count); comedi_buf_read_free(async, count);
async->events |= COMEDI_CB_BLOCK; async->events |= COMEDI_CB_BLOCK;
...@@ -753,10 +753,9 @@ static void mite_decode(char **bit_str, unsigned int bits) ...@@ -753,10 +753,9 @@ static void mite_decode(char **bit_str, unsigned int bits)
int i; int i;
for (i = 31; i >= 0; i--) { for (i = 31; i >= 0; i--) {
if (bits & (1 << i)) { if (bits & (1 << i))
printk(" %s", bit_str[i]); printk(" %s", bit_str[i]);
} }
}
printk("\n"); printk("\n");
} }
#endif #endif
......
...@@ -394,9 +394,9 @@ static inline int plx9080_abort_dma(void *iobase, unsigned int channel) ...@@ -394,9 +394,9 @@ static inline int plx9080_abort_dma(void *iobase, unsigned int channel)
/* abort dma transfer if necessary */ /* abort dma transfer if necessary */
dma_status = readb(dma_cs_addr); dma_status = readb(dma_cs_addr);
if ((dma_status & PLX_DMA_EN_BIT) == 0) { if ((dma_status & PLX_DMA_EN_BIT) == 0)
return 0; return 0;
}
/* wait to make sure done bit is zero */ /* wait to make sure done bit is zero */
for (i = 0; (dma_status & PLX_DMA_DONE_BIT) && i < timeout; i++) { for (i = 0; (dma_status & PLX_DMA_DONE_BIT) && i < timeout; i++) {
comedi_udelay(1); comedi_udelay(1);
......
...@@ -1290,18 +1290,15 @@ static int s626_detach(comedi_device *dev) ...@@ -1290,18 +1290,15 @@ static int s626_detach(comedi_device *dev)
CloseDMAB(dev, &devpriv->ANABuf, DMABUF_SIZE); CloseDMAB(dev, &devpriv->ANABuf, DMABUF_SIZE);
} }
if (dev->irq) { if (dev->irq)
comedi_free_irq(dev->irq, dev); comedi_free_irq(dev->irq, dev);
}
if (devpriv->base_addr) { if (devpriv->base_addr)
iounmap(devpriv->base_addr); iounmap(devpriv->base_addr);
}
if (devpriv->pdev) { if (devpriv->pdev) {
if (devpriv->got_regions) { if (devpriv->got_regions)
comedi_pci_disable(devpriv->pdev); comedi_pci_disable(devpriv->pdev);
}
pci_dev_put(devpriv->pdev); pci_dev_put(devpriv->pdev);
} }
} }
...@@ -2072,9 +2069,8 @@ static int s626_ao_rinsn(comedi_device *dev, comedi_subdevice *s, ...@@ -2072,9 +2069,8 @@ static int s626_ao_rinsn(comedi_device *dev, comedi_subdevice *s,
{ {
int i; int i;
for (i = 0; i < insn->n; i++) { for (i = 0; i < insn->n; i++)
data[i] = devpriv->ao_readback[CR_CHAN(insn->chanspec)]; data[i] = devpriv->ao_readback[CR_CHAN(insn->chanspec)];
}
return i; return i;
} }
...@@ -2119,9 +2115,9 @@ static int s626_dio_insn_bits(comedi_device *dev, comedi_subdevice *s, ...@@ -2119,9 +2115,9 @@ static int s626_dio_insn_bits(comedi_device *dev, comedi_subdevice *s,
{ {
/* Length of data must be 2 (mask and new data, see below) */ /* Length of data must be 2 (mask and new data, see below) */
if (insn->n == 0) { if (insn->n == 0)
return 0; return 0;
}
if (insn->n != 2) { if (insn->n != 2) {
printk("comedi%d: s626: s626_dio_insn_bits(): Invalid instruction length\n", dev->minor); printk("comedi%d: s626: s626_dio_insn_bits(): Invalid instruction length\n", dev->minor);
return -EINVAL; return -EINVAL;
......
...@@ -160,9 +160,9 @@ int comedi_get_krange(comedi_t *d, unsigned int subdevice, unsigned int chan, ...@@ -160,9 +160,9 @@ int comedi_get_krange(comedi_t *d, unsigned int subdevice, unsigned int chan,
} else { } else {
lr = s->range_table; lr = s->range_table;
} }
if (range >= lr->length) { if (range >= lr->length)
return -EINVAL; return -EINVAL;
}
memcpy(krange, lr->range + range, sizeof(comedi_krange)); memcpy(krange, lr->range + range, sizeof(comedi_krange));
return 0; return 0;
......
...@@ -331,9 +331,9 @@ int comedi_lock(comedi_t *d, unsigned int subdevice) ...@@ -331,9 +331,9 @@ int comedi_lock(comedi_t *d, unsigned int subdevice)
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0;
if (subdevice >= dev->n_subdevices) { if (subdevice >= dev->n_subdevices)
return -EINVAL; return -EINVAL;
}
s = dev->subdevices + subdevice; s = dev->subdevices + subdevice;
comedi_spin_lock_irqsave(&s->spin_lock, flags); comedi_spin_lock_irqsave(&s->spin_lock, flags);
...@@ -375,9 +375,9 @@ int comedi_unlock(comedi_t *d, unsigned int subdevice) ...@@ -375,9 +375,9 @@ int comedi_unlock(comedi_t *d, unsigned int subdevice)
comedi_async *async; comedi_async *async;
int ret; int ret;
if (subdevice >= dev->n_subdevices) { if (subdevice >= dev->n_subdevices)
return -EINVAL; return -EINVAL;
}
s = dev->subdevices + subdevice; s = dev->subdevices + subdevice;
async = s->async; async = s->async;
...@@ -425,9 +425,9 @@ int comedi_cancel(comedi_t *d, unsigned int subdevice) ...@@ -425,9 +425,9 @@ int comedi_cancel(comedi_t *d, unsigned int subdevice)
comedi_subdevice *s; comedi_subdevice *s;
int ret = 0; int ret = 0;
if (subdevice >= dev->n_subdevices) { if (subdevice >= dev->n_subdevices)
return -EINVAL; return -EINVAL;
}
s = dev->subdevices + subdevice; s = dev->subdevices + subdevice;
if (s->lock && s->lock != d) if (s->lock && s->lock != d)
...@@ -450,9 +450,9 @@ int comedi_cancel(comedi_t *d, unsigned int subdevice) ...@@ -450,9 +450,9 @@ int comedi_cancel(comedi_t *d, unsigned int subdevice)
return ret; return ret;
#ifdef CONFIG_COMEDI_RT #ifdef CONFIG_COMEDI_RT
if (comedi_get_subdevice_runflags(s) & SRF_RT) { if (comedi_get_subdevice_runflags(s) & SRF_RT)
comedi_switch_to_non_rt(dev); comedi_switch_to_non_rt(dev);
}
#endif #endif
comedi_set_subdevice_runflags(s, SRF_RUNNING | SRF_RT, 0); comedi_set_subdevice_runflags(s, SRF_RUNNING | SRF_RT, 0);
s->async->inttrig = NULL; s->async->inttrig = NULL;
...@@ -471,9 +471,9 @@ int comedi_register_callback(comedi_t *d, unsigned int subdevice, ...@@ -471,9 +471,9 @@ int comedi_register_callback(comedi_t *d, unsigned int subdevice,
comedi_subdevice *s; comedi_subdevice *s;
comedi_async *async; comedi_async *async;
if (subdevice >= dev->n_subdevices) { if (subdevice >= dev->n_subdevices)
return -EINVAL; return -EINVAL;
}
s = dev->subdevices + subdevice; s = dev->subdevices + subdevice;
async = s->async; async = s->async;
...@@ -507,9 +507,9 @@ int comedi_poll(comedi_t *d, unsigned int subdevice) ...@@ -507,9 +507,9 @@ int comedi_poll(comedi_t *d, unsigned int subdevice)
comedi_subdevice *s = dev->subdevices; comedi_subdevice *s = dev->subdevices;
comedi_async *async; comedi_async *async;
if (subdevice >= dev->n_subdevices) { if (subdevice >= dev->n_subdevices)
return -EINVAL; return -EINVAL;
}
s = dev->subdevices + subdevice; s = dev->subdevices + subdevice;
async = s->async; async = s->async;
...@@ -533,17 +533,16 @@ int comedi_map(comedi_t *d, unsigned int subdevice, void *ptr) ...@@ -533,17 +533,16 @@ int comedi_map(comedi_t *d, unsigned int subdevice, void *ptr)
comedi_device *dev = (comedi_device *) d; comedi_device *dev = (comedi_device *) d;
comedi_subdevice *s; comedi_subdevice *s;
if (subdevice >= dev->n_subdevices) { if (subdevice >= dev->n_subdevices)
return -EINVAL; return -EINVAL;
}
s = dev->subdevices + subdevice; s = dev->subdevices + subdevice;
if (!s->async) if (!s->async)
return -EINVAL; return -EINVAL;
if (ptr) { if (ptr)
*((void **)ptr) = s->async->prealloc_buf; *((void **)ptr) = s->async->prealloc_buf;
}
/* XXX no reference counting */ /* XXX no reference counting */
...@@ -556,9 +555,9 @@ int comedi_unmap(comedi_t *d, unsigned int subdevice) ...@@ -556,9 +555,9 @@ int comedi_unmap(comedi_t *d, unsigned int subdevice)
comedi_device *dev = (comedi_device *) d; comedi_device *dev = (comedi_device *) d;
comedi_subdevice *s; comedi_subdevice *s;
if (subdevice >= dev->n_subdevices) { if (subdevice >= dev->n_subdevices)
return -EINVAL; return -EINVAL;
}
s = dev->subdevices + subdevice; s = dev->subdevices + subdevice;
if (!s->async) if (!s->async)
......
...@@ -67,9 +67,8 @@ int comedi_read_procmem(char *buf, char **start, off_t offset, int len, ...@@ -67,9 +67,8 @@ int comedi_read_procmem(char *buf, char **start, off_t offset, int len,
dev->board_name, dev->n_subdevices); dev->board_name, dev->n_subdevices);
} }
} }
if (!devices_q) { if (!devices_q)
l += sprintf(buf + l, "no devices\n"); l += sprintf(buf + l, "no devices\n");
}
for (driv = comedi_drivers; driv; driv = driv->next) { for (driv = comedi_drivers; driv; driv = driv->next) {
l += sprintf(buf + l, "%s:\n", driv->driver_name); l += sprintf(buf + l, "%s:\n", driv->driver_name);
...@@ -78,10 +77,9 @@ int comedi_read_procmem(char *buf, char **start, off_t offset, int len, ...@@ -78,10 +77,9 @@ int comedi_read_procmem(char *buf, char **start, off_t offset, int len,
*(char **)((char *)driv->board_name + *(char **)((char *)driv->board_name +
i * driv->offset)); i * driv->offset));
} }
if (!driv->num_names) { if (!driv->num_names)
l += sprintf(buf + l, " %s\n", driv->driver_name); l += sprintf(buf + l, " %s\n", driv->driver_name);
} }
}
return l; return l;
} }
......
...@@ -135,9 +135,8 @@ int check_chanlist(comedi_subdevice *s, int n, unsigned int *chanlist) ...@@ -135,9 +135,8 @@ int check_chanlist(comedi_subdevice *s, int n, unsigned int *chanlist)
i, chanlist[i], s->n_chan, i, chanlist[i], s->n_chan,
s->range_table->length); s->range_table->length);
#if 0 #if 0
for (i = 0; i < n; i++) { for (i = 0; i < n; i++)
printk("[%d]=0x%08x\n", i, chanlist[i]); printk("[%d]=0x%08x\n", i, chanlist[i]);
}
#endif #endif
return -EINVAL; return -EINVAL;
} }
......
...@@ -84,9 +84,9 @@ int comedi_request_irq(unsigned irq, irqreturn_t(*handler) (int, ...@@ -84,9 +84,9 @@ int comedi_request_irq(unsigned irq, irqreturn_t(*handler) (int,
("comedi: cannot get unshared interrupt, will not use RT interrupts.\n"); ("comedi: cannot get unshared interrupt, will not use RT interrupts.\n");
ret = request_irq(irq, handler, flags, device, dev_id); ret = request_irq(irq, handler, flags, device, dev_id);
} }
if (ret < 0) { if (ret < 0)
return ret; return ret;
}
} else { } else {
it = kzalloc(sizeof(struct comedi_irq_struct), GFP_KERNEL); it = kzalloc(sizeof(struct comedi_irq_struct), GFP_KERNEL);
if (!it) if (!it)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment