Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 141492
b: refs/heads/master
c: 82675f3
h: refs/heads/master
v: v3
  • Loading branch information
Bill Pemberton authored and Greg Kroah-Hartman committed Apr 3, 2009
1 parent ebf70fa commit ff7f474
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 109 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dedd1325f1d53e2a2604457c4b3af9e62dde5001
refs/heads/master: 82675f3547ba2a0732beabd9bb4393535f74408c
50 changes: 20 additions & 30 deletions trunk/drivers/staging/comedi/comedi_compat32.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,14 @@ typedef struct comedi32_insnlist_struct {
static int translated_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
if (!file->f_op) {
if (!file->f_op)
return -ENOTTY;
}

#ifdef HAVE_UNLOCKED_IOCTL
if (file->f_op->unlocked_ioctl) {
int rc = (int)(*file->f_op->unlocked_ioctl)(file, cmd, arg);
if (rc == -ENOIOCTLCMD) {
if (rc == -ENOIOCTLCMD)
rc = -ENOTTY;
}
return rc;
}
#endif
Expand Down Expand Up @@ -150,9 +149,8 @@ static int compat_chaninfo(struct file *file, unsigned long arg)
err |= __put_user(compat_ptr(temp.uptr), &chaninfo->flaglist);
err |= __get_user(temp.uptr, &chaninfo32->rangelist);
err |= __put_user(compat_ptr(temp.uptr), &chaninfo->rangelist);
if (err) {
if (err)
return -EFAULT;
}

return translated_ioctl(file, COMEDI_CHANINFO, (unsigned long)chaninfo);
}
Expand Down Expand Up @@ -182,9 +180,8 @@ static int compat_rangeinfo(struct file *file, unsigned long arg)
err |= __put_user(temp.uint, &rangeinfo->range_type);
err |= __get_user(temp.uptr, &rangeinfo32->range_ptr);
err |= __put_user(compat_ptr(temp.uptr), &rangeinfo->range_ptr);
if (err) {
if (err)
return -EFAULT;
}

return translated_ioctl(file, COMEDI_RANGEINFO,
(unsigned long)rangeinfo);
Expand Down Expand Up @@ -300,9 +297,8 @@ static int compat_cmd(struct file *file, unsigned long arg)
cmd = compat_alloc_user_space(sizeof(*cmd));

rc = get_compat_cmd(cmd, cmd32);
if (rc) {
if (rc)
return rc;
}

return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
}
Expand All @@ -318,19 +314,17 @@ static int compat_cmdtest(struct file *file, unsigned long arg)
cmd = compat_alloc_user_space(sizeof(*cmd));

rc = get_compat_cmd(cmd, cmd32);
if (rc) {
if (rc)
return rc;
}

rc = translated_ioctl(file, COMEDI_CMDTEST, (unsigned long)cmd);
if (rc < 0) {
if (rc < 0)
return rc;
}

err = put_compat_cmd(cmd32, cmd);
if (err) {
if (err)
rc = err;
}

return rc;
}

Expand All @@ -347,9 +341,9 @@ static int get_compat_insn(comedi_insn __user *insn,
/* Copy insn structure. Ignore the unused members. */
err = 0;
if (!access_ok(VERIFY_READ, insn32, sizeof(*insn32))
|| !access_ok(VERIFY_WRITE, insn, sizeof(*insn))) {
|| !access_ok(VERIFY_WRITE, insn, sizeof(*insn)))
return -EFAULT;
}

err |= __get_user(temp.uint, &insn32->insn);
err |= __put_user(temp.uint, &insn->insn);
err |= __get_user(temp.uint, &insn32->n);
Expand Down Expand Up @@ -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(uptr, &insnlist32->insns);
insn32 = compat_ptr(uptr);
if (err) {
if (err)
return -EFAULT;
}

/* Allocate user memory to copy insnlist and insns into. */
s = compat_alloc_user_space(offsetof(struct combined_insnlist,
Expand All @@ -400,16 +393,14 @@ static int compat_insnlist(struct file *file, unsigned long arg)
}
err |= __put_user(n_insns, &s->insnlist.n_insns);
err |= __put_user(&s->insn[0], &s->insnlist.insns);
if (err) {
if (err)
return -EFAULT;
}

/* Copy insn structures. */
for (n = 0; n < n_insns; n++) {
rc = get_compat_insn(&s->insn[n], &insn32[n]);
if (rc) {
if (rc)
return rc;
}
}

return translated_ioctl(file, COMEDI_INSNLIST,
Expand All @@ -427,9 +418,8 @@ static int compat_insn(struct file *file, unsigned long arg)
insn = compat_alloc_user_space(sizeof(*insn));

rc = get_compat_insn(insn, insn32);
if (rc) {
if (rc)
return rc;
}

return translated_ioctl(file, COMEDI_INSN, (unsigned long)insn);
}
Expand Down Expand Up @@ -512,14 +502,14 @@ static int mapped_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
int rc;

/* 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;
}

rc = raw_ioctl(file, cmd, arg);
/* Do not return -ENOIOCTLCMD. */
if (rc == -ENOIOCTLCMD) {
if (rc == -ENOIOCTLCMD)
rc = -ENOTTY;
}

return rc;
}

Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/icp_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1080,9 +1080,8 @@ static int icp_multi_detach(comedi_device *dev)
if (dev->private && 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);
}

return 0;
}
44 changes: 18 additions & 26 deletions trunk/drivers/staging/comedi/drivers/me4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,9 @@ static int me4000_probe(comedi_device *dev, comedi_devconfig *it)
CALL_PDEBUG("In me4000_probe()\n");

/* Allocate private memory */
if (alloc_private(dev, sizeof(me4000_info_t)) < 0) {
if (alloc_private(dev, sizeof(me4000_info_t)) < 0)
return -ENOMEM;
}

/*
* Probe the device to determine what device in the series it is.
*/
Expand Down Expand Up @@ -576,15 +576,13 @@ static int init_board_info(comedi_device *dev, struct pci_dev *pci_dev_p)

/* Get the serial number */
result = pci_read_config_dword(pci_dev_p, 0x2C, &info->serial_no);
if (result != PCIBIOS_SUCCESSFUL) {
if (result != PCIBIOS_SUCCESSFUL)
return result;
}

/* Get the hardware revision */
result = pci_read_config_byte(pci_dev_p, 0x08, &info->hw_revision);
if (result != PCIBIOS_SUCCESSFUL) {
if (result != PCIBIOS_SUCCESSFUL)
return result;
}

