]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
Staging: comedi: Remove curly braces where they are not needed
authorBill Pemberton <wfp5p@virginia.edu>
Tue, 17 Mar 2009 02:04:23 +0000 (22:04 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 3 Apr 2009 21:53:54 +0000 (14:53 -0700)
Changes as suggested by checkpatch.pl.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/comedi/comedi_compat32.c
drivers/staging/comedi/drivers/icp_multi.c
drivers/staging/comedi/drivers/me4000.c
drivers/staging/comedi/drivers/mite.c
drivers/staging/comedi/drivers/plx9080.h
drivers/staging/comedi/drivers/s626.c
drivers/staging/comedi/kcomedilib/get.c
drivers/staging/comedi/kcomedilib/kcomedilib_main.c
drivers/staging/comedi/proc.c
drivers/staging/comedi/range.c
drivers/staging/comedi/rt.c

index 98e570a2cb3e8afb1f0a83d9e16fb5f65aaf097f..7f5a86903c6faf546cb1217ac849a705a2c14a4f 100644 (file)
@@ -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
@@ -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);
 }
@@ -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);
@@ -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);
 }
@@ -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;
 }
 
@@ -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);
@@ -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,
@@ -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,
@@ -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);
 }
@@ -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;
 }
 
index 9603d9e24d30320729ef190524e295d5ba8182be..d9ff568744832b4744ea61c5d0410bd713a5adfe 100644 (file)
@@ -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;
 }
index c1f10b89a8317a743eeef7a6c031f3cd2102dd04..5f6e77cceb69f9e028c1e89b3016ef78a6a78ee0 100644 (file)
@@ -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.
         */
@@ -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;
@@ -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);
                }
        }
@@ -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)++;
@@ -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)++;
@@ -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)++;
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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;
@@ -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",
index c7fe073f27b7f96a47369c1930050c1e529f9dca..e0e2d6c90ac3b3e83a668cc315e1acbbe89e2e42 100644 (file)
@@ -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);
@@ -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 */
@@ -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;
@@ -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;
@@ -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");
 }
index e53d3d429d7f6082e60b4dd2c696d90add41c57b..9231ba8020309c6c6898b1b7ac340637cda1b732 100644 (file)
@@ -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);
index 22b1e72a9f7135a3d9da81eadd7452ffdc2aac12..d447f466d333dc63ba4e033cf88b9492e632516b 100644 (file)
@@ -1290,18 +1290,15 @@ static int s626_detach(comedi_device *dev)
                        CloseDMAB(dev, &devpriv->ANABuf, DMABUF_SIZE);
                }
 
-               if (dev->irq) {
+               if (dev->irq)
                        comedi_free_irq(dev->irq, dev);
-               }
 
-               if (devpriv->base_addr) {
+               if (devpriv->base_addr)
                        iounmap(devpriv->base_addr);
-               }
 
                if (devpriv->pdev) {
-                       if (devpriv->got_regions) {
+                       if (devpriv->got_regions)
                                comedi_pci_disable(devpriv->pdev);
-                       }
                        pci_dev_put(devpriv->pdev);
                }
        }
@@ -2072,9 +2069,8 @@ static int s626_ao_rinsn(comedi_device *dev, comedi_subdevice *s,
 {
        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)];
-       }
 
        return i;
 }
@@ -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) */
-       if (insn->n == 0) {
+       if (insn->n == 0)
                return 0;
-       }
+
        if (insn->n != 2) {
                printk("comedi%d: s626: s626_dio_insn_bits(): Invalid instruction length\n", dev->minor);
                return -EINVAL;
index 781733787e96946462ec56755dbfba9f08720b58..36778b30f3960751ebd0e17d17fd6084b1dae3a3 100644 (file)
@@ -160,9 +160,9 @@ int comedi_get_krange(comedi_t *d, unsigned int subdevice, unsigned int chan,
        } else {
                lr = s->range_table;
        }
-       if (range >= lr->length) {
+       if (range >= lr->length)
                return -EINVAL;
-       }
+
        memcpy(krange, lr->range + range, sizeof(comedi_krange));
 
        return 0;
index 94a5067f6bd5269fc85c1ae35d2b4eea16626485..7818e391dcab977a99840d51ebbb6842d8002d0d 100644 (file)
@@ -331,9 +331,9 @@ int comedi_lock(comedi_t *d, unsigned int subdevice)
        unsigned long flags;
        int ret = 0;
 
-       if (subdevice >= dev->n_subdevices) {
+       if (subdevice >= dev->n_subdevices)
                return -EINVAL;
-       }
+
        s = dev->subdevices + subdevice;
 
        comedi_spin_lock_irqsave(&s->spin_lock, flags);
@@ -375,9 +375,9 @@ int comedi_unlock(comedi_t *d, unsigned int subdevice)
        comedi_async *async;
        int ret;
 
-       if (subdevice >= dev->n_subdevices) {
+       if (subdevice >= dev->n_subdevices)
                return -EINVAL;
-       }
+
        s = dev->subdevices + subdevice;
 
        async = s->async;
@@ -425,9 +425,9 @@ int comedi_cancel(comedi_t *d, unsigned int subdevice)
        comedi_subdevice *s;
        int ret = 0;
 
-       if (subdevice >= dev->n_subdevices) {
+       if (subdevice >= dev->n_subdevices)
                return -EINVAL;
-       }
+
        s = dev->subdevices + subdevice;
 
        if (s->lock && s->lock != d)
@@ -450,9 +450,9 @@ int comedi_cancel(comedi_t *d, unsigned int subdevice)
                return ret;
 
 #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);
-       }
+
 #endif
        comedi_set_subdevice_runflags(s, SRF_RUNNING | SRF_RT, 0);
        s->async->inttrig = NULL;
