|
From: Peter K. <pk...@us...> - 2001-03-23 13:12:47
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
btmem.c 1.37 1.38=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Allow unsubscribe_bt_buf() to be called with NULL as argument.
The diff of the modified file(s):
--- btmem.c 2001/03/02 21:52:15 1.37
+++ btmem.c 2001/03/23 13:12:45 1.38
@@ -239,12 +239,10 @@
get_bt_buf();
=20
if (bt_buf.free > bt_buf.send) {
-=20=20=20=20
tail_free =3D (bt_buf.tail - bt_buf.free);
head_free =3D (bt_buf.send - bt_buf.head);
=20
if (tail_free >=3D buf_len) {
-
D_MEM(FNC"subscribe in tail at pos %d\n",=20
bt_buf.free - bt_buf.head);
tx =3D (bt_tx_buf *)bt_buf.free;
@@ -253,7 +251,6 @@
bt_buf.count +=3D buf_len;
bt_buf.nbr_bufs++;
} else if (head_free >=3D buf_len) {=20=20
-
D_MEM("No room in tail, subscribe at head (WRAP!)\n");
tx =3D (bt_tx_buf *)bt_buf.head;
=20=09=09=09
@@ -264,7 +261,6 @@
bt_buf.nbr_bufs++;
bt_buf.count +=3D buf_len;
} else {
-
D_ERR(FNC"Cannot subscribe %d bytes !\n", send_len);
D_ERR(FNC"Only %d available (non - fragmented)\n",
buf_write_room());
@@ -277,7 +273,6 @@
return NULL;
}
} else if (bt_buf.free <=3D bt_buf.send) {
-=20=20=20=20
/* 'Wrap' case */
tail_free =3D (bt_buf.send - bt_buf.free);
head_free =3D 0; /* head_free is not interesting since we cannot=20
@@ -286,7 +281,6 @@
buffer! (Fragmentation) */
=20=20=20=20=20
if (tail_free >=3D buf_len) {
-
D_MEM("Wrapped buffer, subscribe at free (pos %d)\n",=20
bt_buf.free - bt_buf.head);
tx =3D (bt_tx_buf *)bt_buf.free;
@@ -294,7 +288,6 @@
bt_buf.count +=3D buf_len;
bt_buf.nbr_bufs++;
} else if (!bt_buf.count) {
-
/* If buffer empty, reset buffer */=20=20=20=20=20=20=20=20=20=20
btmem_reset();
=20=09=09=09
@@ -343,7 +336,6 @@
return bt_buf.nbr_bufs;
}
=20
-
/* Returns total number of bytes in buffer (fragmented) */
=20
s32 buf_byte_count()
@@ -351,7 +343,6 @@
return bt_buf.count;
}
=20
-
/* Returns unfragmented buffer space */=20
=20
#define BTMEM_EXTRASPACE BT_BUF_SIZE/10 /* always an extra 10 % marginal
@@ -412,8 +403,7 @@
=20
tx =3D (bt_tx_buf *)(bt_buf.send);
=20
- if (tx->magic !=3D 0x4321)
- {
+ if (tx->magic !=3D 0x4321) {
D_ERR("get_bt_buf : wrong magic!\n");
#if PANIC_AT_ERROR
panic("lets stop here...\n");
@@ -446,6 +436,9 @@
s32 tail_free; /* for debug */
s32 head_free;
=20=20=20
+ if (!tx)
+ return;
+
D_MEM(FNC"%d bytes (not incl hdrs) at pos %d\n",=20
tx->subscr_len, (u8 *)tx - bt_buf.head);
=20=20=20
@@ -453,10 +446,8 @@
buffers in fifo order ! */
=20
cli();
- if (tx && (bt_buf.send =3D=3D (u8*)tx)) {
-
+ if (bt_buf.send =3D=3D (u8*)tx) {
if ((u8*)(tx->data + tx->subscr_len) <=3D bt_buf.tail) {
-=20=20=20=20=20=20
/* don't touch free, only subscribe_bt_buf change free */
bt_buf.send +=3D (tx->subscr_len + BT_TX_HDRSIZE);
bt_buf.count -=3D (tx->subscr_len + BT_TX_HDRSIZE);
@@ -603,13 +594,11 @@
bt_tx_buf *tx;
=20=20=20=20
for (i =3D 0; i < count; i++) {
-
if (cursize > buf_write_room())
return;
=20=09=20=20=20=20=20
printk("storing %d bytes packets\n", cursize);
while (buf_write_room() >=3D cursize) {
-=09=20=20=20=20=20=20=20
if (!(tx =3D subscribe_bt_buf(cursize))) {
return ;
}
|