From: H Hartley Sweeten Date: Wed, 23 May 2012 00:54:46 +0000 (-0700) Subject: staging: comedi: remove this_board macro in the poc driver X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~18509^2~1048 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=d5016e242b3ca919e3be7fa98dbb2b35e61c1efe;p=mirror_ubuntu-focal-kernel.git 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: H Hartley Sweeten Cc: Ian Abbott Cc: Mori Hess Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/poc.c b/drivers/staging/comedi/drivers/poc.c index e7120480687b..95e348fa89c8 100644 --- a/drivers/staging/comedi/drivers/poc.c +++ b/drivers/staging/comedi/drivers/poc.c @@ -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[] = {