if (list->position.tenthdegree[code-3] >180) list->position.tenthdegree[code-3] -=360;
if (list->position.tenthdegree[code-3] >1800) list->position.tenthdegree[code-3] -=3600;
static void trackdev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value){	struct trackdev *trackdev = handle->private;	struct trackdev_list *list = trackdev->list;	struct trackdev_filter *filter;	int i;	while (list) {		get_fast_time(&list->position.time);		if (code < 3 || code > 5) 		     printk(KERN_ERR "itrax: Unknown eventcode : %d\n",code);		else  {		  list->position.raw[code-3] =value ;		  list->position.tenthdegree[code-3] =(value * 1800) / 32768; 				  /*  normalize to 0..360, -80..+80, -90..+90 */		  if (code-3 == 2 || code -3 == 1) 		    if (list->position.tenthdegree[code-3] >180) list->position.tenthdegree[code-3] -=360;		  /*  All stuff below is for filtering */  		  switch (list->filter[code-3].type ) { 		  case ITRAX_FILTER_OFF:		    break;		  case ITRAX_FILTER_SLIDING_WINDOW:		    filter = &(list->filter[code-3]);		    /* replace oldest value with new unweighted value */		    filter->buffer[filter->head] = list->position.tenthdegree[code-3];		     /* increase pointer */		    if (filter->head < filter->size-1) {  		      filter->head++;		    } 		    else {		      filter->head = 0;		      filter->buffer_full = 1;		    }		    /* calculate filtered value */       		    filter->lfv = 0.0;		    for (i=0 ; i<filter->size ; i++) {		      filter->lfv += (filter->buffer[i] * filter->coeff[i]);		    }		    list->position.tenthdegree[code-3] = filter->lfv;		    break;		    		  case ITRAX_FILTER_FASTMEAN:		    filter = &(list->filter[code-3]);		    /* subtract oldest  value from lfv */		    if (filter->buffer_full)		      filter->lfv -= filter->buffer[filter->head];		    /* replace oldest value with new weighted value */		    filter->buffer[filter->head] = list->position.tenthdegree[code-3] 		      / filter->size ;		    /* add new  value  to  lfv */		    filter->lfv += filter->buffer[filter->head];		     /* increase pointer */		    if (filter->head < filter->size-1) {  		      filter->head++;		    } 		    else {		      filter->head = 0;		      filter->buffer_full = 1;		    }		    /* calculate filtered value */		    if (filter->buffer_full)  		    list->position.tenthdegree[code-3] = filter->lfv;		    break;		  }  /* end of switch (filtertype) */		  /* new data arrived */		  list->new = 1;#ifdef K24	     		  kill_fasync(&list->fasync, SIGIO, POLL_IN);#else		  kill_fasync(list->fasync, SIGIO);  #endif		}		list = list->next;	} 	wake_up_interruptible(&trackdev->wait); }