Commit 2851fcd5 authored by Conrad Gomes's avatar Conrad Gomes Committed by Greg Kroah-Hartman

Staging: comedi: change printk to dev_err/dev_dbg in unioxx5.c

This is a patch which fixes coding style issues due to printk usage in
unioxx5.c found by checkpatch.pl in the following functions:
1) __unioxx5_digital_read
2) __unioxx5_analog_read
3) __unioxx5_digital_config

To subsitute printk with dev_err/dev_dbg, access to the struct device is
required. The function definitions of the above functions have been changed
to take the pointer to the struct comedi_subdevice as a parameter instead
of the pointer to struct unioxx5_subd_priv.

The pointers to the stuct device and the struct unioxx5_subd_priv are
obtained through the pointer to the struct comedi_subdevice in these functions.

The function calls of __unioxx5_digital_read and __unioxx5_analog_read in
unioxx5_subdev_read have been changed to pass the pointer to the struct
comedi_subdevice.
Signed-off-by: default avatarConrad Gomes <conrad.s.j.gomes@gmail.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2e9cf848
...@@ -91,12 +91,14 @@ static int __unioxx5_define_chan_offset(int chan_num) ...@@ -91,12 +91,14 @@ static int __unioxx5_define_chan_offset(int chan_num)
} }
#if 0 /* not used? */ #if 0 /* not used? */
static void __unioxx5_digital_config(struct unioxx5_subd_priv *usp, int mode) static void __unioxx5_digital_config(struct comedi_subdevice *s, int mode)
{ {
struct unioxx5_subd_priv *usp = s->private;
struct device *csdev = s->device->class_dev;
int i, mask; int i, mask;
mask = (mode == ALL_2_OUTPUT) ? 0xFF : 0x00; mask = (mode == ALL_2_OUTPUT) ? 0xFF : 0x00;
printk("COMEDI: mode = %d\n", mask); dev_dbg(csdev, "mode = %d\n", mask);
outb(1, usp->usp_iobase + 0); outb(1, usp->usp_iobase + 0);
...@@ -135,14 +137,17 @@ static void __unioxx5_analog_config(struct unioxx5_subd_priv *usp, int channel) ...@@ -135,14 +137,17 @@ static void __unioxx5_analog_config(struct unioxx5_subd_priv *usp, int channel)
usp->usp_prev_cn_val[channel_offset - 1] = conf; usp->usp_prev_cn_val[channel_offset - 1] = conf;
} }
static int __unioxx5_digital_read(struct unioxx5_subd_priv *usp, static int __unioxx5_digital_read(struct comedi_subdevice *s,
unsigned int *data, int channel, int minor) unsigned int *data, int channel, int minor)
{ {
struct unioxx5_subd_priv *usp = s->private;
struct device *csdev = s->device->class_dev;
int channel_offset, mask = 1 << (channel & 0x07); int channel_offset, mask = 1 << (channel & 0x07);
channel_offset = __unioxx5_define_chan_offset(channel); channel_offset = __unioxx5_define_chan_offset(channel);
if (channel_offset < 0) { if (channel_offset < 0) {
pr_err("comedi%d: undefined channel %d. channel range is 0 .. 23\n", dev_err(csdev,
"comedi%d: undefined channel %d. channel range is 0 .. 23\n",
minor, channel); minor, channel);
return 0; return 0;
} }
...@@ -157,9 +162,11 @@ static int __unioxx5_digital_read(struct unioxx5_subd_priv *usp, ...@@ -157,9 +162,11 @@ static int __unioxx5_digital_read(struct unioxx5_subd_priv *usp,
return 1; return 1;
} }
static int __unioxx5_analog_read(struct unioxx5_subd_priv *usp, static int __unioxx5_analog_read(struct comedi_subdevice *s,
unsigned int *data, int channel, int minor) unsigned int *data, int channel, int minor)
{ {
struct unioxx5_subd_priv *usp = s->private;
struct device *csdev = s->device->class_dev;
int module_no, read_ch; int module_no, read_ch;
char control; char control;
...@@ -185,7 +192,8 @@ static int __unioxx5_analog_read(struct unioxx5_subd_priv *usp, ...@@ -185,7 +192,8 @@ static int __unioxx5_analog_read(struct unioxx5_subd_priv *usp,
/* if four bytes readding error occurs - return 0(false) */ /* if four bytes readding error occurs - return 0(false) */
if ((control & Rx4CA_ERR_MASK)) { if ((control & Rx4CA_ERR_MASK)) {
printk("COMEDI: 4 bytes error\n"); dev_err(csdev,
"comedi%d: 4 bytes error\n", minor);
return 0; return 0;
} }
...@@ -273,10 +281,10 @@ static int unioxx5_subdev_read(struct comedi_device *dev, ...@@ -273,10 +281,10 @@ static int unioxx5_subdev_read(struct comedi_device *dev,
type = usp->usp_module_type[channel / 2]; type = usp->usp_module_type[channel / 2];
if (type == MODULE_DIGITAL) { if (type == MODULE_DIGITAL) {
if (!__unioxx5_digital_read(usp, data, channel, dev->minor)) if (!__unioxx5_digital_read(subdev, data, channel, dev->minor))
return -1; return -1;
} else { } else {
if (!__unioxx5_analog_read(usp, data, channel, dev->minor)) if (!__unioxx5_analog_read(subdev, data, channel, dev->minor))
return -1; return -1;
} }
......
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