/*
* 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;
}
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);
}
}
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);
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)
info->priv = pci_iomap(dev, 2, 0);
if (!info->priv)
- goto out_release;
+ goto out_release;
info->mem[0].name = "Board programming registers";
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)
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);
{
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);
pci_iounmap(dev, info->priv);
iounmap(info->mem[0].internal_addr);
iounmap(info->mem[1].internal_addr);
-
+
kfree(info);
}
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,
};