patch-2.4.10 linux/drivers/isdn/hisax/elsa_ser.c
Next file: linux/drivers/isdn/hisax/fsm.c
Previous file: linux/drivers/isdn/hisax/config.c
Back to the patch index
Back to the overall index
- Lines: 57
- Date:
Sun Sep 9 10:45:43 2001
- Orig file:
v2.4.9/linux/drivers/isdn/hisax/elsa_ser.c
- Orig date:
Tue Jul 3 17:08:19 2001
diff -u --recursive --new-file v2.4.9/linux/drivers/isdn/hisax/elsa_ser.c linux/drivers/isdn/hisax/elsa_ser.c
@@ -1,4 +1,4 @@
-/* $Id: elsa_ser.c,v 2.10.6.2 2001/06/09 15:14:17 kai Exp $
+/* $Id: elsa_ser.c,v 2.10.6.3 2001/08/17 12:34:26 kai Exp $
*
* stuff for the serial modem on ELSA cards
*
@@ -14,10 +14,6 @@
#define RS_ISR_PASS_LIMIT 256
#define BASE_BAUD ( 1843200 / 16 )
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
//#define SERIAL_DEBUG_OPEN 1
//#define SERIAL_DEBUG_INTR 1
//#define SERIAL_DEBUG_FLOW 1
@@ -257,7 +253,7 @@
write_modem(struct BCState *bcs) {
int ret=0;
struct IsdnCardState *cs = bcs->cs;
- int count, len, fp, buflen;
+ int count, len, fp;
long flags;
if (!bcs->tx_skb)
@@ -266,12 +262,14 @@
return 0;
save_flags(flags);
cli();
- buflen = MAX_MODEM_BUF - cs->hw.elsa.transcnt;
- len = MIN(buflen, bcs->tx_skb->len);
+ len = bcs->tx_skb->len;
+ if (len > MAX_MODEM_BUF - cs->hw.elsa.transcnt)
+ len = MAX_MODEM_BUF - cs->hw.elsa.transcnt;
fp = cs->hw.elsa.transcnt + cs->hw.elsa.transp;
fp &= (MAX_MODEM_BUF -1);
- count = MIN(len, MAX_MODEM_BUF - fp);
- if (count < len) {
+ count = len;
+ if (count > MAX_MODEM_BUF - fp) {
+ count = MAX_MODEM_BUF - fp;
memcpy(cs->hw.elsa.transbuf + fp, bcs->tx_skb->data, count);
skb_pull(bcs->tx_skb, count);
cs->hw.elsa.transcnt += count;
@@ -472,8 +470,9 @@
}
fp = cs->hw.elsa.transcnt + cs->hw.elsa.transp;
fp &= (MAX_MODEM_BUF -1);
- count = MIN(len, MAX_MODEM_BUF - fp);
- if (count < len) {
+ count = len;
+ if (count > MAX_MODEM_BUF - fp) {
+ count = MAX_MODEM_BUF - fp;
memcpy(cs->hw.elsa.transbuf + fp, msg, count);
cs->hw.elsa.transcnt += count;
msg += count;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)