Commit d5016e24 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

staging: comedi: remove this_board macro in the poc driver



The 'this_board' macro depends on having a local variable with
a magic name. The CodingStyle document suggests not doing this
to avoid confusion. Remove the macro and use the comedi_board()
inline helper to get the dev->board_ptr information.

Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 354c00a6
Loading
Loading
Loading
Loading
+15 −14
Original line number Diff line number Diff line
@@ -57,8 +57,6 @@ struct boarddef_struct {
	const struct comedi_lrange *range;
};

#define this_board ((const struct boarddef_struct *)dev->board_ptr)

static int readback_insn(struct comedi_device *dev, struct comedi_subdevice *s,
			 struct comedi_insn *insn, unsigned int *data)
{
@@ -137,22 +135,23 @@ static int pcl734_insn_bits(struct comedi_device *dev,

static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
	const struct boarddef_struct *board = comedi_board(dev);
	struct comedi_subdevice *s;
	unsigned long iobase;
	unsigned int iosize;

	iobase = it->options[0];
	printk(KERN_INFO "comedi%d: poc: using %s iobase 0x%lx\n", dev->minor,
	       this_board->name, iobase);
	       board->name, iobase);

	dev->board_name = this_board->name;
	dev->board_name = board->name;

	if (iobase == 0) {
		printk(KERN_ERR "io base address required\n");
		return -EINVAL;
	}

	iosize = this_board->iosize;
	iosize = board->iosize;
	/* check if io addresses are available */
	if (!request_region(iobase, iosize, "dac02")) {
		printk(KERN_ERR "I/O port conflict: failed to allocate ports "
@@ -163,18 +162,18 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it)

	if (alloc_subdevices(dev, 1) < 0)
		return -ENOMEM;
	if (alloc_private(dev, sizeof(unsigned int) * this_board->n_chan) < 0)
	if (alloc_private(dev, sizeof(unsigned int) * board->n_chan) < 0)
		return -ENOMEM;

	/* analog output subdevice */
	s = dev->subdevices + 0;
	s->type = this_board->type;
	s->n_chan = this_board->n_chan;
	s->maxdata = (1 << this_board->n_bits) - 1;
	s->range_table = this_board->range;
	s->insn_write = this_board->winsn;
	s->insn_read = this_board->rinsn;
	s->insn_bits = this_board->insnbits;
	s->type = board->type;
	s->n_chan = board->n_chan;
	s->maxdata = (1 << board->n_bits) - 1;
	s->range_table = board->range;
	s->insn_write = board->winsn;
	s->insn_read = board->rinsn;
	s->insn_bits = board->insnbits;
	if (s->type == COMEDI_SUBD_AO || s->type == COMEDI_SUBD_DO)
		s->subdev_flags = SDF_WRITABLE;

@@ -183,8 +182,10 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it)

static void poc_detach(struct comedi_device *dev)
{
	const struct boarddef_struct *board = comedi_board(dev);

	if (dev->iobase)
		release_region(dev->iobase, this_board->iosize);
		release_region(dev->iobase, board->iosize);
}

static const struct boarddef_struct boards[] = {