aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Hartley Sweeten <hartleys@visionengravers.com>2012-08-16 22:50:01 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-17 11:17:34 -0400
commitce774eab13606610df53301897e9c003476d7c6c (patch)
treeedc05e40898c0e1f766d0e3d7cd4432b75def33a
parent8b00a2f801866bd89a70f082cd0f322c7019d476 (diff)
staging: comedi: cb_pcimdda: cleanup the 8255 subdevice init
The dio_registers variable in the private data is only used to pass the base address to the 8255 subdevice. Remove the variable from the private data and pass the value directly to the subdev_8255_init() function. Make sure to check the return from subdev_8255_init(). That function can fail. For aesthetic reasons, rename the local variable 'err' to 'ret'. 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_pcimdda.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c
index 4127aa756f6a..b4d1f8b6136f 100644
--- a/drivers/staging/comedi/drivers/cb_pcimdda.c
+++ b/drivers/staging/comedi/drivers/cb_pcimdda.c
@@ -137,7 +137,6 @@ static const struct cb_pcimdda_board cb_pcimdda_boards[] = {
137 * struct. 137 * struct.
138 */ 138 */
139struct cb_pcimdda_private { 139struct cb_pcimdda_private {
140 unsigned long dio_registers;
141 char attached_to_8255; /* boolean */ 140 char attached_to_8255; /* boolean */
142 141
143#define MAX_AO_READBACK_CHANNELS 6 142#define MAX_AO_READBACK_CHANNELS 6
@@ -243,11 +242,11 @@ static int cb_pcimdda_attach(struct comedi_device *dev,
243 struct cb_pcimdda_private *devpriv; 242 struct cb_pcimdda_private *devpriv;
244 struct pci_dev *pcidev; 243 struct pci_dev *pcidev;
245 struct comedi_subdevice *s; 244 struct comedi_subdevice *s;
246 int err; 245 int ret;
247 246
248 err = alloc_private(dev, sizeof(*devpriv)); 247 ret = alloc_private(dev, sizeof(*devpriv));
249 if (err) 248 if (ret)
250 return err; 249 return ret;
251 devpriv = dev->private; 250 devpriv = dev->private;
252 251
253 pcidev = cb_pcimdda_probe(dev, it); 252 pcidev = cb_pcimdda_probe(dev, it);
@@ -257,15 +256,14 @@ static int cb_pcimdda_attach(struct comedi_device *dev,
257 thisboard = comedi_board(dev); 256 thisboard = comedi_board(dev);
258 dev->board_name = thisboard->name; 257 dev->board_name = thisboard->name;
259 258
260 err = comedi_pci_enable(pcidev, dev->board_name); 259 ret = comedi_pci_enable(pcidev, dev->board_name);
261 if (err) 260 if (ret)
262 return err; 261 return ret;
263 dev->iobase = pci_resource_start(pcidev, thisboard->regs_badrindex); 262 dev->iobase = pci_resource_start(pcidev, thisboard->regs_badrindex);
264 devpriv->dio_registers = dev->iobase + thisboard->dio_offset;
265 263
266 err = comedi_alloc_subdevices(dev, 2); 264 ret = comedi_alloc_subdevices(dev, 2);
267 if (err) 265 if (ret)
268 return err; 266 return ret;
269 267
270 s = dev->subdevices + 0; 268 s = dev->subdevices + 0;
271 269
@@ -287,11 +285,10 @@ static int cb_pcimdda_attach(struct comedi_device *dev,
287 if (thisboard->dio_chans) { 285 if (thisboard->dio_chans) {
288 switch (thisboard->dio_method) { 286 switch (thisboard->dio_method) {
289 case DIO_8255: 287 case DIO_8255:
290 /* 288 ret = subdev_8255_init(dev, s, NULL,
291 * this is a straight 8255, so register us with 289 dev->iobase + thisboard->dio_offset);
292 * the 8255 driver 290 if (ret)
293 */ 291 return ret;
294 subdev_8255_init(dev, s, NULL, devpriv->dio_registers);
295 devpriv->attached_to_8255 = 1; 292 devpriv->attached_to_8255 = 1;
296 break; 293 break;
297 case DIO_INTERNAL: 294 case DIO_INTERNAL: