[PATCH v2 18/43] staging: comedi: ni_660x: remove ni_660x_num_counters()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This inline function is only used by the (*auto_attach). Remove it
and just use a local variable for the calculation.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_660x.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c
index 595c862..6a3a12e 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -342,13 +342,6 @@ struct ni_660x_private {
 	unsigned short pfi_output_selects[NUM_PFI_CHANNELS];
 };
 
-static inline unsigned ni_660x_num_counters(struct comedi_device *dev)
-{
-	const struct ni_660x_board *board = dev->board_ptr;
-
-	return board->n_chips * counters_per_chip;
-}
-
 static enum ni_660x_register ni_gpct_to_660x_register(enum ni_gpct_register reg)
 {
 	switch (reg) {
@@ -927,6 +920,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
 	const struct ni_660x_board *board = NULL;
 	struct ni_660x_private *devpriv;
 	struct comedi_subdevice *s;
+	unsigned int n_counters;
 	int subdev;
 	int ret;
 	unsigned i;
@@ -986,17 +980,17 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
 	 */
 	ni_660x_write(dev, 0, 0, NI660X_STC_DIO_CONTROL);
 
+	n_counters = board->n_chips * counters_per_chip;
 	devpriv->counter_dev = ni_gpct_device_construct(dev,
 						     ni_660x_gpct_write,
 						     ni_660x_gpct_read,
 						     ni_gpct_variant_660x,
-						     ni_660x_num_counters
-						     (dev));
+						     n_counters);
 	if (!devpriv->counter_dev)
 		return -ENOMEM;
 	for (i = 0; i < NI_660X_MAX_NUM_COUNTERS; ++i) {
 		s = &dev->subdevices[subdev++];
-		if (i < ni_660x_num_counters(dev)) {
+		if (i < n_counters) {
 			s->type = COMEDI_SUBD_COUNTER;
 			s->subdev_flags = SDF_READABLE | SDF_WRITABLE |
 					  SDF_LSAMPL | SDF_CMD_READ;
@@ -1025,7 +1019,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
 	for (i = 0; i < board->n_chips; ++i)
 		init_tio_chip(dev, i);
 
-	for (i = 0; i < ni_660x_num_counters(dev); ++i)
+	for (i = 0; i < n_counters; ++i)
 		ni_tio_init_counter(&devpriv->counter_dev->counters[i]);
 
 	for (i = 0; i < NUM_PFI_CHANNELS; ++i) {
-- 
2.6.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux