speedtch usbatm.c,1.27,1.28

Duncan Sands duncan at infradead.org
Tue May 3 05:42:38 EDT 2005


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

Modified Files:
	usbatm.c 
Log Message:
Help the compiler produce better code by putting stride in a local variable.


Index: usbatm.c
===================================================================
RCS file: /home/cvs/speedtch/usbatm.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- usbatm.c	3 May 2005 09:34:34 -0000	1.27
+++ usbatm.c	3 May 2005 09:42:34 -0000	1.28
@@ -298,12 +298,12 @@
 	struct atm_vcc *vcc;
 	struct sk_buff *sarb;
 	struct usbatm_vcc_data *vcc_data;
+	unsigned int stride = instance->rx_channel.stride;
 	int vci, cached_vci = 0;
 	short vpi, cached_vpi = 0;
 	u8 pti;
 
-	for (; avail_data >= instance->rx_channel.stride;
-	     avail_data -= instance->rx_channel.stride, source += instance->rx_channel.stride) {
+	for (; avail_data >= stride; avail_data -= stride, source += stride) {
 		vpi = ((source[0] & 0x0f) << 4) | (source[1] >> 4);
 		vci = ((source[1] & 0x0f) << 12) | (source[2] << 4) | (source[3] >> 4);
 		pti = ((source[3] & 0xe) >> 1);
@@ -418,6 +418,7 @@
 	struct usbatm_control *ctrl = UDSL_SKB(skb);
 	struct atm_vcc *vcc = ctrl->atm.vcc;
 	unsigned int num_written;
+	unsigned int stride = instance->tx_channel.stride;
 
 	/* UDSL_ASSERT(!(avail_space % instance->tx_channel.stride)); */
 	BUG_ON(avail_space % instance->tx_channel.stride);
@@ -425,7 +426,7 @@
 	     __func__, skb->len, avail_space);
 
 	for (num_written = 0; num_written < avail_space && ctrl->len;
-	     num_written += instance->tx_channel.stride, target += instance->tx_channel.stride) {
+	     num_written += stride, target += stride) {
 		unsigned int data_len = min_t(unsigned int, skb->len, ATM_CELL_PAYLOAD);
 		unsigned int left = ATM_CELL_PAYLOAD - data_len;
 		u8 *ptr = target;




More information about the Usbatm-commits mailing list