From dwmw2 at infradead.org  Sat Jun 11 08:58:04 2005
From: dwmw2 at infradead.org (David Woodhouse)
Date: Sat Jun 11 08:58:08 2005
Subject: speedtch cxacru.c,1.30,1.31 speedtch.c,1.58,1.59
Message-ID: <E1Dh5Yq-000669-5q@phoenix.infradead.org>

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

Modified Files:
	cxacru.c speedtch.c 
Log Message:
Speedtouch actually reports speed in kb/s not Kib/s. I suspect cxacru is 
the same, so changing that too...


Index: cxacru.c
===================================================================
RCS file: /home/cvs/speedtch/cxacru.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- cxacru.c	6 May 2005 09:35:40 -0000	1.30
+++ cxacru.c	11 Jun 2005 12:58:00 -0000	1.31
@@ -427,7 +427,7 @@
 		atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424;
 		atm_dev->signal = ATM_PHY_SIG_FOUND;
 
-		dev_info(dev, "ADSL line: up (%d Kib/s down | %d Kib/s up)\n",
+		dev_info(dev, "ADSL line: up (%d kb/s down | %d kb/s up)\n",
 		     buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]);
 		break;
 

Index: speedtch.c
===================================================================
RCS file: /home/cvs/speedtch/speedtch.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- speedtch.c	3 May 2005 07:30:42 -0000	1.58
+++ speedtch.c	11 Jun 2005 12:58:00 -0000	1.59
@@ -480,7 +480,7 @@
 			atm_dev->signal = ATM_PHY_SIG_FOUND;
 
 			atm_info(usbatm,
-				 "ADSL line is up (%d Kib/s down | %d Kib/s up)\n",
+				 "ADSL line is up (%d kb/s down | %d kb/s up)\n",
 				 down_speed, up_speed);
 		}
 		break;


From duncan at infradead.org  Wed Jun 22 18:32:55 2005
From: duncan at infradead.org (Duncan Sands)
Date: Wed Jun 22 18:38:03 2005
Subject: speedtch speedtch.c,1.59,1.60
Message-ID: <E1DlDmB-0000h7-O9@phoenix.infradead.org>

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

Modified Files:
	speedtch.c 
Log Message:
Increase reliability of line resyncing.  Based on a patch by Aurelio Arroyo.


Index: speedtch.c
===================================================================
RCS file: /home/cvs/speedtch/speedtch.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- speedtch.c	11 Jun 2005 12:58:00 -0000	1.59
+++ speedtch.c	22 Jun 2005 22:32:51 -0000	1.60
@@ -100,6 +100,8 @@
 
 	struct work_struct status_checker;
 
+	unsigned char last_status;
+
 	int poll_delay; /* milliseconds */
 
 	struct timer_list resubmit_timer;
@@ -423,52 +425,48 @@
 	struct usbatm_data *usbatm = instance->usbatm;
 	struct atm_dev *atm_dev = usbatm->atm_dev;
 	unsigned char *buf = instance->scratch_buffer;
-	int ret;
+	int down_speed, up_speed, ret;
+	unsigned char status;
 
 	atm_dbg(usbatm, "%s entered\n", __func__);
 
 	ret = speedtch_read_status(instance);
 	if (ret < 0) {
 		atm_warn(usbatm, "error %d fetching device status\n", ret);
-		if (instance->poll_delay < MAX_POLL_DELAY)
-			instance->poll_delay *= 2;
+		instance->poll_delay = min (2 * instance->poll_delay, MAX_POLL_DELAY);
 		return;
 	}
 
-	if (instance->poll_delay > MIN_POLL_DELAY)
-		instance->poll_delay /= 2;
+	instance->poll_delay = max (instance->poll_delay / 2, MIN_POLL_DELAY);
+
+	status = buf[OFFSET_7];
 
-	atm_dbg(usbatm, "%s: line state %02x\n", __func__, buf[OFFSET_7]);
+	atm_dbg(usbatm, "%s: line state %02x\n", __func__, status);
 
