Description: Make variables containing positive offsets unsigned
Author: Simon Richter <sjr@debian.org>
Last-Update: 2013-01-08

Index: langford-0.0.20130228/langford.c
===================================================================
--- langford-0.0.20130228.orig/langford.c
+++ langford-0.0.20130228/langford.c
@@ -39,13 +39,13 @@ static DEFINE_MUTEX(cdev_open_close_mute
 
 static DEFINE_MUTEX(cdev_read_buff_mutex);		/**< Read buffer mutex*/
 static uint8_t	*cdev_read_buff;				/**< Read buffer*/
-static int		cdev_read_buff_start;			/**< Start pointer to read buffer*/
-static int		cdev_read_buff_end;				/**< End pointer to read buffer*/
+static unsigned int	cdev_read_buff_start;			/**< Start pointer to read buffer*/
+static unsigned int	cdev_read_buff_end;				/**< End pointer to read buffer*/
 
 static DEFINE_MUTEX(cdev_write_buff_mutex);		/**< Write buffer mutex*/
 static uint8_t	*cdev_write_buff;				/**< Write buffer*/
-static int		cdev_write_buff_start;			/**< Start pointer to write buffer*/
-static int		cdev_write_buff_end;			/**< End pointer to write buffer*/
+static unsigned int	cdev_write_buff_start;			/**< Start pointer to write buffer*/
+static unsigned int	cdev_write_buff_end;			/**< End pointer to write buffer*/
 
 /*DMA read and write threads*/
 static struct task_struct	*dev_read_thread;	/**< Thread in charge of reading data from PCIe device*/
@@ -54,7 +54,7 @@ static struct task_struct	*dev_write_thr
 
 /**Figures out elements are used in a circular buffer
 */
-static int circ_buff_filled(int start, int end, int len) {
+static unsigned int circ_buff_filled(unsigned int start, unsigned int end, unsigned int len) {
 	int		rc;
 
 	rc = end - start;
@@ -69,7 +69,7 @@ static int circ_buff_filled(int start, i
 
 /**Figures out how many elements of a circular buffer are available to be filled
 */
-static int circ_buff_avail(int start, int end, int len) {
+static unsigned int circ_buff_avail(unsigned int start, unsigned int end, unsigned int len) {
 	return len - circ_buff_filled(start, end, len) - 1;
 };
 
@@ -84,9 +84,9 @@ This thread:
 static int dev_read_task(void *data) {
 	int		DescLevel;					/*Descriptor FIFO level read from device*/
 	int		DescActive, DescComp;		/*Number of descriptors to be serviced and the number of completed descriptors*/
-	int		BuffStart, BuffEnd;			/*Indices to beginning and end of DMA buffers ring array (DevPrivData->RxDmaBuffsBusAddr)*/
+	unsigned int	BuffStart, BuffEnd;			/*Indices to beginning and end of DMA buffers ring array (DevPrivData->RxDmaBuffsBusAddr)*/
 	int		Ctr;
-	int		BuffsToWrite;
+	unsigned int	BuffsToWrite;
 	uint32_t	DescAddr;
 
 	printk(KERN_DEBUG DRIVER_NAME " Read thread created\n");
@@ -225,9 +225,9 @@ This thread:
 static int dev_write_task(void *data) {
 	int		DescLevel;					/*Descriptor FIFO level read from device*/
 	int		DescActive, DescComp;		/*Number of descriptors to be serviced and the number of completed descriptors*/
-	int		BuffStart, BuffEnd;			/*Indices to beginning and end of DMA buffers ring array (DevPrivData->TxDmaBuffsBusAddr)*/
+	unsigned int	BuffStart, BuffEnd;			/*Indices to beginning and end of DMA buffers ring array (DevPrivData->TxDmaBuffsBusAddr)*/
 	int		Ctr;
-	int		BuffsToWrite;
+	unsigned int	BuffsToWrite;
 	uint32_t	DescAddr;
 
 	printk(KERN_DEBUG DRIVER_NAME " Write thread created\n");
@@ -402,7 +402,7 @@ static ssize_t cdev_read(struct file *fi
 /**Service user mode writes
 */
 static ssize_t cdev_write(struct file *file, const char __user *buf, size_t len, loff_t *ppos) {
-	int		cdev_buff_avail;
+	unsigned int		cdev_buff_avail;
 
 #if VERBOSE_LOGGING_W
 	printk(KERN_DEBUG DRIVER_NAME " User requested write of %zu bytes\n", len);
