]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: remove thisboard macro in the comedi_test driver
authorH Hartley Sweeten <hartleys@visionengravers.com>
Tue, 22 May 2012 22:58:28 +0000 (15:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Jun 2012 03:30:06 +0000 (20:30 -0700)
The 'thisboard' 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 <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/comedi_test.c

index 873e37450bba0276d757b451ac97d0772102c904..9f3c3d5d02a4a0b21b93dc2a332692b6cfc33373 100644 (file)
@@ -67,8 +67,6 @@ struct waveform_board {
 
 #define N_CHANS 8
 
-#define thisboard ((const struct waveform_board *)dev->board_ptr)
-
 /* Data unique to this driver */
 struct waveform_private {
        struct timer_list timer;
@@ -429,12 +427,13 @@ static int waveform_ao_insn_write(struct comedi_device *dev,
 static int waveform_attach(struct comedi_device *dev,
                           struct comedi_devconfig *it)
 {
+       const struct waveform_board *board = comedi_board(dev);
        struct comedi_subdevice *s;
        int amplitude = it->options[0];
        int period = it->options[1];
        int i;
 
-       dev->board_name = thisboard->name;
+       dev->board_name = board->name;
 
        if (alloc_private(dev, sizeof(struct waveform_private)) < 0)
                return -ENOMEM;
@@ -457,8 +456,8 @@ static int waveform_attach(struct comedi_device *dev,
        /* analog input subdevice */
        s->type = COMEDI_SUBD_AI;
        s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ;
-       s->n_chan = thisboard->ai_chans;
-       s->maxdata = (1 << thisboard->ai_bits) - 1;
+       s->n_chan = board->ai_chans;
+       s->maxdata = (1 << board->ai_bits) - 1;
        s->range_table = &waveform_ai_ranges;
        s->len_chanlist = s->n_chan * 2;
        s->insn_read = waveform_ai_insn_read;
@@ -471,8 +470,8 @@ static int waveform_attach(struct comedi_device *dev,
        /* analog output subdevice (loopback) */
        s->type = COMEDI_SUBD_AO;
        s->subdev_flags = SDF_WRITEABLE | SDF_GROUND;
-       s->n_chan = thisboard->ai_chans;
-       s->maxdata = (1 << thisboard->ai_bits) - 1;
+       s->n_chan = board->ai_chans;
+       s->maxdata = (1 << board->ai_bits) - 1;
        s->range_table = &waveform_ai_ranges;
        s->len_chanlist = s->n_chan * 2;
        s->insn_write = waveform_ao_insn_write;