-	switch (buf[OFFSET_7]) {
-	case 0:
-		if (atm_dev->signal != ATM_PHY_SIG_LOST) {
+	if ((status != instance->last_status) || !status) {
+		switch (status) {
+		case 0:
 			atm_dev->signal = ATM_PHY_SIG_LOST;
-			atm_info(usbatm, "ADSL line is down\n");
-			/* It'll never resync again unless we ask it to... */
+			if (instance->last_status)
+				atm_info(usbatm, "ADSL line is down\n");
+			/* It may never resync again unless we ask it to... */
 			ret = speedtch_start_synchro(instance);
-		}
-		break;
+			break;
 
-	case 0x08:
-		if (atm_dev->signal != ATM_PHY_SIG_UNKNOWN) {
+		case 0x08:
 			atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
 			atm_info(usbatm, "ADSL line is blocked?\n");
-		}
-		break;
+			break;
 
-	case 0x10:
-		if (atm_dev->signal != ATM_PHY_SIG_LOST) {
+		case 0x10:
 			atm_dev->signal = ATM_PHY_SIG_LOST;
 			atm_info(usbatm, "ADSL line is synchronising\n");
-		}
-		break;
+			break;
 
-	case 0x20:
-		if (atm_dev->signal != ATM_PHY_SIG_FOUND) {
-			int down_speed = buf[OFFSET_b] | (buf[OFFSET_b + 1] << 8)
+		case 0x20:
+			down_speed = buf[OFFSET_b] | (buf[OFFSET_b + 1] << 8)
 				| (buf[OFFSET_b + 2] << 16) | (buf[OFFSET_b + 3] << 24);
-			int up_speed = buf[OFFSET_b + 4] | (buf[OFFSET_b + 5] << 8)
+			up_speed = buf[OFFSET_b + 4] | (buf[OFFSET_b + 5] << 8)
 				| (buf[OFFSET_b + 6] << 16) | (buf[OFFSET_b + 7] << 24);
 
 			if (!(down_speed & 0x0000ffff) && !(up_speed & 0x0000ffff)) {
@@ -482,15 +480,15 @@
 			atm_info(usbatm,
 				 "ADSL line is up (%d kb/s down | %d kb/s up)\n",
 				 down_speed, up_speed);
-		}
-		break;
+			break;
 
-	default:
-		if (atm_dev->signal != ATM_PHY_SIG_UNKNOWN) {
+		default:
 			atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
-			atm_info(usbatm, "Unknown line state %02x\n", buf[OFFSET_7]);
+			atm_info(usbatm, "Unknown line state %02x\n", status);
+			break;
 		}
-		break;
+
+		instance->last_status = status;
 	}
 }
 
@@ -730,6 +728,7 @@
 
 	instance->status_checker.timer.function = speedtch_status_poll;
 	instance->status_checker.timer.data = (unsigned long)instance;
+	instance->last_status = 0xff;
 	instance->poll_delay = MIN_POLL_DELAY;
 
 	init_timer(&instance->resubmit_timer);
@@ -775,9 +774,9 @@
 {
 	struct usb_device *usb_dev = interface_to_usbdev(intf);
 	struct speedtch_instance_data *instance = usbatm->driver_data;
-	
+
 	usb_dbg(usbatm, "%s entered\n", __func__);
-	
+
 	speedtch_release_interfaces(usb_dev, usb_dev->actconfig->desc.bNumInterfaces);
 	usb_free_urb(instance->int_urb);
 	kfree(instance);


From duncan at infradead.org  Thu Jun 23 02:59:18 2005
From: duncan at infradead.org (Duncan Sands)
Date: Thu Jun 23 03:04:23 2005
Subject: speedtch speedtch.c,1.60,1.61
Message-ID: <E1DlLgE-0001Ao-B8@phoenix.infradead.org>

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

Modified Files:
	speedtch.c 
Log Message:
Whitespace fix.


Index: speedtch.c
===================================================================
RCS file: /home/cvs/speedtch/speedtch.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- speedtch.c	22 Jun 2005 22:32:51 -0000	1.60
+++ speedtch.c	23 Jun 2005 06:59:14 -0000	1.61
@@ -433,11 +433,11 @@
 	ret = speedtch_read_status(instance);
 	if (ret < 0) {
 		atm_warn(usbatm, "error %d fetching device status\n", ret);
-		instance->poll_delay = min (2 * instance->poll_delay, MAX_POLL_DELAY);
+		instance->poll_delay = min(2 * instance->poll_delay, MAX_POLL_DELAY);
 		return;
 	}
 
-	instance->poll_delay = max (instance->poll_delay / 2, MIN_POLL_DELAY);
+	instance->poll_delay = max(instance->poll_delay / 2, MIN_POLL_DELAY);
 
 	status = buf[OFFSET_7];
 


