[PATCH 08/31] staging: comedi: comedi_fc: tidy up cfc_bytes_per_scan()

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

 



This function returns the total number of bytes for a full scan of
an async command chanlist. The returned value is an unsigned int.

Change all the local variables to unsigned int and use a local
variable for the s->async->cmd.chanlist_len.

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

diff --git a/drivers/staging/comedi/drivers/comedi_fc.h b/drivers/staging/comedi/drivers/comedi_fc.h
index 042bf87..b8d125e 100644
--- a/drivers/staging/comedi/drivers/comedi_fc.h
+++ b/drivers/staging/comedi/drivers/comedi_fc.h
@@ -47,19 +47,20 @@ unsigned int cfc_handle_events(struct comedi_device *,
 
 static inline unsigned int cfc_bytes_per_scan(struct comedi_subdevice *s)
 {
-	int num_samples;
-	int bits_per_sample;
+	unsigned int chanlist_len = s->async->cmd.chanlist_len;
+	unsigned int num_samples;
+	unsigned int bits_per_sample;
 
 	switch (s->type) {
 	case COMEDI_SUBD_DI:
 	case COMEDI_SUBD_DO:
 	case COMEDI_SUBD_DIO:
 		bits_per_sample = 8 * bytes_per_sample(s);
-		num_samples = (s->async->cmd.chanlist_len +
-			       bits_per_sample - 1) / bits_per_sample;
+		num_samples = (chanlist_len + bits_per_sample - 1) /
+				bits_per_sample;
 		break;
 	default:
-		num_samples = s->async->cmd.chanlist_len;
+		num_samples = chanlist_len;
 		break;
 	}
 	return num_samples * bytes_per_sample(s);
-- 
1.8.5.2

_______________________________________________
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