From: Frank Mori Hess Date: Mon, 12 Apr 2010 18:07:09 +0000 (+0000) Subject: Some changes to make new driver pass kernel's anal formatting checks X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=03019e0bc232015299d41ee18b45a68d5bc488de;p=comedi.git Some changes to make new driver pass kernel's anal formatting checks in checkpatch.pl. --- diff --git a/comedi/drivers/adl_pci7230.c b/comedi/drivers/adl_pci7230.c index a42dcc45..0d277fd9 100644 --- a/comedi/drivers/adl_pci7230.c +++ b/comedi/drivers/adl_pci7230.c @@ -44,52 +44,57 @@ Configuration Options: #define PCI_DEVICE_ID_PCI7230 0x7230 static DEFINE_PCI_DEVICE_TABLE(adl_pci7230_pci_table) = { - {PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7230, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + { + PCI_VENDOR_ID_ADLINK, + PCI_DEVICE_ID_PCI7230, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + 0 + }, {0} }; MODULE_DEVICE_TABLE(pci, adl_pci7230_pci_table); -typedef struct { +struct adl_pci7230_private { int data; struct pci_dev *pci_dev; -} adl_pci7230_private; +}; -#define devpriv ((adl_pci7230_private *)dev->private) +#define devpriv ((struct adl_pci7230_private *)dev->private) -static int adl_pci7230_attach(comedi_device * dev, comedi_devconfig * it); -static int adl_pci7230_detach(comedi_device * dev); +static int adl_pci7230_attach(comedi_device *dev, comedi_devconfig *it); +static int adl_pci7230_detach(comedi_device *dev); static comedi_driver driver_adl_pci7230 = { - driver_name:"adl_pci7230", - module:THIS_MODULE, - attach:adl_pci7230_attach, - detach:adl_pci7230_detach, + .driver_name = "adl_pci7230", + .module = THIS_MODULE, + .attach = adl_pci7230_attach, + .detach = adl_pci7230_detach, }; /* Digital IO */ -static int adl_pci7230_di_insn_bits(comedi_device * dev, comedi_subdevice * s, - comedi_insn * insn, lsampl_t * data); - -static int adl_pci7230_do_insn_bits(comedi_device * dev, comedi_subdevice * s, - comedi_insn * insn, lsampl_t * data); +static int adl_pci7230_di_insn_bits(comedi_device *dev, comedi_subdevice *s, + comedi_insn *insn, lsampl_t *data); -/* */ +static int adl_pci7230_do_insn_bits(comedi_device *dev, comedi_subdevice *s, + comedi_insn *insn, lsampl_t *data); -static int adl_pci7230_attach(comedi_device * dev, comedi_devconfig * it) +static int adl_pci7230_attach(comedi_device *dev, comedi_devconfig *it) { struct pci_dev *pcidev; comedi_subdevice *s; int bus, slot; - printk("comedi: attempt to attach...\n"); - printk("comedi%d: adl_pci7230\n", dev->minor); + printk(KERN_INFO "comedi%d: adl_pci7230\n", dev->minor); dev->board_name = "pci7230"; bus = it->options[0]; slot = it->options[1]; - if (alloc_private(dev, sizeof(adl_pci7230_private)) < 0) + if (alloc_private(dev, sizeof(struct adl_pci7230_private)) < 0) return -ENOMEM; if (alloc_subdevices(dev, 2) < 0) @@ -103,62 +108,66 @@ static int adl_pci7230_attach(comedi_device * dev, comedi_devconfig * it) pcidev->device == PCI_DEVICE_ID_PCI7230) { if (bus || slot) { /* requested particular bus/slot */ - if (pcidev->bus->number != bus || PCI_SLOT(pcidev->devfn) != slot) { + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) { continue; } } devpriv->pci_dev = pcidev; - if (comedi_pci_enable(pcidev, "adl_pci7230") < 0) { - printk("comedi%d: Failed to enable PCI device and request regions\n", dev->minor); - return -EIO; - } - dev->iobase = pci_resource_start(pcidev, 2); - printk("comedi: base addr %4lx\n", dev->iobase); - - s = dev->subdevices + 0; - /* Isolated do */ - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = adl_pci7230_do_insn_bits; - - s = dev->subdevices + 1; - /* Isolated di */ - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = adl_pci7230_di_insn_bits; - - printk("comedi: attached\n"); - - return 1; + break; } } - - printk("comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", dev->minor, bus, slot); - return -EIO; + if (pcidev == NULL) { + printk(KERN_ERR "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", + dev->minor, bus, slot); + return -EIO; + } + if (comedi_pci_enable(pcidev, "adl_pci7230") < 0) { + printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", + dev->minor); + return -EIO; + } + dev->iobase = pci_resource_start(pcidev, 2); + printk(KERN_DEBUG "comedi: base addr %4lx\n", dev->iobase); + + s = dev->subdevices + 0; + /* Isolated do */ + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = adl_pci7230_do_insn_bits; + + s = dev->subdevices + 1; + /* Isolated di */ + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = adl_pci7230_di_insn_bits; + + printk(KERN_DEBUG "comedi: attached\n"); + + return 1; } -static int adl_pci7230_detach(comedi_device * dev) +static int adl_pci7230_detach(comedi_device *dev) { - printk("comedi%d: pci7230: remove\n", dev->minor); + printk(KERN_DEBUG "comedi%d: pci7230: remove\n", dev->minor); if (devpriv && devpriv->pci_dev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); - } pci_dev_put(devpriv->pci_dev); } return 0; } -static int adl_pci7230_do_insn_bits(comedi_device * dev, comedi_subdevice * s, - comedi_insn * insn, lsampl_t * data) +static int adl_pci7230_do_insn_bits(comedi_device *dev, comedi_subdevice *s, + comedi_insn *insn, lsampl_t *data) { if (insn->n != 2) return -EINVAL; @@ -173,8 +182,8 @@ static int adl_pci7230_do_insn_bits(comedi_device * dev, comedi_subdevice * s, return 2; } -static int adl_pci7230_di_insn_bits(comedi_device * dev, comedi_subdevice * s, - comedi_insn * insn, lsampl_t * data) +static int adl_pci7230_di_insn_bits(comedi_device *dev, comedi_subdevice *s, + comedi_insn *insn, lsampl_t *data) { if (insn->n != 2) return -EINVAL;