speedtch speedtch.c,1.52,1.53

Duncan Sands duncan at infradead.org
Mon Apr 25 11:53:05 EDT 2005


Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv22094

Modified Files:
	speedtch.c 
Log Message:
Use the workqueue timer rather than our own, as per Roman's suggestion.  I
guess this is a "layering violation" (whatever that means), but reckon it's
unlikely that we'll ever get bitten by it.


Index: speedtch.c
===================================================================
RCS file: /home/cvs/speedtch/speedtch.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- speedtch.c	24 Apr 2005 21:07:24 -0000	1.52
+++ speedtch.c	25 Apr 2005 15:53:02 -0000	1.53
@@ -96,8 +96,7 @@
 struct speedtch_instance_data {
 	struct usbatm_data *usbatm;
 
-	struct work_struct check_status;
-	struct timer_list poll_timer;
+	struct work_struct status_checker;
 
 	int poll_delay; /* milliseconds */
 
@@ -496,11 +495,11 @@
 {
 	struct speedtch_instance_data *instance = (void *)data;
 
-	schedule_work(&instance->check_status);
+	schedule_work(&instance->status_checker);
 
 	/* The following check is racy, but the race is harmless */
 	if (instance->poll_delay < SPEEDTCH_MAX_POLL_DELAY)
-		mod_timer(&instance->poll_timer, jiffies + msecs_to_jiffies(instance->poll_delay));
+		mod_timer(&instance->status_checker.timer, jiffies + msecs_to_jiffies(instance->poll_delay));
 	else
 		atm_warn(instance->usbatm, "Too many failures - disabling line status polling\n");
 }
@@ -523,7 +522,7 @@
 	}
 
 	if ((count == 6) && !memcmp(up_int, instance->int_data, 6)) {
-		del_timer(&instance->poll_timer);
+		del_timer(&instance->status_checker.timer);
 		atm_info(usbatm, "DSL line goes up\n");
 	} else if ((count == 6) && !memcmp(down_int, instance->int_data, 6)) {
 		atm_info(usbatm, "DSL line goes down\n");
@@ -536,7 +535,7 @@
 		printk("\n");
 	}
 
-	schedule_work(&instance->check_status);
+	schedule_work(&instance->status_checker);
 
 	ret = usb_submit_urb(urb, GFP_ATOMIC);
 	if (ret < 0)
@@ -568,7 +567,7 @@
 	ret = speedtch_start_synchro(instance);
 
 	/* Start status polling */
-	mod_timer(&instance->poll_timer, jiffies + (1 * HZ));
+	mod_timer(&instance->status_checker.timer, jiffies + (1 * HZ));
 
 	/* Set up interrupt endpoint */
 	if (instance->int_urb) {
@@ -590,7 +589,7 @@
 
 	atm_dbg(usbatm, "%s entered\n", __func__);
 
-	del_timer_sync(&instance->poll_timer);
+	del_timer_sync(&instance->status_checker.timer);
 	usb_kill_urb(instance->int_urb);
 	wmb();
 	flush_scheduled_work();
@@ -676,11 +675,10 @@
 
 	instance->usbatm = usbatm;
 
-	INIT_WORK(&instance->check_status, (void *)speedtch_check_status, instance);
+	INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance);
 
-	init_timer(&instance->poll_timer);
-	instance->poll_timer.function = speedtch_status_poll;
-	instance->poll_timer.data = (unsigned long)instance;
+	instance->status_checker.timer.function = speedtch_status_poll;
+	instance->status_checker.timer.data = (unsigned long)instance;
 	instance->poll_delay = SPEEDTCH_MIN_POLL_DELAY;
 
 	instance->int_urb = usb_alloc_urb(0, GFP_KERNEL);




More information about the Usbatm-commits mailing list