From f19df8b0c0a9598bf469692e28dc31c8c0dc1e89 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 9 Apr 2013 16:24:20 -0700 Subject: [PATCH] staging: comedi: adq12b: remove need for some local variables The 'unipolar' and 'differential' local variables are not needed in the adb12b_attach() function. Just use the cached private data variables. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adq12b.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c index 71ed5904382..44e8f0e2d60 100644 --- a/drivers/staging/comedi/drivers/adq12b.c +++ b/drivers/staging/comedi/drivers/adq12b.c @@ -213,12 +213,8 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct adq12b_private *devpriv; struct comedi_subdevice *s; - int unipolar, differential; int ret; - unipolar = it->options[1]; - differential = it->options[2]; - ret = comedi_request_region(dev, it->options[0], ADQ12B_SIZE); if (ret) return ret; @@ -228,8 +224,8 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) return -ENOMEM; dev->private = devpriv; - devpriv->unipolar = unipolar; - devpriv->differential = differential; + devpriv->unipolar = it->options[1]; + devpriv->differential = it->options[2]; devpriv->digital_state = 0; /* * initialize channel and range to -1 so we make sure we @@ -245,7 +241,7 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) s = &dev->subdevices[0]; /* analog input subdevice */ s->type = COMEDI_SUBD_AI; - if (differential) { + if (devpriv->differential) { s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; s->n_chan = 8; } else { @@ -253,7 +249,7 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->n_chan = 16; } - if (unipolar) + if (devpriv->unipolar) s->range_table = &range_adq12b_ai_unipolar; else s->range_table = &range_adq12b_ai_bipolar; -- 2.46.0