/* Get the vendor id */
info->vendor_id = pci_dev_p->vendor;
Expand Down Expand Up @@ -902,9 +900,8 @@ static int me4000_detach(comedi_device *dev)
if (info) {
if (info->pci_dev_p) {
reset_board(dev);
if (info->plx_regbase) {
if (info->plx_regbase)
comedi_pci_disable(info->pci_dev_p);
}
pci_dev_put(info->pci_dev_p);
}
}
Expand Down Expand Up @@ -1163,9 +1160,8 @@ static int ai_round_cmd_args(comedi_device *dev,
rest = (cmd->start_arg * 33) % 1000;

if (cmd->flags & TRIG_ROUND_NEAREST) {
if (rest > 33) {
if (rest > 33)
(*init_ticks)++;
}
} else if (cmd->flags & TRIG_ROUND_UP) {
if (rest)
(*init_ticks)++;
Expand All @@ -1177,9 +1173,8 @@ static int ai_round_cmd_args(comedi_device *dev,
rest = (cmd->scan_begin_arg * 33) % 1000;

if (cmd->flags & TRIG_ROUND_NEAREST) {
if (rest > 33) {
if (rest > 33)
(*scan_ticks)++;
}
} else if (cmd->flags & TRIG_ROUND_UP) {
if (rest)
(*scan_ticks)++;
Expand All @@ -1191,9 +1186,8 @@ static int ai_round_cmd_args(comedi_device *dev,
rest = (cmd->convert_arg * 33) % 1000;

if (cmd->flags & TRIG_ROUND_NEAREST) {
if (rest > 33) {
if (rest > 33)
(*chan_ticks)++;
}
} else if (cmd->flags & TRIG_ROUND_UP) {
if (rest)
(*chan_ticks)++;
Expand Down Expand Up @@ -1503,9 +1497,8 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
cmd->stop_src = TRIG_NONE;
err++;
}
if (err) {
if (err)
return 1;
}

/*
* Stage 2. Check for trigger source conflicts.
Expand Down Expand Up @@ -1553,9 +1546,8 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
cmd->scan_end_src = TRIG_NONE;
err++;
}
if (err) {
if (err)
return 2;
}

/*
* Stage 3. Check if arguments are generally valid.
Expand Down Expand Up @@ -1588,9 +1580,9 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
cmd->convert_arg = 2000;
err++;
}
if (err) {

if (err)
return 3;
}

/*
* Stage 4. Check for argument conflicts.
Expand Down Expand Up @@ -1735,9 +1727,9 @@ static int me4000_ai_do_cmd_test(comedi_device *dev,
err++;
}
}
if (err) {

if (err)
return 4;
}

/*
* Stage 5. Check the channel list.
Expand Down Expand Up @@ -1997,9 +1989,9 @@ static int me4000_dio_insn_bits(comedi_device *dev,
CALL_PDEBUG("In me4000_dio_insn_bits()\n");

/* Length of data must be 2 (mask and new data, see below) */
if (insn->n == 0) {
if (insn->n == 0)
return 0;
}

if (insn->n != 2) {
printk("comedi%d: me4000: me4000_dio_insn_bits(): Invalid instruction length\n", dev->minor);
return -EINVAL;
Expand Down Expand Up @@ -2274,9 +2266,9 @@ static int me4000_cnt_insn_read(comedi_device *dev,

CALL_PDEBUG("In me4000_cnt_insn_read()\n");

if (insn->n == 0) {
if (insn->n == 0)
return 0;
}

if (insn->n > 1) {
printk(KERN_ERR
"comedi%d: me4000: me4000_cnt_insn_read(): Invalid instruction length %d\n",
Expand Down
19 changes: 9 additions & 10 deletions trunk/drivers/staging/comedi/drivers/mite.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring, comedi_async * async)
ring->descriptors_dma_addr = 0;
ring->n_links = 0;

if (async->prealloc_bufsz == 0) {
if (async->prealloc_bufsz == 0)
return 0;
}

n_links = async->prealloc_bufsz >> PAGE_SHIFT;

MDPRINTK("ring->hw_dev=%p, n_links=0x%04x\n", ring->hw_dev, n_links);
Expand Down Expand Up @@ -395,9 +395,9 @@ void mite_prep_dma(struct mite_channel *mite_chan,
on e-series boards. */
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;
}

writel(chcr, mite->mite_io_addr + MITE_CHCR(mite_chan->channel));

/* to/from memory */
Expand Down Expand Up @@ -547,9 +547,9 @@ int mite_sync_input_dma(struct mite_channel *mite_chan, comedi_async * async)
count = nbytes - async->buf_write_count;
/* it's possible count will be negative due to
* conservative value returned by mite_bytes_written_to_memory_lb */
if (count <= 0) {
if (count <= 0)
return 0;
}

comedi_buf_write_free(async, count);

async->scan_progress += count;
Expand Down Expand Up @@ -586,9 +586,9 @@ int mite_sync_output_dma(struct mite_channel *mite_chan, comedi_async * async)
return -1;
}
count = nbytes_lb - async->buf_read_count;
if (count <= 0) {
if (count <= 0)
return 0;
}

if (count) {
comedi_buf_read_free(async, count);
async->events |= COMEDI_CB_BLOCK;
Expand Down Expand Up @@ -753,9 +753,8 @@ static void mite_decode(char **bit_str, unsigned int bits)
int i;

for (i = 31; i >= 0; i--) {
if (bits & (1 << i)) {
if (bits & (1 << i))
printk(" %s", bit_str[i]);
}
}
printk("\n");
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/staging/comedi/drivers/plx9080.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,9 @@ static inline int plx9080_abort_dma(void *iobase, unsigned int channel)

/* abort dma transfer if necessary */
dma_status = readb(dma_cs_addr);
if ((dma_status & PLX_DMA_EN_BIT) == 0) {
if ((dma_status & PLX_DMA_EN_BIT) == 0)
return 0;
}

/* wait to make sure done bit is zero */
for (i = 0; (dma_status & PLX_DMA_DONE_BIT) && i < timeout; i++) {
comedi_udelay(1);
Expand Down
Loading

0 comments on commit ff7f474

Please sign in to comment.