]> rtime.felk.cvut.cz Git - mf6xx.git/commitdiff
UIO: coding style.
authorRostislav Lisovy <lisovy@gmail.com>
Sun, 22 Jan 2012 16:47:01 +0000 (17:47 +0100)
committerRostislav Lisovy <lisovy@gmail.com>
Sun, 22 Jan 2012 16:47:01 +0000 (17:47 +0100)
src/uio/mf614/kernel/mf614.c

index 4ca80933133446def7f95830f8a17ca2cf787a31..98c7ac1a3aa2687402c39e233f66090593085194 100755 (executable)
@@ -1,7 +1,7 @@
 /*
  * UIO driver fo Humusoft MF614 DAQ card.
- * Copyright (C) 2010--2011 Rostislav Lisovy <lisovy@gmail.com> 
- * 
+ * Copyright (C) 2010--2011 Rostislav Lisovy <lisovy@gmail.com>
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
 static irqreturn_t mf614_irq_handler(int irq, struct uio_info *info)
 {
        void __iomem *status_reg = info->priv;
-       status_reg = ((u8*) status_reg) + STATUS_REG;
+       status_reg = (u8 *)status_reg + STATUS_REG;
 
 
-       if ((ioread32(status_reg) & STATUS_T5INTE) 
-               && (ioread32(status_reg) & STATUS_T5))
-       {
-               //disable interrupt
+       if ((ioread32(status_reg) & STATUS_T5INTE)
+       && (ioread32(status_reg) & STATUS_T5)) {
+               /* disable interrupt */
                iowrite32(ioread32(status_reg) & ~STATUS_T5INTE, status_reg);
                return IRQ_HANDLED;
        }
 
-       if ((ioread32(status_reg) & STATUS_CCINTE) 
-               && (ioread32(status_reg) & STATUS_CC))
-       {
-               //disable interrupt
+       if ((ioread32(status_reg) & STATUS_CCINTE)
+       && (ioread32(status_reg) & STATUS_CC)) {
+               /* disable interrupt */
                iowrite32(ioread32(status_reg) & ~STATUS_CCINTE, status_reg);
                return IRQ_HANDLED;
        }
@@ -66,14 +64,13 @@ static irqreturn_t mf614_irq_handler(int irq, struct uio_info *info)
 static int mf614_irqcontrol(struct uio_info *info, s32 irq_on)
 {
        void __iomem *status_reg = info->priv;
-       status_reg = ((u8*) status_reg) + STATUS_REG;
+       status_reg = (u8 *)status_reg + STATUS_REG;
 
 
        if (irq_on == 0) { /* Disable interrupts */
                iowrite32(ioread32(status_reg) & ~STATUS_T5INTE, status_reg);
                iowrite32(ioread32(status_reg) & ~STATUS_CCINTE, status_reg);
-       } 
-       else if (irq_on == 1) {
+       } else if (irq_on == 1) {
                iowrite32(ioread32(status_reg) | STATUS_T5INTE, status_reg);
                iowrite32(ioread32(status_reg) | STATUS_CCINTE, status_reg);
        }
@@ -82,23 +79,23 @@ static int mf614_irqcontrol(struct uio_info *info, s32 irq_on)
 }
 
 static int __devinit mf614_pci_probe(struct pci_dev *dev,
-                                     const struct pci_device_id *id)
+                               const struct pci_device_id *id)
 {
        struct uio_info *info;
 
        info = kzalloc(sizeof(struct uio_info), GFP_KERNEL);
        if (!info)
                return -ENOMEM;
-       
+
        if (pci_enable_device(dev))
                goto out_free;
 
        if (pci_request_regions(dev, "mf614"))
                goto out_disable;
-       
+
        info->name = "MF614";
        info->version = "0.0.1";
-       
+
        info->port[0].name = "Board programming registers";
        info->port[0].porttype = UIO_PORT_X86;
        info->port[0].start = pci_resource_start(dev, 0);
@@ -107,7 +104,7 @@ static int __devinit mf614_pci_probe(struct pci_dev *dev,
        info->port[0].size = pci_resource_len(dev, 0);
 
 
-       info->port[1].name = "OX9162 local configuration registers";    
+       info->port[1].name = "OX9162 local configuration registers";
        info->port[1].porttype = UIO_PORT_X86;
        info->port[1].start = pci_resource_start(dev, 2);
        if (!info->port[1].start)
@@ -116,7 +113,7 @@ static int __devinit mf614_pci_probe(struct pci_dev *dev,
 
        info->priv = pci_iomap(dev, 2, 0);
        if (!info->priv)
-               goto out_release; 
+               goto out_release;
 
 
        info->mem[0].name = "Board programming registers";
@@ -129,7 +126,7 @@ static int __devinit mf614_pci_probe(struct pci_dev *dev,
        if (!info->mem[0].internal_addr)
                goto out_release;
 
-       
+
        info->mem[1].name = "OX9162 local configuration registers";
        info->mem[1].addr = pci_resource_start(dev, 3);
        if (!info->mem[1].addr)
@@ -140,14 +137,14 @@ static int __devinit mf614_pci_probe(struct pci_dev *dev,
        if (!info->mem[1].internal_addr)
                goto out_release;
 
-       
+
        info->irq = dev->irq;
        info->irq_flags = IRQF_SHARED;
        info->handler = mf614_irq_handler;
 
        info->irqcontrol = mf614_irqcontrol;
 
-       if(uio_register_device(&dev->dev, info))
+       if (uio_register_device(&dev->dev, info))
                goto out_unmap;
 
        pci_set_drvdata(dev, info);
@@ -171,12 +168,12 @@ static void mf614_pci_remove(struct pci_dev *dev)
 {
        struct uio_info *info = pci_get_drvdata(dev);
        void __iomem *status_reg = info->priv;
-       status_reg = ((u8*) status_reg) + STATUS_REG;
-       
+       status_reg = (u8 *)status_reg + STATUS_REG;
+
        /* Disable interrupts */
-       iowrite32(ioread32(status_reg) & ~STATUS_T5INTE, status_reg);   
-       iowrite32(ioread32(status_reg) & ~STATUS_CCINTE, status_reg);   
-       
+       iowrite32(ioread32(status_reg) & ~STATUS_T5INTE, status_reg);
+       iowrite32(ioread32(status_reg) & ~STATUS_CCINTE, status_reg);
+
        uio_unregister_device(info);
        pci_release_regions(dev);
        pci_disable_device(dev);
@@ -184,7 +181,7 @@ static void mf614_pci_remove(struct pci_dev *dev)
        pci_iounmap(dev, info->priv);
        iounmap(info->mem[0].internal_addr);
        iounmap(info->mem[1].internal_addr);
-       
+
        kfree(info);
 }
 
@@ -202,7 +199,7 @@ MODULE_DEVICE_TABLE(pci, mf614_pci_driver);
 static struct pci_driver mf614_pci_driver = {
        .name = "mf614",
        .id_table = mf614_pci_id,
-       .probe = mf614_pci_probe, 
+       .probe = mf614_pci_probe,
        .remove = mf614_pci_remove,
 };