@@ -471,9 +471,9 @@ int comedi_register_callback(comedi_t *d, unsigned int subdevice,
        comedi_subdevice *s;
        comedi_async *async;
 
-       if (subdevice >= dev->n_subdevices) {
+       if (subdevice >= dev->n_subdevices)
                return -EINVAL;
-       }
+
        s = dev->subdevices + subdevice;
 
        async = s->async;
@@ -507,9 +507,9 @@ int comedi_poll(comedi_t *d, unsigned int subdevice)
        comedi_subdevice *s = dev->subdevices;
        comedi_async *async;
 
-       if (subdevice >= dev->n_subdevices) {
+       if (subdevice >= dev->n_subdevices)
                return -EINVAL;
-       }
+
        s = dev->subdevices + subdevice;
 
        async = s->async;
@@ -533,17 +533,16 @@ int comedi_map(comedi_t *d, unsigned int subdevice, void *ptr)
        comedi_device *dev = (comedi_device *) d;
        comedi_subdevice *s;
 
-       if (subdevice >= dev->n_subdevices) {
+       if (subdevice >= dev->n_subdevices)
                return -EINVAL;
-       }
+
        s = dev->subdevices + subdevice;
 
        if (!s->async)
                return -EINVAL;
 
-       if (ptr) {
+       if (ptr)
                *((void **)ptr) = s->async->prealloc_buf;
-       }
 
        /* XXX no reference counting */
 
@@ -556,9 +555,9 @@ int comedi_unmap(comedi_t *d, unsigned int subdevice)
        comedi_device *dev = (comedi_device *) d;
        comedi_subdevice *s;
 
-       if (subdevice >= dev->n_subdevices) {
+       if (subdevice >= dev->n_subdevices)
                return -EINVAL;
-       }
+
        s = dev->subdevices + subdevice;
 
        if (!s->async)
index 3f61828294fdeb03143310b41902c9fdc15e8e84..6a1efa86ae97d3a846e5ef9bf750927fc3698600 100644 (file)
@@ -67,9 +67,8 @@ int comedi_read_procmem(char *buf, char **start, off_t offset, int len,
                                dev->board_name, dev->n_subdevices);
                }
        }
-       if (!devices_q) {
+       if (!devices_q)
                l += sprintf(buf + l, "no devices\n");
-       }
 
        for (driv = comedi_drivers; driv; driv = driv->next) {
                l += sprintf(buf + l, "%s:\n", driv->driver_name);
@@ -78,9 +77,8 @@ int comedi_read_procmem(char *buf, char **start, off_t offset, int len,
                                *(char **)((char *)driv->board_name +
                                        i * driv->offset));
                }
-               if (!driv->num_names) {
+               if (!driv->num_names)
                        l += sprintf(buf + l, " %s\n", driv->driver_name);
-               }
        }
 
        return l;
index b8eb4ec418544ae276de4553cb48a4958e5aa24e..e54be6182eea39ee95d679c5e1ee293c11922976 100644 (file)
@@ -135,9 +135,8 @@ int check_chanlist(comedi_subdevice *s, int n, unsigned int *chanlist)
                                        i, chanlist[i], s->n_chan,
                                        s->range_table->length);
 #if 0
-                               for (i = 0; i < n; i++) {
+                               for (i = 0; i < n; i++)
                                        printk("[%d]=0x%08x\n", i, chanlist[i]);
-                               }
 #endif
                                return -EINVAL;
                        }
index f4b851252541d6fc379cfd489e952e2b43e588c9..e6ec8b98a15df6f86cf90c94a1ddd1dd360fa0c2 100644 (file)
@@ -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");
                        ret = request_irq(irq, handler, flags, device, dev_id);
                }
-               if (ret < 0) {
+               if (ret < 0)
                        return ret;
-               }
+
        } else {
                it = kzalloc(sizeof(struct comedi_irq_struct), GFP_KERNEL);
                if (!it)