Skip to content

Commit

Permalink
staging: comedi: comedi_bond: remove private printk macros
Browse files Browse the repository at this point in the history
Remove the macros LOG_MSG, DEBUG, WARNING, and ERROR. Convert
the printk's into dev_printk format.

The DEBUG macro is not being used in the file so the module
parameter 'debug' can also be removed.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Sep 4, 2012
1 parent a62a176 commit fdb2a66
Showing 1 changed file with 18 additions and 30 deletions.
48 changes: 18 additions & 30 deletions drivers/staging/comedi/drivers/comedi_bond.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,6 @@ Configuration Options:
# define STR(x) STR1(x)
#endif

static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "If true, print extra cryptic debugging output useful"
"only to developers.");

#define LOG_MSG(x...) printk(KERN_INFO MODULE_NAME": "x)
#define DEBUG(x...) \
do { \
if (debug) \
printk(KERN_DEBUG MODULE_NAME": DEBUG: "x); \
} while (0)
#define WARNING(x...) printk(KERN_WARNING MODULE_NAME ": WARNING: "x)
#define ERROR(x...) printk(KERN_ERR MODULE_NAME ": INTERNAL ERROR: "x)

struct BondedDevice {
struct comedi_device *dev;
unsigned minor;
Expand Down Expand Up @@ -228,15 +214,18 @@ static int doDevConfig(struct comedi_device *dev, struct comedi_devconfig *it)
struct BondedDevice *bdev = NULL;

if (minor < 0 || minor >= COMEDI_NUM_BOARD_MINORS) {
ERROR("Minor %d is invalid!\n", minor);
dev_err(dev->class_dev,
"Minor %d is invalid!\n", minor);
return 0;
}
if (minor == dev->minor) {
ERROR("Cannot bond this driver to itself!\n");
dev_err(dev->class_dev,
"Cannot bond this driver to itself!\n");
return 0;
}
if (devs_opened[minor]) {
ERROR("Minor %d specified more than once!\n", minor);
dev_err(dev->class_dev,
"Minor %d specified more than once!\n", minor);
return 0;
}

Expand All @@ -246,7 +235,8 @@ static int doDevConfig(struct comedi_device *dev, struct comedi_devconfig *it)
d = devs_opened[minor] = comedi_open(file);

if (!d) {
ERROR("Minor %u could not be opened\n", minor);
dev_err(dev->class_dev,
"Minor %u could not be opened\n", minor);
return 0;
}

Expand All @@ -255,14 +245,14 @@ static int doDevConfig(struct comedi_device *dev, struct comedi_devconfig *it)
sdev + 1)) > -1) {
nchans = comedi_get_n_channels(d, sdev);
if (nchans <= 0) {
ERROR("comedi_get_n_channels() returned %d "
"on minor %u subdev %d!\n",
nchans, minor, sdev);
dev_err(dev->class_dev,
"comedi_get_n_channels() returned %d on minor %u subdev %d!\n",
nchans, minor, sdev);
return 0;
}
bdev = kmalloc(sizeof(*bdev), GFP_KERNEL);
if (!bdev) {
ERROR("Out of memory.\n");
dev_err(dev->class_dev, "Out of memory\n");
return 0;
}
bdev->dev = d;
Expand All @@ -285,8 +275,8 @@ static int doDevConfig(struct comedi_device *dev, struct comedi_devconfig *it)
Realloc(devpriv->devs,
++devpriv->ndevs * sizeof(bdev), tmp);
if (!devpriv->devs) {
ERROR("Could not allocate memory. "
"Out of memory?");
dev_err(dev->class_dev,
"Could not allocate memory. Out of memory?\n");
return 0;
}

Expand All @@ -306,7 +296,7 @@ static int doDevConfig(struct comedi_device *dev, struct comedi_devconfig *it)
}

if (!devpriv->nchans) {
ERROR("No channels found!\n");
dev_err(dev->class_dev, "No channels found!\n");
return 0;
}

Expand All @@ -320,8 +310,6 @@ static int bonding_attach(struct comedi_device *dev,
struct comedi_subdevice *s;
int ret;

LOG_MSG("comedi%d\n", dev->minor);

ret = alloc_private(dev, sizeof(*devpriv));
if (ret)
return ret;
Expand All @@ -348,9 +336,9 @@ static int bonding_attach(struct comedi_device *dev,
s->insn_bits = bonding_dio_insn_bits;
s->insn_config = bonding_dio_insn_config;

LOG_MSG("attached with %u DIO channels coming from %u different "
"subdevices all bonded together. "
"John Lennon would be proud!\n",
dev_info(dev->class_dev,
"%s: %s attached, %u channels from %u devices\n",
dev->driver->driver_name, dev->board_name,
devpriv->nchans, devpriv->ndevs);

return 1;
Expand Down

0 comments on commit fdb2a66

Please sign in to comment.