aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Hartley Sweeten <hartleys@visionengravers.com>2012-09-11 19:49:06 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-12 12:30:34 -0400
commit5c1eb3857a7fada597f6dc2746f5f700bdb780ee (patch)
tree28ce22662987a6a48ce7511d4a00583f11351d75
parent22d4b56f5b4185db609f5c94113d8ee6ca8807dc (diff)
staging: comedi: adq12b: remove devpriv macro
This macro relies on a local variable having a specific name. Also, remove the kfree in the detach. The comedi core handles the kfree of dev->private. 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/adq12b.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c
index 0340c9ccc748..3a2aa5628be3 100644
--- a/drivers/staging/comedi/drivers/adq12b.c
+++ b/drivers/staging/comedi/drivers/adq12b.c
@@ -133,8 +133,6 @@ struct adq12b_private {
133 unsigned int digital_state; 133 unsigned int digital_state;
134}; 134};
135 135
136#define devpriv ((struct adq12b_private *)dev->private)
137
138/* 136/*
139 * "instructions" read/write data in "one-shot" or "software-triggered" 137 * "instructions" read/write data in "one-shot" or "software-triggered"
140 * mode. 138 * mode.
@@ -144,6 +142,7 @@ static int adq12b_ai_rinsn(struct comedi_device *dev,
144 struct comedi_subdevice *s, struct comedi_insn *insn, 142 struct comedi_subdevice *s, struct comedi_insn *insn,
145 unsigned int *data) 143 unsigned int *data)
146{ 144{
145 struct adq12b_private *devpriv = dev->private;
147 int n, i; 146 int n, i;
148 int range, channel; 147 int range, channel;
149 unsigned char hi, lo, status; 148 unsigned char hi, lo, status;
@@ -200,6 +199,7 @@ static int adq12b_do_insn_bits(struct comedi_device *dev,
200 struct comedi_subdevice *s, 199 struct comedi_subdevice *s,
201 struct comedi_insn *insn, unsigned int *data) 200 struct comedi_insn *insn, unsigned int *data)
202{ 201{
202 struct adq12b_private *devpriv = dev->private;
203 int channel; 203 int channel;
204 204
205 for (channel = 0; channel < 8; channel++) 205 for (channel = 0; channel < 8; channel++)
@@ -221,6 +221,7 @@ static int adq12b_do_insn_bits(struct comedi_device *dev,
221static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) 221static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it)
222{ 222{
223 const struct adq12b_board *board = comedi_board(dev); 223 const struct adq12b_board *board = comedi_board(dev);
224 struct adq12b_private *devpriv;
224 struct comedi_subdevice *s; 225 struct comedi_subdevice *s;
225 unsigned long iobase; 226 unsigned long iobase;
226 int unipolar, differential; 227 int unipolar, differential;
@@ -252,19 +253,18 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it)
252 253
253 dev->board_name = board->name; 254 dev->board_name = board->name;
254 255
255/* 256 ret = alloc_private(dev, sizeof(*devpriv));
256 * Allocate the private structure area. alloc_private() is a 257 if (ret)
257 * convenient macro defined in comedidev.h. 258 return ret;
258 */ 259 devpriv = dev->private;
259 if (alloc_private(dev, sizeof(struct adq12b_private)) < 0)
260 return -ENOMEM;
261 260
262/* fill in devpriv structure */
263 devpriv->unipolar = unipolar; 261 devpriv->unipolar = unipolar;
264 devpriv->differential = differential; 262 devpriv->differential = differential;
265 devpriv->digital_state = 0; 263 devpriv->digital_state = 0;
266/* initialize channel and range to -1 so we make sure we always write 264 /*
267 at least once to the CTREG in the instruction */ 265 * initialize channel and range to -1 so we make sure we
266 * always write at least once to the CTREG in the instruction
267 */
268 devpriv->last_channel = -1; 268 devpriv->last_channel = -1;
269 devpriv->last_range = -1; 269 devpriv->last_range = -1;
270 270
@@ -321,7 +321,6 @@ static void adq12b_detach(struct comedi_device *dev)
321{ 321{
322 if (dev->iobase) 322 if (dev->iobase)
323 release_region(dev->iobase, ADQ12B_SIZE); 323 release_region(dev->iobase, ADQ12B_SIZE);
324 kfree(devpriv);
325} 324}
326 325
327static const struct adq12b_board adq12b_boards[] = { 326static const struct adq12b_board adq12b_boards[] = {