Commit eedc1b7b authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: amplc_pci224: Replace printk calls

Replace the printk calls with dev_info, dev_err, etc.  There were some
consecutive printk calls without newlines which now scnprintf into a
temporary buffer and this bit of code has been factored out into new
function pci224_report_attach().

A couple of DPRINTK() macro calls which may result in printk() calls
have been left alone to be tackled en masse at a later date.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 52954abc
...@@ -626,8 +626,7 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, ...@@ -626,8 +626,7 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev,
/* Nothing left to put in the FIFO. */ /* Nothing left to put in the FIFO. */
pci224_ao_stop(dev, s); pci224_ao_stop(dev, s);
s->async->events |= COMEDI_CB_OVERFLOW; s->async->events |= COMEDI_CB_OVERFLOW;
printk(KERN_ERR "comedi%d: " dev_err(dev->class_dev, "AO buffer underrun\n");
"AO buffer underrun\n", dev->minor);
} }
} }
/* Determine how many new scans can be put in the FIFO. */ /* Determine how many new scans can be put in the FIFO. */
...@@ -1295,16 +1294,29 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot, ...@@ -1295,16 +1294,29 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot,
} }
/* No match found. */ /* No match found. */
if (bus || slot) { if (bus || slot) {
printk(KERN_ERR "comedi%d: error! " dev_err(dev->class_dev,
"no %s found at pci %02x:%02x!\n", "error! no %s found at pci %02x:%02x!\n",
dev->minor, thisboard->name, bus, slot); thisboard->name, bus, slot);
} else { } else {
printk(KERN_ERR "comedi%d: error! no %s found!\n", dev_err(dev->class_dev, "error! no %s found!\n",
dev->minor, thisboard->name); thisboard->name);
} }
return -EIO; return -EIO;
} }
static void pci224_report_attach(struct comedi_device *dev, unsigned int irq)
{
char tmpbuf[30];
if (irq)
snprintf(tmpbuf, sizeof(tmpbuf), "irq %u%s", irq,
(dev->irq ? "" : " UNAVAILABLE"));
else
snprintf(tmpbuf, sizeof(tmpbuf), "no irq");
dev_info(dev->class_dev, "%s (pci %s) (%s) attached\n",
dev->board_name, pci_name(devpriv->pci_dev), tmpbuf);
}
/* /*
* Common part of attach and attach_pci. * Common part of attach and attach_pci.
*/ */
...@@ -1319,9 +1331,9 @@ static int pci224_attach_common(struct comedi_device *dev, ...@@ -1319,9 +1331,9 @@ static int pci224_attach_common(struct comedi_device *dev,
devpriv->pci_dev = pci_dev; devpriv->pci_dev = pci_dev;
ret = comedi_pci_enable(pci_dev, DRIVER_NAME); ret = comedi_pci_enable(pci_dev, DRIVER_NAME);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR dev_err(dev->class_dev,
"comedi%d: error! cannot enable PCI device " "error! cannot enable PCI device and request regions!\n"
"and request regions!\n", dev->minor); );
return ret; return ret;
} }
spin_lock_init(&devpriv->ao_spinlock); spin_lock_init(&devpriv->ao_spinlock);
...@@ -1368,8 +1380,7 @@ static int pci224_attach_common(struct comedi_device *dev, ...@@ -1368,8 +1380,7 @@ static int pci224_attach_common(struct comedi_device *dev,
/* Allocate subdevices. There is only one! */ /* Allocate subdevices. There is only one! */
ret = alloc_subdevices(dev, 1); ret = alloc_subdevices(dev, 1);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "comedi%d: error! out of memory!\n", dev_err(dev->class_dev, "error! out of memory!\n");
dev->minor);
return ret; return ret;
} }
...@@ -1403,10 +1414,9 @@ static int pci224_attach_common(struct comedi_device *dev, ...@@ -1403,10 +1414,9 @@ static int pci224_attach_common(struct comedi_device *dev,
if (options) { if (options) {
for (n = 2; n < 3 + s->n_chan; n++) { for (n = 2; n < 3 + s->n_chan; n++) {
if (options[n] < 0 || options[n] > 1) { if (options[n] < 0 || options[n] > 1) {
printk(KERN_WARNING dev_warn(dev->class_dev, DRIVER_NAME
"comedi%d: %s: warning! bad options[%u]=%d\n", ": warning! bad options[%u]=%d\n",
dev->minor, DRIVER_NAME, n, n, options[n]);
options[n]);
} }
} }
} }
...@@ -1435,9 +1445,9 @@ static int pci224_attach_common(struct comedi_device *dev, ...@@ -1435,9 +1445,9 @@ static int pci224_attach_common(struct comedi_device *dev,
devpriv->hwrange = hwrange_pci224_external; devpriv->hwrange = hwrange_pci224_external;
} else { } else {
if (options && options[2] != 0) { if (options && options[2] != 0) {
printk(KERN_WARNING "comedi%d: %s: warning! " dev_warn(dev->class_dev, DRIVER_NAME
"bad options[2]=%d\n", ": warning! bad options[2]=%d\n",
dev->minor, DRIVER_NAME, options[2]); options[2]);
} }
s->range_table = &range_pci224_internal; s->range_table = &range_pci224_internal;
devpriv->hwrange = hwrange_pci224_internal; devpriv->hwrange = hwrange_pci224_internal;
...@@ -1450,24 +1460,15 @@ static int pci224_attach_common(struct comedi_device *dev, ...@@ -1450,24 +1460,15 @@ static int pci224_attach_common(struct comedi_device *dev,
ret = request_irq(irq, pci224_interrupt, IRQF_SHARED, ret = request_irq(irq, pci224_interrupt, IRQF_SHARED,
DRIVER_NAME, dev); DRIVER_NAME, dev);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "comedi%d: error! " dev_err(dev->class_dev,
"unable to allocate irq %u\n", dev->minor, irq); "error! unable to allocate irq %u\n", irq);
return ret; return ret;
} else { } else {
dev->irq = irq; dev->irq = irq;
} }
} }
printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); pci224_report_attach(dev, irq);
printk("(pci %s) ", pci_name(pci_dev));
if (irq)
printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE"));
else
printk("(no irq) ");
printk("attached\n");
return 1; return 1;
} }
...@@ -1477,14 +1478,13 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1477,14 +1478,13 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
int bus, slot; int bus, slot;
int ret; int ret;
printk(KERN_DEBUG "comedi%d: %s: attach\n", dev->minor, DRIVER_NAME); dev_info(dev->class_dev, DRIVER_NAME ": attach\n");
bus = it->options[0]; bus = it->options[0];
slot = it->options[1]; slot = it->options[1];
ret = alloc_private(dev, sizeof(struct pci224_private)); ret = alloc_private(dev, sizeof(struct pci224_private));
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "comedi%d: error! out of memory!\n", dev_err(dev->class_dev, "error! out of memory!\n");
dev->minor);
return ret; return ret;
} }
...@@ -1500,21 +1500,19 @@ pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev) ...@@ -1500,21 +1500,19 @@ pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev)
{ {
int ret; int ret;
printk(KERN_DEBUG "comedi%d: %s: attach_pci %s\n", dev->minor, dev_info(dev->class_dev, DRIVER_NAME ": attach_pci %s\n",
DRIVER_NAME, pci_name(pci_dev)); pci_name(pci_dev));
ret = alloc_private(dev, sizeof(struct pci224_private)); ret = alloc_private(dev, sizeof(struct pci224_private));
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "comedi%d: error! out of memory!\n", dev_err(dev->class_dev, "error! out of memory!\n");
dev->minor);
return ret; return ret;
} }
dev->board_ptr = pci224_find_pci_board(pci_dev); dev->board_ptr = pci224_find_pci_board(pci_dev);
if (dev->board_ptr == NULL) { if (dev->board_ptr == NULL) {
printk(KERN_ERR dev_err(dev->class_dev,
"comedi%d: %s: BUG! cannot determine board type!\n", DRIVER_NAME ": BUG! cannot determine board type!\n");
dev->minor, DRIVER_NAME);
return -EINVAL; return -EINVAL;
} }
return pci224_attach_common(dev, pci_dev, NULL); return pci224_attach_common(dev, pci_dev, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment