X-Git-Url: https://bbs.cooldavid.org/git/?a=blobdiff_plain;f=drivers%2Fstaging%2Fcomedi%2Fdrivers%2Fquatech_daqp_cs.c;h=bf489d7f49909ce75bc9e9b2c3990b1b840218f6;hb=1685e633b396b0f3dabbc9fa5d65dfefe6435250;hp=25f4e67e3e897a327e00caafc722e33fa699719b;hpb=127c03cdbad9bd5af5d7f33bd31a1015a90cb77f;p=net-next-2.6.git diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 25f4e67e3e8..bf489d7f499 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -14,7 +14,7 @@ Documentation for the DAQP PCMCIA cards can be found on Quatech's site: - ftp://ftp.quatech.com/Manuals/daqp-208.pdf + ftp://ftp.quatech.com/Manuals/daqp-208.pdf This manual is for both the DAQP-208 and the DAQP-308. @@ -194,7 +194,7 @@ static struct comedi_driver driver_daqp = { static void daqp_dump(struct comedi_device *dev) { - printk("DAQP: status %02x; aux status %02x\n", + printk(KERN_INFO "DAQP: status %02x; aux status %02x\n", inb(dev->iobase + DAQP_STATUS), inb(dev->iobase + DAQP_AUX)); } @@ -206,9 +206,9 @@ static void hex_dump(char *str, void *ptr, int len) printk(str); for (i = 0; i < len; i++) { - if (i % 16 == 0) { - printk("\n0x%08x:", (unsigned int)cptr); - } + if (i % 16 == 0) + printk("\n%p:", cptr); + printk(" %02x", *(cptr++)); } printk("\n"); @@ -222,9 +222,9 @@ static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { struct local_info_t *local = (struct local_info_t *)s->private; - if (local->stop) { + if (local->stop) return -EIO; - } + outb(DAQP_COMMAND_STOP, dev->iobase + DAQP_COMMAND); @@ -354,9 +354,9 @@ static int daqp_ai_insn_read(struct comedi_device *dev, int v; int counter = 10000; - if (local->stop) { + if (local->stop) return -EIO; - } + /* Stop any running conversion */ daqp_ai_cancel(dev, s); @@ -371,9 +371,9 @@ static int daqp_ai_insn_read(struct comedi_device *dev, v = DAQP_SCANLIST_CHANNEL(CR_CHAN(insn->chanspec)) | DAQP_SCANLIST_GAIN(CR_RANGE(insn->chanspec)); - if (CR_AREF(insn->chanspec) == AREF_DIFF) { + if (CR_AREF(insn->chanspec) == AREF_DIFF) v |= DAQP_SCANLIST_DIFFERENTIAL; - } + v |= DAQP_SCANLIST_START; @@ -487,7 +487,10 @@ static int daqp_ai_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* + * step 2: make sure trigger sources + * are unique and mutually compatible + */ /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_TIMER && @@ -587,9 +590,9 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) int i; int v; - if (local->stop) { + if (local->stop) return -EIO; - } + /* Stop any running conversion */ daqp_ai_cancel(dev, s); @@ -639,13 +642,11 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) v = DAQP_SCANLIST_CHANNEL(CR_CHAN(chanspec)) | DAQP_SCANLIST_GAIN(CR_RANGE(chanspec)); - if (CR_AREF(chanspec) == AREF_DIFF) { + if (CR_AREF(chanspec) == AREF_DIFF) v |= DAQP_SCANLIST_DIFFERENTIAL; - } - if (i == 0 || scanlist_start_on_every_entry) { + if (i == 0 || scanlist_start_on_every_entry) v |= DAQP_SCANLIST_START; - } outb(v & 0xff, dev->iobase + DAQP_SCANLIST); outb(v >> 8, dev->iobase + DAQP_SCANLIST); @@ -759,7 +760,8 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) while (--counter && (inb(dev->iobase + DAQP_STATUS) & DAQP_STATUS_EVENTS)) ; if (!counter) { - printk("daqp: couldn't clear interrupts in status register\n"); + printk(KERN_ERR + "daqp: couldn't clear interrupts in status register\n"); return -1; } @@ -784,9 +786,8 @@ static int daqp_ao_insn_write(struct comedi_device *dev, int d; unsigned int chan; - if (local->stop) { + if (local->stop) return -EIO; - } chan = CR_CHAN(insn->chanspec); d = data[0]; @@ -810,9 +811,8 @@ static int daqp_di_insn_read(struct comedi_device *dev, { struct local_info_t *local = (struct local_info_t *)s->private; - if (local->stop) { + if (local->stop) return -EIO; - } data[0] = inb(dev->iobase + DAQP_DIGITAL_IO); @@ -827,9 +827,8 @@ static int daqp_do_insn_write(struct comedi_device *dev, { struct local_info_t *local = (struct local_info_t *)s->private; - if (local->stop) { + if (local->stop) return -EIO; - } outw(data[0] & 0xf, dev->iobase + DAQP_DIGITAL_IO); @@ -877,7 +876,7 @@ static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; - printk("comedi%d: attaching daqp%d (io 0x%04lx)\n", + printk(KERN_INFO "comedi%d: attaching daqp%d (io 0x%04lx)\n", dev->minor, it->options[0], dev->iobase); s = dev->subdevices + 0; @@ -930,7 +929,7 @@ static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int daqp_detach(struct comedi_device *dev) { - printk("comedi%d: detaching daqp\n", dev->minor); + printk(KERN_INFO "comedi%d: detaching daqp\n", dev->minor); return 0; } @@ -995,14 +994,6 @@ static int daqp_cs_resume(struct pcmcia_device *p_dev); static int daqp_cs_attach(struct pcmcia_device *); static void daqp_cs_detach(struct pcmcia_device *); -/* - The dev_info variable is the "key" that is used to match up this - device driver with appropriate cards, through the card configuration - database. -*/ - -static const dev_info_t dev_info = "quatech_daqp_cs"; - /*====================================================================== daqp_cs_attach() creates an "instance" of the driver, allocating @@ -1075,8 +1066,7 @@ static void daqp_cs_detach(struct pcmcia_device *link) /* Unlink device structure, and free it */ dev_table[dev->table_index] = NULL; - if (dev) - kfree(dev); + kfree(dev); } /* daqp_cs_detach */ @@ -1223,7 +1213,7 @@ static struct pcmcia_driver daqp_cs_driver = { .id_table = daqp_cs_id_table, .owner = THIS_MODULE, .drv = { - .name = dev_info, + .name = "quatech_daqp_cs", }, };