diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-08-16 22:46:20 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-17 11:14:31 -0400 |
commit | 5f7cab0a9b0651e8cb125eb7ce2b1cb21f48b24f (patch) | |
tree | b7a541900cd736fac5b514cee258653a5a736576 | |
parent | 2c0db01128e0d767c4071a5ad22376875bc5d545 (diff) |
staging: comedi: cb_pcimdas: remove thisboard and devpriv macros
These macros rely on a local variable having a specific name.
Remove them and use the comedi_board() helper to get the thisboard
pointer.
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>
-rw-r--r-- | drivers/staging/comedi/drivers/cb_pcimdas.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index c632a89f3ae9..124478d22a48 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c | |||
@@ -119,11 +119,6 @@ static const struct cb_pcimdas_board cb_pcimdas_boards[] = { | |||
119 | }; | 119 | }; |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * Useful for shorthand access to the particular board structure | ||
123 | */ | ||
124 | #define thisboard ((const struct cb_pcimdas_board *)dev->board_ptr) | ||
125 | |||
126 | /* | ||
127 | * this structure is for data unique to this hardware driver. If | 122 | * this structure is for data unique to this hardware driver. If |
128 | * several hardware drivers keep similar information in this structure, | 123 | * several hardware drivers keep similar information in this structure, |
129 | * feel free to suggest moving the variable to the struct comedi_device | 124 | * feel free to suggest moving the variable to the struct comedi_device |
@@ -137,12 +132,6 @@ struct cb_pcimdas_private { | |||
137 | unsigned int ao_readback[2]; | 132 | unsigned int ao_readback[2]; |
138 | }; | 133 | }; |
139 | 134 | ||
140 | /* | ||
141 | * most drivers define the following macro to make it easy to | ||
142 | * access the private structure. | ||
143 | */ | ||
144 | #define devpriv ((struct cb_pcimdas_private *)dev->private) | ||
145 | |||
146 | static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, | 135 | static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, |
147 | struct comedi_subdevice *s, | 136 | struct comedi_subdevice *s, |
148 | struct comedi_insn *insn, unsigned int *data); | 137 | struct comedi_insn *insn, unsigned int *data); |
@@ -193,21 +182,23 @@ static struct pci_dev *cb_pcimdas_find_pci_dev(struct comedi_device *dev, | |||
193 | static int cb_pcimdas_attach(struct comedi_device *dev, | 182 | static int cb_pcimdas_attach(struct comedi_device *dev, |
194 | struct comedi_devconfig *it) | 183 | struct comedi_devconfig *it) |
195 | { | 184 | { |
185 | const struct cb_pcimdas_board *thisboard; | ||
186 | struct cb_pcimdas_private *devpriv; | ||
196 | struct pci_dev *pcidev; | 187 | struct pci_dev *pcidev; |
197 | struct comedi_subdevice *s; | 188 | struct comedi_subdevice *s; |
198 | unsigned long iobase_8255; | 189 | unsigned long iobase_8255; |
199 | int ret; | 190 | int ret; |
200 | 191 | ||
201 | /* | 192 | ret = alloc_private(dev, sizeof(*devpriv)); |
202 | * Allocate the private structure area. | 193 | if (ret) |
203 | */ | 194 | return ret; |
204 | if (alloc_private(dev, sizeof(struct cb_pcimdas_private)) < 0) | 195 | devpriv = dev->private; |
205 | return -ENOMEM; | ||
206 | 196 | ||
207 | pcidev = cb_pcimdas_find_pci_dev(dev, it); | 197 | pcidev = cb_pcimdas_find_pci_dev(dev, it); |
208 | if (!pcidev) | 198 | if (!pcidev) |
209 | return -EIO; | 199 | return -EIO; |
210 | comedi_set_hw_dev(dev, &pcidev->dev); | 200 | comedi_set_hw_dev(dev, &pcidev->dev); |
201 | thisboard = comedi_board(dev); | ||
211 | 202 | ||
212 | /* Warn about non-tested features */ | 203 | /* Warn about non-tested features */ |
213 | switch (thisboard->device_id) { | 204 | switch (thisboard->device_id) { |
@@ -299,6 +290,8 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, | |||
299 | struct comedi_subdevice *s, | 290 | struct comedi_subdevice *s, |
300 | struct comedi_insn *insn, unsigned int *data) | 291 | struct comedi_insn *insn, unsigned int *data) |
301 | { | 292 | { |
293 | const struct cb_pcimdas_board *thisboard = comedi_board(dev); | ||
294 | struct cb_pcimdas_private *devpriv = dev->private; | ||
302 | int n, i; | 295 | int n, i; |
303 | unsigned int d; | 296 | unsigned int d; |
304 | unsigned int busy; | 297 | unsigned int busy; |
@@ -368,6 +361,7 @@ static int cb_pcimdas_ao_winsn(struct comedi_device *dev, | |||
368 | struct comedi_subdevice *s, | 361 | struct comedi_subdevice *s, |
369 | struct comedi_insn *insn, unsigned int *data) | 362 | struct comedi_insn *insn, unsigned int *data) |
370 | { | 363 | { |
364 | struct cb_pcimdas_private *devpriv = dev->private; | ||
371 | int i; | 365 | int i; |
372 | int chan = CR_CHAN(insn->chanspec); | 366 | int chan = CR_CHAN(insn->chanspec); |
373 | 367 | ||
@@ -397,6 +391,7 @@ static int cb_pcimdas_ao_rinsn(struct comedi_device *dev, | |||
397 | struct comedi_subdevice *s, | 391 | struct comedi_subdevice *s, |
398 | struct comedi_insn *insn, unsigned int *data) | 392 | struct comedi_insn *insn, unsigned int *data) |
399 | { | 393 | { |
394 | struct cb_pcimdas_private *devpriv = dev->private; | ||
400 | int i; | 395 | int i; |
401 | int chan = CR_CHAN(insn->chanspec); | 396 | int chan = CR_CHAN(insn->chanspec); |
402 | 397 | ||