[zaptel-commits] tzafrir: branch 1.4 r3073 - /branches/1.4/ztdummy.c

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Fri Sep 21 17:14:34 CDT 2007


Author: tzafrir
Date: Fri Sep 21 17:14:33 2007
New Revision: 3073

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3073
Log:
Sort out print messages in ztdummy:
* Proper priority to every message.
* Remove a useless global.

Modified:
    branches/1.4/ztdummy.c

Modified: branches/1.4/ztdummy.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/ztdummy.c?view=diff&rev=3073&r1=3072&r2=3073
==============================================================================
--- branches/1.4/ztdummy.c (original)
+++ branches/1.4/ztdummy.c Fri Sep 21 17:14:33 2007
@@ -124,7 +124,6 @@
 /* Old UCHI stuff */
 static    uhci_desc_t  *td;
 static    uhci_t *s;
-static int check_int = 0;
 static int monitor = 0;
 
 /* exported kernel symbols */
@@ -154,12 +153,12 @@
 static void update_rtc_rate(struct ztdummy *ztd)
 {
 	if (((rtc_rate & (rtc_rate - 1)) != 0) || (rtc_rate > 8192) || (rtc_rate < 2)) {
-		printk("Invalid RTC rate %d specified\n", rtc_rate);
+		printk(KERN_NOTICE "Invalid RTC rate %d specified\n", rtc_rate);
 		rtc_rate = current_rate;	/* Set default RTC rate */
 	}
 	if (!rtc_rate || (rtc_rate != current_rate)) {
 		rtc_control(&ztd->rtc_task, RTC_IRQP_SET, current_rate = (rtc_rate ? rtc_rate : 1024));	/* 1024 Hz */
-		printk("ztdummy: RTC rate is %d\n", rtc_rate);
+		printk(KERN_INFO "ztdummy: RTC rate is %d\n", rtc_rate);
 		ztd->counter = 0;
 	}
 }
@@ -247,11 +246,14 @@
 
 	status = inw (io_addr + USBSTS);
 	if (status != 0)  {	/* interrupt from our USB port */
+		static int check_int = 0;
 		zt_receive(&ztd->span);
 		zt_transmit(&ztd->span);
-		if (monitor && (check_int==0)) {      /* for testing if interrupt gets triggered*/
+		/* TODO: What's the relation between monitor and
+		 * DEBUG_TICKS */
+		if (monitor && check_int) {
 			check_int = 1;
-			printk("ztdummy: interrupt triggered \n");     
+			printk(KERN_NOTICE "ztdummy: interrupt triggered \n");     
 		}   
 	}
 	return;
@@ -292,26 +294,26 @@
 #endif
 	
 	if (uhci_devices==NULL) {
-		printk ("ztdummy: Uhci_devices pointer error.\n");
+		printk (KERN_ERR "ztdummy: Uhci_devices pointer error.\n");
 		return -ENODEV;
 	}
 	s=*uhci_devices;	/* uhci device */
 	if (s==NULL) {
-		printk ("ztdummy: No uhci_device found.\n");
+		printk (KERN_ERR "ztdummy: No uhci_device found.\n");
 		return -ENODEV;
 	}
 #endif
 
 	ztd = kmalloc(sizeof(struct ztdummy), GFP_KERNEL);
 	if (ztd == NULL) {
-		printk("ztdummy: Unable to allocate memory\n");
+		printk(KERN_ERR "ztdummy: Unable to allocate memory\n");
 		return -ENOMEM;
 	}
 
 	memset(ztd, 0x0, sizeof(struct ztdummy));
 
 	if (ztdummy_initialize(ztd)) {
-		printk("ztdummy: Unable to intialize zaptel driver\n");
+		printk(KERN_ERR "ztdummy: Unable to intialize zaptel driver\n");
 		kfree(ztd);
 		return -ENODEV;
 	}
@@ -324,7 +326,7 @@
 	ztd->rtc_task.private_data = ztd;
 	err = rtc_register(&ztd->rtc_task);
 	if (err < 0) {
-		printk("ztdummy: Unable to register zaptel rtc driver\n");
+		printk(KERN_ERR "ztdummy: Unable to register zaptel rtc driver\n");
 		zt_unregister(&ztd->span);
 		kfree(ztd);
 		return err;
@@ -336,16 +338,16 @@
 	rtc_control(&ztd->rtc_task, RTC_PIE_ON, 0);
 	tasklet_init(&ztd_tlet, ztd_tasklet, 0);
 #elif defined(USE_HIGHRESTIMER)
-	printk("ztdummy: Trying to load High Resolution Timer\n");
+	printk(KERN_DEBUG "ztdummy: Trying to load High Resolution Timer\n");
 	hrtimer_init(&zaptimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	printk("ztdummy: Initialized High Resolution Timer\n");
+	printk(KERN_DEBUG "ztdummy: Initialized High Resolution Timer\n");
 
 	/* Set timer callback function */
 	zaptimer.function = ztdummy_hr_int;
 
-	printk("ztdummy: Starting High Resolution Timer\n");
+	printk(KERN_DEBUG "ztdummy: Starting High Resolution Timer\n");
 	hrtimer_start(&zaptimer, ktime_set(0, ZAPTEL_TIME_NS), HRTIMER_MODE_REL);
-	printk("ztdummy: High Resolution Timer started, good to go\n");
+	printk(KERN_INFO "ztdummy: High Resolution Timer started, good to go\n");
 #else
 	init_timer(&timer);
 	timer.function = ztdummy_timer;
@@ -375,7 +377,7 @@
 #endif	
 
 	if (debug)
-		printk("ztdummy: init() finished\n");
+		printk(KERN_DEBUG "ztdummy: init() finished\n");
 	return 0;
 }
 




More information about the zaptel-commits mailing list