diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2017-02-17 11:09:12 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-06 09:16:58 +0100 |
commit | 048ad49af32fe910259bc5f1a49f464b63a03029 (patch) | |
tree | ae1f1ab5c7d83abae6604394ec6552cfedc1c7d0 | |
parent | 47ba9b528501273712b8e14bc1cb4c772fcfe9f2 (diff) |
staging: comedi: jr3_pci: re-work firmware copyright display
If debug messages are enabled, the card initialization done in
`jr3_pci_auto_attach()` spits out 24 (0x18) debug messages to show the
null-terminated copyright string embedded in the firmware, one character
at a time, including the ASCII NUL characters at the end. Factor out
the copyright display into a new function `jr3_pci_show_copyright()` and
re-work it to copy the whole copyright string into a buffer, so that it
can be shown with a single debug message.
Incidentally, this also removes a checkpatch warning "Avoid multiple
line dereference" in the original code.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/jr3_pci.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index d800a5e113ab..69ed84a385e3 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c @@ -679,6 +679,19 @@ jr3_pci_alloc_spriv(struct comedi_device *dev, struct comedi_subdevice *s) return spriv; } +static void jr3_pci_show_copyright(struct comedi_device *dev) +{ + struct jr3_pci_dev_private *devpriv = dev->private; + struct jr3_channel __iomem *ch0data = &devpriv->iobase->channel[0].data; + char copy[ARRAY_SIZE(ch0data->copyright) + 1]; + int i; + + for (i = 0; i < ARRAY_SIZE(ch0data->copyright); i++) + copy[i] = (char)(get_u16(&ch0data->copyright[i]) >> 8); + copy[i] = '\0'; + dev_dbg(dev->class_dev, "Firmware copyright: %s\n", copy); +} + static int jr3_pci_auto_attach(struct comedi_device *dev, unsigned long context) { @@ -762,11 +775,7 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, * can read firmware version */ msleep_interruptible(25); - for (i = 0; i < 0x18; i++) { - dev_dbg(dev->class_dev, "%c\n", - get_u16(&devpriv->iobase->channel[0]. - data.copyright[i]) >> 8); - } + jr3_pci_show_copyright(dev); /* Start card timer */ for (i = 0; i < dev->n_subdevices; i++) { |